Commit 47347ba3 by jason

食材搜索 區分供應商

parent 96d00b33
...@@ -7,6 +7,7 @@ import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean; ...@@ -7,6 +7,7 @@ import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean; import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
...@@ -80,5 +81,8 @@ public interface BuyIngredientsContract { ...@@ -80,5 +81,8 @@ public interface BuyIngredientsContract {
Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map); Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map);
Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map); Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map);
Observable<BaseResult> searchFoodBySupplierId(Map<String, Object> map);
} }
} }
...@@ -70,5 +70,7 @@ public interface OtherFunctionContract { ...@@ -70,5 +70,7 @@ public interface OtherFunctionContract {
// Observable<DishesResultBean> getFoodList(Map<String, Object> map); // Observable<DishesResultBean> getFoodList(Map<String, Object> map);
Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map); Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map);
Observable<BaseResult> searchFoodBySupplierId(Map<String, Object> map);
} }
} }
...@@ -65,6 +65,11 @@ public class BuyIngredientsModel extends BaseModel implements BuyIngredientsCont ...@@ -65,6 +65,11 @@ public class BuyIngredientsModel extends BaseModel implements BuyIngredientsCont
} }
@Override @Override
public Observable<BaseResult> searchFoodBySupplierId(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).searchFoodBySupplierId(map);
}
@Override
public Observable<BaseResult> deleteFood(int foodId) { public Observable<BaseResult> deleteFood(int foodId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFood(foodId); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFood(foodId);
} }
......
...@@ -59,6 +59,11 @@ public class OtherFunctionModel extends BaseModel implements OtherFunctionContra ...@@ -59,6 +59,11 @@ public class OtherFunctionModel extends BaseModel implements OtherFunctionContra
} }
@Override @Override
public Observable<BaseResult> searchFoodBySupplierId(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).searchFoodBySupplierId(map);
}
@Override
public Observable<BaseResult> deleteFood(int foodId) { public Observable<BaseResult> deleteFood(int foodId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFood(foodId); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFood(foodId);
} }
......
...@@ -432,12 +432,10 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -432,12 +432,10 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* @param position 供應商下標 * @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息 * @param foodCategoryTrees 供應商轉換為分類後的信息
*/ */
public void getFoodsBySupplier(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) { public void searchFoodByCategory(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
LogUtil.e(" zjs getFoodsBySupplier foodCategoryTrees.getId()= "+foodCategoryTrees.getId() +
" name="+name +" position="+position);
final boolean hasName=!TextUtils.isEmpty(name); final boolean hasName=!TextUtils.isEmpty(name);
if (hasName) { if (hasName) {
map.put("name", name); map.put("name", name);
...@@ -446,7 +444,55 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -446,7 +444,55 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
map.put("supplierId", foodCategoryTrees.getId()); map.put("supplierId", foodCategoryTrees.getId());
} }
} }
AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map);
mModel.getFoodBySupplierId(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
//mRootView.showLoading(Constant.GET_INFO_LOADING)
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
//mRootView.hideLoading()
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
if (hasName) {
loadFood(buyIngredientsBean, addToHead, isReset);
}else {
supplierFoods.set(position, buyIngredientsBean);
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
loadFood(buyIngredientsBean, addToHead, isReset);
}
}
}
});
}
/**
* 獲取數據,供應商
*
* @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息
*/
public void getFoodsBySupplier( int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(4);
map.put("pageSize", 1000);
map.put("pageIndex", 0);
LogUtil.e(" zjs getFoodsBySupplier foodCategoryTrees.getId()= "+foodCategoryTrees.getId() + " position="+position);
if (foodCategoryTrees != null) {
map.put("supplierId", foodCategoryTrees.getId());
}
AppConstant.addBrandId(map); AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map); AppConstant.addRestaurantId(map);
...@@ -468,6 +514,57 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -468,6 +514,57 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
if (info.isSuccess() && info.getData() != null) { if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class); List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS); BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
supplierFoods.set(position, buyIngredientsBean);
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
loadFood(buyIngredientsBean, addToHead, isReset);
}
}
});
}
/**
* 獲取數據,供應商
*
* @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息
*/
public void searchFoodBySupplierId(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000);
map.put("pageIndex", 0);
LogUtil.e(" zjs searchFoodBySupplierId foodCategoryTrees.getId()= "+foodCategoryTrees.getId() +
" name="+name +" position="+position);
final boolean hasName=!TextUtils.isEmpty(name);
if (hasName) {
map.put("name", name);
}else {
if (foodCategoryTrees != null) {
map.put("supplierId", foodCategoryTrees.getId());
}
}
AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map);
mModel.searchFoodBySupplierId(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
//mRootView.showLoading(Constant.GET_INFO_LOADING)
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
//mRootView.hideLoading()
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
if (hasName) { if (hasName) {
loadFood(buyIngredientsBean, addToHead, isReset); loadFood(buyIngredientsBean, addToHead, isReset);
}else { }else {
...@@ -644,7 +741,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -644,7 +741,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* @param position 分類下標 * @param position 分類下標
* @param foodCategoryTrees 分類 * @param foodCategoryTrees 分類
*/ */
public void loadNextCategoryFood(String name, boolean isSupplier, int position, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) { public void loadNextCategoryFood(boolean isSupplier, int position, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
List<BuyIngredientsBean> buyIngredientsBeans = null; List<BuyIngredientsBean> buyIngredientsBeans = null;
if (isSupplier) { if (isSupplier) {
if (supplierFoods.get(position) != null) { if (supplierFoods.get(position) != null) {
...@@ -668,7 +765,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -668,7 +765,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
if (position < size) { if (position < size) {
Log.e("eee", "下一個"); Log.e("eee", "下一個");
loadNextCategoryFood(name,isSupplier, position, foodCategoryTrees); loadNextCategoryFood(isSupplier, position, foodCategoryTrees);
} else { } else {
mRootView.finishLoad(true); mRootView.finishLoad(true);
} }
...@@ -680,7 +777,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -680,7 +777,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
loadCacheFood(isSupplier, position, false, false); loadCacheFood(isSupplier, position, false, false);
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(name,position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false);
} else { } else {
getFoodByCategory(position, foodCategoryTrees.get(position), false, false); getFoodByCategory(position, foodCategoryTrees.get(position), false, false);
} }
...@@ -688,7 +785,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -688,7 +785,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(name,position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false);
} else { } else {
Log.e("eee", "loadNextCategoryFood為空"); Log.e("eee", "loadNextCategoryFood為空");
getFoodByCategory(position, foodCategoryTrees.get(position), false, false); getFoodByCategory(position, foodCategoryTrees.get(position), false, false);
...@@ -758,7 +855,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -758,7 +855,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} else { } else {
Log.e("eee", "没有供應商缓存" + position); Log.e("eee", "没有供應商缓存" + position);
//需要通过接口 //需要通过接口
getFoodsBySupplier("", position, supplierTranCategoryCache.get(position), addToHead, isReset); getFoodsBySupplier( position, supplierTranCategoryCache.get(position), addToHead, isReset);
} }
} else { } else {
List<BuyIngredientsBean> buyIngredientsBeans = categoryFoods.get(position); List<BuyIngredientsBean> buyIngredientsBeans = categoryFoods.get(position);
......
...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult; ...@@ -8,6 +8,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.AppConstant; import com.gingersoft.gsa.cloud.common.constans.AppConstant;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils; import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean; import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
...@@ -434,7 +435,48 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract. ...@@ -434,7 +435,48 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract.
* @param position 供應商下標 * @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息 * @param foodCategoryTrees 供應商轉換為分類後的信息
*/ */
public void getFoodsBySupplier(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) { public void getFoodsBySupplier( int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(4);
map.put("pageSize", 1000);
map.put("pageIndex", 0);
if (foodCategoryTrees != null) {
map.put("supplierId", foodCategoryTrees.getId());
}
AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map);
mModel.getFoodBySupplierId(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
//mRootView.showLoading(Constant.GET_INFO_LOADING)
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
//mRootView.hideLoading()
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
supplierFoods.set(position, buyIngredientsBean);
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
loadFood(buyIngredientsBean, addToHead, isReset);
}
}
});
}
/**
* 獲取數據,供應商
*
* @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息
*/
public void searchFoodByCategory(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
...@@ -481,6 +523,60 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract. ...@@ -481,6 +523,60 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract.
}); });
} }
/**
* 獲取數據,供應商
*
* @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息
*/
public void searchFoodBySupplierId(String name , int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) {
Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000);
map.put("pageIndex", 0);
final boolean hasName=!TextUtils.isEmpty(name);
if (hasName) {
map.put("name", name);
}else {
if (foodCategoryTrees != null) {
map.put("supplierId", foodCategoryTrees.getId());
}
}
AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map);
mModel.searchFoodBySupplierId(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
//mRootView.showLoading(Constant.GET_INFO_LOADING)
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
//mRootView.hideLoading()
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
List<PurchaseFoodBean> purchaseFoodListVOS = JsonUtils.parseArray(info.getData(), PurchaseFoodBean.class);
BuyIngredientsBean buyIngredientsBean = conversionSupplierToShowInfo(foodCategoryTrees, purchaseFoodListVOS);
if (hasName) {
loadFood(buyIngredientsBean, addToHead, isReset);
}else {
supplierFoods.set(position, buyIngredientsBean);
showFoods.add(addToHead ? 0 : showFoods.size(), buyIngredientsBean);
loadFood(buyIngredientsBean, addToHead, isReset);
}
}
}
});
}
private void loadFood(BuyIngredientsBean buyIngredientsBean, boolean addToHead, boolean isReset) { private void loadFood(BuyIngredientsBean buyIngredientsBean, boolean addToHead, boolean isReset) {
ArrayList<BuyIngredientsBean> buyIngredientsBeans = new ArrayList<>(); ArrayList<BuyIngredientsBean> buyIngredientsBeans = new ArrayList<>();
buyIngredientsBeans.add(buyIngredientsBean); buyIngredientsBeans.add(buyIngredientsBean);
...@@ -684,7 +780,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract. ...@@ -684,7 +780,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract.
loadCacheFood(isSupplier, position, false, false); loadCacheFood(isSupplier, position, false, false);
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(name,position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false);
} else { } else {
getFoodByCategory(position, foodCategoryTrees.get(position), false, false); getFoodByCategory(position, foodCategoryTrees.get(position), false, false);
} }
...@@ -692,7 +788,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract. ...@@ -692,7 +788,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract.
} }
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(name,position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false);
} else { } else {
Log.e("eee", "loadNextCategoryFood為空"); Log.e("eee", "loadNextCategoryFood為空");
getFoodByCategory(position, foodCategoryTrees.get(position), false, false); getFoodByCategory(position, foodCategoryTrees.get(position), false, false);
...@@ -762,7 +858,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract. ...@@ -762,7 +858,7 @@ public class OtherFunctionPresenter extends BasePresenter<OtherFunctionContract.
} else { } else {
Log.e("eee", "没有供應商缓存" + position); Log.e("eee", "没有供應商缓存" + position);
//需要通过接口 //需要通过接口
getFoodsBySupplier("", position, supplierTranCategoryCache.get(position), addToHead, isReset); getFoodsBySupplier( position, supplierTranCategoryCache.get(position), addToHead, isReset);
} }
} else { } else {
List<BuyIngredientsBean> buyIngredientsBeans = categoryFoods.get(position); List<BuyIngredientsBean> buyIngredientsBeans = categoryFoods.get(position);
......
...@@ -236,6 +236,17 @@ public interface SupplierServer { ...@@ -236,6 +236,17 @@ public interface SupplierServer {
@GET("supplier/purchaseFood/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("supplier/purchaseFood/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getFoodBySupplierId(@QueryMap Map<String, Object> map); Observable<BaseResult> getFoodBySupplierId(@QueryMap Map<String, Object> map);
/**
* 搜索食材 區分供應商
* @param map
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseFood/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> searchFoodBySupplierId(@QueryMap Map<String, Object> map);
/** /**
* 修改食材信息 * 修改食材信息
* *
......
...@@ -206,7 +206,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -206,7 +206,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
int i = firstLevelCategoryAdapter.getSelectedIndex() + 1; int i = firstLevelCategoryAdapter.getSelectedIndex() + 1;
if (i < firstLevelCategoryAdapter.getItemCount()) { if (i < firstLevelCategoryAdapter.getItemCount()) {
//判斷是否有緩存,把緩存拿出來,看看有沒有加載到列表中,如果已經加載了,繼續獲取下一個分類,一直到沒有加載的那個 //判斷是否有緩存,把緩存拿出來,看看有沒有加載到列表中,如果已經加載了,繼續獲取下一個分類,一直到沒有加載的那個
mPresenter.loadNextCategoryFood(edFoodIngredientsSearch.getText().toString(), isShowSupplier, i, firstLevelCategoryAdapter.getData()); mPresenter.loadNextCategoryFood(isShowSupplier, i, firstLevelCategoryAdapter.getData());
} else { } else {
finishLoad(true); finishLoad(true);
} }
...@@ -290,7 +290,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -290,7 +290,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
*/ */
private void jumpToSearch() { private void jumpToSearch() {
int position = firstLevelCategoryAdapter.getSelectedIndex() ; int position = firstLevelCategoryAdapter.getSelectedIndex() ;
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), false, true); if (isShowSupplier) {
mPresenter.searchFoodBySupplierId(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), false, true);
}else {
mPresenter.searchFoodByCategory(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), false, true);
}
} }
/** /**
...@@ -488,7 +492,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -488,7 +492,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
//本地沒有緩衝才去查找 //本地沒有緩衝才去查找
//獲取點擊的分類的所有食材 //獲取點擊的分類的所有食材
if (isShowSupplier) { if (isShowSupplier) {
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodsBySupplier(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} else { } else {
mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} }
......
...@@ -298,8 +298,12 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction ...@@ -298,8 +298,12 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
* 跳轉到搜索頁面 * 跳轉到搜索頁面
*/ */
private void jumpToSearch() { private void jumpToSearch() {
int position = firstLevelCategoryAdapter.getSelectedIndex() ; int position = firstLevelCategoryAdapter.getSelectedIndex();
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), false, true); if (isShowSupplier) {
mPresenter.searchFoodBySupplierId(edFoodIngredientsSearch.getText().toString(), position, firstLevelCategoryAdapter.getItem(position), false, true);
} else {
mPresenter.searchFoodByCategory(edFoodIngredientsSearch.getText().toString(), position, firstLevelCategoryAdapter.getItem(position), false, true);
}
} }
/** /**
...@@ -500,7 +504,7 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction ...@@ -500,7 +504,7 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
//本地沒有緩衝才去查找 //本地沒有緩衝才去查找
//獲取點擊的分類的所有食材 //獲取點擊的分類的所有食材
if (isShowSupplier) { if (isShowSupplier) {
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodsBySupplier( position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} else { } else {
mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} }
......
...@@ -5,6 +5,7 @@ import android.view.View; ...@@ -5,6 +5,7 @@ import android.view.View;
import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback; import com.gingersoft.gsa.cloud.common.loadsir.purchase.NotGoodsCallback;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean; import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
...@@ -73,7 +74,12 @@ public class SupplierFoodFragment extends BuyIngredientsFragment { ...@@ -73,7 +74,12 @@ public class SupplierFoodFragment extends BuyIngredientsFragment {
@Override @Override
protected void refreshData() { protected void refreshData() {
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),0, firstLevelCategoryAdapter.getItem(0), false, true); String name=edFoodIngredientsSearch.getText().toString();
if (TextUtil.isEmptyOrNullOrUndefined(name)) {
mPresenter.getFoodsBySupplier( 0, firstLevelCategoryAdapter.getItem(0), false, true);
}else {
mPresenter.searchFoodBySupplierId( name,0, firstLevelCategoryAdapter.getItem(0), false, true);
}
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment