Ver código fonte

可视化大屏08.10

zhangxin 1 ano atrás
pai
commit
0a59ed6ca8

+ 5 - 2
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/IWmsDocAsnHeaderService.java

@@ -1,17 +1,18 @@
 package com.ruoyi.ams.asn.service;
 
-import java.util.List;
-
 import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 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;
 
+import java.util.List;
+
 /**
  * 入库单Service接口
  *
@@ -75,6 +76,8 @@ public interface IWmsDocAsnHeaderService {
      */
     int deleteWmsDocAsnHeaderByAsnNo(String asnNo);
 
+    void createWmsDoc(FlowConfigHeaderVO flowConfigHeaderVO, String lotatt01);
+
     /**
      * 插入表体
      *

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnDetailsServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.common.collect.Lists;
 import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.dto.TotalInfoDTO;
 import com.ruoyi.ams.asn.dto.WmsAllGranularityTotalDTO;
@@ -285,8 +286,7 @@ public class WmsDocAsnDetailsServiceImpl implements IWmsDocAsnDetailsService {
         if (CollectionUtil.isEmpty(dataList)) throw new BaseException("配置为空!");
         for (String item : dataList) {
             List<WmsDocAsnDetails> wmsDocAsnDetailsList = queryWmsDocAsnDetailsList(item, field, beginTime, endTime, status);
-            if (CollectionUtil.isEmpty(wmsDocAsnDetailsList)) continue;
-            WmsDetailsTotalDTO wmsDetailsTotalDTO = buildWmsDetailsTotalDTOList(item, wmsDocAsnDetailsList, splitTimeMap);
+            WmsDetailsTotalDTO wmsDetailsTotalDTO = CollectionUtil.isEmpty(wmsDocAsnDetailsList) ? buildWmsDetailsTotalDTOList(item, Lists.newArrayList(), splitTimeMap) : buildWmsDetailsTotalDTOList(item, wmsDocAsnDetailsList, splitTimeMap);
             result.add(wmsDetailsTotalDTO);
         }
         return result;

+ 33 - 16
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -1,25 +1,22 @@
 package com.ruoyi.ams.asn.service.impl;
 
-import java.math.BigDecimal;
-import java.util.*;
-
+import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
+import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 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.mapper.WmsDocAsnDetailsMapper;
+import com.ruoyi.ams.asn.mapper.WmsDocAsnHeaderMapper;
+import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
 import com.ruoyi.ams.asn.vo.SearchStockVO;
 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.AgvCallDTO;
 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.ActTransactionLog;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
-import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
-import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IActTransactionLogService;
 import com.ruoyi.ams.inv.service.IInvLotAttService;
@@ -30,9 +27,7 @@ import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
 import com.ruoyi.ams.order.dto.WmsDocOrderDTO;
 import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
 import com.ruoyi.ams.order.service.IActAllocationDetailsService;
-import com.ruoyi.ams.order.service.IWmsDocOrderDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
-import com.ruoyi.ams.task.domain.WcsTask;
 import com.ruoyi.ams.task.service.IWcsTaskService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
@@ -48,16 +43,13 @@ import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.uuid.SnowflakeIdWorker;
+import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import com.ruoyi.common.utils.StringUtils;
 import org.springframework.transaction.annotation.Transactional;
-import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
-import com.ruoyi.ams.asn.mapper.WmsDocAsnHeaderMapper;
-import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
-import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
+
+import java.math.BigDecimal;
+import java.util.*;
 
 /**
  * 入库单Service业务层处理
@@ -196,6 +188,31 @@ 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<>();

+ 12 - 1
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -1,10 +1,13 @@
 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;
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
+import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.config.domain.AsnSoStrategy;
 import com.ruoyi.ams.config.domain.dto.*;
@@ -68,6 +71,10 @@ public class BusinessServiceImpl implements IBusinessService {
     private IBaseSkuService baseSkuService;
     @Autowired
     private RedisCache redisCache;
+
+    @Autowired
+    private IWmsDocAsnHeaderService wmsDocAsnHeaderService;
+
     @Autowired
     private IWmsBoxInfoService wmsBoxInfoService;
     @Autowired
@@ -122,7 +129,11 @@ 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;