Browse Source

空托上料和废料搬运流程优化

dfsfs 1 năm trước cách đây
mục cha
commit
59fea10871

+ 74 - 24
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -152,7 +152,32 @@ public class BusinessServiceImpl implements IBusinessService {
                     List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
                     List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
 
-                    // ASN类型的且要到仓储区的任务进行判断入库条件
+                    // 如果是废料入库 需要判断同列是否有出库任务
+                    if (flowConfigHeaderVO.getId().equals(Long.valueOf("4"))
+                            || flowConfigHeaderVO.getId().equals(Long.valueOf("6"))) {
+                        String currentColNo = null;// 当前列
+                        Long currentZoneId = null; // 当前库区
+                        List<BaseLocationInfo> locationInfos = new ArrayList();
+                        for (BaseLocationInfo baseLocationInfo : locationToList) {
+                            // 如果当前库位的列和库区和标记的列和库区相同 跳过当前库位
+                            if (baseLocationInfo.getColNo().equals(currentColNo) && baseLocationInfo.getZoneId().equals(currentZoneId)) {
+                                continue;
+                            }
+                            boolean hasDiff = checkCurrentColumnDiffTaskType(baseLocationInfo, null);
+                            // 同列有未完成的其他类型任务
+                            if (hasDiff){
+                                // 记录当前库位区域和列id
+                                currentColNo = baseLocationInfo.getColNo();
+                                currentZoneId = baseLocationInfo.getZoneId();
+                                continue;
+                            }else {
+                                locationInfos.add(baseLocationInfo);
+                            }
+                        }
+                        locationToList = locationInfos;
+                    }
+
+                    // 如果是成品入库任务需要进行判断班组信息和同列是否有出库任务
                     if (flowConfigHeaderVO.getId().equals(Long.valueOf("9")) || flowConfigHeaderVO.getId().equals(Long.valueOf("10"))
                             || flowConfigHeaderVO.getId().equals(Long.valueOf("12"))
                             || flowConfigHeaderVO.getId().equals(Long.valueOf("13"))) {
@@ -162,11 +187,11 @@ public class BusinessServiceImpl implements IBusinessService {
                         String currentColNo = null;// 当前列
                         Long currentZoneId = null; // 当前库区
                         for (BaseLocationInfo baseLocationInfo : locationToList) {
-                            // 如果当前库位和标记的
+                            // 如果当前库位的列和库区和标记的列和库区相同 跳过当前库位
                             if (baseLocationInfo.getColNo().equals(currentColNo) && baseLocationInfo.getZoneId().equals(currentZoneId)) {
                                 continue;
                             }
-                            // 标记当前列分配
+                            // 标记当前列是否可分配
                             Boolean columnAvailable = true;
                             // 查询当前库位的库存包含批次属性
                             List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(baseLocationInfo.getId());
@@ -181,16 +206,16 @@ public class BusinessServiceImpl implements IBusinessService {
                                     break;
                                 }
                             }
-                            if (columnAvailable) { // 当前列同班组或者为空
-                                // 判断当前库位同列是否有不同类型任务
-                                List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnAndTeamNotFinish(baseLocationInfo.getColNo(),
-                                        team, baseLocationInfo.getZoneId(), Constant.WAREHOUSE_ID, "ASN");
-                                // 当前列有不同类型未完成任务 继续遍历下一库位
-                                if (blsList != null && blsList.size() > 0) {
-                                    log.info("==========当前库位同列有未完成的出库任务,库位编号{}列{}", baseLocationInfo.getId(), baseLocationInfo.getColNo());
+                            if (columnAvailable) {
+                                // 检查同列是否有不同班组的库存
+                                boolean hasDiff = checkCurrentColumnDiffTaskType(baseLocationInfo, team);
+                                if (hasDiff){
+                                    currentColNo = baseLocationInfo.getColNo();
+                                    currentZoneId = baseLocationInfo.getZoneId();
                                     continue;
+                                }else {
+                                    locationInfos.add(baseLocationInfo);
                                 }
-                                locationInfos.add(baseLocationInfo);
                             }
                         }
                         locationToList = locationInfos;
@@ -224,7 +249,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     }
                     List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
 
-                    // 如果是从仓储区出库的任务 检查同列未完成任务类型是否相同
+                    // 如果是从仓储区出库的任务 检查同列是否有未完成的其它类型任务
                     if (flowConfigHeaderVO.getId().equals(Long.valueOf("14")) || flowConfigHeaderVO.getId().equals(Long.valueOf("15"))) {
                         Assert.isTrue(checkWcsSameColumnNotFinish(locationFromListEnd, "SO"), "同列有未完成的入库任务");
                     }
@@ -256,7 +281,25 @@ public class BusinessServiceImpl implements IBusinessService {
     }
 
     /**
-     * 检查同列的未完成任务类型是否与当前任务类型一致
+     * 入库检查同列是否有出库类型(且不同班组)的任务
+     * @param baseLocationInfo
+     * @return
+     */
+    public boolean checkCurrentColumnDiffTaskType(BaseLocationInfo baseLocationInfo,String team){
+        log.info("============检查入库任务同列的未完成任务类型及班组是否与当前任务类型一致");
+        // 判断当前库位同列是否有不同类型任务
+        List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnAndTeamNotFinish(baseLocationInfo.getColNo(),
+                team, baseLocationInfo.getZoneId(), Constant.WAREHOUSE_ID, "ASN");
+        // 当前列有不同类型未完成任务 继续遍历下一库位
+        if (blsList != null && blsList.size() > 0) {
+            log.info("==========当前库位同列有未完成的出库任务,库位编号:{},列:{}", baseLocationInfo.getId(), baseLocationInfo.getColNo());
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 出库检查同列的未完成任务类型是否与当前任务类型一致
      *
      * @param baseLocationInfoList
      * @param type
@@ -270,6 +313,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     locationInfo.getColIndex(), locationInfo.getZoneId(), Constant.WAREHOUSE_ID, type);
             // 如果同列有不同类型的未完成任务
             if (blsList != null && blsList.size() > 0) {
+                log.info("==========当前库位同列有未完成的入库任务,库位编号:{},列:{}", locationInfo.getId(), locationInfo.getColNo());
                 return false;
             }
         }
@@ -429,7 +473,10 @@ public class BusinessServiceImpl implements IBusinessService {
             }
         } else {
             // 是到仓储区的入库任务
-            if (type.equals("ASN") && !flowId.equals(Long.valueOf("8")) && !flowId.equals(Long.valueOf("11"))) {
+            if (type.equals("ASN") && !flowId.equals(Long.valueOf("8"))
+                                    && !flowId.equals(Long.valueOf("11"))
+                                    && !flowId.equals(Long.valueOf("16"))) {
+                // 不判断同列任务和阻挡情况
                 locationInfo = checkTheSameColumnLocationASN(locationInfoList, token, true);
             } else {
                 locationInfo = checkTheSameColumnLocation(locationInfoList, token, true);
@@ -825,7 +872,7 @@ public class BusinessServiceImpl implements IBusinessService {
                         log.info("出库任务下发AMS调用AGV{}", JSON.toJSONString(wcsTask));
                         // 根据起始地查询库位信息
                         BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
-                        //同列外方是否有任务
+                        // 同列外方是否有任务
                         List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(baseLocationInfo);
                         if (occupyByLocs.size() > 0) {
                             log.info("同列外面有任务=========={}", occupyByLocs);
@@ -837,22 +884,25 @@ public class BusinessServiceImpl implements IBusinessService {
                             log.info("同列有阻挡=========={}", inStockByLocs);
                             continue;
                         }
-                    } else if (StringUtils.isNotEmpty(wcsTask.getExt7()) // 判断如果是入库任务
+                    } else if (StringUtils.isNotEmpty(wcsTask.getExt7()) // 判断如果是入库且到仓储区的任务
                             && (wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.NINE.getValue()))
                             || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.TEN.getValue()))
                             || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.TWELVE.getValue()))
-                            || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.THIRTEEN.getValue())))) {
+                            || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.THIRTEEN.getValue()))
+                            || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.FOUR.getValue()))
+                            || wcsTask.getExt7().equals(String.valueOf(Constant.FLOW_CONFIG_ID.SIX.getValue())))) {
                         log.info("入库任务下发AMS调用AGV{}", JSON.toJSONString(wcsTask));
                         // 根据起始地查询库位信息
                         BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
-                        //同列里面是否有任务
+                        // 同列里面是否有任务
                         List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLocOR(baseLocationInfo);
-                        for (int i=0 ; i < occupyByLocs.size(); i++){
-                           WcsTask wTask =  wcsTaskService.selectWcsTaskByLocationTo(occupyByLocs.get(i).getId());
-                           if(wTask != null){
-                               wcsTask.setRemark("目标库位同列后方存在未取货完成的任务,请等待!");
-                               break;
-                           }
+                        for (int i = 0; i < occupyByLocs.size(); i++) {
+                            // 查询前方是否有未取货完成的任务
+                            WcsTask wTask = wcsTaskService.selectWcsTaskByLocationTo(occupyByLocs.get(i).getId());
+                            if (wTask != null) {
+                                wcsTask.setRemark("目标库位同列后方存在未取货完成的任务,请等待!");
+                                break;
+                            }
                         }
                         //同列前方是否有阻挡
                         List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(baseLocationInfo);

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

@@ -494,6 +494,7 @@ public class AgvCallProxyService {
         // todo 判断起始库位库存需要是合格
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattByLocationId(Long.valueOf(locationFrom));
         if (invLotLocIdLotattVOList.size() == 0) {
+            log.info("=========所选库位无库存!:{}",locationFrom);
             return AjaxResult.error("所选库位无库存!");
         }
         AgvCallDTO agvCallDTO = new AgvCallDTO();

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

@@ -306,7 +306,7 @@ public interface IBaseLocationInfoService {
     List<BaseLocationInfo> selectEmptyLocationByZoneId(String zoneId);
 
     /**
-     * 检查同列的未完成任务类型是否与当前任务类型一致
+     * 出库检查同列的未完成任务类型是否与当前任务类型一致
      * @param colNo
      * @param colIndex
      * @param zoneId

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

@@ -707,7 +707,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and i.zone_id = #{zoneId}
         </if>
         <if test="type != null and type != '' and type == 'SO'">
-            and w.ext7 in ('9','10','12','13')
+            and w.ext7 in ('4','6','9','10','12','13')
         </if>
         <if test="type != null and type != '' and type == 'ASN'">
             and w.ext7 in ('14','15')
@@ -732,7 +732,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and b.zone_id = #{zoneId}
         </if>
         <if test="type != null and type != '' and type == 'SO'">
-            and w.ext7 in ('9','10','12','13')
+            and w.ext7 in ('4','6','9','10','12','13')
         </if>
         <if test="type != null and type != '' and type == 'ASN'">
             and w.ext7 in ('14','15')