Procházet zdrojové kódy

华兰:PDA接口+调试修改

k před 2 roky
rodič
revize
de5490012d

+ 35 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaBasLocationInfoController.java

@@ -0,0 +1,35 @@
+package com.ruoyi.web.controller.warewms.pda;
+
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author JWK
+ * @version 1.0
+ * @date 2022/11/14 14:52
+ */
+@RestController
+@RequestMapping("/pda/basLoc")
+public class PdaBasLocationInfoController {
+
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
+
+
+    /**
+     * 获取库位列表
+     */
+    @GetMapping("/list")
+    public AjaxResult list(BaseLocationInfo baseLocationInfo) {
+        List<BaseLocationInfo> list = baseLocationInfoService.selectBaseLocationInfoList(baseLocationInfo);
+        return AjaxResult.success("", list);
+    }
+
+}

+ 35 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaBasLocationZoneController.java

@@ -0,0 +1,35 @@
+package com.ruoyi.web.controller.warewms.pda;
+
+import com.ruoyi.base.domain.BaseLocationZone;
+import com.ruoyi.base.service.IBaseLocationZoneService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author JWK
+ * @version 1.0
+ * @date 2022/11/14 14:52
+ */
+@RestController
+@RequestMapping("/pda/basZone")
+public class PdaBasLocationZoneController {
+
+    @Autowired
+    private IBaseLocationZoneService iBaseLocationZoneService;
+
+
+    /**
+     * 获取库区列表
+     */
+    @GetMapping("/list")
+    public AjaxResult list(BaseLocationZone baseLocationZone) {
+        List<BaseLocationZone> list = iBaseLocationZoneService.selectBaseLocationZoneList(baseLocationZone);
+        return AjaxResult.success("", list);
+    }
+
+}

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

@@ -8,7 +8,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,7 +29,7 @@ public class PdaDocAsnController {
 
     @ApiOperation("入库位->接驳位任务下发")
     @PostMapping("inToTran")
-    public AjaxResult inToTran(@Validated @RequestBody AgvCallItem agvCallItem) {
+    public AjaxResult inToTran(@RequestBody AgvCallItem agvCallItem) {
         if (StringUtils.isEmpty(agvCallItem.getLocationFrom())) {
             return AjaxResult.error("起始库位不可为空!");
         }

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaDocSoController.java

@@ -30,9 +30,9 @@ public class PdaDocSoController {
     @ApiOperation("出库位->接驳位任务下发")
     @PostMapping("outToTran")
     public AjaxResult outToTran(@RequestBody AgvCallItem agvCallItem) {
-        if (StringUtils.isEmpty(agvCallItem.getLocationTo())) {
-            return AjaxResult.error("目标库位不可为空!");
-        }
+//        if (StringUtils.isEmpty(agvCallItem.getLocationTo())) {
+//            return AjaxResult.error("目标库位不可为空!");
+//        }
         return businessService.agvCall(agvCallItem, Constant.STO_TRAN_FLOW_ID);
     }
 }

+ 22 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaInvLotLocIdController.java

@@ -1,8 +1,11 @@
 package com.ruoyi.web.controller.warewms.pda;
 
+import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
 import com.ruoyi.ams.inv.form.InvMovePalletForm;
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.common.annotation.Log;
@@ -13,10 +16,10 @@ import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-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;
+import java.util.stream.Collectors;
 
 /**
  * @author JWK
@@ -29,6 +32,21 @@ public class PdaInvLotLocIdController {
 
     @Autowired
     private IInvLotLocIdService invLotLocIdService;
+    @Autowired
+    private InvLotLocIdMapper invLotLocIdMapper;
+
+
+    @GetMapping("/getLotatt")
+    public AjaxResult getLotatt() {
+        InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+        invLocIdSearchFrom.setZoneId(Constant.ZONE_TYPE.STORAGE.getValue().toString());
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdMapper.selectInvLocIdLotattListGroupBy(invLocIdSearchFrom);
+        List<String> lists = invLotLocIdLotattVOList
+                .stream()
+                .map(v -> v.getLotatt01())
+                .collect(Collectors.toList());
+        return AjaxResult.success("", lists);
+    }
 
 
     /**

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

@@ -66,7 +66,7 @@ testtag:
 # 日志配置
 logging:
     level:
-        com.ruoyi: info
+        com.ruoyi: debug
         org.springframework: info
 
 

+ 1 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/thread/AutoTranSitTaskThread.java

@@ -1,6 +1,7 @@
 package com.ruoyi.ams.agv.ndc.thread;
 
 import com.ruoyi.ams.business.IBusinessService;
+import com.ruoyi.common.exception.ServiceException;
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j

+ 18 - 8
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -138,13 +138,15 @@ public class BusinessServiceImpl implements IBusinessService {
                 if (flowConfigHeaderVO.getFlowType().equals("ASN")) {
                     AgvCallItemDTO agvCall = agvCallDTO.getAgvCallItemDTOList().get(0);
                     List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
-                    List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), "shift_no + 0,shift_index");
+                    List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), "shift_no+ 0,shift_index");
                     locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "ASN", asnSoStrategy, agvCall, token);
                     locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "ASN", asnSoStrategy, agvCall, token);
                     //2.初始化库存
 //                    for (AgvCallItemDTO call : agvCallDTO.getAgvCallItemDTOList()) {
-//                        invLotLocIdService.deleteInvLotLocIdById(locationFrom.getId());
-//                        invLotLocIdService.initInv(locationFrom.getId().toString(), call.getSku(), Constant.CUSTOMER_ID, call.getQty(), call.getLotattDTO(), BigDecimal.ZERO);
+//                        if (call.getLotattDTO() != null) {
+//                            invLotLocIdService.deleteInvLotLocIdById(locationFrom.getId());
+//                            invLotLocIdService.initInv(locationFrom.getId().toString(), call.getSku(), Constant.CUSTOMER_ID, call.getQty(), call.getLotattDTO(), BigDecimal.ZERO);
+//                        }
 //                    }
                     wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
 
@@ -166,14 +168,17 @@ public class BusinessServiceImpl implements IBusinessService {
                     locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "MV", asnSoStrategy, agvCall, token);
                     //2.初始化库存
                     for (AgvCallItemDTO call : agvCallDTO.getAgvCallItemDTOList()) {
-                        invLotLocIdService.deleteInvLotLocIdById(locationFrom.getId());
-                        invLotLocIdService.initInv(locationFrom.getId().toString(), call.getSku(), Constant.CUSTOMER_ID, call.getQty(), call.getLotattDTO(), BigDecimal.ZERO);
+                        if (call.getLotattDTO() != null) {
+                            invLotLocIdService.deleteInvLotLocIdById(locationFrom.getId());
+                            invLotLocIdService.initInv(locationFrom.getId().toString(), call.getSku(), Constant.CUSTOMER_ID, call.getQty(), call.getLotattDTO(), BigDecimal.ZERO);
+                        }
                     }
                     wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
                 }
             }
             return AjaxResult.success("任务下发成功");
         } catch (Exception e) {
+            redisCache.unlockCacheObject(token); // 异常捕获的话就不能释放锁
             throw new ServiceException(e.getMessage(), token);
         }
     }
@@ -309,6 +314,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     if (!b.getStockStatus().equals("00") || !b.getIsEmpty().equals("Y") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + b.getId())) {
                         continue;
                     }
+                    // todo 第六层不能放数量超过2的货
                     if (!redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + b.getId(), b.getId().toString(), token)) {
                         continue;
                     }
@@ -663,11 +669,15 @@ public class BusinessServiceImpl implements IBusinessService {
         for (BaseLocationInfo baseLocationInfo : baseLocationInfos) {
             // 判断是否有货并且空闲
             if (baseLocationInfo.getStockStatus().equals(Constant.STOCK_STATUS.STOCK00.getValue())
-                    && baseLocationInfo.getIsEmpty().equals(Constant.IS_YES.N)) {
+                    && baseLocationInfo.getIsEmpty().equals(Constant.IS_YES.N.name())) {
                 if (baseLocationInfo.getUserdefine1().equals("ASN")) {
-                    businessService.agvCall(null, Constant.TRAN_STO_FLOW_ID);
+                    AgvCallItem agvCallItem = new AgvCallItem();
+                    agvCallItem.setLocationFrom(baseLocationInfo.getLocationNo());
+                    businessService.agvCall(agvCallItem, Constant.TRAN_STO_FLOW_ID);
                 } else if (baseLocationInfo.getUserdefine1().equals("SO")) {
-                    businessService.agvCall(null, Constant.TRAN_OUT_FLOW_ID);
+                    AgvCallItem agvCallItem = new AgvCallItem();
+                    agvCallItem.setLocationFrom(baseLocationInfo.getLocationNo());
+                    businessService.agvCall(agvCallItem, Constant.TRAN_OUT_FLOW_ID);
                 }
             }
         }

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -119,6 +119,13 @@ public interface InvLotLocIdMapper {
      */
     List<BaseLocationLotattVO> selectInvZoneBySkuLotatt(@Param("sku") String sku, @Param("skuType") String skuType, @Param("lotattDTO") LotattDTO lotattDTO);
 
+    /**
+     * 获取批次列表
+     * @param invLocIdSearchFrom
+     * @return
+     */
+    List<InvLotLocIdLotattVO> selectInvLocIdLotattListGroupBy(InvLocIdSearchFrom invLocIdSearchFrom);
+
     /**
      * 查询物料批次信息列表
      *

+ 16 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -299,6 +299,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and bz.userdefine1 = 'INV'
     </select>
 
+    <select id="selectInvLocIdLotattListGroupBy" resultMap="InvLotLocIdLotattResult">
+        select
+        att.lotatt01
+        from inv_lot_loc_id inv
+        left join inv_lot_att att on inv.lotnum = att.lotnum
+        left join base_location_info b on inv.location_id = b.id
+        left join base_location_zone z on b.zone_id = z.zone_id
+        left join base_sku sk on inv.sku = sk.sku
+        <where>
+            1=1
+            <if test="zoneId != null  and zoneId != ''"> and b.zone_id = #{zoneId}</if>
+        </where>
+        group by att.lotatt01
+        order by att.lotatt01
+    </select>
+
     <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
         select
         inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated

+ 5 - 5
warewms-base/src/main/java/com/ruoyi/base/domain/BaseLocationInfo.java

@@ -142,7 +142,7 @@ public class BaseLocationInfo extends BaseEntity {
 
     private String userdefine10;
 
-    private String orderBy;
+    private String orderByClause;
 
     public void setId(Long id) {
         this.id = id;
@@ -392,12 +392,12 @@ public class BaseLocationInfo extends BaseEntity {
         this.weightLimit = weightLimit;
     }
 
-    public String getOrderBy() {
-        return orderBy;
+    public String getOrderByClause() {
+        return orderByClause;
     }
 
-    public void setOrderBy(String orderBy) {
-        this.orderBy = orderBy;
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
     }
 
     @Override

+ 2 - 1
warewms-base/src/main/java/com/ruoyi/base/mapper/BaseLocationInfoMapper.java

@@ -99,7 +99,8 @@ public interface BaseLocationInfoMapper {
      */
     List<BaseLocationLotattVO> selectSortedLocationLotattListByZoneIdList(@Param("zoneId") List<Long> zoneId, @Param("warehouseId") Long warehouseId, @Param("lotatt") Map<String, String> lotatt);
 
-    List<BaseLocationInfo> selectSortedLocationLotattListByZoneIdListOrderBy(@Param("zoneId") List<String> zoneId, @Param("warehouseId") Long warehouseId, @Param("lotatt") Map<String, String> lotatt,@Param("sku") String sku,@Param("orderBy") String orderBy);
+    List<BaseLocationInfo> selectSortedLocationLotattListByZoneIdListOrderBy(@Param("zoneId") List<String> zoneId, @Param("warehouseId") Long warehouseId
+            , @Param("lotatt") Map<String, String> lotatt,@Param("sku") String sku,@Param("orderByClause") String orderBy);
 
 
     List<BaseLocationLotattVO> selectSortedLocationLotattListByLocationIdList(@Param("locationId") List<Long> locationId, @Param("warehouseId") Long warehouseId, @Param("lotatt") Map<String, String> lotatt, @Param("sku") String sku);

+ 1 - 1
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseLocationInfoServiceImpl.java

@@ -181,7 +181,7 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
         BaseLocationInfo query = new BaseLocationInfo();
         query.setWarehouseId(warehouseId);
         query.setZoneId(zoneId);
-        query.setOrderBy(orderBy);
+        query.setOrderByClause(orderBy);
         return baseLocationInfoMapper.selectSortedLocationListByZoneId(query);
     }
 

+ 10 - 8
warewms-base/src/main/resources/mapper/base/BaseLocationInfoMapper.xml

@@ -175,7 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isEmpty != null  and isEmpty != ''"> and is_empty = #{isEmpty}</if>
             <if test="locationType != null  and locationType != ''"> and location_type = #{locationType}</if>
         </where>
-        order by create_time desc
+        order by location_no
     </select>
 
     <select id="selectBaseLocationInfoByLocationNo" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoResult">
@@ -322,10 +322,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectSortedLocationListByZoneId" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoResult">
         <include refid="selectBaseLocationInfoVo"/>
         where warehouse_id = #{warehouseId} and zone_id = #{zoneId}
-        <if test="orderBy != null">
-            orderBy #{orderBy}
+        <if test="orderByClause != null and orderByClause != ''" >
+            order by  ${orderByClause}
         </if>
-        <if test="orderBy == null">
+        <if test="orderByClause == null or orderByClause == ''">
             order by row_no + 0,row_index,shift_no + 0,shift_index,col_no + 0,col_index
         </if>
     </select>
@@ -465,6 +465,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="lotatt.lotatt18 != null and lotatt.lotatt18 != ''"> and att.lotatt18 = #{lotatt.lotatt18}</if>
         order by lpad(row_no, 11, '0'),row_index,lpad(shift_no, 11, '0'),shift_index,lpad(col_no, 11, '0'),col_index
     </select>
+
     <select id="selectSortedLocationLotattListByZoneIdListOrderBy" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoLotattResult">
         select b.id, b.warehouse_id, b.zone_id, b.location_no, b.location_barcode, b.row_no, b.row_index, b.col_no, b.col_index, b.shift_no,
         b.shift_index, b.stock_status, b.is_empty, b.bind_sku, b.location_type,  b.rack_id,  b.agv_station,  b.folded_tag,  b.folded_count,
@@ -496,12 +497,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="lotatt.lotatt16 != null and lotatt.lotatt16 != ''"> and att.lotatt16 = #{lotatt.lotatt16}</if>
         <if test="lotatt.lotatt17 != null and lotatt.lotatt17 != ''"> and att.lotatt17 = #{lotatt.lotatt17}</if>
         <if test="lotatt.lotatt18 != null and lotatt.lotatt18 != ''"> and att.lotatt18 = #{lotatt.lotatt18}</if>
-        <if test="orderBy != null">
-            order By #{orderBy}
+        <if test="orderByClause != null and orderByClause != ''" >
+            order by  ${orderByClause}
         </if>
-        <if test="orderBy == null">
+        <if test="orderByClause == null or orderByClause == ''">
             order by row_no + 0,row_index,shift_no + 0,shift_index,col_no + 0,col_index
-        </if>    </select>
+        </if>
+    </select>
 
     <select id="selectSortedLocationLotattListByLocationIdList" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoLotattResult">
         select b.id, b.warehouse_id, b.zone_id, b.location_no, b.location_barcode, b.row_no, b.row_index, b.col_no, b.col_index, b.shift_no,