@@ -4,10 +4,10 @@ | |||||
<selectionStates> | <selectionStates> | ||||
<SelectionState runConfigName="app"> | <SelectionState runConfigName="app"> | ||||
<option name="selectionMode" value="DROPDOWN" /> | <option name="selectionMode" value="DROPDOWN" /> | ||||
<DropdownSelection timestamp="2024-05-23T08:15:27.830482400Z"> | |||||
<DropdownSelection timestamp="2024-05-24T08:58:29.020582800Z"> | |||||
<Target type="DEFAULT_BOOT"> | <Target type="DEFAULT_BOOT"> | ||||
<handle> | <handle> | ||||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=b7a867da" /> | |||||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=f785e23a" /> | |||||
</handle> | </handle> | ||||
</Target> | </Target> | ||||
</DropdownSelection> | </DropdownSelection> | ||||
@@ -153,6 +153,7 @@ public class APIService { | |||||
* 同步云端商品分类到本地 | * 同步云端商品分类到本地 | ||||
*/ | */ | ||||
private static void GoodTypeSynchronous(){ | private static void GoodTypeSynchronous(){ | ||||
LogUtils.d("GoodTypeSynchronous1"); | |||||
List<BPA_GOODSTYPE> datas = new ArrayList<>(); | List<BPA_GOODSTYPE> datas = new ArrayList<>(); | ||||
for(DeviceGoodInfo item : deviceGoodInfo){ | for(DeviceGoodInfo item : deviceGoodInfo){ | ||||
BPA_GOODSTYPE bpa_goodstype = new BPA_GOODSTYPE(); | BPA_GOODSTYPE bpa_goodstype = new BPA_GOODSTYPE(); | ||||
@@ -168,6 +169,7 @@ public class APIService { | |||||
* 同步云端商品属性到本地 | * 同步云端商品属性到本地 | ||||
*/ | */ | ||||
private static void GoodPropSynchronous(){ | private static void GoodPropSynchronous(){ | ||||
LogUtils.d("GoodPropSynchronous"); | |||||
List<BPA_GOODPROPERTY> datas = new ArrayList<>(); | List<BPA_GOODPROPERTY> datas = new ArrayList<>(); | ||||
for(DeviceGoodInfo item : deviceGoodInfo){ | for(DeviceGoodInfo item : deviceGoodInfo){ | ||||
if(item.goodsAttributeList!=null){ | if(item.goodsAttributeList!=null){ | ||||
@@ -205,6 +207,7 @@ public class APIService { | |||||
* 同步云端商品信息到本地 | * 同步云端商品信息到本地 | ||||
*/ | */ | ||||
private static void GoodInfoSynchronous(){ | private static void GoodInfoSynchronous(){ | ||||
LogUtils.d("GoodInfoSynchronous"); | |||||
List<BPA_GOODS> datas = new ArrayList<>(); | List<BPA_GOODS> datas = new ArrayList<>(); | ||||
for(DeviceGoodInfo item : deviceGoodInfo){ | for(DeviceGoodInfo item : deviceGoodInfo){ | ||||
if(item.goodsInfoList!=null){ | if(item.goodsInfoList!=null){ | ||||
@@ -251,6 +254,7 @@ public class APIService { | |||||
* 同步云端配方详细信息到本地 | * 同步云端配方详细信息到本地 | ||||
*/ | */ | ||||
private static void GoodRecipeSynchronous() { | private static void GoodRecipeSynchronous() { | ||||
LogUtils.d("GoodRecipeSynchronous"); | |||||
List<BPA_GOODSRECIPENAME> datas1 = new ArrayList<>(); | List<BPA_GOODSRECIPENAME> datas1 = new ArrayList<>(); | ||||
List<BPA_GOODSRECIPE> datas2 = new ArrayList<>(); | List<BPA_GOODSRECIPE> datas2 = new ArrayList<>(); | ||||
for(DeviceGoodInfo item : deviceGoodInfo){ | for(DeviceGoodInfo item : deviceGoodInfo){ | ||||
@@ -258,44 +262,53 @@ public class APIService { | |||||
List<BPA_GOODPROPERTY> goodProps = QueryDB.GetGoodsSubPropertyALL(); | List<BPA_GOODPROPERTY> goodProps = QueryDB.GetGoodsSubPropertyALL(); | ||||
List<BPA_MATERIAL> bpaMaterials = QueryDB.GetMaterialALL(); | List<BPA_MATERIAL> bpaMaterials = QueryDB.GetMaterialALL(); | ||||
item.goodsInfoList.forEach(goodinfo->{ | item.goodsInfoList.forEach(goodinfo->{ | ||||
ConcurrentHashMap<String,List<GoodsTechnologyActionList>> recipes = new ConcurrentHashMap<>(); | |||||
goodinfo.goodsTechnologyActionList.forEach(material->{ | |||||
if(!recipes.containsKey(material.goodsAttributeId))recipes.put(material.goodsAttributeId,new ArrayList<>()); | |||||
recipes.get(material.goodsAttributeId).add(material); | |||||
}); | |||||
try { | |||||
ConcurrentHashMap<String,List<GoodsTechnologyActionList>> recipes = new ConcurrentHashMap<>(); | |||||
goodinfo.goodsTechnologyActionList.forEach(material->{ | |||||
if(!recipes.containsKey(material.goodsAttributeId))recipes.put(material.goodsAttributeId,new ArrayList<>()); | |||||
recipes.get(material.goodsAttributeId).add(material); | |||||
}); | |||||
recipes.forEach((key,value)->{ | |||||
//添加配方 | |||||
BPA_GOODSRECIPENAME bpa_goodsrecipename = new BPA_GOODSRECIPENAME(); | |||||
bpa_goodsrecipename.name =GetRecipeName(goodinfo.goodsName, value.get(0).goodsAttributeId,goodProps); | |||||
bpa_goodsrecipename.goodsID= goodinfo.goodsId; | |||||
bpa_goodsrecipename.design=key; | |||||
datas1.add(bpa_goodsrecipename); | |||||
recipes.forEach((key,value)->{ | |||||
//添加配方 | |||||
BPA_GOODSRECIPENAME bpa_goodsrecipename = new BPA_GOODSRECIPENAME(); | |||||
bpa_goodsrecipename.name =GetRecipeName(goodinfo.goodsName, value.get(0).goodsAttributeId,goodProps); | |||||
bpa_goodsrecipename.goodsID= goodinfo.goodsId; | |||||
bpa_goodsrecipename.design=key; | |||||
datas1.add(bpa_goodsrecipename); | |||||
//遍历工艺步骤 | |||||
value.forEach(material->{ | |||||
material.GetFuncModel().OnSource(action->{ | |||||
FuncModel func= action.Content.stream().filter(p->p.actionName.equals("主料名称")).findFirst().get(); | |||||
BPA_MATERIAL bpaMaterial= bpaMaterials.stream().filter(p->p.name.equals(func.actionValue)).findFirst().get(); | |||||
FuncModel weight= action.Content.stream().filter(p->p.actionName.equals("主料重量")).findFirst().get(); | |||||
FuncModel sort= action.Content.stream().filter(p->p.actionName.equals("执行步骤")).findFirst().get(); | |||||
if(bpaMaterial!=null){ | |||||
BPA_GOODSRECIPE bpa_goodsrecipe = new BPA_GOODSRECIPE(); | |||||
bpa_goodsrecipe.goodsID = goodinfo.goodsId; | |||||
bpa_goodsrecipe.materialID = bpaMaterial.id; | |||||
bpa_goodsrecipe.value =weight.actionValue; | |||||
bpa_goodsrecipe.sort = Integer.parseInt(sort.actionValue); | |||||
bpa_goodsrecipe.recipeID=bpa_goodsrecipename.id; | |||||
datas2.add(bpa_goodsrecipe); | |||||
} | |||||
//遍历工艺步骤 | |||||
value.forEach(material->{ | |||||
material.GetFuncModel().OnSource(action->{ | |||||
FuncModel func= action.Content.stream().filter(p->p.actionName.equals("主料名称")).findFirst().get(); | |||||
BPA_MATERIAL bpaMaterial= bpaMaterials.stream().filter(p->p.name.equals(func.actionValue)).findFirst().get(); | |||||
FuncModel weight= action.Content.stream().filter(p->p.actionName.equals("主料重量")).findFirst().get(); | |||||
FuncModel sort= action.Content.stream().filter(p->p.actionName.equals("执行步骤")).findFirst().get(); | |||||
if(bpaMaterial!=null){ | |||||
BPA_GOODSRECIPE bpa_goodsrecipe = new BPA_GOODSRECIPE(); | |||||
bpa_goodsrecipe.goodsID = goodinfo.goodsId; | |||||
bpa_goodsrecipe.materialID = bpaMaterial.id; | |||||
bpa_goodsrecipe.value =weight.actionValue; | |||||
bpa_goodsrecipe.sort = Integer.parseInt(sort.actionValue); | |||||
bpa_goodsrecipe.recipeID=bpa_goodsrecipename.id; | |||||
datas2.add(bpa_goodsrecipe); | |||||
} | |||||
}); | |||||
}); | }); | ||||
}); | }); | ||||
}); | |||||
}catch (Exception e){ | |||||
LogUtils.d("GoodRecipeSynchronous 5"+goodinfo.goodsId); | |||||
e.printStackTrace(); | |||||
} | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
LogUtils.d("GoodRecipeSynchronous6"); | |||||
QueryDB.AddGoodsRecipeNameList(datas1); | QueryDB.AddGoodsRecipeNameList(datas1); | ||||
LogUtils.d("GoodRecipeSynchronous7"); | |||||
QueryDB.AddGoodsSrecipeList(datas2); | QueryDB.AddGoodsSrecipeList(datas2); | ||||
LogUtils.d("GoodRecipeSynchronous8"); | |||||
} | } | ||||
/** | /** | ||||
@@ -309,11 +322,17 @@ public class APIService { | |||||
String[] props = goodsAttributeId.split("[,]"); | String[] props = goodsAttributeId.split("[,]"); | ||||
StringBuffer recpipeNameTemp = new StringBuffer(); | StringBuffer recpipeNameTemp = new StringBuffer(); | ||||
recpipeNameTemp.append(goodsName).append("_"); | recpipeNameTemp.append(goodsName).append("_"); | ||||
for(int i=0;i<props.length;i++){ | |||||
String id = props[i]; | |||||
BPA_GOODPROPERTY tempGoodProp = goodProps.stream().filter(p->p.id.equals(id)).findFirst().get(); | |||||
if(tempGoodProp!=null) recpipeNameTemp.append(tempGoodProp.name).append("_") ; | |||||
try{ | |||||
for(int i=0;i<props.length;i++){ | |||||
String id = props[i]; | |||||
BPA_GOODPROPERTY tempGoodProp = goodProps.stream().filter(p->p.id.equals(id)).findFirst().get(); | |||||
if(tempGoodProp!=null) recpipeNameTemp.append(tempGoodProp.name).append("_") ; | |||||
} | |||||
}catch (Exception e){ | |||||
LogUtils.d(" GetRecipeName goodsAttributeId="+goodsAttributeId); | |||||
} | } | ||||
return recpipeNameTemp.toString().substring(0, recpipeNameTemp.length() - 1); | return recpipeNameTemp.toString().substring(0, recpipeNameTemp.length() - 1); | ||||
} | } | ||||
@@ -397,6 +397,7 @@ public class ExecuteTheRecipe { | |||||
ArrayList<ResGoodsRecipe> recipes= GoodMake.recipes; | ArrayList<ResGoodsRecipe> recipes= GoodMake.recipes; | ||||
//region 根据物料配方排序Sort步骤分组 | //region 根据物料配方排序Sort步骤分组 | ||||
MainInit.initToastString(); | |||||
LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>(); | LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>(); | ||||
for (int i = 0; i < recipes.size(); i++) { | for (int i = 0; i < recipes.size(); i++) { | ||||
if (!rgrs.containsKey(recipes.get(i).sort)) | if (!rgrs.containsKey(recipes.get(i).sort)) | ||||
@@ -439,39 +440,29 @@ public class ExecuteTheRecipe { | |||||
if(silos==null) | if(silos==null) | ||||
silos = item; | silos = item; | ||||
} | } | ||||
//等待配料完成,一直等待 | |||||
//等待配料完成,一直等待 | |||||
if (silos == null) { | if (silos == null) { | ||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有绑定料仓!"); | MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有绑定料仓!"); | ||||
Thread.sleep(2000); | Thread.sleep(2000); | ||||
IsComplete[0] = true; | IsComplete[0] = true; | ||||
isError = true; | isError = true; | ||||
} else { | } else { | ||||
// if(silos.status == 1){ | |||||
// LogUtils.d("商品制作线程 status=1 禁用"); | |||||
// Thread.sleep(150); | |||||
// MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,silos.name+"已禁用,执行下一步"); | |||||
// }else { | |||||
//MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); | |||||
// int _val = (int)Math.round((Double.parseDouble(recipe.value) * 10)); | |||||
float _val = Float.parseFloat(recipe.value); | |||||
BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(silos.num); | |||||
if(res!=null){ | |||||
String name = silos.name+silos.num+"出料时间"; | |||||
outValue = Unity.Scale(_val,res.inputWightMax,res.inputWightMin,res.outputTimeMax,res.outputTimeMin); | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "写入地址:"+name+"地址值:"+outValue*100); | |||||
LogUtils.d("商品制作线程 name="+name+"; outValue="+outValue); | |||||
WritePLC(name, (short) (outValue*100), null); | |||||
}else{ | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有对应的校准值!"); | |||||
} | |||||
//減去料仓数量 | |||||
int otherG=silos.silosmargin-(int)(_val); | |||||
QueryDB.UpdateYL(silos.id,otherG>=0?otherG:0); | |||||
LogUtils.d("商品制作线程 _val="+_val+" ;otherG = "+otherG+";silos.silosmargin="+silos.silosmargin); | |||||
float _val = Float.parseFloat(recipe.value); | |||||
BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(silos.num); | |||||
if(res!=null){ | |||||
String name = silos.name+silos.num+"出料时间"; | |||||
outValue = Unity.Scale(_val,res.inputWightMax,res.inputWightMin,res.outputTimeMax,res.outputTimeMin); | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "写入地址:"+name+"地址值:"+outValue*100); | |||||
LogUtils.d("商品制作线程 name="+name+"; outValue="+outValue); | |||||
WritePLC(name, (short) (outValue*100), null); | |||||
}else{ | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有对应的校准值!"); | |||||
} | } | ||||
// } | |||||
//減去料仓数量 | |||||
int otherG=silos.silosmargin-(int)(_val); | |||||
QueryDB.UpdateYL(silos.id,otherG>=0?otherG:0); | |||||
LogUtils.d("商品制作线程 _val="+_val+" ;otherG = "+otherG+";silos.silosmargin="+silos.silosmargin); | |||||
} | |||||
} | } | ||||
MessageLog.ShowInfo(RecipesNames + "下发成功!"); | MessageLog.ShowInfo(RecipesNames + "下发成功!"); | ||||
//endregion | //endregion | ||||
@@ -488,17 +479,10 @@ public class ExecuteTheRecipe { | |||||
}; | }; | ||||
//启动配料 | //启动配料 | ||||
// float finalOutValue = outValue; | |||||
WritePLC("配料启动",true,new IWriteCallBack() { | WritePLC("配料启动",true,new IWriteCallBack() { | ||||
@Override | @Override | ||||
public void onSuccess() { | public void onSuccess() { | ||||
MessageLog.ShowInfo("[" + GoodMake.good.name + "]步骤【" + key + "】启动配料成功!"); | MessageLog.ShowInfo("[" + GoodMake.good.name + "]步骤【" + key + "】启动配料成功!"); | ||||
// try { | |||||
// Thread.sleep((long) (finalOutValue *1000L)); | |||||
// } catch (InterruptedException e) { | |||||
// throw new RuntimeException(e); | |||||
// } | |||||
// IsComplete[0] = true; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -509,10 +493,9 @@ public class ExecuteTheRecipe { | |||||
} | } | ||||
}); | }); | ||||
long a = System.currentTimeMillis(); | long a = System.currentTimeMillis(); | ||||
while (!IsComplete[0]) { | while (!IsComplete[0]) { | ||||
if ((System.currentTimeMillis() - a) > 1000 * 60) { | |||||
if ((System.currentTimeMillis() - a) > 1000 * 30) { | |||||
break; | break; | ||||
} | } | ||||
Thread.sleep(100);//10 *6 | Thread.sleep(100);//10 *6 | ||||
@@ -534,10 +517,14 @@ public class ExecuteTheRecipe { | |||||
GoodMake=null; | GoodMake=null; | ||||
IsMakeGood=false; | IsMakeGood=false; | ||||
MainInit.initToastString(); | MainInit.initToastString(); | ||||
OnChargeMixtureCompleteNotify = null; | |||||
} | } | ||||
IsMakeGood=false; | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
ToastUtils.error("异常信息:" + ex.getMessage()); | ToastUtils.error("异常信息:" + ex.getMessage()); | ||||
IsMakeGood=false; | IsMakeGood=false; | ||||
MainInit.initToastString(); | |||||
} | } | ||||
Thread.sleep(500); | Thread.sleep(500); | ||||
} | } | ||||
@@ -999,7 +986,7 @@ public class ExecuteTheRecipe { | |||||
// } | // } | ||||
if(ListeningValue.containsKey(name)){ | if(ListeningValue.containsKey(name)){ | ||||
if(name.equals("配料完成")){ | |||||
if(!name.equals("配料完成")){ | |||||
boolean res = Boolean.parseBoolean(ListeningValue.get(name).toString()); | boolean res = Boolean.parseBoolean(ListeningValue.get(name).toString()); | ||||
RTrig.get(name).Start(res,()->{if(callback!=null)callback.Run();}); | RTrig.get(name).Start(res,()->{if(callback!=null)callback.Run();}); | ||||
}else { | }else { | ||||
@@ -46,8 +46,8 @@ import java.util.concurrent.ConcurrentHashMap; | |||||
* 配置文件 | * 配置文件 | ||||
*/ | */ | ||||
public class ConfigName { | public class ConfigName { | ||||
public static final boolean TEST = true; | |||||
public static final boolean TEST2 = true; | |||||
public static final boolean TEST = false; | |||||
public static final boolean TEST2 = false; | |||||
//region 单例模式 | //region 单例模式 | ||||
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问 | private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问 | ||||
@@ -94,19 +94,21 @@ public class UpdateAppUtils { | |||||
if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) | if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) | ||||
{ | { | ||||
// mode.productCode="1679307017135329280"; | |||||
// mode.moduleCode="newncapp"; | |||||
// mode.serverCode="1680767784879656960";//服务器 | |||||
// mode.branchCode="1712279450412756993"; | |||||
mode.productCode="1679307017135329280"; | |||||
mode.moduleCode="newncapp"; | |||||
mode.serverCode="1680767784879656960";//服务器 | |||||
mode.branchCode="1712279450412756993"; | |||||
}else { | |||||
// mode.productCode = "1679307017135329280"; | |||||
// mode.moduleCode = "newtwbt"; | |||||
// mode.serverCode = "1680767784879656960";//服务器 | |||||
// mode.branchCode = "1712279534630187009"; | |||||
mode.productCode="1769564215952125952"; | mode.productCode="1769564215952125952"; | ||||
mode.moduleCode="desktopplbt"; | mode.moduleCode="desktopplbt"; | ||||
mode.serverCode="1769564338190921728";//服务器 | mode.serverCode="1769564338190921728";//服务器 | ||||
mode.branchCode="1789857238682284033"; | mode.branchCode="1789857238682284033"; | ||||
}else { | |||||
mode.productCode = "1679307017135329280"; | |||||
mode.moduleCode = "newtwbt"; | |||||
mode.serverCode = "1680767784879656960";//服务器 | |||||
mode.branchCode = "1712279534630187009"; | |||||
} | } | ||||
//调味吧台 | //调味吧台 | ||||
@@ -159,8 +159,8 @@ | |||||
android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:layout_margin="5dp" | android:layout_margin="5dp" | ||||
android:text="称(单击清零):" | |||||
android:paddingTop="15dp" | android:paddingTop="15dp" | ||||
android:text="称(单击清零):" | |||||
android:textSize="@dimen/TitleSize" /> | android:textSize="@dimen/TitleSize" /> | ||||
<TextView | <TextView | ||||
@@ -35,8 +35,8 @@ task clean(type: Delete) { | |||||
ext { // 统一版本入口 | ext { // 统一版本入口 | ||||
//App版本号 | //App版本号 | ||||
versionCode = 12 | |||||
versionName = "1.2.0" | |||||
versionCode = 14 | |||||
versionName = "1.4.0" | |||||
// 支持Android版本 | // 支持Android版本 | ||||
buildToolsVersion = "33.0.0" | buildToolsVersion = "33.0.0" | ||||