Explorar o código

aps-撤回订单时,释放备料或领料信息

sucheng hai 8 meses
pai
achega
438e10f352

+ 2 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsProductionOrderService.java

@@ -44,4 +44,6 @@ public interface ApsProductionOrderService extends IService<ApsProductionOrderDo
     R generalMsInsert(OrderSaveOrUpdateVo req);
 
     R generalMsUpdate(OrderSaveOrUpdateVo req);
+
+    R removeBatchNumberByOrderId(String orderId);
 }

+ 20 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductionOrderServiceImpl.java

@@ -129,6 +129,8 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
     private CXAdminFeginClient cxAdminFeginClient;
     @Autowired
     private ApsProductionTechnicalRequirementService apsProductionTechnicalRequirementService;
+    @Autowired
+    private ApsWorkInProgressInventoryService apsWorkInProgressInventoryService;
 
 
     public static final String ERROR_MSG = "%s上诉订单的排程交货期大于承诺交货期";
@@ -1017,6 +1019,24 @@ public class ApsProductionOrderServiceImpl extends ServiceImpl<ApsProductionOrde
         return R.ok();
     }
 
+    @Override
+    public R removeBatchNumberByOrderId(String orderId) {
+        //查询所有的坯料计划
+        List<ApsBlankOrderDo> apsBlankOrderDoList = apsBlankOrderService.list(new QueryWrapper<ApsBlankOrderDo>().lambda().eq(ApsBlankOrderDo::getProductionorderid, orderId));
+        for (ApsBlankOrderDo apsBlankOrderDo : apsBlankOrderDoList) {
+            //如果是否备料=是,备料对应在制品的备料计划ID=(空),在制品状态=备料中
+            if (ObjectUtil.isNotEmpty(apsBlankOrderDo.getPreparematerialbatchno())) {
+                List<String> batchNumberList = Arrays.asList(apsBlankOrderDo.getPreparematerialbatchno().split(","));
+                apsWorkInProgressInventoryService.update(new UpdateWrapper<ApsWorkInProgressInventoryDo>().lambda()
+                        .set(ApsWorkInProgressInventoryDo::getPlanmaterialid, null)
+                        .setSql("WORKINPROCESSSTATUS = IF(REMARK = '待加工','备料中',REMARK)")
+                        .eq(ApsWorkInProgressInventoryDo::getDeleted, "0")
+                        .in(ApsWorkInProgressInventoryDo::getBatchnumber, batchNumberList));
+            }
+        }
+        return R.ok();
+    }
+
 }
 
 

+ 12 - 4
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductionOrderController.java

@@ -14,10 +14,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -174,4 +171,15 @@ public class ApsProductionOrderController {
     public R generalMsUpdate(@RequestBody OrderSaveOrUpdateVo req) {
         return apsProductionOrderService.generalMsUpdate(req);
     }
+
+    /**
+     * 撤回订单时,需要的操作,释放备料或领料信息
+     */
+    @GetMapping("/removeBatchNumberByOrderId")
+    public R removeBatchNumberByOrderId(@RequestParam String orderId) {
+        if (StringUtils.isEmpty(orderId)) {
+            return R.error("订单ID不能为空");
+        }
+        return apsProductionOrderService.removeBatchNumberByOrderId(orderId);
+    }
 }