Browse Source

取消维修增加已出库的库存

lyhzzz 2 năm trước cách đây
mục cha
commit
2bcabcd5d9

+ 8 - 10
src/main/java/com/fdkankan/sale/service/impl/RepairSaleService.java

@@ -263,10 +263,16 @@ public class RepairSaleService {
             throw new BusinessException(ResultCode.ORDER_PAY_ERROR);
         }
         BigDecimal payAmount;
+        String orderSn = null;
+        Integer status = null;
         if(repair.getStatus().equals(RepairStatusEnum.TO_BE_CANCELED.status())){
             payAmount = priceListService.getRobAmountByRepairId(repair.getRepairId());
+            orderSn = "se_c"+DateUtil.getDate(DateUtil.repairIdFmt);
+            status = RepairStatusEnum.TO_BE_CANCELED_RECOVERED.status();
         }else {
             payAmount = priceListService.getAmountByRepairId(repair.getRepairId());
+            orderSn = "se_s"+DateUtil.getDate(DateUtil.repairIdFmt);
+            status = RepairStatusEnum.TO_BE_RECOVERED.status();
         }
         RepairPay repairPay = new RepairPay();
         repairPay.setRepairId(repair.getRepairId());
@@ -277,20 +283,12 @@ public class RepairSaleService {
         repairPay.setPayAmount(payAmount);
         repairPay.setPayTime(DateUtil.getDate());
         repairPay.setOrderType(0);
-        if(repair.getCancelStatus() == 1){
-            repairPay.setOrderSn("se_c"+DateUtil.getDate(DateUtil.repairIdFmt));
-        }else {
-            repairPay.setOrderSn("se_s"+DateUtil.getDate(DateUtil.repairIdFmt));
-        }
+        repairPay.setOrderSn(orderSn);
         repairPayService.save(repairPay);
 
         List<RepairRegisterPartVo> partVoList = repairSupplyService.partInfo(repairPay.getRepairId(), 1);
         if(partVoList.size() >0){
-            if(repair.getCancelStatus() == 1){
-                repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_CANCELED_RECOVERED.status(), "付款登记");
-            }else {
-                repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_RECOVERED.status(), "付款登记");
-            }
+            repairLogService.saveBySysUser(userId,param.getRepairId(),status, "付款登记");
         }else {
             repairLogService.saveBySysUser(userId,param.getRepairId(),RepairStatusEnum.TO_BE_SHIPPED.status(), "付款登记");
         }