Commit 044908ec by 张建升

菜品食材綁定 代码同步

parent adb702b0
...@@ -24,7 +24,6 @@ public class DishDetailBean { ...@@ -24,7 +24,6 @@ public class DishDetailBean {
private boolean deletes;// 非必须 删除 false 未删除 true 删除 private boolean deletes;// 非必须 删除 false 未删除 true 删除
private String foodBasicUnit;// string 非必须 食材基本单位 private String foodBasicUnit;// string 非必须 食材基本单位
private List<DeputyUnitBean> foodUnits; private List<DeputyUnitBean> foodUnits;
private boolean show=true;
public DishDetailBean(PurchaseFoodBean foodBean , DishNode dishNode ) { public DishDetailBean(PurchaseFoodBean foodBean , DishNode dishNode ) {
// this.id = foodBean.get; ///此时的 id 一定是null deletes必是f // this.id = foodBean.get; ///此时的 id 一定是null deletes必是f
...@@ -41,6 +40,5 @@ public class DishDetailBean { ...@@ -41,6 +40,5 @@ public class DishDetailBean {
this.foodNo = foodBean.getFoodNo(); this.foodNo = foodBean.getFoodNo();
this.type = 0; this.type = 0;
this.foodUnits = foodBean.getFoodUnits(); this.foodUnits = foodBean.getFoodUnits();
this.show = true;
} }
} }
...@@ -97,7 +97,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -97,7 +97,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
public void onError(@NotNull Throwable t) { public void onError(@NotNull Throwable t) {
super.onError(t); super.onError(t);
mRootView.loadDishGroupFail(); mRootView.loadDishGroupFail();
LogUtil.e("ZJS"," onError ");
} }
}); });
} }
...@@ -121,15 +120,22 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -121,15 +120,22 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
@Override @Override
public void onNext(DishDetailResultBean dishDetailBean) {//數據處理 public void onNext(DishDetailResultBean dishDetailBean) {//數據處理
if (dishDetailBean.isSuccess()) { if (dishDetailBean.isSuccess()) {
LogUtil.e("ZJS"," dishDetailBean"+dishDetailBean.toString());
dishNode.setDetailBean(dishDetailBean); dishNode.setDetailBean(dishDetailBean);
mRootView.loadDishesInfo(dishNode,dishDetailBean); mRootView.loadDishesInfo(dishNode,dishDetailBean);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(dishDetailBean.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(dishDetailBean.getErrMsg())) {
mRootView.showMessage(dishDetailBean.getErrMsg()); mRootView.showMessage(dishDetailBean.getErrMsg());
mRootView.loadDishesFail();
} else { } else {
mRootView.loadDishesFail();
mRootView.showMessage(AppConstant.GET_INFO_ERROR); mRootView.showMessage(AppConstant.GET_INFO_ERROR);
} }
} }
@Override
public void onError(@NotNull Throwable t) {
super.onError(t);
mRootView.loadDishesFail();
}
}); });
} }
...@@ -147,7 +153,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -147,7 +153,6 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
@Override @Override
public void onNext(BaseResult bindResult) {//數據處理 public void onNext(BaseResult bindResult) {//數據處理
if (bindResult.isSuccess()) { if (bindResult.isSuccess()) {
LogUtil.e("ZJS"," 菜品食材綁定成功 bindResult"+bindResult.toString());
DishDetailResultBean dishDetailResultBean=new DishDetailResultBean(); DishDetailResultBean dishDetailResultBean=new DishDetailResultBean();
dishDetailResultBean.setData(dishDetailBeans); dishDetailResultBean.setData(dishDetailBeans);
dishNode.setDetailBean(dishDetailResultBean); dishNode.setDetailBean(dishDetailResultBean);
......
package com.gingersoft.supply_chain.mvp.ui.adapter.dishes; package com.gingersoft.supply_chain.mvp.ui.adapter.dishes;
import android.content.Context; import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.DishDetailBean; import com.gingersoft.supply_chain.mvp.bean.DishDetailBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -19,7 +22,8 @@ import java.util.List; ...@@ -19,7 +22,8 @@ import java.util.List;
*/ */
public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseViewHolder> { public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseViewHolder> {
public DishDetailAdapter(Context context, List<DishDetailBean> foods) { private List<DishDetailBean> dels=new ArrayList<>();
public DishDetailAdapter( List<DishDetailBean> foods) {
super(R.layout.item_dishes_foods,foods); super(R.layout.item_dishes_foods,foods);
addChildClickViewIds(R.id.tv_dishes_unit,R.id.tv_dishes_del); addChildClickViewIds(R.id.tv_dishes_unit,R.id.tv_dishes_del);
} }
...@@ -29,20 +33,54 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView ...@@ -29,20 +33,54 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView
protected void convert(@NotNull BaseViewHolder viewHolder, DishDetailBean item) { protected void convert(@NotNull BaseViewHolder viewHolder, DishDetailBean item) {
viewHolder.setText(R.id.tv_dishes_name, item.getFoodName());//食材名字 viewHolder.setText(R.id.tv_dishes_name, item.getFoodName());//食材名字
viewHolder.setText(R.id.tv_dishes_unit, item.getBasicUnitName());//配置的單位 viewHolder.setText(R.id.tv_dishes_unit, item.getBasicUnitName());//配置的單位
if (item.isShow()) { final EditText count=viewHolder.getView(R.id.et_dishes_count);
// viewHolder.itemView.setVisibility(View.VISIBLE); count.setTag(item);
// viewHolder.setTextColor(R.id.tv_dishes_name, ArmsUtils.getColor(context, R.color.color_18)); count.addTextChangedListener(new TextWatcher() {
} else { @Override
// viewHolder.itemView.setVisibility(View.GONE); public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// viewHolder.setTextColor(R.id.tv_dishes_name, ArmsUtils.getColor(context, R.color.switcher_off_color));
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
} }
// viewHolder.setText(R.id.tv_dishes_unit, item.getUnitName()); @Override
List<DeputyUnitBean> deputyUnitBeans= item.getFoodUnits();//副單位 public void afterTextChanged(Editable s) {
if (CollectionUtils.isNullOrEmpty(deputyUnitBeans)) { DishDetailBean tag= (DishDetailBean) count.getTag();
// addChildClickViewIds(R.id.tv_dishes_unit); consumeQuantity if (TextUtil.isEmptyOrNullOrUndefined(s)) {
ToastUtils.show(getContext(),"數量不能為空");
count.setText(String.valueOf(tag.getConsumeQuantity()));
count.setSelection(count.getText().toString().length());
}else {
tag.setConsumeQuantity(Integer.parseInt(s.toString()));
}
} }
viewHolder.setText(R.id.tv_dishes_count, String.valueOf(item.getConsumeQuantity()));//消耗數量 });
count.setText(String.valueOf(item.getConsumeQuantity()));//消耗數量
}
public void addDel(DishDetailBean del){
dels.add(del);
}
public List<DishDetailBean> getDels() {
return dels;
}
public void removeDel(DishDetailBean remove){
for (int i = 0; i < dels.size(); i++) {
DishDetailBean del=dels.get(i);
if (remove.getPurchaseFoodId()==del.getPurchaseFoodId()) {
dels.remove(del);
}
}
}
public void clearDel(){
dels.clear();
} }
} }
...@@ -38,8 +38,6 @@ public class DishProvider extends BaseNodeProvider { ...@@ -38,8 +38,6 @@ public class DishProvider extends BaseNodeProvider {
@Override @Override
public void onClick(@NotNull BaseViewHolder helper, @NotNull View view, BaseNode data, int position) { public void onClick(@NotNull BaseViewHolder helper, @NotNull View view, BaseNode data, int position) {
DishNode entity = (DishNode) data; DishNode entity = (DishNode) data;
LogUtil.e("zjs"," onClick entity.isExpanded()="+entity.toString());
if (entity.isExpanded()) { if (entity.isExpanded()) {
getAdapter().collapse(position); getAdapter().collapse(position);
} else { } else {
......
...@@ -95,7 +95,7 @@ public class DishesGroupProvider extends BaseNodeProvider { ...@@ -95,7 +95,7 @@ public class DishesGroupProvider extends BaseNodeProvider {
DishesGroupNode groupNode= (DishesGroupNode)data; DishesGroupNode groupNode= (DishesGroupNode)data;
List<DishNode> dishNodes= groupNode.getDishNodes(); List<DishNode> dishNodes= groupNode.getDishNodes();
LogUtil.e("zjs","父菜单点击 onClick position ="+position+" getFoodName"+groupNode.getFoodName()+" groupNode="+groupNode.isExpanded()); // LogUtil.e("zjs","父菜单点击 onClick position ="+position+" getFoodName"+groupNode.getFoodName()+" groupNode="+groupNode.isExpanded());
if (CollectionUtils.isNotNullOrEmpty(dishNodes)) { if (CollectionUtils.isNotNullOrEmpty(dishNodes)) {
if (groupNode.getPos()==0) { if (groupNode.getPos()==0) {
groupNode.setPos(1); groupNode.setPos(1);
......
...@@ -12,7 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,7 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.entity.node.BaseNode; import com.chad.library.adapter.base.entity.node.BaseNode;
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.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerDishesComponent; import com.gingersoft.supply_chain.di.component.DaggerDishesComponent;
...@@ -31,6 +31,7 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ChooseUnitPopup; ...@@ -31,6 +31,7 @@ import com.gingersoft.supply_chain.mvp.ui.widget.ChooseUnitPopup;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -51,6 +52,9 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -51,6 +52,9 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
RecyclerView rvDishesGroup; RecyclerView rvDishesGroup;
@BindView(R2.id.rv_dishes_food) @BindView(R2.id.rv_dishes_food)
RecyclerView rvDishes; RecyclerView rvDishes;
@BindView(R2.id.dish_refreshLayout)
SmartRefreshLayout refresh;
private View footView; private View footView;
private DishesTreeAdapter dishesTreeAdapter; private DishesTreeAdapter dishesTreeAdapter;
private DishDetailAdapter dishDetailAdapter; private DishDetailAdapter dishDetailAdapter;
...@@ -82,34 +86,46 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -82,34 +86,46 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
//setToolBarNoBack(toolbar, "Dishes"); //setToolBarNoBack(toolbar, "Dishes");
initTopBar(topbarFoodIngredients, getString(R.string.str_dishes)); initTopBar(topbarFoodIngredients, getString(R.string.str_dishes));
refresh.setOnRefreshListener(refreshLayout -> {
if (curSelectDishNode != null) {
mPresenter.getDishesDetailData(curSelectDishNode);
}
});
refresh.setEnableLoadMore(false);
mPresenter.getDishGroupData(); mPresenter.getDishGroupData();
} }
private void initDishDetail(DishDetailResultBean dishesResultBean){ private void initDishDetail(DishDetailResultBean dishesResultBean){
List<DishDetailBean> foods=dishesResultBean.getData(); List<DishDetailBean> foods=dishesResultBean.getData();
if (dishDetailAdapter == null) { if (dishDetailAdapter == null) {
dishDetailAdapter = new DishDetailAdapter(requireContext(), new ArrayList<>()); dishDetailAdapter = new DishDetailAdapter(new ArrayList<>());
// addChildClickViewIds(R.id.tv_dishes_unit,R.id.tv_dishes_del);
dishDetailAdapter.setOnItemChildClickListener((adapter, view, position) -> { dishDetailAdapter.setOnItemChildClickListener((adapter, view, position) -> {
LogUtil.e("zjs","position="+position+" curSelectDishNode "+(curSelectDishNode==null));
if (curSelectDishNode != null) { if (curSelectDishNode != null) {
DishDetailBean detailBean=dishDetailAdapter.getItem(position); DishDetailBean detailBean=dishDetailAdapter.getItem(position);
int id = view.getId(); int id = view.getId();
if (id == R.id.tv_dishes_del) { if (id == R.id.tv_dishes_del) {
detailBean.setShow(false); AppDialog.getInstance().showWaringDialog(mContext, "確定移除食材?", () ->{
dishDetailAdapter.notifyItemChanged(position); if (detailBean.getId() == null) {//刚加 为提交直接删
dishDetailAdapter.removeAt(position);
}else {
detailBean.setDeletes(true);
dishDetailAdapter.addDel(detailBean);
dishDetailAdapter.removeAt(position);
}
});
} else if (id == R.id.tv_dishes_unit) { } else if (id == R.id.tv_dishes_unit) {
List<DeputyUnitBean> foodUnits= detailBean.getFoodUnits(); List<DeputyUnitBean> foodUnits= detailBean.getFoodUnits();
if (CollectionUtils.isNotNullOrEmpty(foodUnits)) { if (CollectionUtils.isNotNullOrEmpty(foodUnits)) {
List<String> units = new ArrayList<>(); List<String> units = new ArrayList<>();
for (int i = 0; i < foodUnits.size(); i++) { for (int i = 0; i < foodUnits.size(); i++) {
units.add(foodUnits.get(i).getDeputyUnit()); String name=foodUnits.get(i).getDeputyUnit();
units.add(name);
} }
if (units.size() > 1) { if (units.size() > 0) {
ChooseUnitPopup popup = new ChooseUnitPopup(requireContext()).setStringData(units).setOnSelectListener((pos, text) -> { ChooseUnitPopup popup = new ChooseUnitPopup(requireContext()).setStringData(units).setOnSelectListener((pos, text) -> {
//將用戶之前輸入的值,修改到新選擇的單位匯中 //將用戶之前輸入的值,修改到新選擇的單位匯中
String unitName= detailBean.getBasicUnitName(); String unitName= detailBean.getBasicUnitName();
DeputyUnitBean deputyUnitBean = foodUnits.get(pos); DeputyUnitBean deputyUnitBean = foodUnits.get(pos);
LogUtil.e("zjs"," unitName="+unitName+" deputyUnitBean="+deputyUnitBean.toString());
String selectUnitName=deputyUnitBean.getDeputyUnit(); String selectUnitName=deputyUnitBean.getDeputyUnit();
if (!unitName.equals(selectUnitName)) { if (!unitName.equals(selectUnitName)) {
detailBean.setBasicUnitName(selectUnitName); detailBean.setBasicUnitName(selectUnitName);
...@@ -137,8 +153,8 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -137,8 +153,8 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
dishDetailAdapter.setList(new ArrayList<>()); dishDetailAdapter.setList(new ArrayList<>());
} }
int size=dishDetailAdapter.getData().size(); int size=dishDetailAdapter.getData().size();
dishDetailAdapter.clearDel();
getFooterView(size>0); getFooterView(size>0);
LogUtil.e("ZJS"," dishDetailAdapter== " +" size="+size);
} }
private View getFooterView(boolean showDone) { private View getFooterView(boolean showDone) {
...@@ -149,14 +165,15 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -149,14 +165,15 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
}); });
footView.findViewById(R.id.tv_dish_done).setOnClickListener(v -> { footView.findViewById(R.id.tv_dish_done).setOnClickListener(v -> {
if (curSelectDishNode != null) { if (curSelectDishNode != null) {
List<DishDetailBean> allBeans=dishDetailAdapter.getDels();
List<DishDetailBean> detailBeans= dishDetailAdapter.getData(); List<DishDetailBean> detailBeans= dishDetailAdapter.getData();
if (CollectionUtils.isNotNullOrEmpty(detailBeans)) { if (CollectionUtils.isNotNullOrEmpty(detailBeans)) {
mPresenter.bindDishFoods(curSelectDishNode ,detailBeans); allBeans.addAll(detailBeans);
}
if (CollectionUtils.isNotNullOrEmpty(allBeans)) {
mPresenter.bindDishFoods(curSelectDishNode ,allBeans);
} }
} }
LogUtil.e("zjs"," 完成 tv_dish_done");
}); });
} }
if (showDone) { if (showDone) {
...@@ -181,7 +198,7 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -181,7 +198,7 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
int lastPost = pNode.getPos()+ppos; int lastPost = pNode.getPos()+ppos;
int myPostion=position-ppos; int myPostion=position-ppos;
boolean isCur=position ==lastPost; boolean isCur=position ==lastPost;
LogUtil.e("ZJS"," lastPost="+lastPost+" myPostion="+myPostion+" isCur="+isCur ); // LogUtil.e("ZJS"," lastPost="+lastPost+" myPostion="+myPostion+" isCur="+isCur );
if (!isCur) {//当前点击的不是上次点击的项目 if (!isCur) {//当前点击的不是上次点击的项目
DishNode lastDishNode= (DishNode) dishesTreeAdapter.getItem(lastPost); DishNode lastDishNode= (DishNode) dishesTreeAdapter.getItem(lastPost);
lastDishNode.setSelect(false); lastDishNode.setSelect(false);
...@@ -193,7 +210,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -193,7 +210,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
if (detailBean == null) { if (detailBean == null) {
mPresenter.getDishesDetailData(curDishNode); mPresenter.getDishesDetailData(curDishNode);
} else { } else {
LogUtil.e("ZJS", " detailBean= " + detailBean.toString());
loadDishesInfo(curDishNode, detailBean); loadDishesInfo(curDishNode, detailBean);
} }
...@@ -215,6 +231,7 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -215,6 +231,7 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
@Override @Override
public void loadDishesInfo(DishNode dishNode,DishDetailResultBean dishesDetail) { public void loadDishesInfo(DishNode dishNode,DishDetailResultBean dishesDetail) {
refresh.finishRefresh();
curSelectDishNode=dishNode; curSelectDishNode=dishNode;
initDishDetail(dishesDetail); initDishDetail(dishesDetail);
} }
...@@ -226,12 +243,13 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -226,12 +243,13 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
@Override @Override
public void loadDishesFail() { public void loadDishesFail() {
refresh.finishRefresh();
} }
@Override @Override
public void bindDishFoods(DishNode dishNode) { public void bindDishFoods(DishNode dishNode) {
LogUtil.e("zjs"," 绑定车工 "+dishNode.toString()); dishDetailAdapter.clearDel();
mPresenter.getDishesDetailData(dishNode);
} }
@Override @Override
...@@ -243,7 +261,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -243,7 +261,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
@Override @Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
LogUtil.e("zjs"," onFragmentResult ="+requestCode + " resultCode="+resultCode);
if (requestCode == DISHES_ADD) { if (requestCode == DISHES_ADD) {
if (data != null) { if (data != null) {
if (dishDetailAdapter != null && curSelectDishNode != null ) { if (dishDetailAdapter != null && curSelectDishNode != null ) {
...@@ -252,7 +269,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -252,7 +269,6 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
if (purchaseFood != null) { if (purchaseFood != null) {
List<DishDetailBean> foodsNew = new ArrayList<>(); List<DishDetailBean> foodsNew = new ArrayList<>();
int len=purchaseFood.size(); int len=purchaseFood.size();
LogUtil.e("zjs", " purchaseFood =" + purchaseFood.size()+" foodsOld="+foodsOld.size());
if (CollectionUtils.isNotNullOrEmpty(foodsOld)) { if (CollectionUtils.isNotNullOrEmpty(foodsOld)) {
int old=foodsOld.size(); int old=foodsOld.size();
boolean isNew=true; boolean isNew=true;
...@@ -260,10 +276,11 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -260,10 +276,11 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
PurchaseFoodBean newBean= purchaseFood.get(i); PurchaseFoodBean newBean= purchaseFood.get(i);
for (int j = 0; j < old; j++) { for (int j = 0; j < old; j++) {
DishDetailBean oldBean=foodsOld.get(j); DishDetailBean oldBean=foodsOld.get(j);
LogUtil.e("zjs"," oldBean="+oldBean.toString()+" newBean="+newBean.toString()); // LogUtil.e("zjs"," oldBean="+oldBean.toString()+" newBean="+newBean.toString());
if (newBean.getId()==oldBean.getPurchaseFoodId()) { if (newBean.getId()==oldBean.getPurchaseFoodId()) {//选择了同一个食材
oldBean.setConsumeQuantity(oldBean.getConsumeQuantity()+newBean.getFoodQuantity()); oldBean.setConsumeQuantity(oldBean.getConsumeQuantity()+newBean.getFoodQuantity());
isNew=false; isNew=false;
dishDetailAdapter.removeDel(oldBean);
dishDetailAdapter.notifyItemChanged(j); dishDetailAdapter.notifyItemChanged(j);
continue; continue;
} }
...@@ -272,12 +289,11 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -272,12 +289,11 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
DishDetailBean addNewBean=new DishDetailBean(newBean,curSelectDishNode); DishDetailBean addNewBean=new DishDetailBean(newBean,curSelectDishNode);
foodsNew.add(addNewBean); foodsNew.add(addNewBean);
} }
} }
}else { //全新 }else { //全新
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
PurchaseFoodBean newBean= purchaseFood.get(i); PurchaseFoodBean newBean= purchaseFood.get(i);
LogUtil.e("zjs"," 全新 newBean="+newBean.toString()); // LogUtil.e("zjs"," 全新 newBean="+newBean.toString());
DishDetailBean addNewBean=new DishDetailBean(newBean,curSelectDishNode); DishDetailBean addNewBean=new DishDetailBean(newBean,curSelectDishNode);
foodsNew.add(addNewBean); foodsNew.add(addNewBean);
} }
...@@ -294,6 +310,5 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -294,6 +310,5 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
} }
} }
} }
} }
} }
\ No newline at end of file
...@@ -452,7 +452,6 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction ...@@ -452,7 +452,6 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
protected void confirm() { protected void confirm() {
ArrayList<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood(); ArrayList<PurchaseFoodBean> purchaseFood = mPresenter.getPurchaseFood();
if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) { if (CollectionUtils.isNotNullOrEmpty(purchaseFood)) {
LogUtil.e("zjs"," purchaseFood "+purchaseFood.size());
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable("zjs", purchaseFood); bundle.putSerializable("zjs", purchaseFood);
setFragmentResult(RESULT_OK, bundle); setFragmentResult(RESULT_OK, bundle);
......
...@@ -94,14 +94,14 @@ ...@@ -94,14 +94,14 @@
</LinearLayout> </LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/dish_refreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.scwang.smartrefresh.layout.header.ClassicsHeader <com.scwang.smartrefresh.layout.header.ClassicsHeader
android:id="@+id/fresh_header" android:id="@+id/fresh_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_30" android:layout_height="@dimen/dp_48"
app:srlAccentColor="#aaa" app:srlAccentColor="#aaa"
app:srlDrawableArrow="@drawable/ic_pulling" app:srlDrawableArrow="@drawable/ic_pulling"
app:srlDrawableMarginRight="@dimen/dp_5" app:srlDrawableMarginRight="@dimen/dp_5"
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
app:srlTextPulling="下滑查看上一分類" app:srlTextPulling="下滑查看上一分類"
app:srlTextRefreshing="正在飛速加載..." app:srlTextRefreshing="正在飛速加載..."
app:srlTextRelease="釋放查看上一分類" app:srlTextRelease="釋放查看上一分類"
app:srlTextSizeTitle="@dimen/dp_12" /> app:srlTextSizeTitle="@dimen/dp_16" />
<com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout <com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout
android:id="@+id/view_stick_head" android:id="@+id/view_stick_head"
...@@ -128,17 +128,6 @@ ...@@ -128,17 +128,6 @@
</com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout> </com.gingersoft.supply_chain.mvp.ui.widget.StickyHeaderLayout>
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
app:srlDrawableArrow="@drawable/ic_push"
app:srlDrawableMarginRight="@dimen/dp_5"
app:srlDrawableSize="@dimen/dp_12"
app:srlTextFailed="加載完成"
app:srlTextLoading="正在飛速加載中..."
app:srlTextPulling="上拉加載更多"
app:srlTextRelease="釋放查看下一分類"
app:srlTextSizeTitle="@dimen/dp_12" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:textColor="@color/color_18" android:textColor="@color/color_18"
tools:text="單位" /> tools:text="單位" />
...@@ -40,14 +42,24 @@ ...@@ -40,14 +42,24 @@
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:background="@color/supply_function_color" /> android:background="@color/supply_function_color" />
<TextView <com.google.android.material.textfield.TextInputEditText
android:id="@+id/tv_dishes_count" android:id="@+id/et_dishes_count"
style="@style/WareHouse_item_TextStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginRight="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_4"
android:layout_marginBottom="@dimen/dp_4"
android:textColor="@color/color_18" android:textColor="@color/color_18"
tools:text="數量" /> android:background="@drawable/shape_border_bg_c8"
android:gravity="center"
android:inputType="numberDecimal"
android:maxLines="1"
android:textColorHighlight="@color/theme_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_15"
tools:text="2" />
<View <View
android:layout_width="1px" android:layout_width="1px"
......
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