*
lsh
2025-04-21 787ac0c93db67a3ead8e8dd306ad631ac8dd8a56
src/main/resources/mapper/TaskWrkMapper.xml
@@ -4,133 +4,140 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.TaskWrk">
        <result column="task_no" property="taskNo" />
        <result column="status" property="status" />
        <result column="wrk_no" property="wrkNo" />
        <result column="create_time" property="createTime" />
        <result column="io_type" property="ioType" />
        <result column="io_pri" property="ioPri" />
        <result column="start_point" property="startPoint" />
        <result column="target_point" property="targetPoint" />
        <result column="modi_user" property="modiUser" />
        <result column="modi_time" property="modiTime" />
        <result column="memo" property="memo" />
        <result column="barcode" property="barcode" />
        <result column="assign_time" property="assignTime" />
        <result column="execute_time" property="executeTime" />
        <result column="complete_time" property="completeTime" />
        <result column="cancel_time" property="cancelTime" />
        <result column="wrk_sts" property="wrkSts" />
        <result column="crn_no" property="crnNo" />
        <result column="command_step" property="commandStep" />
        <result column="transfer_mark" property="transferMark" />
        <result column="TASK_NO" property="taskNo" />
        <result column="STATUS" property="status" />
        <result column="WRK_NO" property="wrkNo" />
        <result column="CREATE_TIME" property="createTime" />
        <result column="IO_TYPE" property="ioType" />
        <result column="IO_PRI" property="ioPri" />
        <result column="START_POINT" property="startPoint" />
        <result column="TARGET_POINT" property="targetPoint" />
        <result column="ORIGIN_START_POINT" property="originStartPoint" />
        <result column="ORIGIN_TARGET_POINT" property="originTargetPoint" />
        <result column="SC_WEIGHT" property="scWeight" />
        <result column="MODI_USER" property="modiUser" />
        <result column="MODI_TIME" property="modiTime" />
        <result column="MEMO" property="memo" />
        <result column="BARCODE" property="barcode" />
        <result column="ASSIGN_TIME" property="assignTime" />
        <result column="EXECUTE_TIME" property="executeTime" />
        <result column="COMPLETE_TIME" property="completeTime" />
        <result column="CANCEL_TIME" property="cancelTime" />
        <result column="WRK_STS" property="wrkSts" />
        <result column="CRN_NO" property="crnNo" />
        <result column="COMMAND_STEP" property="commandStep" />
        <result column="TRANSFER_MARK" property="transferMark" />
    </resultMap>
    
    <select id="selectByTaskNo" resultMap="BaseResultMap">
        select top 1 * from wcs_task_wrk
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and task_no = #{taskNo}
        and "TASK_NO" = #{taskNo}
    </select>
    <select id="selectByStartPoint" resultMap="BaseResultMap">
        select top 1 * from wcs_task_wrk
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and io_type=3
        and start_point = #{startPoint}
        and "IO_TYPE"=3
        and "START_POINT" = #{startPoint}
    </select>
    <select id="selectByWrkNo" resultMap="BaseResultMap">
        select top 1 * from wcs_task_wrk
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and wrk_no = #{wrkNo}
        and "WRK_NO" = #{wrkNo}
    </select>
    <select id="selectPakIn" resultMap="BaseResultMap">
        select top 1 * from dbo.wcs_task_wrk
        where wrk_sts=2
        and crn_no=#{crnNo}
        and wrk_no=#{workNo}
        and start_point=#{startPoint}
        and io_type=1
        order by io_pri desc,create_time,wrk_no ASC
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where "STATUS"=1
        and "CRN_NO"=#{crnNo}
        and "WRK_NO"=#{workNo}
        and "START_POINT"=#{startPoint}
        and "IO_TYPE"=1
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectReceive" resultMap="BaseResultMap">
        select * from wcs_task_wrk
        select * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and status = 1
        and "STATUS" = 1
    </select>
    <select id="selectPakOutIoType" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        where crn_no=#{crnNo}
        and io_type = 3
        order by io_pri desc,create_time,wrk_no ASC
        select * from "SOURCE"."wcs_task_wrk"
        where "CRN_NO"=#{crnNo}
        and "IO_TYPE" = 3
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectCrnStaWorking" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        where crn_no=#{crnNo}
        and target_point=#{targetPoint}
        and wrk_sts=12
        and io_type = 2
        order by io_pri desc,create_time,wrk_no ASC
        select * from "SOURCE"."wcs_task_wrk"
        where "CRN_NO"=#{crnNo}
        and "TARGET_POINT"=#{targetPoint}
        and "WRK_STS"=13
        and "IO_TYPE" = 2
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectPakOut" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        where crn_no=#{crnNo}
        select * from "SOURCE"."wcs_task_wrk"
        where "CRN_NO"=#{crnNo}
        <if test="targetPoint!=null and targetPoint!='' ">
            and target_point=#{targetPoint}
            and "TARGET_POINT"=#{targetPoint}
        </if>
        and wrk_sts=11
        and io_type = 2
        order by io_pri desc,create_time,wrk_no ASC
        and "WRK_STS"=11
        and "IO_TYPE" = 2
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectPakOut3" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        where crn_no=#{crnNo}
        select * from "SOURCE"."wcs_task_wrk"
        where "CRN_NO"=#{crnNo}
--         and target_point=#{targetPoint}
        and wrk_sts=11
        and io_type = 3
        order by io_pri desc,create_time ASC
        and "WRK_STS"=11
        and "IO_TYPE" = 3
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectCrnWorking" resultMap="BaseResultMap">
        select top 1 * from dbo.wcs_task_wrk
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and (wrk_sts=3 or wrk_sts=12)
        and crn_no=#{crnNo}
        order by io_pri desc,create_time,wrk_no ASC
        and ("WRK_STS"=3 or "WRK_STS"=12)
        and "CRN_NO"=#{crnNo}
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectCrnNoWorking" resultMap="BaseResultMap">
        select top 1 * from dbo.wcs_task_wrk
    <select id="selectCrnNoInWorking" resultMap="BaseResultMap">
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and (wrk_sts=3 or wrk_sts=12)
        and crn_no=#{crnNo}
        and wrk_no=#{workNo}
        order by io_pri desc,create_time,wrk_no ASC
        and ("WRK_STS"=3 or "WRK_STS"=12)
        and "CRN_NO"=#{crnNo}
        and "WRK_NO"=#{workNo}
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <select id="selectToBeHistoryData" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        select * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and ((wrk_sts=14 and status=5) or status=4 or (wrk_sts=4 and status=5))
        order by io_pri desc,create_time,wrk_no ASC
        and (("WRK_STS"=14 and "STATUS"=5) or "STATUS"=7 or "STATUS"=4
                 or ("WRK_STS"=4 and "STATUS"=5))
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
    <insert id="saveToHistory">
        insert into wcs_task_wrk_log select * from wcs_task_wrk where task_no = #{taskNo} and (status=5 or status=4)
        insert into "SOURCE"."wcs_task_wrk_log"
        select * from "SOURCE"."wcs_task_wrk"
        where "TASK_NO" = #{taskNo}
          and ("STATUS"=5 or "STATUS"=4 or "STATUS"=6)
    </insert>
    <select id="selectWorkingTask" resultMap="BaseResultMap">
        select * from dbo.wcs_task_wrk
        where (wrk_sts=3 and io_type = 1)
        or (wrk_sts=12 and io_type = 2)
        order by io_pri desc,create_time,wrk_no ASC
        select * from "SOURCE"."wcs_task_wrk"
        where ("WRK_STS"=3 and "IO_TYPE" = 1)
        or ("WRK_STS"=12 and "IO_TYPE" = 2)
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
</mapper>