Commit 41b3a4c6 by 张建升

SN盤點 不可以手動輸入, 代碼同步

parent 1335ed97
package com.gingersoft.supply_chain.mvp.presenter; package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; 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;
...@@ -430,10 +432,16 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -430,10 +432,16 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* @param position 供應商下標 * @param position 供應商下標
* @param foodCategoryTrees 供應商轉換為分類後的信息 * @param foodCategoryTrees 供應商轉換為分類後的信息
*/ */
public void getFoodsBySupplier(int position, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees, boolean addToHead, boolean isReset) { public void getFoodsBySupplier(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);
if (!TextUtils.isEmpty(name)) {
map.put("name", name);
}
AppConstant.addBrandId(map); AppConstant.addBrandId(map);
AppConstant.addRestaurantId(map); AppConstant.addRestaurantId(map);
if (foodCategoryTrees != null) { if (foodCategoryTrees != null) {
...@@ -628,7 +636,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -628,7 +636,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* @param position 分類下標 * @param position 分類下標
* @param foodCategoryTrees 分類 * @param foodCategoryTrees 分類
*/ */
public void loadNextCategoryFood(boolean isSupplier, int position, List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) { public void loadNextCategoryFood(String name, 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) {
...@@ -652,7 +660,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -652,7 +660,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
if (position < size) { if (position < size) {
Log.e("eee", "下一個"); Log.e("eee", "下一個");
loadNextCategoryFood(isSupplier, position, foodCategoryTrees); loadNextCategoryFood(name,isSupplier, position, foodCategoryTrees);
} else { } else {
mRootView.finishLoad(true); mRootView.finishLoad(true);
} }
...@@ -664,7 +672,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -664,7 +672,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
loadCacheFood(isSupplier, position, false, false); loadCacheFood(isSupplier, position, false, false);
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(name,position, foodCategoryTrees.get(position), false, false);
} else { } else {
getFoodByCategory(position, foodCategoryTrees.get(position), false, false); getFoodByCategory(position, foodCategoryTrees.get(position), false, false);
} }
...@@ -672,7 +680,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -672,7 +680,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
} else { } else {
if (isSupplier) { if (isSupplier) {
getFoodsBySupplier(position, foodCategoryTrees.get(position), false, false); getFoodsBySupplier(name,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);
...@@ -742,7 +750,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -742,7 +750,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);
......
...@@ -22,6 +22,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -22,6 +22,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener; import com.chad.library.adapter.base.listener.OnItemClickListener;
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.log.LogUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
...@@ -205,7 +206,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -205,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(isShowSupplier, i, firstLevelCategoryAdapter.getData()); mPresenter.loadNextCategoryFood(edFoodIngredientsSearch.getText().toString(), isShowSupplier, i, firstLevelCategoryAdapter.getData());
} else { } else {
finishLoad(true); finishLoad(true);
} }
...@@ -259,11 +260,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -259,11 +260,11 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
@OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm, @OnClick({R2.id.layout_food_ingredients_search, R2.id.tv_switch_food_ingredients_show_type, R2.id.btn_food_ingredients_confirm,
R2.id.btn_food_ingredients_cancel, R2.id.btn_switch_row, R2.id.card_show_more_category}) R2.id.btn_food_ingredients_cancel, R2.id.btn_switch_row, R2.id.card_show_more_category,R2.id.iv_food_search})
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.layout_food_ingredients_search) { if (viewId == R.id.layout_food_ingredients_search || viewId == R.id.iv_food_search ) {
//跳轉搜索頁面 //跳轉搜索頁面
jumpToSearch(); jumpToSearch();
} else if (viewId == R.id.btn_switch_row) { } else if (viewId == R.id.btn_switch_row) {
...@@ -288,7 +289,9 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -288,7 +289,9 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* 跳轉到搜索頁面 * 跳轉到搜索頁面
*/ */
private void jumpToSearch() { private void jumpToSearch() {
int position = firstLevelCategoryAdapter.getSelectedIndex() ;
LogUtil.e("zjs jumpToSearch 跳轉到搜索頁面 position"+position);
mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), false, true);
} }
/** /**
...@@ -461,6 +464,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -461,6 +464,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext()); firstLevelCategoryAdapter = new FirstLevelCategoryAdapter(foodCategoryTrees, requireContext());
rvFirstCategory.setAdapter(firstLevelCategoryAdapter); rvFirstCategory.setAdapter(firstLevelCategoryAdapter);
firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { firstLevelCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
LogUtil.e("zjs initCategoryInfo ItemClick position "+position);
firstCategoryClick(position); firstCategoryClick(position);
}); });
} else { } else {
...@@ -486,7 +490,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -486,7 +490,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
//本地沒有緩衝才去查找 //本地沒有緩衝才去查找
//獲取點擊的分類的所有食材 //獲取點擊的分類的所有食材
if (isShowSupplier) { if (isShowSupplier) {
mPresenter.getFoodsBySupplier(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} else { } else {
mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset); mPresenter.getFoodByCategory(position, firstLevelCategoryAdapter.getItem(position), addToHead, isReset);
} }
......
...@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
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.gsa.cloud.ui.bean.view.CategoryBean; import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
...@@ -49,8 +50,10 @@ import butterknife.OnClick; ...@@ -49,8 +50,10 @@ import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredientsFragment.EDIT_FOOD_RESULT_CODE; import static com.gingersoft.supply_chain.mvp.ui.fragment.food.NewFoodIngredientsFragment.EDIT_FOOD_RESULT_CODE;
/** /**
* Deprecated
* Description: 食材管理 * Description: 食材管理
*/ */
public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredientsPresenter> implements FoodIngredientsContract.View, View.OnClickListener { public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredientsPresenter> implements FoodIngredientsContract.View, View.OnClickListener {
@BindView(R2.id.topbar_food_ingredients) @BindView(R2.id.topbar_food_ingredients)
......
...@@ -73,7 +73,7 @@ public class SupplierFoodFragment extends BuyIngredientsFragment { ...@@ -73,7 +73,7 @@ public class SupplierFoodFragment extends BuyIngredientsFragment {
@Override @Override
protected void refreshData() { protected void refreshData() {
mPresenter.getFoodsBySupplier(0, firstLevelCategoryAdapter.getItem(0), false, true); mPresenter.getFoodsBySupplier(edFoodIngredientsSearch.getText().toString(),0, firstLevelCategoryAdapter.getItem(0), false, true);
} }
@Override @Override
......
...@@ -188,8 +188,10 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -188,8 +188,10 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
//添加保存按鈕 //添加保存按鈕
if (purchaseWarehousingOrderDetailsVo.getFoodMarkSn() != HAS_SN) { if (purchaseWarehousingOrderDetailsVo.getFoodMarkSn() != HAS_SN) {
addTopRightBtn(R.string.str_save, R.id.id_inventory_consumption); addTopRightBtn(R.string.str_save, R.id.id_inventory_consumption);
edWarehouseLoss.setEnabled(true);
} else { } else {
addTopRightBtn(R.string.str_inventory, R.id.id_inventory); addTopRightBtn(R.string.str_inventory, R.id.id_inventory);
edWarehouseLoss.setEnabled(false);
} }
} }
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<ImageView <ImageView
android:id="@+id/iv_food_search"
android:paddingLeft="@dimen/dp_12" android:paddingLeft="@dimen/dp_12"
android:paddingRight="@dimen/dp_10" android:paddingRight="@dimen/dp_10"
android:paddingTop="@dimen/dp_6" android:paddingTop="@dimen/dp_6"
......
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