车辆结算时,判断是否超重,超重事出厂LED上显示超重状态

dev
wuwenxiong 2021-09-08 16:11:19 +08:00
parent 365b15fe78
commit f25d1e8603
2 changed files with 40 additions and 7 deletions

View File

@ -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);

View File

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