Browse Source

PDA成品中转开发+测试 --end

k 1 year ago
parent
commit
c853999277

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/nieyan/controller/pda/PdaAgvCallController.java

@@ -266,6 +266,22 @@ public class PdaAgvCallController {
                 , false);
     }
 
+    /**
+     * 成品中转(硫酸镍|氯化镍)
+     * 成品下线暂存区 ->裹膜
+     *
+     * @param agvCallForm
+     * @return
+     */
+    @ApiOperation("成品中转(硫酸镍|氯化镍)")
+    @PostMapping("productsDownLineToCache")
+    public AjaxResult productsDownLineToCache(@RequestBody AgvCallForm agvCallForm) {
+        String locationFrom = agvCallForm.getLocationFrom();
+        String locationTo = agvCallForm.getLocationTo();
+        String createUser = agvCallForm.getCreateUser();
+        return agvCallProxyService.productsDownLineToCache(locationFrom, locationTo, createUser);
+    }
+
     /**
      * 成品出库(硫酸镍)
      *

+ 5 - 2
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -88,6 +88,7 @@ public class BusinessServiceImpl implements IBusinessService {
         }
     }
 
+    @Transactional
     @Override
     public AjaxResult agvCall(Long flowId, AgvCallDTO agvCallDTO) {
         //查询所属流程
@@ -99,6 +100,7 @@ public class BusinessServiceImpl implements IBusinessService {
         return businessService.agvCall(flowConfigHeaderVO, agvCallDTOList);
     }
 
+    @Transactional
     @Override
     public AjaxResult agvCall(FlowConfigHeaderVO flowConfigHeaderVO, AgvCallDTO agvCallDTO) {
         List<AgvCallDTO> agvCallDTOList = new ArrayList<>();
@@ -160,7 +162,8 @@ public class BusinessServiceImpl implements IBusinessService {
                         locationFromListEnd.add(info);
                     }
                     if (locationFromListEnd.size() == 0) {
-                        AgvCallItemDTO agvCall = agvCallDTO.getAgvCallItemDTOList().get(0);
+                        AgvCallItemDTO agvCall = agvCallDTO.getAgvCallItemDTOList().size() == 0
+                                ? new AgvCallItemDTO() : agvCallDTO.getAgvCallItemDTOList().get(0);
                         HashMap<String, String> hashMap = JSON.parseObject(JSON.toJSONString(agvCall.getLotattDTO()), HashMap.class);
                         List<BaseLocationInfo> locationFromList = baseLocationInfoMapper.selectSortedLocationLotattListByZoneIdListOrderBy(zoneIdList
                                 , agvCallDTO.getWarehouseId(), hashMap, agvCall.getSku(), "inv.create_time");
@@ -187,7 +190,7 @@ public class BusinessServiceImpl implements IBusinessService {
             }
             return AjaxResult.success("任务下发成功");
         } catch (Exception e) {
-            log.error("任务下发失败!",e);
+            log.error("任务下发失败!", e);
             redisCache.unlockCacheObject(token); // 异常捕获的话就不能释放锁
             throw new ServiceException(e.getMessage(), token);
         }

+ 28 - 2
warewms-ams/src/main/java/com/ruoyi/ams/nieyan/service/AgvCallProxyService.java

@@ -4,6 +4,7 @@ import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
 import com.ruoyi.ams.config.domain.dto.AgvCallItemDTO;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+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;
@@ -32,6 +33,8 @@ public class AgvCallProxyService {
     private IInvLotLocIdService invLotLocIdService;
     @Autowired
     private IBaseLocationInfoService baseLocationInfoService;
+    @Autowired
+    private IInvLotAttService iInvLotAttService;
 
 
     /**
@@ -53,6 +56,12 @@ public class AgvCallProxyService {
         agvCallItemDTO.setSku(Constant.EMPTY_TRAY); // 空托盘
         agvCallItemDTOList.add(agvCallItemDTO);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        // 初始化库存
+        if (agvCallDTO.getAgvCallItemDTOList().size() > 0) {
+            iInvLotAttService.deleteInvLotAttBylocationId(Long.valueOf(locationFrom));
+            invLotLocIdService.deleteInvLotLocIdById(Long.valueOf(locationFrom));
+            invLotLocIdService.initInv(locationFrom, agvCallDTO);
+        }
         return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.ONE.getValue(), agvCallDTO);
     }
 
@@ -191,7 +200,7 @@ public class AgvCallProxyService {
     }
 
     /**
-     * 成品下线(硫酸镍)->裹膜
+     * 成品下线(硫酸镍)->裹膜|成品暂存区
      *
      * @param locationFrom
      * @param locationTo
@@ -372,7 +381,24 @@ public class AgvCallProxyService {
         }else {
             // 氯化镍
             return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.THIRTEEN.getValue(), agvCallDTO);
-        }    }
+        }
+    }
+
+    /**
+     * 成品中转(硫酸镍|氯化镍)->裹膜
+     *
+     * @param locationFrom
+     * @param locationTo
+     * @param createUser
+     * @return
+     */
+    public AjaxResult productsDownLineToCache(String locationFrom, String locationTo, String createUser) {
+        AgvCallDTO agvCallDTO = new AgvCallDTO();
+        agvCallDTO.setLocationFrom(locationFrom);
+        agvCallDTO.setLocationTo(locationTo);
+        agvCallDTO.setCreateUser(createUser);
+        return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.SIXTEEN.getValue(), agvCallDTO);
+    }
 
     /**
      * 成品出库(硫酸镍)

+ 7 - 3
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -60,7 +60,7 @@ public class Constant {
          */
         SEVEN(7l),
         /**
-         * 成品下线(硫酸镍)->裹膜
+         * 成品下线(硫酸镍)->裹膜|成品暂存区
          */
         EIGHT(8l),
         /**
@@ -72,7 +72,7 @@ public class Constant {
          */
         TEN(10l),
         /**
-         * 成品下线(氯化镍)->裹膜
+         * 成品下线(氯化镍)->裹膜|成品暂存区
          */
         ELEVEN(11l),
         /**
@@ -90,7 +90,11 @@ public class Constant {
         /**
          * 成品出库(氯化镍)
          */
-        FIFTEEN(15l);
+        FIFTEEN(15l),
+        /**
+         * 成品中转(硫酸镍|氯化镍)-成品暂存区->裹膜
+         */
+        SIXTEEN(16l);
 
         private Long flowId;
 

+ 2 - 1
warewms-base/src/main/resources/mapper/base/BaseLocationInfoMapper.xml

@@ -503,7 +503,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from base_location_info b
         left join inv_lot_loc_id inv on b.id = inv.location_id
         left join inv_lot_att att on inv.lotnum = att.lotnum
-        where warehouse_id = #{warehouseId} and zone_id in
+        where warehouse_id = #{warehouseId} and b.is_empty = 'N'
+        and zone_id in
         <foreach item="item" collection="zoneId" open="(" separator="," close=")">
             #{item}
         </foreach>