lisai17@sina.com 2021-03-16 17:32:42 +08:00
parent 96573b2e67
commit 46eefb5a8d
1 changed files with 10 additions and 9 deletions

View File

@ -706,7 +706,8 @@ public class OrderclusterSyncService extends BaseSyncService {
return Result.failed(false, "订单已完成,不能修改"); return Result.failed(false, "订单已完成,不能修改");
} }
BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量 BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量
BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(overweight); // 剩余量
if (model.getTotalWeight().compareTo(overweight) < 0) { if (model.getTotalWeight().compareTo(overweight) < 0) {
return Result.failedstr("总量不能低于已运输量(%.2f", overweight); return Result.failedstr("总量不能低于已运输量(%.2f", overweight);
@ -723,13 +724,13 @@ public class OrderclusterSyncService extends BaseSyncService {
// 客户在所有砂站的未完成的配额中,未执行完成的总金额 // 客户在所有砂站的未完成的配额中,未执行完成的总金额
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId()); BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
BigDecimal plan_total_price; BigDecimal plan_total_price;
if (model.getTotalWeight().compareTo(oldobj.getTotalWeight()) > 0) { // 修改后,比原来的大 if (model.getTotalWeight().compareTo(surplus_weight) > 0) { // 修改后,比原来的大
BigDecimal surplus_weight = model.getTotalWeight().subtract(oldobj.getTotalWeight()); // 本次修改增加的重量 BigDecimal surplus_weight_1 = model.getTotalWeight().subtract(surplus_weight); // 本次修改增加的重量
BigDecimal offset_total_price = surplus_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额 plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额
} else { // 修改后比原来的小 } else { // 修改后比原来的小
BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(model.getTotalWeight()); // 本次修改增加的重量 BigDecimal surplus_weight_1 = surplus_weight.subtract(model.getTotalWeight()); // 本次修改增加的重量
BigDecimal offset_total_price = surplus_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额 plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
} }
@ -951,12 +952,12 @@ public class OrderclusterSyncService extends BaseSyncService {
// 客户在所有砂站的未完成的配额中,未执行完成的总金额 // 客户在所有砂站的未完成的配额中,未执行完成的总金额
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId()); BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
BigDecimal plan_total_price; BigDecimal plan_total_price;
if (total_weight.compareTo(oldobj.getTotalWeight()) > 0) { // 修改后,比原来的大 if (total_weight.compareTo(surplus_weight) > 0) { // 修改后,比原来的大
BigDecimal surplus_weight_1 = total_weight.subtract(oldobj.getTotalWeight()); // 本次修改增加的重量 BigDecimal surplus_weight_1 = total_weight.subtract(surplus_weight); // 本次修改增加的重量
BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额 plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额
} else { // 修改后比原来的小 } else { // 修改后比原来的小
BigDecimal surplus_weight_1 = oldobj.getTotalWeight().subtract(total_weight); // 本次修改增加的重量 BigDecimal surplus_weight_1 = surplus_weight.subtract(total_weight); // 本次修改增加的重量
BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额 plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
} }