修改出厂超重判断

dev
wuwenxiong 2021-09-14 11:51:20 +08:00
parent d1fcd5564f
commit 706f8e2dae
1 changed files with 42 additions and 21 deletions

View File

@ -92,15 +92,22 @@ public class OrderTempSyncService {
return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight()); return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight());
} }
BigDecimal weightLimit; BigDecimal truckWeightLimit;
TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); BigDecimal minWeightLimit;
if (truckWeightLimit != null) { BigDecimal supermarketWeightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max"));
weightLimit = truckWeightLimit.getWeightLimit(); TruckWeightLimit weightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense());
if (weightLimit != null) {
truckWeightLimit = weightLimit.getWeightLimit();
if (truckWeightLimit.compareTo(supermarketWeightLimit) > 0) {
minWeightLimit = supermarketWeightLimit;
} else { } else {
weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); minWeightLimit = truckWeightLimit;
} }
if (transport.getSecondWeight().compareTo(weightLimit) > 0) { } else {
return Result.failedstr("毛重不能超过 %d 吨", weightLimit); minWeightLimit = supermarketWeightLimit;
}
if (transport.getSecondWeight().compareTo(minWeightLimit) > 0) {
return Result.failedstr("毛重不能超过 %.2f 吨", minWeightLimit);
} }
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次 BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
@ -338,15 +345,22 @@ public class OrderTempSyncService {
return Result.failedstr("重量数据有误,第一次称重:%.2f,第二次称重:%.2f", transport.getFirstWeight(), transport.getSecondWeight()); return Result.failedstr("重量数据有误,第一次称重:%.2f,第二次称重:%.2f", transport.getFirstWeight(), transport.getSecondWeight());
} }
BigDecimal weightLimit; BigDecimal truckWeightLimit;
TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); BigDecimal minWeightLimit;
if (truckWeightLimit != null) { BigDecimal supermarketWeightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max"));
weightLimit = truckWeightLimit.getWeightLimit(); TruckWeightLimit weightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense());
if (weightLimit != null) {
truckWeightLimit = weightLimit.getWeightLimit();
if (truckWeightLimit.compareTo(supermarketWeightLimit) > 0) {
minWeightLimit = supermarketWeightLimit;
} else { } else {
weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); minWeightLimit = truckWeightLimit;
} }
if (transport.getSecondWeight().compareTo(weightLimit) > 0) { } else {
return Result.failedstr("毛重不能超过 %d 吨", weightLimit); minWeightLimit = supermarketWeightLimit;
}
if (transport.getSecondWeight().compareTo(minWeightLimit) > 0) {
return Result.failedstr("毛重不能超过 %.2f 吨", minWeightLimit);
} }
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次 BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
@ -683,15 +697,22 @@ public class OrderTempSyncService {
return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight()); return Result.failedstr("重量数据有误,第一次称重:%.4f,第二次称重:%.4f", transport.getFirstWeight(), transport.getSecondWeight());
} }
BigDecimal weightLimit; BigDecimal truckWeightLimit;
TruckWeightLimit truckWeightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense()); BigDecimal minWeightLimit;
if (truckWeightLimit != null) { BigDecimal supermarketWeightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max"));
weightLimit = truckWeightLimit.getWeightLimit(); TruckWeightLimit weightLimit = TruckWeightLimit.dao.findById(transport.getTruckLicense());
if (weightLimit != null) {
truckWeightLimit = weightLimit.getWeightLimit();
if (truckWeightLimit.compareTo(supermarketWeightLimit) > 0) {
minWeightLimit = supermarketWeightLimit;
} else { } else {
weightLimit = BigDecimal.valueOf(Config.configprop.getInt("weigh.max")); minWeightLimit = truckWeightLimit;
} }
if (transport.getSecondWeight().compareTo(weightLimit) > 0) { } else {
return Result.failedstr("毛重不能超过 %d 吨", weightLimit); minWeightLimit = supermarketWeightLimit;
}
if (transport.getSecondWeight().compareTo(minWeightLimit) > 0) {
return Result.failedstr("毛重不能超过 %.2f 吨", minWeightLimit);
} }
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次 BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次