zhangxin 1 год назад
Родитель
Сommit
f3b64f0093

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -145,7 +145,7 @@ public class PdaController {
             }
             stockForm.setOrderNo(orderNo);
         }
-        return wmsDocAsnHeaderService.doStock(stockForm);
+        return wmsDocAsnHeaderService.syncDoStock(stockForm);
     }
 
     /**

+ 1 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/yonghu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+                url: jdbc:mysql://localhost:3306/warewms_yonghu_zx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
                 username: root
                 password: root
                 driverClassName: com.mysql.cj.jdbc.Driver

+ 30 - 6
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/impl/WarehouseTest.java

@@ -41,7 +41,6 @@ import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.ams.task.service.IWcsTaskService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
-import com.ruoyi.base.domain.BaseWarehouse;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.base.mapper.BaseLocationInfoMapper;
 import com.ruoyi.base.mapper.BaseSkuMapper;
@@ -59,9 +58,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 ;
 
@@ -124,8 +121,35 @@ public class WarehouseTest {
 
     @Test
     public void test() {
-        List<BaseWarehouse> warehouseList = baseWarehouseService.selectBaseWarehouseList(null);
-        System.out.println(JSON.toJSONString(warehouseList));
+        InvLotAtt invLotAtt = new InvLotAtt();
+        invLotAtt.setLotatt08("ASN202311210001");
+        Map<String, String> iotMap = new HashMap<>();
+        iotMap.put("YZB0115", "10220");
+        iotMap.put("YZB0152", "10587");
+        iotMap.put("YZB0067", "10223");
+        iotMap.put("10220", "1700537533202");
+        iotMap.put("10587", "1700537160181");
+        iotMap.put("10223", "1700536568619");
+
+        List<InvLotAtt> invLotAtts = invLotAttService.selectInvLotAttList(invLotAtt);
+        invLotAtts.forEach(item -> {
+            InvLotLocId invLotLocId = new InvLotLocId();
+            invLotLocId.setLotnum(item.getLotnum());
+            invLotLocId.setLocationId(iotMap.get(item.getLotatt07()));
+            invLotLocId.setTraceid(iotMap.get(invLotLocId.getLocationId()));
+
+            invLotLocId.setSku(item.getSku());
+            invLotLocId.setCustomerId("default");
+            invLotLocId.setQty(new BigDecimal(1));
+            invLotLocId.setQtyEach(new BigDecimal(1));
+            invLotLocId.setQtyallocated(new BigDecimal(0));
+            invLotLocId.setQtyallocatedEach(new BigDecimal(0));
+
+            invLotLocId.setQtypa(BigDecimal.ZERO);
+            invLotLocId.setQtyrpin(BigDecimal.ZERO);
+            invLotLocId.setCreateTime(item.getCreateTime());
+            invLotLocIdMapper.insertInvLotLocId(invLotLocId);
+        });
     }
 
     @Test

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

@@ -1,7 +1,5 @@
 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;
@@ -16,6 +14,8 @@ 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接口
  *
@@ -112,6 +112,13 @@ public interface IWmsDocAsnHeaderService {
      */
     WmsDocAsnDetails queryWmsDocAsnDetailsOne(String asnNo, int asnLineNo);
 
+    /**
+     * 入库码盘异步处理
+     * @param stockForm
+     * @return
+     */
+    AjaxResult syncDoStock(StockForm stockForm);
+
     /**
      * 入库码盘
      *

+ 22 - 27
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -1,21 +1,21 @@
 package com.ruoyi.ams.asn.service.impl;
 
-import java.math.BigDecimal;
-import java.util.*;
-
 import cn.hutool.core.comparator.CompareUtil;
 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.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.LotattDTO;
 import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
-import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.erp.domain.ErpBarcodes;
 import com.ruoyi.ams.erp.domain.ErpOrderList;
 import com.ruoyi.ams.erp.service.IErpBarcodesService;
@@ -24,16 +24,12 @@ import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
-import com.ruoyi.ams.inv.service.IActTransactionLogService;
 import com.ruoyi.ams.inv.service.IInvLotAttService;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.lineCall.domain.form.LineCallForm;
 import com.ruoyi.ams.lineCall.domain.form.LineCallListFrom;
 import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
 import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
-import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
-import com.ruoyi.ams.order.mapper.WmsDocOrderHeaderMapper;
-import com.ruoyi.ams.order.service.IActAllocationDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
@@ -46,22 +42,19 @@ import com.ruoyi.base.service.ICodeSkuRelationshipService;
 import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.entity.SysUser;
 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.StringUtils;
 import io.jsonwebtoken.lang.Assert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-
-import com.ruoyi.common.utils.StringUtils;
 import org.springframework.transaction.annotation.Propagation;
 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业务层处理
@@ -71,6 +64,8 @@ import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
  */
 @Service
 public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
+    @Autowired
+    private IWmsDocAsnHeaderService wmsDocAsnHeaderService;
     @Autowired
     private WmsDocAsnHeaderMapper wmsDocAsnHeaderMapper;
     @Autowired
@@ -82,28 +77,18 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
     @Autowired
     private IWmsDocOrderHeaderService wmsDocOrderHeaderService;
     @Autowired
-    private WmsDocOrderDetailsMapper wmsDocOrderDetailsMapper;
-    @Autowired
-    private WmsDocOrderHeaderMapper wmsDocOrderHeaderMapper;
-    @Autowired
     private IBaseSkuService baseSkuService;
     @Autowired
     private IWmsBoxInfoService wmsBoxInfoService;
     @Autowired
-    private IActTransactionLogService actTransactionLogService;
-    @Autowired
     private IdSequenceUtils idSequenceUtils;
     @Autowired
     private IInvLotAttService invLotAttService;
     @Autowired
     private InvLotLocIdMapper invLotLocIdMapper;
     @Autowired
-    private IActAllocationDetailsService actAllocationDetailsService;
-    @Autowired
     private ICodeSkuRelationshipService codeSkuRelationshipService;
     @Autowired
-    private IFlowConfigHeaderService flowConfigHeaderService;
-    @Autowired
     private IBusinessService businessService;
     @Autowired
     private IBaseLocationInfoService baseLocationInfoService;
@@ -277,15 +262,25 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
         }
     }
 
+    /**
+     * 入库码盘异步处理
+     * @param stockForm
+     * @return
+     */
+    @Override
+    public synchronized AjaxResult syncDoStock(StockForm stockForm){
+        return wmsDocAsnHeaderService.doStock(stockForm);
+    }
+
     /**
      * 入库码盘
      *
      * @param stockForm
      * @return
      */
-    @Transactional
+    @Transactional(propagation = Propagation.REQUIRES_NEW)
     @Override
-    public synchronized AjaxResult doStock(StockForm stockForm) {
+    public AjaxResult doStock(StockForm stockForm) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         Long STAGE01 = Constant.LOC_STAGE_CACHE;
         WmsDocOrderHeader wmsDocOrderHeader;

+ 4 - 6
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.ams.inv.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
@@ -30,7 +31,6 @@ import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.BaseLocationZone;
 import com.ruoyi.base.domain.form.BasLocationForm;
 import com.ruoyi.base.service.IBaseLocationInfoService;
-import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
@@ -68,8 +68,6 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
     @Autowired
     private IBaseLocationInfoService baseLocationInfoService;
     @Autowired
-    private IdSequenceUtils idSequenceUtils;
-    @Autowired
     private IWmsBoxInfoService iWmsBoxInfoService;
     @Autowired
     private IInvLotLocIdService invLotLocIdService;
@@ -622,7 +620,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             invLotAtt = queryList.get(0);
             lotnum = invLotAtt.getLotnum();
         } else {
-            lotnum = idSequenceUtils.generateId("LOTNUMBER");
+            lotnum = IdWorker.getIdStr();
             invLotAtt.setLotnum(lotnum);
             invLotAtt.setSku(sku);
             invLotAtt.setCustomerId(customerId);
@@ -677,7 +675,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             invLotAtt = queryList.get(0);
             lotnum = invLotAtt.getLotnum();
         } else {
-            lotnum = idSequenceUtils.generateId("LOTNUMBER");
+            lotnum = IdWorker.getIdStr();
             invLotAtt.setLotnum(lotnum);
             invLotAtt.setSku(sku);
             invLotAtt.setCustomerId(customerId);
@@ -721,7 +719,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             String sku = agvCallItemDTO.getSku();
             Double qty = agvCallItemDTO.getQty() == null ? 1D : agvCallItemDTO.getQty();
             // 批次表
-            String lotnum = idSequenceUtils.generateId("LOTNUMBER");
+            String lotnum = IdWorker.getIdStr();
             LotattDTO lotattDTO = agvCallItemDTO.getLotattDTO();
             InvLotAtt invLotAtt = new InvLotAtt();
             BeanUtils.copyProperties(lotattDTO, invLotAtt);

+ 8 - 11
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -1,25 +1,21 @@
 package com.ruoyi.ams.task.service.impl;
 
-import java.lang.reflect.Method;
-import java.util.Date;
-import java.util.List;
-
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
-import com.ruoyi.ams.agv.ndc.entity.CallbackResult;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
-import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.config.domain.FlowConfigEvent;
 import com.ruoyi.ams.config.service.IFlowConfigEventService;
-import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotAttService;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.order.service.IActAllocationDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
+import com.ruoyi.ams.task.domain.WcsTask;
 import com.ruoyi.ams.task.dto.WcsTaskLocationDTO;
+import com.ruoyi.ams.task.mapper.WcsTaskMapper;
+import com.ruoyi.ams.task.service.IWcsTaskService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.service.IBaseLocationInfoService;
@@ -32,11 +28,12 @@ import com.ruoyi.common.utils.spring.SpringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.ams.task.mapper.WcsTaskMapper;
-import com.ruoyi.ams.task.domain.WcsTask;
-import com.ruoyi.ams.task.service.IWcsTaskService;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.List;
+
 /**
  * AGV任务Service业务层处理
  *
@@ -551,6 +548,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         return AjaxResult.success();
     }
 
+
     /**
      * 将中间缓存位库存放到终点位置
      *
@@ -580,7 +578,6 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         return AjaxResult.success();
     }
 
-
     /**
      * 取消任务删除中间缓存库存
      *