diff --git a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java index 0c210b8..37fc9a2 100644 --- a/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java +++ b/ssjygl-xsx-service/src/main/java/com/cowr/service/ssjygl/order/ordercluster/OrderclusterSyncService.java @@ -706,7 +706,8 @@ public class OrderclusterSyncService extends BaseSyncService { 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) { return Result.failedstr("总量不能低于已运输量(%.2f)", overweight); @@ -723,13 +724,13 @@ public class OrderclusterSyncService extends BaseSyncService { // 客户在所有砂站的未完成的配额中,未执行完成的总金额 BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId()); BigDecimal plan_total_price; - if (model.getTotalWeight().compareTo(oldobj.getTotalWeight()) > 0) { // 修改后,比原来的大 - BigDecimal surplus_weight = model.getTotalWeight().subtract(oldobj.getTotalWeight()); // 本次修改增加的重量 - BigDecimal offset_total_price = surplus_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 + if (model.getTotalWeight().compareTo(surplus_weight) > 0) { // 修改后,比原来的大 + BigDecimal surplus_weight_1 = model.getTotalWeight().subtract(surplus_weight); // 本次修改增加的重量 + BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额 } else { // 修改后比原来的小 - BigDecimal surplus_weight = oldobj.getTotalWeight().subtract(model.getTotalWeight()); // 本次修改增加的重量 - BigDecimal offset_total_price = surplus_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 + BigDecimal surplus_weight_1 = surplus_weight.subtract(model.getTotalWeight()); // 本次修改增加的重量 + BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 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 plan_total_price; - if (total_weight.compareTo(oldobj.getTotalWeight()) > 0) { // 修改后,比原来的大 - BigDecimal surplus_weight_1 = total_weight.subtract(oldobj.getTotalWeight()); // 本次修改增加的重量 + if (total_weight.compareTo(surplus_weight) > 0) { // 修改后,比原来的大 + BigDecimal surplus_weight_1 = total_weight.subtract(surplus_weight); // 本次修改增加的重量 BigDecimal offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格 plan_total_price = offset_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额 } 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()); // 本次修改增加的价格 plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额 }