lisai17@sina.com 2021-03-16 17:23:39 +08:00
parent 08a19b9645
commit 96573b2e67
1 changed files with 22 additions and 6 deletions

View File

@ -721,10 +721,17 @@ public class OrderclusterSyncService extends BaseSyncService {
}
// 客户在所有砂站的未完成的配额中,未执行完成的总金额
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
BigDecimal surplus_weight = model.getTotalWeight().subtract(oldobj.getTotalWeight()); // 本次修改增加的重量
BigDecimal add_total_price = surplus_weight.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
BigDecimal plan_total_price = add_total_price.add(undo_price); // 剩余未完成金额加上本次增加的金额
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()); // 本次修改增加的价格
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()); // 本次修改增加的价格
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
}
if (plan_total_price.compareTo(prepayCustomer.getSurplus()) > 0) {
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, prepayCustomer.getSurplus());
@ -942,8 +949,17 @@ public class OrderclusterSyncService extends BaseSyncService {
}
// 客户在所有砂站的未完成的配额中,未执行完成的总金额
BigDecimal undo_price = OrderclusterService.me.undoPrice(oldobj.getCustomerId());
BigDecimal plan_total_price = total_weight.subtract(oldobj.getTotalWeight()).multiply(oldobj.getUnitPrice()).add(undo_price); // 本次转结的量,减去已完成量
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()); // 本次修改增加的重量
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 offset_total_price = surplus_weight_1.multiply(oldobj.getUnitPrice()); // 本次修改增加的价格
plan_total_price = undo_price.subtract(offset_total_price); // 剩余未完成金额加上本次增加的金额
}
if (plan_total_price.compareTo(prepayCustomer.getSurplus()) > 0) {
return Result.failedstr("共计总配额达 %.2f元,客户余额(%.2f元)不足", plan_total_price, prepayCustomer.getSurplus());