From 18071ceaacb5d49e47e8f9f1f7d76bb3cd04b82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Thu, 4 May 2023 17:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/bpa/app/BusinessServer.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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);//启动配料