Browse Source

提交修改,定版

调味吧台
liup 7 months ago
parent
commit
6f48b90887
7 changed files with 93 additions and 85 deletions
  1. +2
    -2
      .idea/deploymentTargetSelector.xml
  2. +52
    -33
      app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java
  3. +23
    -36
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  4. +2
    -2
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  5. +11
    -9
      app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
  6. +1
    -1
      app/src/main/res/layout/fragment_make_good.xml
  7. +2
    -2
      build.gradle

+ 2
- 2
.idea/deploymentTargetSelector.xml View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<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">
<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>
</Target>
</DropdownSelection>


+ 52
- 33
app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java View File

@@ -153,6 +153,7 @@ public class APIService {
* 同步云端商品分类到本地
*/
private static void GoodTypeSynchronous(){
LogUtils.d("GoodTypeSynchronous1");
List<BPA_GOODSTYPE> datas = new ArrayList<>();
for(DeviceGoodInfo item : deviceGoodInfo){
BPA_GOODSTYPE bpa_goodstype = new BPA_GOODSTYPE();
@@ -168,6 +169,7 @@ public class APIService {
* 同步云端商品属性到本地
*/
private static void GoodPropSynchronous(){
LogUtils.d("GoodPropSynchronous");
List<BPA_GOODPROPERTY> datas = new ArrayList<>();
for(DeviceGoodInfo item : deviceGoodInfo){
if(item.goodsAttributeList!=null){
@@ -205,6 +207,7 @@ public class APIService {
* 同步云端商品信息到本地
*/
private static void GoodInfoSynchronous(){
LogUtils.d("GoodInfoSynchronous");
List<BPA_GOODS> datas = new ArrayList<>();
for(DeviceGoodInfo item : deviceGoodInfo){
if(item.goodsInfoList!=null){
@@ -251,6 +254,7 @@ public class APIService {
* 同步云端配方详细信息到本地
*/
private static void GoodRecipeSynchronous() {
LogUtils.d("GoodRecipeSynchronous");
List<BPA_GOODSRECIPENAME> datas1 = new ArrayList<>();
List<BPA_GOODSRECIPE> datas2 = new ArrayList<>();
for(DeviceGoodInfo item : deviceGoodInfo){
@@ -258,44 +262,53 @@ public class APIService {
List<BPA_GOODPROPERTY> goodProps = QueryDB.GetGoodsSubPropertyALL();
List<BPA_MATERIAL> bpaMaterials = QueryDB.GetMaterialALL();
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);
LogUtils.d("GoodRecipeSynchronous7");
QueryDB.AddGoodsSrecipeList(datas2);
LogUtils.d("GoodRecipeSynchronous8");
}

/**
@@ -309,11 +322,17 @@ public class APIService {
String[] props = goodsAttributeId.split("[,]");
StringBuffer recpipeNameTemp = new StringBuffer();
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);
}



+ 23
- 36
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -397,6 +397,7 @@ public class ExecuteTheRecipe {
ArrayList<ResGoodsRecipe> recipes= GoodMake.recipes;

//region 根据物料配方排序Sort步骤分组
MainInit.initToastString();
LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>();
for (int i = 0; i < recipes.size(); i++) {
if (!rgrs.containsKey(recipes.get(i).sort))
@@ -439,39 +440,29 @@ public class ExecuteTheRecipe {
if(silos==null)
silos = item;
}
//等待配料完成,一直等待
//等待配料完成,一直等待
if (silos == null) {
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有绑定料仓!");
Thread.sleep(2000);
IsComplete[0] = true;
isError = true;
} 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 + "下发成功!");
//endregion
@@ -488,17 +479,10 @@ public class ExecuteTheRecipe {
};

//启动配料
// float finalOutValue = outValue;
WritePLC("配料启动",true,new IWriteCallBack() {
@Override
public void onSuccess() {
MessageLog.ShowInfo("[" + GoodMake.good.name + "]步骤【" + key + "】启动配料成功!");
// try {
// Thread.sleep((long) (finalOutValue *1000L));
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// IsComplete[0] = true;
}

@Override
@@ -509,10 +493,9 @@ public class ExecuteTheRecipe {
}
});


long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 60) {
if ((System.currentTimeMillis() - a) > 1000 * 30) {
break;
}
Thread.sleep(100);//10 *6
@@ -534,10 +517,14 @@ public class ExecuteTheRecipe {
GoodMake=null;
IsMakeGood=false;
MainInit.initToastString();
OnChargeMixtureCompleteNotify = null;
}

IsMakeGood=false;
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
IsMakeGood=false;
MainInit.initToastString();
}
Thread.sleep(500);
}
@@ -999,7 +986,7 @@ public class ExecuteTheRecipe {
// }

if(ListeningValue.containsKey(name)){
if(name.equals("配料完成")){
if(!name.equals("配料完成")){
boolean res = Boolean.parseBoolean(ListeningValue.get(name).toString());
RTrig.get(name).Start(res,()->{if(callback!=null)callback.Run();});
}else {


+ 2
- 2
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -46,8 +46,8 @@ import java.util.concurrent.ConcurrentHashMap;
* 配置文件
*/
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 单例模式
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问



+ 11
- 9
app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java View File

@@ -94,19 +94,21 @@ public class UpdateAppUtils {

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.moduleCode="desktopplbt";
mode.serverCode="1769564338190921728";//服务器
mode.branchCode="1789857238682284033";
}else {
mode.productCode = "1679307017135329280";
mode.moduleCode = "newtwbt";
mode.serverCode = "1680767784879656960";//服务器
mode.branchCode = "1712279534630187009";
}

//调味吧台


+ 1
- 1
app/src/main/res/layout/fragment_make_good.xml View File

@@ -159,8 +159,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="称(单击清零):"
android:paddingTop="15dp"
android:text="称(单击清零):"
android:textSize="@dimen/TitleSize" />

<TextView


+ 2
- 2
build.gradle View File

@@ -35,8 +35,8 @@ task clean(type: Delete) {

ext { // 统一版本入口
//App版本号
versionCode = 12
versionName = "1.2.0"
versionCode = 14
versionName = "1.4.0"

// 支持Android版本
buildToolsVersion = "33.0.0"


Loading…
Cancel
Save