@@ -54,7 +54,7 @@ public class ExecuteTheRecipe { | |||
* 等待超时时间 | |||
*/ | |||
//public static int whileTime = 40; | |||
public static int whileTime = 10000; | |||
public static int whileTime = 600; | |||
//手动操作耗时时长 | |||
public static int HandTime = 0; | |||
@@ -164,6 +164,7 @@ public class ExecuteTheRecipe { | |||
//endregion | |||
//region 执行配方 | |||
public static boolean hasClear = false; | |||
public static CountDownTimer countDownTimer; | |||
public static int cookingTime = 0; | |||
public static int cookedTime = 0; | |||
@@ -243,6 +244,12 @@ public class ExecuteTheRecipe { | |||
NewToastUtil.getInstance().showToastError("设备连接异常,停止制作!"); | |||
return; | |||
} | |||
if((Boolean) ReadPLC("温度定位超时")||(Boolean) ReadPLC("档位定位超时")|| | |||
(Boolean) ReadPLC("档位回原点超时")||(Boolean) ReadPLC("温度回原点超时") | |||
||(Boolean) ReadPLC("烤箱开门动作超时")||(Boolean) ReadPLC("烤箱关门动作超时")){ | |||
IsForcedEnd2 = true; | |||
return; | |||
} | |||
RecordManager.getInstance().addLogRecord("订单处理日志","烤箱("+orderDetail.goodsName+"-"+orderDetail.groupName+")-开始制作-工序-"+item.processname+"("+item.processvalue+")"); | |||
ExecuteOperationSteps(item.processname, item.processvalue); | |||
} | |||
@@ -260,6 +267,7 @@ public class ExecuteTheRecipe { | |||
RecordManager.getInstance().addOrderRecords(bean,"异常"); | |||
}finally { | |||
if(IsForcedEnd2){ | |||
NewToastUtil.getInstance().showToast("烤箱烤制已强制停止"); | |||
BPA_ORDER_DETAIL bean = OrderDetailUtil.getByMaking(1); | |||
if(bean!=null){ | |||
RecordManager.getInstance().addLogRecord("订单处理日志","烤箱("+bean.goodsName+"-"+bean.groupName+")-制作取消"); | |||
@@ -308,7 +316,9 @@ public class ExecuteTheRecipe { | |||
//获取工艺 | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId); | |||
int m = 0; | |||
RecordManager.getInstance().addLogRecord("订单处理日志","炒锅("+orderDetail.goodsName+"-"+orderDetail.groupName+")-开始制作"); | |||
if(!goodsrecipes.isEmpty()){ | |||
hasClear = goodsrecipes.get(goodsrecipes.size()-1).processname.contains("清洗"); | |||
} | |||
for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) { | |||
if(!ExecuteTheRecipe.MakeStatus){ | |||
@@ -324,6 +334,11 @@ public class ExecuteTheRecipe { | |||
if(IsForcedEnd){ | |||
return; | |||
} | |||
if((Boolean) ReadPLC("补盆动作超时")){ | |||
NewToastUtil.getInstance().showToastError("补盆动作超时"); | |||
IsForcedEnd = true; | |||
return; | |||
} | |||
LogUtils.d("startMakingThread process = "+m); | |||
EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,m)); | |||
orderDetail.process=m+1; | |||
@@ -347,6 +362,9 @@ public class ExecuteTheRecipe { | |||
ExecuteTheRecipe.WritePLC("搅拌", false, null); | |||
ExecuteTheRecipe.WritePLC("加热", false, null); | |||
ExecuteTheRecipe.WritePLC("暂停开关", false, null); | |||
Make位置("原点位"); | |||
WokModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); | |||
ConfigName.getInstance().IsOpenHuoLi = false; | |||
long endTime = System.currentTimeMillis(); //结束时间 | |||
int time = (int) ((endTime - startTime) / 1000); | |||
@@ -385,7 +403,6 @@ public class ExecuteTheRecipe { | |||
RecordManager.getInstance().addOrderRecords(orderDetail,"完成"); | |||
} | |||
} | |||
ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); | |||
reset1(); | |||
// autoBupen(); | |||
} | |||
@@ -492,7 +509,6 @@ public class ExecuteTheRecipe { | |||
{ | |||
if (recipe.processname.equals("加水") || recipe.processname.equals("并行出料")) { | |||
Make位置("抽料位"); | |||
ThreadWhile("抽料位反馈"); | |||
} | |||
//执行工序 | |||
ExecuteOperationSteps(recipe.processname, recipe.processvalue); | |||
@@ -515,7 +531,6 @@ public class ExecuteTheRecipe { | |||
try { | |||
//先到达抽料位 | |||
Make位置("抽料位"); | |||
ThreadWhile("抽料位反馈"); | |||
if (!text.isEmpty()) { | |||
long startTime = System.currentTimeMillis(); //起始时间 | |||
if (NoticeHandSuspension != null) { | |||
@@ -822,14 +837,14 @@ public class ExecuteTheRecipe { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (!key.contains("(秒)") && !key.contains("速度")) { | |||
if(!value.contains("炒菜") && !value.contains("原点位")){ | |||
boolean isJre = false; | |||
Object K = ReadPLC("加热"); | |||
isJre = K == null ? false : (boolean) K; | |||
if (isJre) { | |||
ExecuteTheRecipe.WritePLC("加热", false, null); | |||
}//不在炒菜位就关闭加热 | |||
} | |||
// if(!value.contains("炒菜") && !value.contains("原点位")){ | |||
// boolean isJre = false; | |||
// Object K = ReadPLC("加热"); | |||
// isJre = K == null ? false : (boolean) K; | |||
// if (isJre) { | |||
// ExecuteTheRecipe.WritePLC("加热", false, null); | |||
// }//不在炒菜位就关闭加热 | |||
// } | |||
if (ExecuteCurrentOperation != null) { | |||
ExecuteCurrentOperation.Run("位置" + "|" + value); | |||
@@ -1128,13 +1143,13 @@ public class ExecuteTheRecipe { | |||
//<<开门流程 | |||
ExecuteTheRecipe.WritePLC("档位选择", 0, null); | |||
ExecuteTheRecipe.WritePLC("档位选择触发", true, null); | |||
ThreadWhile2("当前档位_关"); | |||
// ThreadWhile2("当前档位_关"); | |||
Thread.sleep(100); | |||
ConfigName.getInstance().oven_wendu = 0+""; | |||
ExecuteTheRecipe.WritePLC("温度选择", 0, null); | |||
Thread.sleep(10); | |||
ExecuteTheRecipe.WritePLC("温度选择触发", true, null); | |||
ThreadWhile2("温度设置完成"); | |||
// ThreadWhile2("温度设置完成"); | |||
Thread.sleep(100); | |||
boolean isOpen = (boolean)ReadPLC("烤箱门开到位检测"); | |||
if(!isOpen){ | |||
@@ -1158,7 +1173,7 @@ public class ExecuteTheRecipe { | |||
//<<关门流程 | |||
Thread.sleep(100); | |||
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null); | |||
Thread.sleep(3000); | |||
Thread.sleep(10000); | |||
boolean isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测"); | |||
if(!isClose2){ | |||
Wait_Robot2_No_Working();//等待机器人空闲 | |||
@@ -1230,29 +1245,34 @@ public class ExecuteTheRecipe { | |||
ConfigName.getInstance().oven_wendu = wendu+""; | |||
ExecuteTheRecipe.WritePLC("档位选择", dangwei, null); | |||
ExecuteTheRecipe.WritePLC("档位选择触发", true, null); | |||
switch (dangwei){ | |||
case 0: | |||
ThreadWhile2("当前档位_关"); | |||
break; | |||
case 1: | |||
ThreadWhile2("当前档位_蒸"); | |||
break; | |||
case 2: | |||
ThreadWhile2("当前档位_烤"); | |||
break; | |||
case 3: | |||
ThreadWhile2("当前档位_蒸烤"); | |||
break; | |||
case 4: | |||
ThreadWhile2("当前档位_其他"); | |||
break; | |||
} | |||
// switch (dangwei){ | |||
// case 0: | |||
// ThreadWhile2("当前档位_关"); | |||
// break; | |||
// case 1: | |||
// ThreadWhile2("当前档位_蒸"); | |||
// break; | |||
// case 2: | |||
// ThreadWhile2("当前档位_烤"); | |||
// break; | |||
// case 3: | |||
// ThreadWhile2("当前档位_蒸烤"); | |||
// break; | |||
// case 4: | |||
// ThreadWhile2("当前档位_其他"); | |||
// break; | |||
// } | |||
Thread.sleep(100); | |||
ExecuteTheRecipe.WritePLC("温度选择", wendu, null); | |||
Thread.sleep(10); | |||
ExecuteTheRecipe.WritePLC("温度选择触发", true, null); | |||
ThreadWhile2("温度设置完成"); | |||
// ThreadWhile2("温度设置完成"); | |||
if((Boolean) ReadPLC("温度定位超时")||(Boolean) ReadPLC("档位定位超时")|| | |||
(Boolean) ReadPLC("档位回原点超时")||(Boolean) ReadPLC("温度回原点超时")){ | |||
IsForcedEnd2 = true; | |||
} | |||
long startTime = System.currentTimeMillis(); | |||
while ((System.currentTimeMillis() - startTime) <= (time * 1000) && !IsForcedEnd2) { | |||
@@ -1304,13 +1324,13 @@ public class ExecuteTheRecipe { | |||
//<<开门流程 | |||
ExecuteTheRecipe.WritePLC("档位选择", 0, null); | |||
ExecuteTheRecipe.WritePLC("档位选择触发", true, null); | |||
ThreadWhile2("当前档位_关"); | |||
// ThreadWhile2("当前档位_关"); | |||
Thread.sleep(100); | |||
ConfigName.getInstance().oven_wendu = 0+""; | |||
ExecuteTheRecipe.WritePLC("温度选择", 0, null); | |||
Thread.sleep(10); | |||
ExecuteTheRecipe.WritePLC("温度选择触发", true, null); | |||
ThreadWhile2("温度设置完成"); | |||
// ThreadWhile2("温度设置完成"); | |||
Thread.sleep(100); | |||
boolean isOpen = (boolean)ReadPLC("烤箱门开到位检测"); | |||
if(!isOpen){ | |||
@@ -1427,9 +1447,8 @@ public class ExecuteTheRecipe { | |||
}//提前关闭加热 | |||
Make位置("原点位"); | |||
ThreadWhile("原点位反馈"); | |||
//检测盆是否存在 | |||
ThreadWhile(foodPosition+"#料仓检测有无"); | |||
// ThreadWhile(foodPosition+"#料仓检测有无"); | |||
Wait_Robot_No_Working();//等待机器人空闲 | |||
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null); | |||
@@ -1437,7 +1456,7 @@ public class ExecuteTheRecipe { | |||
return; | |||
} | |||
ModbusCenter.robotWritePlc(true,foodPosition+"#库取原料倒至炒锅",true,null); | |||
Thread.sleep(100); | |||
Thread.sleep(2000); | |||
ThreadWhile("炒锅倒原料完成"); | |||
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) { | |||
@@ -1445,7 +1464,6 @@ public class ExecuteTheRecipe { | |||
}//再次释放加热 | |||
Make位置(czwz); | |||
ThreadWhile(czwz); | |||
//判断是否有烹饪时间 | |||
int val = 0; | |||
@@ -1456,7 +1474,7 @@ public class ExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} | |||
} | |||
if (val > 0 && !IsForcedEnd&&!MakeStatus) { | |||
if (val > 0 && !IsForcedEnd) { | |||
ThreadDelay(val); | |||
} | |||
if(ConfigName.TEST){ | |||
@@ -1468,6 +1486,11 @@ public class ExecuteTheRecipe { | |||
isTouLiao = false; | |||
} | |||
} | |||
/** | |||
* 手动控制倒主料 | |||
* @param data | |||
*/ | |||
public static void Write_PLC_MainIngredients_shoudong(HashMap<String, String> data) { | |||
try { | |||
ExecuteTheRecipe.showlog("准备倒入主料!"); | |||
@@ -1496,7 +1519,6 @@ public class ExecuteTheRecipe { | |||
}//提前关闭加热 | |||
Make位置("原点位"); | |||
ThreadWhile("原点位反馈"); | |||
//检测盆是否存在 | |||
ThreadWhile(foodPosition+"#料仓检测有无"); | |||
@@ -1512,7 +1534,6 @@ public class ExecuteTheRecipe { | |||
}//再次释放加热 | |||
Make位置(czwz); | |||
ThreadWhile(czwz); | |||
} catch (Exception ex) { | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
@@ -1529,7 +1550,7 @@ public class ExecuteTheRecipe { | |||
public static void Write_PLC_MainAccessory(HashMap<String, String> data) { | |||
try { | |||
isTouLiao = true; | |||
ExecuteTheRecipe.showlog("准备倒入主料!"); | |||
ExecuteTheRecipe.showlog("准备倒入辅料!"); | |||
//判断炒制位置 | |||
String czwz = "炒菜位高"; | |||
String foodPosition = "F1"; | |||
@@ -1558,9 +1579,7 @@ public class ExecuteTheRecipe { | |||
}//提前关闭加热 | |||
Make位置("原点位"); | |||
ThreadWhile("原点位反馈"); | |||
//检测盆是否存在 | |||
ThreadWhile(foodPosition+"#调料检测有无"); | |||
Wait_Robot_No_Working();//等待机器人空闲 | |||
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null); | |||
@@ -1568,7 +1587,7 @@ public class ExecuteTheRecipe { | |||
return; | |||
} | |||
ModbusCenter.robotWritePlc(true,foodPosition+"#库取调料倒至炒锅",true,null); | |||
Thread.sleep(100); | |||
Thread.sleep(2000); | |||
ThreadWhile("炒锅倒调料完成"); | |||
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) { | |||
@@ -1576,7 +1595,6 @@ public class ExecuteTheRecipe { | |||
}//再次释放加热 | |||
Make位置(czwz); | |||
ThreadWhile(czwz); | |||
//判断是否有烹饪时间 | |||
int val = 0; | |||
@@ -1587,7 +1605,7 @@ public class ExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} | |||
} | |||
if (val > 0 && !IsForcedEnd &&!MakeStatus) { | |||
if (val > 0 && !IsForcedEnd) { | |||
ThreadDelay(val); | |||
} | |||
if(ConfigName.TEST){ | |||
@@ -1600,9 +1618,13 @@ public class ExecuteTheRecipe { | |||
} | |||
} | |||
/** | |||
* 手动控制倒辅料 | |||
* @param data | |||
*/ | |||
public static void Write_PLC_MainAccessory_shoudong(HashMap<String, String> data) { | |||
try { | |||
ExecuteTheRecipe.showlog("准备倒入主料!"); | |||
ExecuteTheRecipe.showlog("准备倒入辅料!"); | |||
//判断炒制位置 | |||
String czwz = "炒菜位高"; | |||
String foodPosition = "F1"; | |||
@@ -1627,7 +1649,6 @@ public class ExecuteTheRecipe { | |||
}//提前关闭加热 | |||
Make位置("原点位"); | |||
ThreadWhile("原点位反馈"); | |||
//检测盆是否存在 | |||
ThreadWhile(foodPosition+"#调料检测有无"); | |||
@@ -1643,7 +1664,6 @@ public class ExecuteTheRecipe { | |||
}//再次释放加热 | |||
Make位置(czwz); | |||
ThreadWhile(czwz); | |||
} catch (Exception ex) { | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
@@ -1672,7 +1692,6 @@ public class ExecuteTheRecipe { | |||
} | |||
} | |||
} | |||
ExecuteTheRecipe.WritePLC("搅拌", false, null); | |||
ExecuteTheRecipe.WritePLC("加热", false, null); | |||
ExecuteTheRecipe.showlog("关闭搅拌、关闭加热!"); | |||
ThreadWhile("出料空盆检测有无"); | |||
@@ -1703,8 +1722,16 @@ public class ExecuteTheRecipe { | |||
} | |||
Thread.sleep(100);//10 *6 | |||
} | |||
ThreadWhile("出餐启动反馈"); | |||
Thread.sleep(100); | |||
ThreadWhile("炒锅出餐完成"); | |||
ModbusCenter.robotWritePlc(false,"炒锅出餐倒菜完成",true,null); | |||
Thread.sleep(500); | |||
ExecuteTheRecipe.Make位置("原点位"); | |||
if(hasClear){ | |||
LogUtils.d(" 有清洗,直接下一步"); | |||
}else { | |||
ThreadWhile("炒锅出餐完成"); | |||
} | |||
ExecuteTheRecipe.showlog("出菜完成,锅体准备回到原位!"); | |||
} catch (Exception ex) { | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
@@ -2047,7 +2074,7 @@ public class ExecuteTheRecipe { | |||
long a = System.currentTimeMillis(); | |||
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",等待中"); | |||
while (!IsComplete[0] && !IsForcedEnd && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect&& OvenModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) { | |||
while (!IsComplete[0] && !IsForcedEnd && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) { | |||
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { | |||
ExecuteTheRecipe.showlog(name + ",异常超时退出!"); | |||
break; | |||
@@ -2056,8 +2083,12 @@ public class ExecuteTheRecipe { | |||
if (sb != null) { | |||
IsComplete[0] = (boolean) (sb); | |||
if (IsComplete[0]) { | |||
LogUtils.d(TAG+" ThreadWhile name="+name+" true"); | |||
LogUtils.d(TAG+" ThreadWhile name="+name+" true ////"); | |||
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",true"); | |||
}else { | |||
if(name.equals("出料空盆检测有无")){ | |||
NewToastUtil.getInstance().showToastError("出料空盆没有盆,请检查传感器或放置空盆!"); | |||
} | |||
LogUtils.d(TAG+" ThreadWhile name="+name+" false"); | |||
} | |||
} | |||
@@ -187,6 +187,8 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0)); | |||
add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 1, 0)); | |||
add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 1, 0)); | |||
add(new Res_PLCADDRESS("炒菜位高反馈", "M40.5", 1, 0)); | |||
add(new Res_PLCADDRESS("炒菜位低反馈", "M40.6", 1, 0)); | |||
add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 1, 0)); | |||
add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 1, 0)); | |||
add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0)); | |||
@@ -11,7 +11,10 @@ public class BPA_ORDER_DETAIL extends ModeBase{ | |||
public String goodsName; | |||
public String goodsId; | |||
public String classifyId; | |||
public int type = 0;//0炒菜 1烤菜 | |||
/** | |||
* 0炒菜 1烤菜 | |||
*/ | |||
public int type = 0;// | |||
public int process=0;//进度 | |||
/** | |||
* 0未开始 1制作中 2完成 3异常 | |||
@@ -114,7 +114,7 @@ public class ModbusCenter { | |||
ThreadManager.get().StartLong("炒锅PLC设备数据监听", true, () -> { | |||
try { | |||
try{ | |||
LogUtils.d("炒锅*******************++"); | |||
// LogUtils.d("炒锅*******************++"); | |||
if(WokModbusTcpServer.get().plcIsConnect){ | |||
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_Wok) { | |||
if(item!=null){ | |||
@@ -162,7 +162,7 @@ public class ModbusCenter { | |||
//// WritePlc("烤箱心跳位", 0, null); | |||
// } | |||
LogUtils.d("OvenModbusTcpServer.get().plcIsConnect ="+OvenModbusTcpServer.get().plcIsConnect); | |||
LogUtils.d("炒锅*******************++222"); | |||
// LogUtils.d("炒锅*******************++222"); | |||
} catch (Exception ex) { | |||
// NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -173,7 +173,7 @@ public class ModbusCenter { | |||
ThreadManager.get().StartLong("烤箱PLC设备数据监听", true, () -> { | |||
try { | |||
try{ | |||
LogUtils.d("烤箱*******************++"); | |||
// LogUtils.d("烤箱*******************++"); | |||
if(OvenModbusTcpServer.get().plcIsConnect){ | |||
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_Oven) { | |||
@@ -194,6 +194,11 @@ public class ModbusCenter { | |||
NewToastUtil.getInstance().showToastError(item.name+",请前往设备报警信息栏目,手动复位"); | |||
} | |||
} | |||
if(item.name.equals("烤箱门开到位检测")){ | |||
if(RobotModbusTcpServer.get().plcIsConnect){ | |||
ModbusCenter.robotWritePlc(false,"烤箱允许放料",(boolean)val,null); | |||
} | |||
} | |||
if(ConfigName.LOG_TEST){ | |||
LogUtils.d("烤箱PLC设备数据监听 name="+item.name +" plcaddress.address="+item.address+" ;val="+val); | |||
} | |||
@@ -207,11 +212,11 @@ public class ModbusCenter { | |||
}else { | |||
OvenModbusTcpServer.get().ReConnect("Connection refused"); | |||
} | |||
LogUtils.d("烤箱*******************++222"); | |||
// LogUtils.d("烤箱*******************++222"); | |||
}catch (Exception ex){ | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
} | |||
LogUtils.d("OvenModbusTcpServer.get().plcIsConnect ="+OvenModbusTcpServer.get().plcIsConnect); | |||
// LogUtils.d("OvenModbusTcpServer.get().plcIsConnect ="+OvenModbusTcpServer.get().plcIsConnect); | |||
} catch (Exception ex) { | |||
// NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -221,7 +226,7 @@ public class ModbusCenter { | |||
ThreadManager.get().StartLong("机器人PLC设备数据监听", true, () -> { | |||
try { | |||
try{ | |||
LogUtils.d("机器人*******************++"); | |||
// LogUtils.d("机器人*******************++"); | |||
if(RobotModbusTcpServer.get().plcIsConnect){ | |||
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_Robot) { | |||
@@ -232,6 +237,7 @@ public class ModbusCenter { | |||
if(ConfigName.LOG_TEST){ | |||
LogUtils.d("机器人PLC设备数据监听 ovenReadPlc item="+item.name+" plcaddress.address="+item.address+" val="+val); | |||
} | |||
listeningValue.put(item.name, val); | |||
} | |||
} | |||
@@ -264,6 +270,7 @@ public class ModbusCenter { | |||
if (plcAddress.get(name)!=null) { | |||
BPA_PLCADDRESS plcaddress = plcAddress.get(name); | |||
assert plcaddress != null; | |||
LogUtils.d("modbuscenter ReadPlc name="+name+" plcaddress.address="+plcaddress.address); | |||
if(plcaddress.type == 1){ | |||
return wokReadPlc(name); | |||
}else if(plcaddress.type == 2){ | |||
@@ -254,9 +254,9 @@ public class MainHActivity extends BaseActivity { | |||
} | |||
if(object5 instanceof Boolean){ | |||
if((Boolean)object5){ | |||
changeTextView(viewBinding.tvDianguimeng,"电柜门:","开",false); | |||
changeTextView(viewBinding.tvDianguimeng,"电柜门:","开",true); | |||
}else { | |||
changeTextView(viewBinding.tvDianguimeng,"电柜门:","关",true); | |||
changeTextView(viewBinding.tvDianguimeng,"电柜门:","关",false); | |||
} | |||
}else { | |||
changeTextView(viewBinding.tvDianguimeng,"电柜门:","异常",true); | |||
@@ -135,7 +135,7 @@ public class OvenControlDialog extends DialogFragment { | |||
} | |||
private void initView(){ | |||
viewBinding.btnOpen.setOnClickListener(v->{ | |||
viewBinding.btnOpenWithRobot.setOnClickListener(v->{ | |||
if(!OvenModbusTcpServer.get().checkConnect()){ | |||
return; | |||
} | |||
@@ -152,7 +152,7 @@ public class OvenControlDialog extends DialogFragment { | |||
DialogTipBinding binding = DialogTipBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("确认指令"); | |||
binding.message.setText("是否打开烤箱门"); | |||
binding.message.setText("确保烤箱和机器人周围无人,是否控制机器人辅助打开烤箱门?"); | |||
binding.close.setOnClickListener(view1->{ | |||
xCom.dismissX(); | |||
}); | |||
@@ -166,23 +166,82 @@ public class OvenControlDialog extends DialogFragment { | |||
//<<开门流程 | |||
ExecuteTheRecipe.WritePLC("档位选择", 0, null); | |||
ExecuteTheRecipe.WritePLC("档位选择触发", true, null); | |||
ExecuteTheRecipe.ThreadWhile2("当前档位_关"); | |||
// ExecuteTheRecipe.ThreadWhile2("当前档位_关"); | |||
Thread.sleep(100); | |||
ConfigName.getInstance().oven_wendu = 0+""; | |||
ExecuteTheRecipe.WritePLC("温度选择", 0, null); | |||
Thread.sleep(10); | |||
ExecuteTheRecipe.WritePLC("温度选择触发", true, null); | |||
ExecuteTheRecipe.ThreadWhile2("温度设置完成"); | |||
// ExecuteTheRecipe.ThreadWhile2("温度设置完成"); | |||
Thread.sleep(100); | |||
NewToastUtil.getInstance().showToast("烤箱档位和温度已关闭"); | |||
boolean isOpen = (boolean)ExecuteTheRecipe.ReadPLC("烤箱门开到位检测"); | |||
if(!isOpen){ | |||
ExecuteTheRecipe.Wait_Robot2_No_Working();//等待机器人空闲 | |||
ModbusCenter.robotWritePlc(true,"机器人烤箱开门",true,null); | |||
ExecuteTheRecipe.ThreadWhile2("机器人烤箱开门完成"); | |||
if(RobotModbusTcpServer.get().plcIsConnect){ | |||
ExecuteTheRecipe.Wait_Robot2_No_Working();//等待机器人空闲 | |||
ModbusCenter.robotWritePlc(true,"机器人烤箱开门",true,null); | |||
ExecuteTheRecipe.ThreadWhile2("机器人烤箱开门完成"); | |||
} | |||
Thread.sleep(100); | |||
ExecuteTheRecipe.WritePLC("烤箱门打开控制", true, null); | |||
Thread.sleep(100); | |||
} | |||
ExecuteTheRecipe.ThreadWhile2("烤箱门开到位检测"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
//>> | |||
}catch (Exception e){ | |||
LogUtils.d("异常信息:"+e.getMessage()); | |||
} | |||
} | |||
})); | |||
}); | |||
}); | |||
}); | |||
viewBinding.btnOpen.setOnClickListener(v->{ | |||
if(!OvenModbusTcpServer.get().checkConnect()){ | |||
return; | |||
} | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("请勿快速点击"); | |||
return; | |||
} | |||
boolean isOpen = (boolean) ModbusCenter.ReadPlc("烤箱门开到位检测"); | |||
if(isOpen){ | |||
NewToastUtil.getInstance().showToast("检测到烤箱门已打开"); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_tip, (layoutView, xCom) -> { | |||
DialogTipBinding binding = DialogTipBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("确认指令"); | |||
binding.message.setText("请先打开把手,确保烤箱周围无人,是否直接打开烤箱门?"); | |||
binding.close.setOnClickListener(view1->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
xCom.dismissX(); | |||
WaitProcessUtil.getInstance().show(getContext(),"提示","烤箱门正在打开,请等待完成,不要进行其他操作!"); | |||
ThreadManager.get().execute(new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
//<<开门流程 | |||
ExecuteTheRecipe.WritePLC("档位选择", 0, null); | |||
ExecuteTheRecipe.WritePLC("档位选择触发", true, null); | |||
// ExecuteTheRecipe.ThreadWhile2("当前档位_关"); | |||
Thread.sleep(100); | |||
ConfigName.getInstance().oven_wendu = 0+""; | |||
ExecuteTheRecipe.WritePLC("温度选择", 0, null); | |||
Thread.sleep(10); | |||
ExecuteTheRecipe.WritePLC("温度选择触发", true, null); | |||
// ExecuteTheRecipe.ThreadWhile2("温度设置完成"); | |||
NewToastUtil.getInstance().showToast("烤箱档位和温度已关闭"); | |||
boolean isOpen = (boolean)ExecuteTheRecipe.ReadPLC("烤箱门开到位检测"); | |||
if(!isOpen){ | |||
ExecuteTheRecipe.WritePLC("烤箱门打开控制", true, null); | |||
} | |||
ExecuteTheRecipe.ThreadWhile2("烤箱门开到位检测"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
//>> | |||
}catch (Exception e){ | |||
LogUtils.d("异常信息:"+e.getMessage()); | |||
@@ -215,7 +274,7 @@ public class OvenControlDialog extends DialogFragment { | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
xCom.dismissX(); | |||
WaitProcessUtil.getInstance().show(getContext(),"提示","烤箱门正在打开,请等待完成,不要进行其他操作!"); | |||
WaitProcessUtil.getInstance().show(getContext(),"提示","烤箱门正在关闭,请等待完成,不要进行其他操作!"); | |||
ThreadManager.get().execute(new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
@@ -223,13 +282,14 @@ public class OvenControlDialog extends DialogFragment { | |||
//<<关门流程 | |||
Thread.sleep(100); | |||
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null); | |||
Thread.sleep(3000); | |||
Thread.sleep(10000); | |||
boolean isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测"); | |||
if(!isClose2){ | |||
ExecuteTheRecipe.Wait_Robot2_No_Working();//等待机器人空闲 | |||
ModbusCenter.robotWritePlc(true,"机器人烤箱关门",true,null); | |||
ExecuteTheRecipe.ThreadWhile2("机器人烤箱关门完成"); | |||
} | |||
ExecuteTheRecipe.ThreadWhile2("烤箱门关到位检测"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
//>> | |||
}catch (Exception e){ | |||
LogUtils.d("异常信息:"+e.getMessage()); | |||
@@ -337,7 +337,19 @@ public class RobotControlDialog extends DialogFragment { | |||
@Override | |||
public void run() { | |||
LogUtils.d("去维护位"); | |||
ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
// ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
boolean robotNoWorking = false; | |||
if (object1 != null && object2!=null && object3!=null) { | |||
robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
} | |||
if(!robotNoWorking){ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
NewToastUtil.getInstance().showToastError("机器人正在工作!"); | |||
return; | |||
} | |||
LogUtils.d("去维护位 空闲中"); | |||
ModbusCenter.robotWritePlc(true,"机器人去维护位置",true,null); | |||
ExecuteTheRecipe.ThreadWhile2("机器人到达维护位"); | |||
@@ -432,7 +444,19 @@ public class RobotControlDialog extends DialogFragment { | |||
@Override | |||
public void run() { | |||
try { | |||
ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
// ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
boolean robotNoWorking = false; | |||
if (object1 != null && object2!=null && object3!=null) { | |||
robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
} | |||
if(!robotNoWorking){ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
NewToastUtil.getInstance().showToastError("机器人正在工作!"); | |||
return; | |||
} | |||
ModbusCenter.robotWritePlc(false,"烤箱允许放料",true,null); | |||
ModbusCenter.robotWritePlc(true,"1#库取烤架放至烤箱",true,null); | |||
ConfigName.getInstance().oven_has_food = true; | |||
@@ -465,7 +489,19 @@ public class RobotControlDialog extends DialogFragment { | |||
@Override | |||
public void run() { | |||
try { | |||
ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
// ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
boolean robotNoWorking = false; | |||
if (object1 != null && object2!=null && object3!=null) { | |||
robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
} | |||
if(!robotNoWorking){ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
NewToastUtil.getInstance().showToastError("机器人正在工作!"); | |||
return; | |||
} | |||
ModbusCenter.robotWritePlc(false,"烤箱允许放料",true,null); | |||
ModbusCenter.robotWritePlc(true,"2#库取烤架放至烤箱",true,null); | |||
ConfigName.getInstance().oven_has_food = true; | |||
@@ -497,6 +533,7 @@ public class RobotControlDialog extends DialogFragment { | |||
public void run() { | |||
try { | |||
ExecuteTheRecipe.Write_PLC_MainOutdishes(data); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
}catch (Exception e){ | |||
LogUtils.d("异常信息:"+e.getMessage()); | |||
@@ -522,9 +559,20 @@ public class RobotControlDialog extends DialogFragment { | |||
@Override | |||
public void run() { | |||
try { | |||
ModbusCenter.robotWritePlc(false,"允许机器人出餐放盆",true,null); | |||
ExecuteTheRecipe.ThreadWhileFalse("出餐工位检测有无"); | |||
ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
// ExecuteTheRecipe.Wait_Robot_No_Working();//等待机器人空闲 | |||
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
boolean robotNoWorking = false; | |||
if (object1 != null && object2!=null && object3!=null) { | |||
robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
} | |||
if(!robotNoWorking){ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
NewToastUtil.getInstance().showToastError("机器人正在工作!"); | |||
return; | |||
} | |||
ModbusCenter.robotWritePlc(true,"机器人取烤箱烤盘出餐",true,null); | |||
ConfigName.getInstance().oven_has_food = false; | |||
ExecuteTheRecipe.ThreadWhile2("烤盘出餐完成"); | |||
@@ -237,27 +237,35 @@ public class HomeOrderFragment extends BaseFragment { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
return; | |||
} | |||
if(!OvenModbusTcpServer.get().plcIsConnect||!WokModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect){ | |||
NewToastUtil.getInstance().showToast("设备连接异常,请稍后重试"); | |||
return; | |||
} | |||
String name = mData.get(position).goodsName +"—"+ (mData.get(position).groupName==null?"":mData.get(position).groupName); | |||
if(mData.get(position).status == 0){ | |||
boolean robotNoWorking = false; | |||
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
if (object1 != null && object2!=null && object3!=null) { | |||
if(ConfigName.TEST){ | |||
robotNoWorking = true; | |||
}else { | |||
robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
} | |||
if(mData.get(position).type==0){ | |||
if(!WokModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect){ | |||
NewToastUtil.getInstance().showToast("炒锅、机器人设备连接异常,请稍后重试"); | |||
return; | |||
} | |||
if(!robotNoWorking){ | |||
NewToastUtil.getInstance().showToast("机器人正在工作,请稍后重试"); | |||
}else{ | |||
if(!OvenModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect){ | |||
NewToastUtil.getInstance().showToast("烤箱、机器人设备连接异常,请稍后重试"); | |||
return; | |||
} | |||
} | |||
String name = mData.get(position).goodsName +"—"+ (mData.get(position).groupName==null?"":mData.get(position).groupName); | |||
if(mData.get(position).status == 0){ | |||
// boolean robotNoWorking = false; | |||
// Object object1 = ModbusCenter.robotReadPlc("主任务读取"); | |||
// Object object2 = ModbusCenter.robotReadPlc("机器人在原点"); | |||
// Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪"); | |||
// if (object1 != null && object2!=null && object3!=null) { | |||
// if(ConfigName.TEST){ | |||
// robotNoWorking = true; | |||
// }else { | |||
// robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3; | |||
// } | |||
// } | |||
// if(!robotNoWorking){ | |||
// NewToastUtil.getInstance().showToast("机器人正在工作,请稍后重试"); | |||
// return; | |||
// } | |||
for(BPA_ORDER_DETAIL bean : mData){ | |||
if(bean.status!=0){ | |||
@@ -265,11 +273,11 @@ public class HomeOrderFragment extends BaseFragment { | |||
return; | |||
} | |||
} | |||
Object object4 = ModbusCenter.getListingValue("出料空盆检测有无"); | |||
if(object4!=null && !(boolean) object4){ | |||
NewToastUtil.getInstance().showToast("出料空盆未放置,请补盆后重试"); | |||
return; | |||
} | |||
// Object object4 = ModbusCenter.getListingValue("出料空盆检测有无"); | |||
// if(object4!=null && !(boolean) object4){ | |||
// NewToastUtil.getInstance().showToast("出料空盆未放置,请补盆后重试"); | |||
// return; | |||
// } | |||
Object object5 = ModbusCenter.getListingValue("出餐工位检测有无"); | |||
if(object5!=null && (boolean) object5){ | |||
NewToastUtil.getInstance().showToast("出餐工位有盆,请取走后重试"); | |||
@@ -424,7 +432,13 @@ public class HomeOrderFragment extends BaseFragment { | |||
* | |||
**/ | |||
private void makingOrderDialog(BPA_ORDER_DETAIL orderDetail,int status,String name,String error,int position){ | |||
Object isClose = ModbusCenter.listeningValue.get("电柜门关到位检测"); | |||
if(isClose instanceof Boolean){ | |||
if((Boolean) isClose){ | |||
NewToastUtil.getInstance().showToastError("电柜门未关闭,请关闭!"); | |||
return; | |||
} | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_order, (layoutView, xCom) -> { | |||
DialogOrderBinding binding = DialogOrderBinding.bind(layoutView); | |||
String desc = "【"+name+"】订单"; | |||
@@ -560,7 +574,7 @@ public class HomeOrderFragment extends BaseFragment { | |||
if(processDetail.processname.equals("主料")){ | |||
String[] res = processDetail.processvalue.split("\\|"); | |||
String[] res2= res[1].split(","); | |||
String pos = res2[1].replace("K",""); | |||
String pos = res2[1].replace("Z",""); | |||
CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("主料位置"+pos+"号位"); | |||
if(positionBean!=null){ | |||
if(positionBean.exist){ | |||
@@ -589,7 +603,7 @@ public class HomeOrderFragment extends BaseFragment { | |||
}else { | |||
check.append("辅料位置解析失败;"); | |||
} | |||
}else if(processDetail.processname.equals("烤箱")){ | |||
}else if(processDetail.processname.equals("放入烤盘")){ | |||
String[] res = processDetail.processvalue.split("\\|"); | |||
for(String s : res){ | |||
if(s.equals("烤盘位置")){ | |||
@@ -65,7 +65,7 @@ public class HomeWarnFragment extends BaseFragment { | |||
if(handler.hasMessages(1)){ | |||
handler.removeMessages(1); | |||
} | |||
handler.sendEmptyMessageDelayed(1,500); | |||
handler.sendEmptyMessageDelayed(1,2000); | |||
} | |||
} | |||
}; | |||
@@ -285,7 +285,7 @@ public class HomeWarnFragment extends BaseFragment { | |||
}else { | |||
boolean result= (boolean)ModbusCenter.listeningValue.get(res) ; | |||
if(res.contains("电柜门关到位检测")){ | |||
if(result){ | |||
if(!result){ | |||
if(type==2){ | |||
warnInfoList.add(res+"-无故障-已关闭"); | |||
} | |||
@@ -7,10 +7,12 @@ import android.os.Build; | |||
import android.os.Bundle; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.AdapterView; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
@@ -21,9 +23,11 @@ import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
@@ -32,6 +36,7 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAttributeSelectBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.SelectAttributeListAdapter; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
@@ -64,13 +69,8 @@ public class AttributeSelectDialog extends DialogFragment { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogScale); | |||
if (getArguments() != null) { | |||
goodId = getArguments().getString("goodId"); | |||
groupId = getArguments().getString("groupId"); | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if (goods != null) { | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
} | |||
} | |||
private void fullScreen(Window window){ | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |||
@@ -116,7 +116,7 @@ public class AttributeSelectDialog extends DialogFragment { | |||
window.setAttributes(params); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
updateAttributeData(); | |||
initClassify(); | |||
initListener(); | |||
} | |||
@@ -178,7 +178,36 @@ public class AttributeSelectDialog extends DialogFragment { | |||
this.listener = listener; | |||
} | |||
private String classifyId = ""; | |||
private void initListener(){ | |||
viewBinding.clContent0.setVisibility(View.VISIBLE); | |||
viewBinding.clContent1.setVisibility(View.GONE); | |||
viewBinding.clContent2.setVisibility(View.GONE); | |||
viewBinding.btnClose0.setOnClickListener(view -> { | |||
dismiss(); | |||
}); | |||
viewBinding.btnClose1.setOnClickListener(view -> { | |||
dismiss(); | |||
}); | |||
viewBinding.btnNext0.setOnClickListener(v->{ | |||
viewBinding.clContent0.setVisibility(View.GONE); | |||
viewBinding.clContent1.setVisibility(View.VISIBLE); | |||
viewBinding.clContent2.setVisibility(View.GONE); | |||
}); | |||
viewBinding.btnNext1.setOnClickListener(view -> { | |||
if(viewBinding.spinnerGoods.getSelectedItem().toString().contains("未设置")|| viewBinding.spinnerGoods.getSelectedItem().toString().isEmpty()){ | |||
NewToastUtil.getInstance().showToast("请选择商品"); | |||
}else { | |||
viewBinding.clContent1.setVisibility(View.GONE); | |||
viewBinding.clContent2.setVisibility(View.VISIBLE); | |||
if (goods != null) { | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
updateAttributeData(); | |||
} | |||
} | |||
}); | |||
viewBinding.btnClose.setOnClickListener(view -> { | |||
dismiss(); | |||
}); | |||
@@ -233,6 +262,88 @@ public class AttributeSelectDialog extends DialogFragment { | |||
}); | |||
} | |||
/** | |||
* 分类信息 | |||
*/ | |||
private void initClassify(){ | |||
List<BPA_GOODS_CLASSIFY> list = GoodsClassifyDBUtil.getAll(); | |||
List<String> names = new ArrayList<>(); | |||
for(BPA_GOODS_CLASSIFY bean : list){ | |||
names.add(bean.name+""); | |||
} | |||
if(list.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("没有分类可导入"); | |||
dismiss(); | |||
return; | |||
} | |||
ClassifySpinnerAdapter spinnerAdapter = new ClassifySpinnerAdapter(getContext(), names); | |||
viewBinding.spinnerClassify.setAdapter(spinnerAdapter); | |||
viewBinding.spinnerClassify.setSelection(0); | |||
classifyId = list.get(0).id; | |||
if(!classifyId.isEmpty()){ | |||
initGoods(); | |||
} | |||
viewBinding.spinnerClassify.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.spinnerClassify.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
classifyId = list.get(i).id; | |||
if(!classifyId.isEmpty()){ | |||
initGoods(); | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
/** | |||
* 商品信息 | |||
*/ | |||
private void initGoods(){ | |||
List<BPA_GOODS> goodsList = GoodsDBUtil.getByClassifyId(classifyId); | |||
List<String> names = new ArrayList<>(); | |||
if(goodsList.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("该分类没有商品可导入"); | |||
return; | |||
} | |||
for(BPA_GOODS bean : goodsList){ | |||
names.add(bean.name+""); | |||
} | |||
ClassifySpinnerAdapter spinnerAdapter = new ClassifySpinnerAdapter(getContext(), names); | |||
viewBinding.spinnerGoods.setAdapter(spinnerAdapter); | |||
viewBinding.spinnerGoods.setSelection(0); | |||
goodId = goodsList.get(0).id; | |||
goods = goodsList.get(0); | |||
viewBinding.spinnerGoods.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.spinnerGoods.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
goodId = goodsList.get(i).id; | |||
goods = goodsList.get(i); | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
/** | |||
* 判断是否存在该组合 | |||
*/ | |||
@@ -5,13 +5,155 @@ | |||
xmlns:tools="http://schemas.android.com/tools" | |||
tools:background="#7F000000" | |||
android:layout_height="wrap_content"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/cl_content0" | |||
android:layout_width="900dp" | |||
android:layout_height="400dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title0" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn_dialog" | |||
android:text="导入工序" | |||
/> | |||
<TextView | |||
android:id="@+id/desc0" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="@dimen/dp_130" | |||
android:text="选择分类:" | |||
style="@style/TextView_desc" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_classify" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_575" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc0" | |||
app:layout_constraintTop_toTopOf="@id/desc0" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_next0" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginEnd="50dp" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn_dialog" | |||
android:text="下一步" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close0" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn_dialog" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/cl_content1" | |||
android:layout_width="900dp" | |||
android:layout_height="400dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:visibility="gone" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title1" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
style="@style/TextView_btn_dialog" | |||
android:text="导入工序" | |||
/> | |||
<TextView | |||
android:id="@+id/desc1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_50" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="@dimen/dp_130" | |||
android:text="选择商品:" | |||
style="@style/TextView_desc" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_goods" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_575" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc1" | |||
app:layout_constraintTop_toTopOf="@id/desc1" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_next1" | |||
android:layout_width="@dimen/dp_155" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginEnd="50dp" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
style="@style/TextView_btn_dialog" | |||
android:text="下一步" | |||
/> | |||
<ImageView | |||
android:id="@+id/btn_close1" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
style="@style/TextView_btn_dialog" | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<!--子属性选择--> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/cl_content2" | |||
android:layout_width="1440dp" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:visibility="gone" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:background="@drawable/bg_round25_white"> | |||
@@ -148,8 +148,10 @@ | |||
android:id="@+id/recycle_step" | |||
android:layout_width="@dimen/dp_350" | |||
android:layout_height="0dp" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginStart="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:paddingBottom="50dp" | |||
android:layout_marginBottom="10dp" | |||
android:orientation="vertical" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
@@ -23,8 +23,6 @@ | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_open" | |||
android:layout_width="200dp" | |||
@@ -33,12 +31,29 @@ | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="120dp" | |||
android:layout_marginStart="220dp" | |||
android:layout_marginStart="50dp" | |||
android:gravity="center" | |||
android:textSize="32sp" | |||
android:maxLines="2" | |||
android:ellipsize="end" | |||
android:text="手动辅助烤箱开门" | |||
android:textColor="@color/white" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_open_with_robot" | |||
android:layout_width="200dp" | |||
android:layout_height="100dp" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="120dp" | |||
android:layout_marginStart="510dp" | |||
android:gravity="center" | |||
android:textSize="32sp" | |||
android:maxLines="2" | |||
android:ellipsize="end" | |||
android:text="烤箱开门" | |||
android:text="机器人辅助\n烤箱开门" | |||
android:textColor="@color/white" | |||
/> | |||
@@ -50,7 +65,7 @@ | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="120dp" | |||
android:layout_marginStart="450dp" | |||
android:layout_marginStart="280dp" | |||
android:gravity="center" | |||
android:textSize="32sp" | |||
android:maxLines="2" | |||
@@ -65,13 +80,13 @@ | |||
android:layout_height="wrap_content" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="100dp" | |||
android:layout_marginTop="140dp" | |||
android:layout_marginStart="750dp" | |||
android:gravity="center" | |||
android:textSize="32sp" | |||
android:maxLines="2" | |||
android:ellipsize="end" | |||
android:text="烤箱门:开启" | |||
android:text="烤箱门状态:开启" | |||
android:textColor="@color/black" | |||
/> | |||
<TextView | |||