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()); // 销售的用第二次减第一次