<?xml version="1.0" encoding="UTF-8"?> 
 | 
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
 | 
<mapper namespace="com.zy.asrs.common.wms.mapper.WrkMastMapper"> 
 | 
  
 | 
    <select id="selectToBeCompleteData" resultType="com.zy.asrs.common.wms.entity.WrkMast"> 
 | 
        select * from wms_wrk_mast where ((wrk_sts = 99 Or wrk_sts = 199 ) and io_type != 103 and io_type != 104 and io_type != 107 ) order by io_time,wrk_no 
 | 
    </select> 
 | 
  
 | 
    <select id="selectToBeHistoryData" resultType="com.zy.asrs.common.wms.entity.WrkMast"> 
 | 
        select * from wms_wrk_mast 
 | 
        where wrk_sts=100 
 | 
        or (wrk_sts=200 and ove_mk='Y' and wrk_no not in (select wrk_no from common_bas_devp where common_bas_devp.host_id = wms_wrk_mast.host_id)) 
 | 
        or (wrk_sts=200 and dateadd(mi,15,io_time) <= getdate() and wrk_no not in (select wrk_no from common_bas_devp where common_bas_devp.host_id = wms_wrk_mast.host_id)) 
 | 
        or (wrk_sts=200 and io_time is null and wrk_no not in (select wrk_no from common_bas_devp where common_bas_devp.host_id = wms_wrk_mast.host_id)) 
 | 
        order by io_time,wrk_no asc 
 | 
    </select> 
 | 
  
 | 
    <select id="selectSameLevMatnrs" resultType="com.zy.asrs.common.wms.entity.WrkMast"> 
 | 
        select m.loc_no 
 | 
        from wms_wrk_mast m, 
 | 
             wms_wrk_detl d, 
 | 
             common_loc_mast lm 
 | 
        where m.id = d.wrk_mast_id 
 | 
          and m.loc_no = lm.loc_no 
 | 
          and m.host_id = lm.host_id 
 | 
          and io_type = 1 
 | 
          and wrk_sts < 99 
 | 
          and d.matnr = #{matnr} 
 | 
          <if test="batch != null and batch != ''"> 
 | 
              and d.batch = #{batch} 
 | 
          </if> 
 | 
          <if test="hostId != null"> 
 | 
              and lm.host_id = #{hostId} 
 | 
          </if> 
 | 
          <if test="locRangeDto != null"> 
 | 
              <if test="locRangeDto.startRow"> 
 | 
                  and lm.row1 >= #{locRangeDto.startRow} 
 | 
              </if> 
 | 
              <if test="locRangeDto.targetRow"> 
 | 
                  and lm.row1 <= #{locRangeDto.targetRow} 
 | 
              </if> 
 | 
              <if test="locRangeDto.startBay"> 
 | 
                  and lm.bay1 >= #{locRangeDto.startBay} 
 | 
              </if> 
 | 
              <if test="locRangeDto.targetBay"> 
 | 
                  and lm.bay1 <= #{locRangeDto.targetBay} 
 | 
              </if> 
 | 
              <if test="locRangeDto.startLev"> 
 | 
                  and lm.lev1 >= #{locRangeDto.startLev} 
 | 
              </if> 
 | 
              <if test="locRangeDto.targetLev"> 
 | 
                  and lm.lev1 <= #{locRangeDto.targetLev} 
 | 
              </if> 
 | 
          </if> 
 | 
        ORDER BY m.wrk_no desc; 
 | 
    </select> 
 | 
  
 | 
</mapper> 
 |