diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index f7fa2b53..c26077c6 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -72,20 +72,16 @@ public class ExecuteTheRecipe { ArrayList goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId); if(orderDetail.deviceNum ==1){ Wok1ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); - ConfigName.goodsProcess1.clear(); - ConfigName.goodsProcess1.addAll(goodsrecipes); + goodsrecipes = ConfigName.goodsProcess1; }else if(orderDetail.deviceNum ==2){ Wok2ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); - ConfigName.goodsProcess2.clear(); - ConfigName.goodsProcess2.addAll(goodsrecipes); + goodsrecipes = ConfigName.goodsProcess2; }else if(orderDetail.deviceNum ==3){ Wok3ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); - ConfigName.goodsProcess3.clear(); - ConfigName.goodsProcess3.addAll(goodsrecipes); + goodsrecipes = ConfigName.goodsProcess3; }else if(orderDetail.deviceNum ==4){ Wok4ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); - ConfigName.goodsProcess4.clear(); - ConfigName.goodsProcess4.addAll(goodsrecipes); + goodsrecipes = ConfigName.goodsProcess4; } int m = 0; if(!goodsrecipes.isEmpty()){ @@ -174,16 +170,12 @@ public class ExecuteTheRecipe { WritePLC(orderDetail.deviceNum,"暂停开关", false, null); Make位置(orderDetail.deviceNum,"原点位"); if(orderDetail.deviceNum ==1){ - ConfigName.goodsProcess1.clear(); Wok1ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); }else if(orderDetail.deviceNum ==2){ - ConfigName.goodsProcess2.clear(); Wok2ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); }else if(orderDetail.deviceNum ==3){ - ConfigName.goodsProcess3.clear(); Wok3ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); }else if(orderDetail.deviceNum ==4){ - ConfigName.goodsProcess4.clear(); Wok4ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); } diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index 56ec9674..a6aeb5f4 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -109,7 +109,7 @@ public class ConfigName { */ public String Key = "be992a44-d6a8-462d-8206-3c7998fa944b"; - public static String dataPath = "/hbldbWokRobot"; + public static String dataPath = "/hbldbWokRobot14"; public String oven_wendu="0"; diff --git a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java index f9e21eba..282f195e 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java @@ -127,14 +127,13 @@ public class OrderDetailUtil { public static BPA_ORDER_DETAIL resetOrder() { String orderby = QueryDB.Desc_Time_Up; - String where = "isDelete=? and status!=0"; + String where = "isDelete=?"; String[] args = new String[]{"0"}; ArrayList obj = QueryDB.Get(BPA_ORDER_DETAIL.class, where, args, orderby); for (Object k : obj) { - if(((BPA_ORDER_DETAIL) k).status!=0){ - ((BPA_ORDER_DETAIL) k).status=0; - update((BPA_ORDER_DETAIL) k); - } + ((BPA_ORDER_DETAIL) k).status=0; + ((BPA_ORDER_DETAIL) k).deviceNum=0; + update((BPA_ORDER_DETAIL) k); } return obj.size() > 0 ? (BPA_ORDER_DETAIL) obj.get(0) : null; } @@ -170,4 +169,21 @@ public class OrderDetailUtil { } return data; } + + public static List getByFilterMaking(int deviceNum ,int mainPosition) { + String orderby = QueryDB.Desc_Time_Up; + String where = "isDelete=? and status!=0 and deviceNum!=0 and deviceNum!=? and mainPosition=?"; + String[] args = new String[]{"0",deviceNum+"",mainPosition+""}; + ArrayList data = new ArrayList<>(); + ArrayList obj = QueryDB.Get(BPA_ORDER_DETAIL.class, where, args, orderby); + for (Object k : obj) { + if(((BPA_ORDER_DETAIL) k).status!=0){ + data.add(0,(BPA_ORDER_DETAIL) k); + }else { + data.add((BPA_ORDER_DETAIL) k); + } + } + LogUtils.d("OrderDetailUtil getByAllMaking data=" + data.toString()); + return data; + } } diff --git a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java index d7bc6cf2..d7763355 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java +++ b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java @@ -352,6 +352,8 @@ public class MainHActivity extends BaseActivity { ModbusCenter.closePLC(); ExecuteTheRecipe.reset1(1); ExecuteTheRecipe.reset1(2); + ExecuteTheRecipe.reset1(3); + ExecuteTheRecipe.reset1(4); OrderDetailUtil.resetOrder(); } } diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java index c74525c5..b6b817ba 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java @@ -18,6 +18,7 @@ import androidx.fragment.app.DialogFragment; import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL; import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; @@ -30,6 +31,7 @@ import com.bonait.bnframework.databinding.DialogFoodInfoBinding; import com.bonait.bnframework.databinding.DialogFoodPosSelectBinding; import com.bonait.bnframework.newui.adapter.order.WokNameAdapter; import com.bonait.bnframework.newui.adapter.other.FoodPosSelectAdapter; +import com.bonait.bnframework.newui.widget.NewToastUtil; import java.util.ArrayList; import java.util.Arrays; @@ -44,6 +46,7 @@ public class FoodInfoDialog extends DialogFragment { private String TAG = " FoodInfoDialog =>"; private DialogFoodInfoBinding viewBinding; private String orderId = ""; + private boolean showBack = false; private BPA_ORDER_DETAIL orderDetail; @Override @@ -95,11 +98,19 @@ public class FoodInfoDialog extends DialogFragment { AdbCommandUtil.hideStatusBar(true); if (getArguments() != null) { orderId = getArguments().getString("orderId"); + showBack = getArguments().getBoolean("showBack"); } initView(); } private void initView(){ + viewBinding.btnBack.setVisibility(showBack?View.VISIBLE:View.GONE); + viewBinding.btnBack.setOnClickListener(v->{ + if(listener!=null){ + listener.clickListenerNew(null,0,null); + dismiss(); + } + }); viewBinding.btnClose1.setOnClickListener(v->{ dismiss(); }); @@ -127,6 +138,24 @@ public class FoodInfoDialog extends DialogFragment { dismiss(); return; } + viewBinding.tvTip.setVisibility(orderDetail.status!=0?View.VISIBLE:View.GONE); + viewBinding.tvTip.setOnClickListener(v->{ + NewToastUtil.getInstance().showToast("正在制作中,无法修改位置"); + }); + List details = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId); + if(orderDetail.deviceNum ==1){ + details.clear(); + details.addAll(ConfigName.goodsProcess1); + }else if(orderDetail.deviceNum ==2){ + details.clear(); + details.addAll(ConfigName.goodsProcess2); + }else if(orderDetail.deviceNum ==3){ + details.clear(); + details.addAll(ConfigName.goodsProcess3); + }else if(orderDetail.deviceNum ==4){ + details.clear(); + details.addAll(ConfigName.goodsProcess4); + } if(orderDetail.mainPosition!=0 && orderDetail.deviceNum !=0){ switch (orderDetail.mainPosition){ case 1: @@ -149,7 +178,6 @@ public class FoodInfoDialog extends DialogFragment { break; } } - List details = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId); for(BPA_GOODS_PROCESS_DETAIL detail:details){ if(detail.processname.equals("辅料")){ if(!detail.processvalue.isEmpty()){ @@ -257,24 +285,24 @@ public class FoodInfoDialog extends DialogFragment { showFuLiaoDialog("辅料位置","F8"); }); - viewBinding.mainFood1.setOnClickListener(v->{ - showMainFoodDialog("主料位置",1); - }); - viewBinding.mainFood2.setOnClickListener(v->{ - showMainFoodDialog("主料位置",2); - }); - viewBinding.mainFood3.setOnClickListener(v->{ - showMainFoodDialog("主料位置",3); - }); - viewBinding.mainFood4.setOnClickListener(v->{ - showMainFoodDialog("主料位置",4); - }); - viewBinding.mainFood5.setOnClickListener(v->{ - showMainFoodDialog("主料位置",5); - }); - viewBinding.mainFood6.setOnClickListener(v->{ - showMainFoodDialog("主料位置",6); - }); +// viewBinding.mainFood1.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",1); +// }); +// viewBinding.mainFood2.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",2); +// }); +// viewBinding.mainFood3.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",3); +// }); +// viewBinding.mainFood4.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",4); +// }); +// viewBinding.mainFood5.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",5); +// }); +// viewBinding.mainFood6.setOnClickListener(v->{ +// showMainFoodDialog("主料位置",6); +// }); } /** @@ -329,6 +357,44 @@ public class FoodInfoDialog extends DialogFragment { detail.processvalue = detail.processvalue.replace(posInfo,"辅料位置,"+positionName); detail.processms = detail.processms.replace(res2[1],positionName); } + + if(order.deviceNum ==1){ + if(!ConfigName.goodsProcess1.isEmpty()){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess1){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + } + }else if(order.deviceNum ==2){ + if(!ConfigName.goodsProcess2.isEmpty()){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess2){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + } + }else if(order.deviceNum ==3){ + if(!ConfigName.goodsProcess3.isEmpty()){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess3){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + } + }else if(order.deviceNum ==4){ + if(!ConfigName.goodsProcess4.isEmpty()){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess4){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + } + } if(GoodsProcessDetailDBUtil.update(detail)){ freshView(); xCom.dismissX(); @@ -370,7 +436,6 @@ public class FoodInfoDialog extends DialogFragment { WokNameAdapter adapter = new WokNameAdapter(){ @Override protected void onItemClick(View v, int position) { - orderDetail.deviceNum = Integer.parseInt(mData.get(position).substring(0,1)); orderDetail.mainPosition = mainPosition; OrderDetailUtil.update(orderDetail); freshView(); diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java index 637d62f4..776c35c7 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java @@ -150,37 +150,37 @@ public class RootTipDialog extends DialogFragment { switch (i){ case 1: if(kongPen instanceof Boolean){ - viewBinding.content2.tvKongPen1.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无")); + viewBinding.content2.tvKongPen1.setText(i+"号出餐盆:"+(((Boolean)kongPen)?"有":"无")); viewBinding.content2.tvKongPen1.setTextColor(((Boolean)kongPen)?Color.parseColor("#000000"):Color.parseColor("#EF5362")); }else { - viewBinding.content2.tvKongPen1.setText("炒锅"+i+"出餐盆:异常"); + viewBinding.content2.tvKongPen1.setText(i+"号出餐盆:异常"); viewBinding.content2.tvKongPen1.setTextColor(Color.parseColor("#EF5362")); } break; case 2: if(kongPen instanceof Boolean){ - viewBinding.content2.tvKongPen2.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无")); + viewBinding.content2.tvKongPen2.setText(i+"号出餐盆:"+(((Boolean)kongPen)?"有":"无")); viewBinding.content2.tvKongPen2.setTextColor(((Boolean)kongPen)?Color.parseColor("#000000"):Color.parseColor("#EF5362")); }else { - viewBinding.content2.tvKongPen2.setText("炒锅"+i+"出餐盆:异常"); + viewBinding.content2.tvKongPen2.setText(i+"号出餐盆:异常"); viewBinding.content2.tvKongPen2.setTextColor(Color.parseColor("#EF5362")); } break; case 3: if(kongPen instanceof Boolean){ - viewBinding.content2.tvKongPen3.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无")); + viewBinding.content2.tvKongPen3.setText(i+"号出餐盆:"+(((Boolean)kongPen)?"有":"无")); viewBinding.content2.tvKongPen3.setTextColor(((Boolean)kongPen)?Color.parseColor("#000000"):Color.parseColor("#EF5362")); }else { - viewBinding.content2.tvKongPen3.setText("炒锅"+i+"出餐盆:异常"); + viewBinding.content2.tvKongPen3.setText(i+"号出餐盆:异常"); viewBinding.content2.tvKongPen3.setTextColor(Color.parseColor("#EF5362")); } break; case 4: if(kongPen instanceof Boolean){ - viewBinding.content2.tvKongPen4.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无")); + viewBinding.content2.tvKongPen4.setText(i+"号出餐盆:"+(((Boolean)kongPen)?"有":"无")); viewBinding.content2.tvKongPen4.setTextColor(((Boolean)kongPen)?Color.parseColor("#000000"):Color.parseColor("#EF5362")); }else { - viewBinding.content2.tvKongPen4.setText("炒锅"+i+"出餐盆:异常"); + viewBinding.content2.tvKongPen4.setText(i+"号出餐盆:异常"); viewBinding.content2.tvKongPen4.setTextColor(Color.parseColor("#EF5362")); } break; diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/FoodPosSetDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/FoodPosSetDialog.java index b2e51526..5bd7126c 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/FoodPosSetDialog.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/FoodPosSetDialog.java @@ -18,6 +18,7 @@ import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL; import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; @@ -27,6 +28,7 @@ import com.bonait.bnframework.common.utils.AdbCommandUtil; import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.databinding.DialogFoodPosSetBinding; import com.bonait.bnframework.newui.widget.FoodPosSetView; +import com.bonait.bnframework.newui.widget.NewToastUtil; import java.util.ArrayList; import java.util.List; @@ -42,7 +44,6 @@ public class FoodPosSetDialog extends DialogFragment { private String orderId = ""; private List materialData = new ArrayList<>(); private int mainPosition; - private int deviceNum; private BPA_ORDER_DETAIL order; @@ -98,42 +99,59 @@ public class FoodPosSetDialog extends DialogFragment { orderId = getArguments().getString("orderId"); } initView(); + viewListener(); } private void initView(){ - viewBinding.btnClose.setOnClickListener(view -> dismiss()); order = OrderDetailUtil.getById(orderId); if(order==null){ dismiss(); return; } + mainPosition = order.mainPosition; materialData.clear(); List details = GoodsProcessDetailDBUtil.getByGroupId(order.groupId); for(BPA_GOODS_PROCESS_DETAIL detail:details){ if(detail.processname.equals("辅料")){ materialData.add(detail); - viewBinding.tv2.setText("辅料位置"); } } - updateView(); - - List posList = new ArrayList<>(); - posList.add("Z1"); - posList.add("Z2"); - posList.add("Z3"); - posList.add("Z4"); - posList.add("Z5"); - posList.add("Z6"); - ArrayAdapter spinnerAdapter3 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, posList); - spinnerAdapter3.setDropDownViewResource(R.layout.spinner_dropdown_item); - viewBinding.spinnerPosition.setAdapter(spinnerAdapter3); - if(order.mainPosition!=0){ - viewBinding.spinnerPosition.setSelection(order.mainPosition-1); - }else { - viewBinding.spinnerPosition.setSelection(0); + viewBinding.tvWok1.setSelected(order.deviceNum==1); + viewBinding.wokImage1.setVisibility(order.deviceNum==1?View.VISIBLE:View.GONE); + viewBinding.tvWok2.setSelected(order.deviceNum==2); + viewBinding.wokImage2.setVisibility(order.deviceNum==2?View.VISIBLE:View.GONE); + viewBinding.tvWok3.setSelected(order.deviceNum==3); + viewBinding.wokImage3.setVisibility(order.deviceNum==3?View.VISIBLE:View.GONE); + viewBinding.tvWok4.setSelected(order.deviceNum==4); + viewBinding.wokImage4.setVisibility(order.deviceNum==4?View.VISIBLE:View.GONE); + viewBinding.tvTip.setVisibility(order.deviceNum == 0?View.VISIBLE:View.GONE); + if(order.deviceNum ==1){ + if(!ConfigName.goodsProcess1.isEmpty()){ + details.clear(); + details.addAll(ConfigName.goodsProcess1); + } + }else if(order.deviceNum ==2){ + if(!ConfigName.goodsProcess2.isEmpty()){ + details.clear(); + details.addAll(ConfigName.goodsProcess2); + } + }else if(order.deviceNum ==3){ + if(!ConfigName.goodsProcess3.isEmpty()){ + details.clear(); + details.addAll(ConfigName.goodsProcess3); + } + }else if(order.deviceNum ==4){ + if(!ConfigName.goodsProcess4.isEmpty()){ + details.clear(); + details.addAll(ConfigName.goodsProcess4); + } } - mainPosition = Integer.parseInt(viewBinding.spinnerPosition.getSelectedItem().toString().substring(1)); + updateView(); + } + + private void viewListener(){ + viewBinding.btnClose.setOnClickListener(view -> dismiss()); viewBinding.spinnerPosition.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { @@ -146,37 +164,135 @@ public class FoodPosSetDialog extends DialogFragment { } }); - List wokList = new ArrayList<>(); - wokList.add("1号炒锅"); - wokList.add("2号炒锅"); - wokList.add("3号炒锅"); - wokList.add("4号炒锅"); - ArrayAdapter spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, wokList); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item); - viewBinding.spinnerWok.setAdapter(spinnerAdapter); - if(order.deviceNum !=0){ - viewBinding.spinnerWok.setSelection(order.deviceNum -1); + viewBinding.flWok1.setOnClickListener(v->{ + selectWok(1); + }); + viewBinding.flWok2.setOnClickListener(v->{ + selectWok(2); + }); + viewBinding.flWok3.setOnClickListener(v->{ + selectWok(3); + }); + viewBinding.flWok4.setOnClickListener(v->{ + selectWok(4); + }); + viewBinding.tvTip.setOnClickListener(v->{ + NewToastUtil.getInstance().showToast("请先选择炒锅位置"); + }); + } + + private void selectWok(int deviceNum){ + List posList = new ArrayList<>(); + if(order.deviceNum == 2 || order.deviceNum == 3){ + posList.add("Z4"); + posList.add("Z5"); + posList.add("Z6"); }else { - viewBinding.spinnerWok.setSelection(0); + posList.add("Z1"); + posList.add("Z2"); + posList.add("Z3"); } - deviceNum = Integer.parseInt(viewBinding.spinnerWok.getSelectedItem().toString().substring(0,1)); - viewBinding.spinnerWok.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView adapterView, View view, int i, long l) { - deviceNum = Integer.parseInt(viewBinding.spinnerWok.getSelectedItem().toString().substring(0,1)); - order.deviceNum = deviceNum; - OrderDetailUtil.update(order); + + ArrayAdapter spinnerAdapter3 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, posList); + spinnerAdapter3.setDropDownViewResource(R.layout.spinner_dropdown_item); + viewBinding.spinnerPosition.setAdapter(spinnerAdapter3); + viewBinding.spinnerPosition.setSelection(0); + if(order.mainPosition!=0){ + for(int i=0;i adapterView) { + } + mainPosition = Integer.parseInt(viewBinding.spinnerPosition.getSelectedItem().toString().substring(1)); + + if(order.deviceNum == deviceNum){ + if(order.deviceNum ==1){ + ConfigName.goodsProcess1.clear(); + }else if(order.deviceNum ==2){ + ConfigName.goodsProcess2.clear(); + }else if(order.deviceNum ==3){ + ConfigName.goodsProcess3.clear(); + }else if(order.deviceNum ==4){ + ConfigName.goodsProcess4.clear(); } - }); + viewBinding.tvWok1.setSelected(false); + viewBinding.wokImage1.setVisibility(View.GONE); + viewBinding.tvWok2.setSelected(false); + viewBinding.wokImage2.setVisibility(View.GONE); + viewBinding.tvWok3.setSelected(false); + viewBinding.wokImage3.setVisibility(View.GONE); + viewBinding.tvWok4.setSelected(false); + viewBinding.wokImage4.setVisibility(View.GONE); + order.deviceNum = 0; + viewBinding.tvTip.setVisibility(order.deviceNum == 0?View.VISIBLE:View.GONE); + OrderDetailUtil.update(order); + return; + } + + for(BPA_ORDER_DETAIL bean : OrderDetailUtil.getAll()){ + if(bean.deviceNum == deviceNum){ + NewToastUtil.getInstance().showToastError(bean.deviceNum+"号炒锅已绑定菜品【"+bean.goodsName+"】"); + return; + } + } + viewBinding.tvWok1.setSelected(deviceNum==1); + viewBinding.wokImage1.setVisibility(deviceNum==1?View.VISIBLE:View.GONE); + viewBinding.tvWok2.setSelected(deviceNum==2); + viewBinding.wokImage2.setVisibility(deviceNum==2?View.VISIBLE:View.GONE); + viewBinding.tvWok3.setSelected(deviceNum==3); + viewBinding.wokImage3.setVisibility(deviceNum==3?View.VISIBLE:View.GONE); + viewBinding.tvWok4.setSelected(deviceNum==4); + viewBinding.wokImage4.setVisibility(deviceNum==4?View.VISIBLE:View.GONE); + order.deviceNum = deviceNum; + OrderDetailUtil.update(order); + + ArrayList goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(order.groupId); + if(order.deviceNum ==1){ + ConfigName.goodsProcess1.clear(); + ConfigName.goodsProcess1.addAll(goodsrecipes); + }else if(order.deviceNum ==2){ + ConfigName.goodsProcess2.clear(); + ConfigName.goodsProcess2.addAll(goodsrecipes); + }else if(order.deviceNum ==3){ + ConfigName.goodsProcess3.clear(); + ConfigName.goodsProcess3.addAll(goodsrecipes); + }else if(order.deviceNum ==4){ + ConfigName.goodsProcess4.clear(); + ConfigName.goodsProcess4.addAll(goodsrecipes); + } + viewBinding.tvTip.setVisibility(order.deviceNum == 0?View.VISIBLE:View.GONE); + updateView(); } private void updateView(){ + List posList = new ArrayList<>(); + if(order.deviceNum == 2 || order.deviceNum == 3){ + posList.add("Z4"); + posList.add("Z5"); + posList.add("Z6"); + }else { + posList.add("Z1"); + posList.add("Z2"); + posList.add("Z3"); + } + + ArrayAdapter spinnerAdapter3 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, posList); + spinnerAdapter3.setDropDownViewResource(R.layout.spinner_dropdown_item); + viewBinding.spinnerPosition.setAdapter(spinnerAdapter3); + viewBinding.spinnerPosition.setSelection(0); + if(order.mainPosition!=0){ + for(int i=0;i { DialogWokMakeTipBinding binding = DialogWokMakeTipBinding.bind(layoutView); @@ -203,25 +210,78 @@ public class HomeOrderFragment extends BaseFragment{ viewBinding.recyclerInfo.setAdapter(orderAdapter1); viewBinding.btnLocationInfo.setOnClickListener(v->{ - if(ConfigName.getInstance().isFastClick()){ - return; + lookPosition(false); + }); + viewBinding.btnFoodPosSet.setOnClickListener(v->{ + setPositionInfo(); + }); + changeRightBtn(); + } + + /** + * 查看位置信息 + */ + private void lookPosition(boolean showBack){ + if(ConfigName.getInstance().isFastClick()){ + return; + } + if(foodInfoList.isEmpty()){ + return; + } + FoodInfoDialog foodInfoDialog = new FoodInfoDialog(); + Bundle bundle = new Bundle(); + bundle.putString("orderId",orderDetail.id); + bundle.putBoolean("showBack",showBack); + foodInfoDialog.setArguments(bundle); + foodInfoDialog.setListener(new MyClickListener() { + @Override + public void clickListener(View v, Object data) { + orderDetails1.clear(); + orderDetails1.addAll(OrderDetailUtil.getAll()); + orderAdapter1.notifyDataSetChanged(); + if(orderAdapter1.getCurrentPosition()>=0){ + orderClick(orderAdapter1.getData().get(orderAdapter1.getCurrentPosition())); + } } - if(foodInfoList.isEmpty()){ - return; + + @Override + public void clickListenerNew(View v, int k, Object data) { + setPositionInfo(); } - FoodInfoDialog foodInfoDialog = new FoodInfoDialog(); - Bundle bundle = new Bundle(); - bundle.putString("orderId",orderDetail.id); - foodInfoDialog.setArguments(bundle); - foodInfoDialog.setListener(new MyClickListener() { + }); + if(getActivity()!=null){ + foodInfoDialog.show(getActivity().getSupportFragmentManager(),"配料信息"); + } + } + + /** + * 设置位置信息 + */ + private void setPositionInfo(){ + if(ConfigName.getInstance().isFastClick()){ + return; + } + if(foodInfoList.isEmpty()){ + return; + } + FoodPosSetDialog dialog = new FoodPosSetDialog(); + Bundle bundle = new Bundle(); + bundle.putString("orderId",orderDetail.id); + dialog.setArguments(bundle); + if(getActivity()!=null){ + dialog.show(getActivity().getSupportFragmentManager(),"设置配料位置"); + dialog.setListener(new MyClickListener() { @Override - public void clickListener(View v, Object data) { + public void clickListener(View v, Object deviceNum) { orderDetails1.clear(); orderDetails1.addAll(OrderDetailUtil.getAll()); orderAdapter1.notifyDataSetChanged(); if(orderAdapter1.getCurrentPosition()>=0){ orderClick(orderAdapter1.getData().get(orderAdapter1.getCurrentPosition())); } + if((int)deviceNum != 0){ + lookPosition(true); + } } @Override @@ -229,42 +289,7 @@ public class HomeOrderFragment extends BaseFragment{ } }); - if(getActivity()!=null){ - foodInfoDialog.show(getActivity().getSupportFragmentManager(),"配料信息"); - } - }); - viewBinding.btnFoodPosSet.setOnClickListener(v->{ - if(ConfigName.getInstance().isFastClick()){ - return; - } - if(foodInfoList.isEmpty()){ - return; - } - FoodPosSetDialog dialog = new FoodPosSetDialog(); - Bundle bundle = new Bundle(); - bundle.putString("orderId",orderDetail.id); - dialog.setArguments(bundle); - if(getActivity()!=null){ - dialog.show(getActivity().getSupportFragmentManager(),"修改配料位置"); - dialog.setListener(new MyClickListener() { - @Override - public void clickListener(View v, Object data) { - orderDetails1.clear(); - orderDetails1.addAll(OrderDetailUtil.getAll()); - orderAdapter1.notifyDataSetChanged(); - if(orderAdapter1.getCurrentPosition()>=0){ - orderClick(orderAdapter1.getData().get(orderAdapter1.getCurrentPosition())); - } - } - - @Override - public void clickListenerNew(View v, int k, Object data) { - - } - }); - } - }); - changeRightBtn(); + } } /** @@ -278,7 +303,7 @@ public class HomeOrderFragment extends BaseFragment{ }else { if(orderDetail.status!=0){ viewBinding.btnFoodPosSet.setVisibility(View.GONE); - viewBinding.btnLocationInfo.setVisibility(View.GONE); + viewBinding.btnLocationInfo.setVisibility(View.VISIBLE); }else { viewBinding.btnFoodPosSet.setVisibility(View.VISIBLE); viewBinding.btnLocationInfo.setVisibility(View.VISIBLE); @@ -520,6 +545,15 @@ public class HomeOrderFragment extends BaseFragment{ if (ConfigName.getInstance().isFastClick()){ return; } + if(orderDetails1.get(position).deviceNum ==1){ + ConfigName.goodsProcess1.clear(); + }else if(orderDetails1.get(position).deviceNum ==2){ + ConfigName.goodsProcess2.clear(); + }else if(orderDetails1.get(position).deviceNum ==3){ + ConfigName.goodsProcess3.clear(); + }else if(orderDetails1.get(position).deviceNum ==4){ + ConfigName.goodsProcess4.clear(); + } BPA_ORDER_DETAIL orderDetail1 = OrderDetailUtil.getById(orderDetails1.get(position).id); OrderDetailUtil.deleteById(orderDetails1.get(position).id); orderDetails1.remove(position); @@ -591,6 +625,9 @@ public class HomeOrderFragment extends BaseFragment{ } switch (status){ case 0: + if(checkPositionResue()){ + return; + } orderDetails1.get(position).status = 1; BPA_ORDER_DETAIL bean = orderDetails1.get(position); bean.createTime = "0"; @@ -613,6 +650,15 @@ public class HomeOrderFragment extends BaseFragment{ foodInfoAdapter.notifyDataSetChanged(); changeRightBtn(); } + if(orderDetails1.get(position).deviceNum ==1){ + ConfigName.goodsProcess1.clear(); + }else if(orderDetails1.get(position).deviceNum ==2){ + ConfigName.goodsProcess2.clear(); + }else if(orderDetails1.get(position).deviceNum ==3){ + ConfigName.goodsProcess3.clear(); + }else if(orderDetails1.get(position).deviceNum ==4){ + ConfigName.goodsProcess4.clear(); + } OrderDetailUtil.deleteById(orderDetails1.get(position).id); orderDetails1.remove(position); orderAdapter1.setCurrentPosition(-1); @@ -630,6 +676,9 @@ public class HomeOrderFragment extends BaseFragment{ } xCom.dismissX(); if(status==0){ + if(checkPositionResue()){ + return; + } orderDetails1.get(position).status = 1; BPA_ORDER_DETAIL bean = orderDetails1.get(position); bean.createTime = "0"; @@ -680,6 +729,125 @@ public class HomeOrderFragment extends BaseFragment{ } } + /** + * 检查位置是否重复使用 + */ + private boolean checkPositionResue(){ + try { + List goodsrecipes = new ArrayList<>(); + List otherCooking = new ArrayList<>(); + StringBuffer desc = new StringBuffer(); + if(!OrderDetailUtil.getByFilterMaking(orderDetail.deviceNum,orderDetail.mainPosition).isEmpty()){ + desc.append("主料Z").append(orderDetail.mainPosition).append("|"); + }else { + if(orderDetail.deviceNum ==1){ + goodsrecipes = ConfigName.goodsProcess1; + if(ConfigName.IsStart[1]){ + otherCooking.addAll(ConfigName.goodsProcess2); + } + if(ConfigName.IsStart[2]){ + otherCooking.addAll(ConfigName.goodsProcess3); + } + if(ConfigName.IsStart[3]){ + otherCooking.addAll(ConfigName.goodsProcess4); + } + }else if(orderDetail.deviceNum ==2){ + goodsrecipes = ConfigName.goodsProcess2; + if(ConfigName.IsStart[0]){ + otherCooking.addAll(ConfigName.goodsProcess1); + } + if(ConfigName.IsStart[2]){ + otherCooking.addAll(ConfigName.goodsProcess3); + } + if(ConfigName.IsStart[3]){ + otherCooking.addAll(ConfigName.goodsProcess4); + } + }else if(orderDetail.deviceNum ==3){ + goodsrecipes = ConfigName.goodsProcess3; + if(ConfigName.IsStart[1]){ + otherCooking.addAll(ConfigName.goodsProcess2); + } + if(ConfigName.IsStart[0]){ + otherCooking.addAll(ConfigName.goodsProcess1); + } + if(ConfigName.IsStart[3]){ + otherCooking.addAll(ConfigName.goodsProcess4); + } + }else if(orderDetail.deviceNum ==4){ + goodsrecipes = ConfigName.goodsProcess4; + if(ConfigName.IsStart[1]){ + otherCooking.addAll(ConfigName.goodsProcess2); + } + if(ConfigName.IsStart[2]){ + otherCooking.addAll(ConfigName.goodsProcess3); + } + if(ConfigName.IsStart[0]){ + otherCooking.addAll(ConfigName.goodsProcess1); + } + } + if(goodsrecipes.isEmpty()){ + NewToastUtil.getInstance().showToast("商品工序为空!"); + return true; + } + + for(BPA_GOODS_PROCESS_DETAIL detail : goodsrecipes){ + if(detail.processname.equals("辅料")){ + for(BPA_GOODS_PROCESS_DETAIL detailing : otherCooking){ + if(detail.processname.equals(detailing.processname)){ + String[] position1 = detail.processvalue.split("\\|"); + String[] position2 = detailing.processvalue.split("\\|"); + if(position1[1].equals(position2[1])){ + desc.append(position2[1]).append("|"); + break; + } + } + } + } + } + } + if(desc.length()>0){ + desc.substring(0,desc.length()-1); + desc.append("\n库位正在被其他设备使用,请更换位置重试"); + }else { + List posList = new ArrayList<>(); + for(BPA_GOODS_PROCESS_DETAIL detail : goodsrecipes){ + if(detail.processname.equals("辅料")||detail.processname.equals("主料")){ + String[] position1 = detail.processvalue.split("\\|"); + if(posList.contains(position1[1])){ + desc.append(position1[1]).append("|"); + }else { + posList.add(position1[1]); + } + } + } + if(desc.length()>0){ + desc.substring(0,desc.length()-1); + desc.append("\n库位被重复使用,请更换位置重试"); + } + } + if(desc.length()>0){ + AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_tip, (layoutView, xCom) -> { + DialogTipBinding binding = DialogTipBinding.bind(layoutView); + DisplayManager.scaleViewGroup(binding.getRoot()); + binding.title.setText("警告"); + binding.message.setText(desc.toString()); + binding.close.setOnClickListener(view1->{ + xCom.dismissX(); + }); + binding.submit.setOnClickListener(view1 -> { + xCom.dismissX(); + }); + }); + return true; + } + return false; + }catch (Exception e){ + NewToastUtil.getInstance().showToastError("startMakingThread 下单异常:"+e.getMessage()); + RecordManager.getInstance().addLogRecord("角色操作日志","startMakingThread 下单异常:"+e.getMessage()); + return true; + } + } + /** * 跳转去烹饪页面 */ diff --git a/app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java b/app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java index 56b9ccf6..b2bd7150 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java +++ b/app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java @@ -7,6 +7,7 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.FrameLayout; +import android.widget.LinearLayout; import com.bonait.bnframework.R; import com.bonait.bnframework.common.constant.ConfigName; @@ -24,17 +25,20 @@ import java.util.List; * @description: * @date: 2024/5/16 17:53. */ -public class FoodPosSetView extends FrameLayout { +public class FoodPosSetView extends LinearLayout { private ViewFoodPosSetBinding viewBinding; private BPA_GOODS_PROCESS_DETAIL detail; + private int deviceNum = 0; - public FoodPosSetView(Context context, AttributeSet attrs, BPA_GOODS_PROCESS_DETAIL detail) { + + public FoodPosSetView(Context context, AttributeSet attrs, BPA_GOODS_PROCESS_DETAIL detail,int deviceNum) { super(context, attrs); View root= LayoutInflater.from(context).inflate(R.layout.view_food_pos_set, this); viewBinding = ViewFoodPosSetBinding.bind(root); DisplayManager.scaleViewGroup(viewBinding.getRoot()); this.detail = detail; + this.deviceNum = deviceNum; init(); } @@ -72,6 +76,7 @@ public class FoodPosSetView extends FrameLayout { detail.processvalue = detail.processvalue.replace(posInfo,"辅料位置,"+viewBinding.spinner.getSelectedItem().toString()); detail.processms = detail.processms.replace(res2[1],viewBinding.spinner.getSelectedItem().toString()); GoodsProcessDetailDBUtil.update(detail); + updateData(detail); } @Override public void onNothingSelected(AdapterView adapterView) { @@ -83,4 +88,36 @@ public class FoodPosSetView extends FrameLayout { } } } + + private void updateData(BPA_GOODS_PROCESS_DETAIL detail){ + if(deviceNum ==1){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess1){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + }else if(deviceNum ==2){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess2){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + }else if(deviceNum ==3){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess3){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + }else if(deviceNum ==4){ + for(BPA_GOODS_PROCESS_DETAIL bean:ConfigName.goodsProcess4){ + if(detail.id.equals(bean.id)){ + bean.processvalue = detail.processvalue; + bean.processms = detail.processms; + } + } + } + } } diff --git a/app/src/main/res/drawable/bg_round25_gray.xml b/app/src/main/res/drawable/bg_round25_gray.xml new file mode 100644 index 00000000..e5ef5a0c --- /dev/null +++ b/app/src/main/res/drawable/bg_round25_gray.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/bg_wok_select.xml b/app/src/main/res/drawable/bg_wok_select.xml new file mode 100644 index 00000000..c64e42bb --- /dev/null +++ b/app/src/main/res/drawable/bg_wok_select.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/color_text_wok_select.xml b/app/src/main/res/drawable/color_text_wok_select.xml new file mode 100644 index 00000000..30b3df07 --- /dev/null +++ b/app/src/main/res/drawable/color_text_wok_select.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/new/layout/dialog_food_info.xml b/app/src/main/res/layout/new/layout/dialog_food_info.xml index ffe8e50f..33855f17 100644 --- a/app/src/main/res/layout/new/layout/dialog_food_info.xml +++ b/app/src/main/res/layout/new/layout/dialog_food_info.xml @@ -281,6 +281,34 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/new/layout/dialog_food_pos_set.xml b/app/src/main/res/layout/new/layout/dialog_food_pos_set.xml index 5e409ead..0b244c83 100644 --- a/app/src/main/res/layout/new/layout/dialog_food_pos_set.xml +++ b/app/src/main/res/layout/new/layout/dialog_food_pos_set.xml @@ -9,9 +9,9 @@ android:layout_height="wrap_content"> + android:layout_width="1800dp" + android:background="@drawable/bg_round25_gray" + android:layout_height="950dp"> + + android:text="主料位置" + android:gravity="center" + android:layout_height="wrap_content"/> + - - - + android:layout_below="@id/ll_title" + android:layout_alignStart="@id/ll_title" + android:layout_marginBottom="20dp" + android:layout_height="match_parent"> - + android:layout_marginBottom="20dp" + android:layout_height="match_parent"> - + + + + + + + + + + + + + + + + + + - + android:textColor="@color/black" + android:textSize="32sp" + android:textStyle="bold" + android:text="辅料位置" + android:layout_marginStart="320dp" + android:layout_marginTop="130dp" + android:gravity="center" + android:layout_height="wrap_content"/> - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/new/layout/dialog_root_tip.xml b/app/src/main/res/layout/new/layout/dialog_root_tip.xml index 8f985bf8..4bf2ad75 100644 --- a/app/src/main/res/layout/new/layout/dialog_root_tip.xml +++ b/app/src/main/res/layout/new/layout/dialog_root_tip.xml @@ -23,8 +23,8 @@ /> diff --git a/app/src/main/res/layout/new/layout/view_food_pos_set.xml b/app/src/main/res/layout/new/layout/view_food_pos_set.xml index 7fb618b7..52a58941 100644 --- a/app/src/main/res/layout/new/layout/view_food_pos_set.xml +++ b/app/src/main/res/layout/new/layout/view_food_pos_set.xml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/svg/drawable/ic_true.xml b/app/src/main/res/layout/svg/drawable/ic_true.xml new file mode 100644 index 00000000..fa3a218d --- /dev/null +++ b/app/src/main/res/layout/svg/drawable/ic_true.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 20e845ac..5e59a34d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -144,4 +144,7 @@ #800088FF #80567722 #80DA5A17 + + #68A00F + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e33c1eec..d46860d9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - 一拖二炒菜机器人 + 一拖四炒菜机器人 常用文件 全部文件 没有数据 diff --git a/build.gradle b/build.gradle index ebcf7814..770c6998 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ ext { // 统一版本入口 // 炒锅 // 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中) // applicationId="com.bonait.shanghaiminzhong" - applicationId="com.bonait.wokrobot" + applicationId="com.bonait.wokrobot14" // 奶茶机 // 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中) // applicationId= "com.bonait.ncj"