From f25d1e8603fae03f899356feea9e546067c7acb7 Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Wed, 8 Sep 2021 16:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E7=BB=93=E7=AE=97=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E8=B6=85=E9=87=8D?= =?UTF-8?q?=EF=BC=8C=E8=B6=85=E9=87=8D=E4=BA=8B=E5=87=BA=E5=8E=82LED?= =?UTF-8?q?=E4=B8=8A=E6=98=BE=E7=A4=BA=E8=B6=85=E9=87=8D=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devicectrl/controllers/OutController.java | 14 +++++++- .../order/ordertemp/OrderTempSyncService.java | 33 +++++++++++++++---- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java index 5b24993..e11932c 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/devicectrl/controllers/OutController.java @@ -6,7 +6,9 @@ import com.cowr.local.ssjygl.devicectrl.device.LEDThread; import com.cowr.local.ssjygl.devicectrl.device.PLC; import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair; import com.cowr.local.ssjygl.main.CliCacheData; +import com.cowr.local.ssjygl.main.Config; import com.cowr.model.PostLicenseResult; +import com.cowr.model.TruckWeightLimit; import com.cowr.ssjygl.order.ordercluster.OrderclusterService; import com.jfinal.kit.StrKit; import com.jfinal.log.Log; @@ -252,7 +254,17 @@ public class OutController extends Controller implements Runnable { try { // 如果对应的车辆有限重配置则判断限重配置是否超标,如果没有则用系统默认的限重配置判断 // 如果超重则在LED上显示超重信息 - + BigDecimal weightLimit; + TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(pair.license); + if (truckWeightLimit != null) { + weightLimit = truckWeightLimit.getWeightLimit(); + } else { + weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); + } + if (weightLimit != null && new BigDecimal(weight).compareTo(weightLimit) > 0) { + getLed().setInfo(pair.license, "超重"); + log.debug("%s 【%s】超重,限重%s吨,称重%s吨", getWhich(), pair.license, weightLimit, weight); + } BigDecimal total_price = OrderclusterService.me.getTotalPriceByLicense(CliCacheData.SUP.getId(), pair.license, weight); diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordertemp/OrderTempSyncService.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordertemp/OrderTempSyncService.java index 96de0ad..3b2817c 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordertemp/OrderTempSyncService.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordertemp/OrderTempSyncService.java @@ -92,8 +92,15 @@ public class OrderTempSyncService { return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight()); } - if (transport.getSecondWeight().compareTo(BigDecimal.valueOf(Config.configprop.getInt("weigh.max"))) > 0) { - return Result.failedstr("毛重不能超过 %d 吨", Config.configprop.getInt("weigh.max")); + BigDecimal weightLimit; + TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); + if (truckWeightLimit != null) { + weightLimit = truckWeightLimit.getWeightLimit(); + } else { + weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); + } + if (transport.getSecondWeight().compareTo(weightLimit) > 0) { + return Result.failedstr("毛重不能超过 %d 吨", weightLimit); } BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次 @@ -331,8 +338,15 @@ public class OrderTempSyncService { return Result.failedstr("重量数据有误,第一次称重:%.2f,第二次称重:%.2f", transport.getFirstWeight(), transport.getSecondWeight()); } - if (transport.getSecondWeight().compareTo(BigDecimal.valueOf(Config.configprop.getInt("weigh.max"))) > 0) { - return Result.failedstr("毛重 %.2f 吨,不能超过 %s 吨", transport.getSecondWeight(), Config.configprop.getInt("weigh.max")); + BigDecimal weightLimit; + TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); + if (truckWeightLimit != null) { + weightLimit = truckWeightLimit.getWeightLimit(); + } else { + weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); + } + if (transport.getSecondWeight().compareTo(weightLimit) > 0) { + return Result.failedstr("毛重不能超过 %d 吨", weightLimit); } BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次 @@ -669,8 +683,15 @@ public class OrderTempSyncService { return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight()); } - if (transport.getSecondWeight().compareTo(BigDecimal.valueOf(Config.configprop.getInt("weigh.max"))) > 0) { - return Result.failedstr("毛重不能超过 %d 吨", Config.configprop.getInt("weigh.max")); + BigDecimal weightLimit; + TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); + if (truckWeightLimit != null) { + weightLimit = truckWeightLimit.getWeightLimit(); + } else { + weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); + } + if (transport.getSecondWeight().compareTo(weightLimit) > 0) { + return Result.failedstr("毛重不能超过 %d 吨", weightLimit); } BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次