|  |  |  | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Insert; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Select; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Update; | 
|---|
|  |  |  | import org.springframework.stereotype.Repository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface WrkMastMapper extends BaseMapper<WrkMast> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    @Select("select * from asr_wrk_mast where ((wrk_sts = 4 Or wrk_sts = 14 ) and io_type <> 103 and io_type <> 104 and io_type <> 107 ) or (wrk_sts = 2 and io_type=6) order by upd_mk,io_time,wrk_no") | 
|---|
|  |  |  | WrkMast selectByLocNo(@Param("sourceLocNo") String sourceLocNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectByLocNo1(@Param("sourceLocNo") String sourceLocNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    @Select("select * from asr_wrk_mast where ((wrk_sts = 4 Or wrk_sts = 14 ) and io_type <> 103 and io_type <> 104 and io_type <> 107 ) or (wrk_sts = 2 and io_type=6) order by upd_mk,io_time,wrk_no") | 
|---|
|  |  |  | List<WrkMast> selectToBeCompleteData(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<WrkMast> selectToBeHistoryData(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // wcs --------------------------------------------- | 
|---|
|  |  |  | // 入库第一步,扫码仪获取条码信息时查询 | 
|---|
|  |  |  | @Select("select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=2 and barcode=#{barcode} and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC") | 
|---|
|  |  |  | WrkMast selectPakInStep1(@Param("sourceStaNo")Integer sourceStaNo, @Param("barcode")String barcode); | 
|---|
|  |  |  | //    @Select("select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=2 and barcode=#{barcode} and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC") | 
|---|
|  |  |  | WrkMast selectPakInStep1(@Param("sourceStaNo") Integer sourceStaNo, @Param("barcode") String barcode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectPakInStep11(@Param("sourceStaNo") Integer sourceStaNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 入库第二步,当托盘物料在堆垛机入库站时时查询 | 
|---|
|  |  |  | @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no={crnNo} and wrk_no={workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC") | 
|---|
|  |  |  | WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo); | 
|---|
|  |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC") | 
|---|
|  |  |  | WrkMast selectPakInStep2(@Param("crnNo") Integer crnNo, @Param("workNo") Integer workNo, @Param("staNo") Integer staNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 入库第三步,当堆垛机把货放入库位时 | 
|---|
|  |  |  | //    @Select("select top 1 from dbo.asr_wrk_mast where wrk_no=#{workNo}") | 
|---|
|  |  |  | WrkMast selectPakInStep3(@Param("workNo") Integer workNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 拣料再入库时,站点有物且需求时查询 | 
|---|
|  |  |  | @Select("select top 1 * from asr_wrk_mast where wrk_no=#{workNo} and wrk_sts=14 and (io_type=103 or io_type=107 or io_type=104)") | 
|---|
|  |  |  | WrkMast selectPickStep(@Param("workNo")Integer workNo); | 
|---|
|  |  |  | //    @Select("select top 1 * from asr_wrk_mast where wrk_no=#{workNo} and wrk_sts=14 and (io_type=103 or io_type=107 or io_type=104)") | 
|---|
|  |  |  | WrkMast selectPickStep(@Param("barcode") String barcode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 出库第一步,从库位到堆垛机出库站 | 
|---|
|  |  |  | @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 selectPakOutStep1(@Param("crnNo")Integer crnNO); | 
|---|
|  |  |  | //    @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 selectPakOutStep1(@Param("crnNo") Integer crnNO, @Param("sourceStaNo") Integer sourceStaNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 出库第二步,从堆垛机出库站到目标出库站,堆垛机出库站有物时执行 | 
|---|
|  |  |  | @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") | 
|---|
|  |  |  | WrkMast selectPakOutStep2(@Param("sourceStaNo")Integer sourceStaNo); | 
|---|
|  |  |  | //    @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") | 
|---|
|  |  |  | WrkMast selectPakOutStep2(@Param("sourceStaNo") Integer sourceStaNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 库位移转工作档,在进行一次入出库作业后紧跟库位移转 | 
|---|
|  |  |  | //    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=11 and (io_type=11 or io_type=110) and crn_no=#{crnNo} order by io_time,wrk_no") | 
|---|
|  |  |  | WrkMast selectLocMove(@Param("crnNo") Integer crnNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectLocMoving(@Param("crnNo") Integer crnNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectWorking(@Param("crnNo") Integer crnNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // work log ------------------------------------------------------- | 
|---|
|  |  |  | @Insert("insert into asr_wrk_mast_log select * from asr_wrk_mast where wrk_no=#{workNo}") | 
|---|
|  |  |  | 
|---|
|  |  |  | @Insert("insert into asr_wrk_detl_log select * from asr_wrk_detl where wrk_no=#{workNo}") | 
|---|
|  |  |  | int saveWrkDetlLog(Integer workNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 通知档 ---------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // update 入库通知档 -- Y | 
|---|
|  |  |  | @Update("update cust_wait_pakin set io_status='Y' where zpallet = #{barcode}") | 
|---|
|  |  |  | int updateWaitPakInStep1(String barcode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // update 入库通知档  -- F | 
|---|
|  |  |  | @Update("update cust_wait_pakin set io_status='F' where zpallet = #{barcode}") | 
|---|
|  |  |  | int updateWaitPakInStep2(String barcode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    WrkMast selectWorkingPakin(); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //    WrkMast selectWorkingPakout(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机是否存在出库任务 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param crnNo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | WrkMast selectCrnWorking(@Param("crnNo") Integer crnNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 输送线是否存在入库任务 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param crnNo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | WrkMast selectDevWorking(@Param("crnNo") Integer crnNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<WrkMast> selectPick(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查找堆垛机号对应所有待出库工作档 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param crnNO | 
|---|
|  |  |  | * @param sourceStaNo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | List<WrkMast> selectPakOutStep11(@Param("crnNo") Integer crnNO, @Param("sourceStaNo") Integer sourceStaNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectWorkingPakin(@Param("sourceStaNo") Integer sourceStaNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WrkMast selectWorkingPakout(@Param("staNo") Integer staNo); | 
|---|
|  |  |  | } | 
|---|