Merge branch 'ynwcs' of http://47.97.1.152:5880/r/zy-wcs into ynwcs
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |  | 
 |  |  |     // 出库第一步,从库位到堆垛机出库站 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where crn_no=#{crnNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc") | 
 |  |  |     WrkMast selectPakOutStep111215(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |     WrkMast selectPakOutStep111215(@Param("crnNo")Integer crnNo, @Param("sourceStaNo")Integer sourceStaNo); | 
 |  |  |  | 
 |  |  |     List<WrkMast> selectWorkingOfPakOutBySource(@Param("locNos") List<String> locNos); | 
 |  |  |  | 
 |  |  |     // 出库第二步,从堆垛机出库站到目标出库站,堆垛机出库站有物时执行 | 
 |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=12 and io_type>100 order by io_pri desc,io_time desc,wrk_no ASC") | 
 
 |  |  | 
 |  |  |                 log.error("出库操作库位状态不符合--状态, 库位号={},库位状态={}", wrkMast.getLocNo(), sourceSta.getLocSts()); | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 判断是否有同库位组的出库任务,如果有,则暂停 | 
 |  |  |             List<String> outsideLoc = Utils.getGroupOutsideLoc(wrkMast.getSourceLocNo()); | 
 |  |  |             if (!Cools.isEmpty(outsideLoc)) { | 
 |  |  |                 if (!Cools.isEmpty(wrkMastMapper.selectWorkingOfPakOutBySource(outsideLoc))) { | 
 |  |  |                     log.warn("{}工作档出库失败,原因:外层库位{}正在执行出库任务!", wrkMast.getWrkNo(), JSON.toJSONString(outsideLoc)); | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             // 获取堆垛机出库站信息 | 
 |  |  |             DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); | 
 |  |  |             StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); | 
 
 |  |  | 
 |  |  |  | 
 |  |  | import java.text.DecimalFormat; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Arrays; | 
 |  |  | import java.util.Collections; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |         return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 外侧方向的货位  优先入库方向/优先出库方向 ===>> 反之 | 
 |  |  |     public static List<String> getGroupOutsideLoc(String locNo){ | 
 |  |  |         int row = getRow(locNo); | 
 |  |  |         List<String> result = new ArrayList<>(); | 
 |  |  |         if (FIRST_GROUP_ROW_LIST.contains(row)) { | 
 |  |  |             for (Integer integer : FIRST_GROUP_ROW_LIST) { | 
 |  |  |                 if (integer < row) { | 
 |  |  |                     result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); | 
 |  |  |                 } else { | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } else if (SECOND_GROUP_ROW_LIST.contains(row)) { | 
 |  |  |             List<Integer> clone = Arrays.asList(new Integer[SECOND_GROUP_ROW_LIST.size()]); | 
 |  |  |             Collections.copy(clone, SECOND_GROUP_ROW_LIST); | 
 |  |  |             Collections.reverse(clone); | 
 |  |  |             for (Integer integer : clone) { | 
 |  |  |                 if (integer > row) { | 
 |  |  |                     result.add(zerofill(String.valueOf(integer), 2) + locNo.substring(2)); | 
 |  |  |                 } else { | 
 |  |  |                     break; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  | //            throw new RuntimeException("库位解析异常"); | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(result)) { | 
 |  |  |             Collections.reverse(result); | 
 |  |  |         } | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     <select id="selectPakOutStep111215" resultMap="BaseResultMap"> | 
 |  |  |         select top 1 * from dbo.asr_wrk_mast where crn_no=#{crnNo} and wrk_sts in (11,12,13,14,15, 16) and io_type>100 order by io_pri desc,io_time,wrk_no asc | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectWorkingOfPakOutBySource" resultMap="BaseResultMap"> | 
 |  |  |         select * from dbo.asr_wrk_mast | 
 |  |  |         where 1=1 | 
 |  |  |         and source_loc_no in | 
 |  |  |         <foreach item="item" collection="locNos" index="index"  separator="," open="(" close=")"> | 
 |  |  |             #{item} | 
 |  |  |         </foreach> | 
 |  |  |         and wrk_sts in (11,12,13,14,15,16) and io_type>100 order by io_pri desc,io_time,wrk_no asc | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectPakOutStep16" resultMap="BaseResultMap"> |