Bläddra i källkod

出入库bug修改

dfsfs 1 år sedan
förälder
incheckning
e3a2a654b6

+ 55 - 54
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -154,48 +154,45 @@ public class BusinessServiceImpl implements IBusinessService {
 
                     // ASN类型的且要到仓储区的任务进行判断入库条件
                     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"))){
+                            || flowConfigHeaderVO.getId().equals(Long.valueOf("12"))
+                            || flowConfigHeaderVO.getId().equals(Long.valueOf("13"))) {
                         // 查询同班组的库存
-                        List<AgvCallItemDTO> agvCallItemDTOList = agvCallDTO.getAgvCallItemDTOList();
-                        if (agvCallItemDTOList != null && agvCallItemDTOList.size() >= 0){
-                            String team = agvCallItemDTOList.get(0).getLotattDTO().getLotatt09();
-                            List<BaseLocationInfo> locationInfos = new ArrayList();
-                            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());
-                                for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOS){
-                                    // 库存当前某列有不同班组
-                                    if (Objects.nonNull(invLotLocIdLotattVO) && !invLotLocIdLotattVO.getLotatt09().equals(team)){
-                                        // 标记当前列不分配
-                                        columnAvailable = false;
-                                        currentColNo = baseLocationInfo.getColNo();
-                                        currentZoneId = baseLocationInfo.getZoneId();
-                                        log.info("==========当前库位有不同班组批次{}{}",baseLocationInfo,invLotLocIdLotattVO.getLotatt09());
-                                        break;
-                                    }
+                        String team = agvCallDTO.getTeamNo();
+                        List<BaseLocationInfo> locationInfos = new ArrayList();
+                        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());
+                            for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOS) {
+                                // 库存当前某列有不同班组
+                                if (Objects.nonNull(invLotLocIdLotattVO) && !invLotLocIdLotattVO.getLotatt09().equals(team)) {
+                                    // 标记当前列不分配
+                                    columnAvailable = false;
+                                    currentColNo = baseLocationInfo.getColNo();
+                                    currentZoneId = baseLocationInfo.getZoneId();
+                                    log.info("==========当前库位有不同班组批次{}{}", baseLocationInfo, invLotLocIdLotattVO.getLotatt09());
+                                    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());
-                                        continue;
-                                    }
-                                    locationInfos.add(baseLocationInfo);
+                            }
+                            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());
+                                    continue;
                                 }
+                                locationInfos.add(baseLocationInfo);
                             }
-                            locationToList = locationInfos;
                         }
+                        locationToList = locationInfos;
                     }
 
                     locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "ASN", asnSoStrategy, token, flowConfigHeaderVO.getId());
@@ -227,8 +224,8 @@ 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"),"同列有未完成的入库任务");
+                    if (flowConfigHeaderVO.getId().equals(Long.valueOf("14")) || flowConfigHeaderVO.getId().equals(Long.valueOf("15"))) {
+                        Assert.isTrue(checkWcsSameColumnNotFinish(locationFromListEnd, "SO"), "同列有未完成的入库任务");
                     }
 
                     locationFrom = this.zoneLocationAllocation(locationFromListEnd, "locationFrom", "SO", asnSoStrategy, token, flowConfigHeaderVO.getId());
@@ -259,18 +256,19 @@ public class BusinessServiceImpl implements IBusinessService {
 
     /**
      * 检查同列的未完成任务类型是否与当前任务类型一致
+     *
      * @param baseLocationInfoList
      * @param type
      * @return
      */
-    public Boolean checkWcsSameColumnNotFinish(List<BaseLocationInfo> baseLocationInfoList,String type){
+    public Boolean checkWcsSameColumnNotFinish(List<BaseLocationInfo> baseLocationInfoList, String type) {
         log.info("检查同列的未完成任务类型是否与当前任务类型一致============");
-        for(BaseLocationInfo locationInfo: baseLocationInfoList){
+        for (BaseLocationInfo locationInfo : baseLocationInfoList) {
             // 查询任务状态不为2(完成),6(卸货完成),7(取消)的同列任务
             List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnNotFinish(locationInfo.getColNo(),
                     locationInfo.getColIndex(), locationInfo.getZoneId(), Constant.WAREHOUSE_ID, type);
             // 如果同列有不同类型的未完成任务
-            if (blsList != null && blsList.size() > 0){
+            if (blsList != null && blsList.size() > 0) {
                 return false;
             }
         }
@@ -279,19 +277,20 @@ public class BusinessServiceImpl implements IBusinessService {
 
     /**
      * 检查同列的未完成任务类型及班组是否与当前任务类型一致
+     *
      * @param baseLocationInfoList
      * @param type
      * @return
      */
-    public List<BaseLocationInfo> checkWcsSameColumnAndTeamNotFinish(List<BaseLocationInfo> baseLocationInfoList,String type,String team){
+    public List<BaseLocationInfo> checkWcsSameColumnAndTeamNotFinish(List<BaseLocationInfo> baseLocationInfoList, String type, String team) {
         log.info("检查同列的未完成任务类型及班组是否与当前任务类型一致============");
         List<BaseLocationInfo> resultList = new ArrayList<>();
-        for(BaseLocationInfo locationInfo: baseLocationInfoList){
+        for (BaseLocationInfo locationInfo : baseLocationInfoList) {
             // 查询任务状态不为2(完成),6(卸货完成),7(取消)的同列任务
             List<BaseLocationInfo> blsList = baseLocationInfoService.selectWcsSameColumnAndTeamNotFinish(locationInfo.getColNo(),
                     team, locationInfo.getZoneId(), Constant.WAREHOUSE_ID, type);
             // 如果同列有不同类型的未完成任务
-            if (blsList != null && blsList.size() > 0){
+            if (blsList != null && blsList.size() > 0) {
                 resultList.addAll(blsList);
             }
         }
@@ -411,9 +410,9 @@ public class BusinessServiceImpl implements IBusinessService {
         if (locationType.equals("locationFrom")) {
 
             // 如果是从仓储区出库 调用无需判断阻挡的方法
-            if (type.equals("SO") && (flowId.equals(Long.valueOf("14")) || flowId.equals(Long.valueOf("15")))){
+            if (type.equals("SO") && (flowId.equals(Long.valueOf("14")) || flowId.equals(Long.valueOf("15")))) {
                 locationInfo = checkTheSameColumnLocationSO(locationInfoList, token);
-            }else {
+            } else {
                 locationInfo = checkTheSameColumnLocation(locationInfoList, token, false);
             }
 
@@ -429,9 +428,9 @@ 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"))) {
                 locationInfo = checkTheSameColumnLocationASN(locationInfoList, token, true);
-            }else {
+            } else {
                 locationInfo = checkTheSameColumnLocation(locationInfoList, token, true);
             }
             if (locationInfo == null) {
@@ -450,6 +449,7 @@ public class BusinessServiceImpl implements IBusinessService {
 
     /**
      * 入库判断目标点位
+     *
      * @param locationInfoList
      * @param token
      * @param isReleaseGoods
@@ -502,13 +502,13 @@ public class BusinessServiceImpl implements IBusinessService {
                     //同列是否有任务
                     List<BaseLocationInfo> occupyByLocs = baseLocationInfoMapper.queryByListOccupyByLoc(location);
                     if (occupyByLocs.size() > 0) {
-                        log.info("同列有任务=========={}",occupyByLocs);
+                        log.info("同列有任务=========={}", occupyByLocs);
                         continue;
                     }
                     //同列前方是否有阻挡
                     List<BaseLocationInfo> inStockByLocs = baseLocationInfoMapper.queryByListInStockByLoc(location);
                     if (inStockByLocs.size() > 0) {
-                        log.info("同列有阻挡=========={}",inStockByLocs);
+                        log.info("同列有阻挡=========={}", inStockByLocs);
                         continue;
                     }
                 }
@@ -539,6 +539,7 @@ public class BusinessServiceImpl implements IBusinessService {
 
     /**
      * AGV出库任务生成时的起始位置不判断是否阻挡
+     *
      * @param basLocationList
      * @param token
      * @return
@@ -746,7 +747,7 @@ public class BusinessServiceImpl implements IBusinessService {
     public AjaxResult sendTask(WcsTask wcsTask) {
         BaseLocationInfo locFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID);
         BaseLocationInfo locTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationTo(), Constant.WAREHOUSE_ID);
-        log.info("进入AMS任务下发=========={}",wcsTask);
+        log.info("进入AMS任务下发=========={}", wcsTask);
         AmsTask amsTask = new AmsTask();
         amsTask.setTaskNo(wcsTask.getTaskNo());
         if (wcsTask.getBusinessType() == null || wcsTask.getBusinessType().equals("")) {
@@ -761,11 +762,11 @@ public class BusinessServiceImpl implements IBusinessService {
         amsTask.setExt1(wcsTask.getExt1());
         amsTask.setExt2(wcsTask.getExt2());
         amsTask.setExt3(wcsTask.getExt3());
-        if(wcsTask.getBusinessType().equals(Constant.TASK_BUSINESS_TYPE.TASK_POWER.getValue())){
+        if (wcsTask.getBusinessType().equals(Constant.TASK_BUSINESS_TYPE.TASK_POWER.getValue())) {
             amsTask.setStFrom(Integer.valueOf(wcsTask.getLocationFrom()));
             amsTask.setStTo(Integer.valueOf(wcsTask.getLocationTo()));
             amsTask.setDeviceName(wcsTask.getDeviceName());
-        }else{
+        } else {
             amsTask.setStFrom(locFrom.getAgvStation().intValue());
             amsTask.setStTo(locTo.getAgvStation().intValue());
         }

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/AgvCallDTO.java

@@ -20,5 +20,9 @@ public class AgvCallDTO {
     private Boolean theWeighing; // 是否复称
     private Boolean asnType; // TRUE-中转入库  FALSE-中转入库
     private String ext3; //任务类型
+    /**
+     * 班组编号
+     */
+    private String teamNo;
     private List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
 }

+ 7 - 11
warewms-ams/src/main/java/com/ruoyi/ams/nieyan/service/impl/AgvCallProxyService.java

@@ -248,6 +248,7 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        agvCallDTO.setTeamNo(agvCallItemDTOList.get(0).getLotattDTO().getLotatt09());
         // 增加硫酸镍标识
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("Y"); //是否硫酸镍,Y代表是
@@ -275,6 +276,7 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        agvCallDTO.setTeamNo(agvCallItemDTOList.get(0).getLotattDTO().getLotatt09());
         // 增加硫酸镍标识
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("Y"); //是否硫酸镍,Y代表是
@@ -348,21 +350,11 @@ public class AgvCallProxyService {
         }
         AgvCallDTO agvCallDTO = new AgvCallDTO();
 
-        List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
-        AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
-        LotattDTO lotattDTO = new LotattDTO();
-        // 存放班组信息
-        lotattDTO.setLotatt09(invLotLocIdLotattVOList.get(0).getLotatt09());
-        agvCallItemDTO.setLotattDTO(lotattDTO);
-        agvCallItemDTOList.add(agvCallItemDTO);
-
-        agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
-
         agvCallDTO.setLocationFrom(locationFrom);
         agvCallDTO.setLocationTo(locationTo);
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
-
+        agvCallDTO.setTeamNo(invLotLocIdLotattVOList.get(0).getLotatt09());
         if (isLSN) {
             // 硫酸镍
             return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.TEN.getValue(), agvCallDTO);
@@ -391,6 +383,7 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        agvCallDTO.setTeamNo(agvCallItemDTOList.get(0).getLotattDTO().getLotatt09());
         // 增加氯化镍标识
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("N"); //是否硫酸镍,N代表否
@@ -418,6 +411,7 @@ public class AgvCallProxyService {
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        agvCallDTO.setTeamNo(agvCallItemDTOList.get(0).getLotattDTO().getLotatt09());
         // 增加氯化镍标识
         for (AgvCallItemDTO agvCallItemDTO : agvCallItemDTOList) {
             agvCallItemDTO.getLotattDTO().setLotatt18("N"); //是否硫酸镍,N代表否
@@ -461,6 +455,8 @@ public class AgvCallProxyService {
         agvCallDTO.setLocationTo(locationTo);
         agvCallDTO.setCreateUser(createUser);
         agvCallDTO.setTheWeighing(theWeighing);
+        agvCallDTO.setTeamNo(invLotLocIdLotattVOList.get(0).getLotatt09());
+
         if (isLSN) {
             // 硫酸镍
             return iBusinessService.agvCall(Constant.FLOW_CONFIG_ID.TEN.getValue(), agvCallDTO);