diff --git a/app/src/main/java/com/example/bpa/app/BusinessServer.java b/app/src/main/java/com/example/bpa/app/BusinessServer.java index 601963a..51a44a2 100644 --- a/app/src/main/java/com/example/bpa/app/BusinessServer.java +++ b/app/src/main/java/com/example/bpa/app/BusinessServer.java @@ -5,6 +5,7 @@ import com.example.bpa.Model.IThread; import com.example.bpa.Model.IWriteCallBack; import com.example.bpa.db.QueryDB; import com.example.bpa.db.mode.BPA_SILOS; +import com.example.bpa.db.mode.BPA_SUGAR; import com.example.bpa.helper.MessageLog; import com.example.bpa.helper.ThreadManager; import com.example.bpa.view.mode.ResGoodsRecipe; @@ -58,13 +59,20 @@ public class BusinessServer { for (LinkedHashMap.Entry> entry : rgrs.entrySet()) { for (int m = 0; m < entry.getValue().size(); m++) { - //获取料仓信息 - List bss = QueryDB.GetSolisByMaterialID(entry.getValue().get(m).materialID); - for (int x = 0; x < bss.size(); x++) { - if (DeviceData.Get().getCallCurrentWeight(bss.get(x).num) >= (float) entry.getValue().get(m).value) { - MessageLog.ShowInfo("下发【" + bss.get(x).num + "】号料仓PLC控制命令,需求量:=" + entry.getValue().get(m).value); - DeviceData.Get().setDemandValue((short) entry.getValue().get(m).value, bss.get(x).num, null); + int materialType = entry.getValue().get(m).materialType; + if (materialType == 1) { + //获取料仓信息 + List bss = QueryDB.GetSolisByMaterialID(entry.getValue().get(m).materialID); + //GetsugarId + for (int x = 0; x < bss.size(); x++) { + if (DeviceData.Get().getCallCurrentWeight(bss.get(x).num) >= (float) entry.getValue().get(m).value) { + MessageLog.ShowInfo("下发【" + bss.get(x).num + "】号料仓PLC控制命令,需求量:=" + entry.getValue().get(m).value); + DeviceData.Get().setDemandValue((short) entry.getValue().get(m).value, bss.get(x).num, null); + } } + } else if (materialType == 2) { + BPA_SUGAR bs = QueryDB.GetsugarId(entry.getValue().get(m).materialID); + ModbusTcpServer.get().WriteBool(bs.plcvar, true); } } DeviceData.Get().setChargeMixtureStart(null);//启动配料