Kaynağa Gözat

入库单bug修复

zhangxin 1 yıl önce
ebeveyn
işleme
b1f9b69ad2

+ 0 - 3
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/IWmsDocAsnHeaderService.java

@@ -6,7 +6,6 @@ import com.ruoyi.ams.asn.form.PaForm;
 import com.ruoyi.ams.asn.form.StockForm;
 import com.ruoyi.ams.asn.form.UnlockForm;
 import com.ruoyi.ams.asn.vo.SearchStockVO;
-import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
 import com.ruoyi.base.domain.vo.CodeSkuRelationshipVO;
 import com.ruoyi.base.form.SnCheckForm;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -76,8 +75,6 @@ public interface IWmsDocAsnHeaderService {
      */
     int deleteWmsDocAsnHeaderByAsnNo(String asnNo);
 
-    void createWmsDoc(FlowConfigHeaderVO flowConfigHeaderVO, String lotatt01);
-
     /**
      * 插入表体
      *

+ 0 - 26
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -13,7 +13,6 @@ import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
-import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
 import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
@@ -188,31 +187,6 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
         return wmsDocAsnHeaderMapper.deleteWmsDocAsnHeaderByAsnNo(asnNo);
     }
 
-    @Override
-    public void createWmsDoc(FlowConfigHeaderVO flowConfigHeaderVO, String lotatt01) {
-        // 创建入库单
-        WmsDocAsnHeader header = new WmsDocAsnHeader();
-        header.setAsnStatus("99");
-        header.setAsnType("PR");
-        header.setCreateTime(new Date());
-        header.setCreateBy("pda");
-        header.setCustomerId(Constant.CUSTOMER_ID);
-        WmsDocAsnDetails details = new WmsDocAsnDetails();
-        details.setAsnNo(header.getAsnNo());
-        details.setSku(flowConfigHeaderVO.getSkuType());
-        details.setExpectedQty(new BigDecimal(flowConfigHeaderVO.getQty()));
-        details.setExpectedQtyEach(new BigDecimal(flowConfigHeaderVO.getQty()));
-        details.setReceivedQty(BigDecimal.ZERO);
-        details.setReceivedQtyEach(BigDecimal.ZERO);
-        details.setLineStatus("99");
-        details.setCreateBy("pda");
-        details.setCreateTime(new Date());
-        details.setLotatt01(StringUtils.isNotBlank(lotatt01) ? lotatt01 : null);
-        details.setLotatt02(flowConfigHeaderVO.getWeight().toString());
-        details.setLotatt05("DJ");
-        insertWmsDocAsnDetails(details);
-    }
-
     @Override
     public int insertWmsDocAsnDetails(WmsDocAsnDetails wmsDocAsnDetails) {
         List<WmsDocAsnDetails> detailsList = new ArrayList<>();

+ 0 - 7
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -1,7 +1,5 @@
 package com.ruoyi.ams.business;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.ams.agv.ndc.common.ByteUtil;
 import com.ruoyi.ams.agv.ndc.common.CRC16Util;
@@ -129,11 +127,6 @@ public class BusinessServiceImpl implements IBusinessService {
         try {
             //查询全局配置策略
             AsnSoStrategy asnSoStrategy = asnSoStrategyMapper.selectAsnSoStrategy();
-            String lotatt01 = agvCallDTOList.stream().filter(item -> CollectionUtil.isNotEmpty(item.getAgvCallItemDTOList()))
-                    .map(item -> item.getAgvCallItemDTOList().stream().filter(agvCallItemDTO -> ObjectUtil.isNotNull(agvCallItemDTO.getLotattDTO()) && StringUtils.isNotBlank(agvCallItemDTO.getLotattDTO().getLotatt01()))
-                            .map(agvCallItemDTO -> agvCallItemDTO.getLotattDTO().getLotatt01()).findFirst().get()).findFirst().orElseGet(() -> null);
-            //生成入库单
-            wmsDocAsnHeaderService.createWmsDoc(flowConfigHeaderVO, lotatt01);
             for (AgvCallDTO agvCallDTO : agvCallDTOList) {
                 //如果是入库把起始库位相同的数据整合到一起生成库存记录
                 BaseLocationInfo locationFrom = null;

+ 54 - 0
warewms-ams/src/main/java/com/ruoyi/ams/nieyan/service/impl/AgvCallProxyService.java

@@ -1,5 +1,10 @@
 package com.ruoyi.ams.nieyan.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
+import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
+import com.ruoyi.ams.asn.service.IWmsDocAsnDetailsService;
+import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
 import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
 import com.ruoyi.ams.config.domain.dto.AgvCallItemDTO;
@@ -8,12 +13,16 @@ import com.ruoyi.ams.inv.service.IInvLotAttService;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -36,6 +45,15 @@ public class AgvCallProxyService {
     @Autowired
     private IInvLotAttService iInvLotAttService;
 
+    @Autowired
+    private IdSequenceUtils idSequenceUtils;
+
+    @Autowired
+    private IWmsDocAsnHeaderService wmsDocAsnHeaderService;
+
+    @Autowired
+    private IWmsDocAsnDetailsService wmsDocAsnDetailsService;
+
 
     /**
      * 补空托(空托暂存区)
@@ -222,6 +240,7 @@ public class AgvCallProxyService {
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("Y"); //是否硫酸镍,Y代表否
         }
+        createWmsDoc(createUser, agvCallItemDTOList);
         return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.EIGHT.getValue(), agvCallDTO);
     }
 
@@ -244,9 +263,42 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        createWmsDoc(createUser, agvCallItemDTOList);
         return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.NINE.getValue(), agvCallDTO);
     }
 
+    public void createWmsDoc(String createUser
+            , List<AgvCallItemDTO> agvCallItemDTOList){
+        // 创建入库单
+        WmsDocAsnHeader header = new WmsDocAsnHeader();
+        header.setAsnStatus("00");
+        header.setAsnType("PR");
+        header.setCreateTime(new Date());
+        header.setCreateBy(createUser);
+        header.setCustomerId(Constant.CUSTOMER_ID);
+        String asnNo = idSequenceUtils.generateId("ASNNO");
+        header.setAsnNo(asnNo);
+        wmsDocAsnHeaderService.insertWmsDocAsnHeader(header);
+        int i = 1;
+        for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
+            WmsDocAsnDetails details = new WmsDocAsnDetails();
+            details.setAsnNo(header.getAsnNo());
+            details.setSku(agvCallItemDTO.getSku());
+            details.setAsnLineNo(Long.parseLong(String.valueOf(i++)));
+            details.setExpectedQty(ObjectUtil.isNotNull(agvCallItemDTO.getQty()) ? new BigDecimal(agvCallItemDTO.getQty()) : null);
+            details.setExpectedQtyEach(ObjectUtil.isNotNull(agvCallItemDTO.getQty()) ? new BigDecimal(agvCallItemDTO.getQty()) : null);
+            details.setReceivedQty(BigDecimal.ZERO);
+            details.setReceivedQtyEach(BigDecimal.ZERO);
+            details.setLineStatus("00");
+            details.setCreateBy(createUser);
+            details.setCreateTime(new Date());
+            details.setLotatt01(StringUtils.isNotBlank(agvCallItemDTO.getLotattDTO().getLotatt01()) ? agvCallItemDTO.getLotattDTO().getLotatt01() : null);
+            details.setLotatt02(ObjectUtil.isNotNull(agvCallItemDTO.getWeight()) ? agvCallItemDTO.getWeight().toString() : null);
+            details.setLotatt05("DJ");
+            wmsDocAsnDetailsService.insertWmsDocAsnDetails(details);
+        }
+    }
+
     /**
      * 成品下线(硫酸镍)-裹膜->仓储区
      *
@@ -315,6 +367,7 @@ public class AgvCallProxyService {
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("N"); //是否硫酸镍,N代表否
         }
+        createWmsDoc(createUser, agvCallItemDTOList);
         return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.ELEVEN.getValue(), agvCallDTO);
     }
 
@@ -337,6 +390,7 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        createWmsDoc(createUser, agvCallItemDTOList);
         return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.TWELVE.getValue(), agvCallDTO);
     }