cpT
2025-06-19 c1ef2d1fc4c0dae2bc8452924dcd77a0ff3a1ef5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?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.mapper.TaskWrkMapper">
 
    <!-- 通用查询映射结果 -->
    <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="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 "SOURCE"."wcs_task_wrk"
        where 1=1
        and "TASK_NO" = #{taskNo}
    </select>
 
    <select id="selectByStartPoint" resultMap="BaseResultMap">
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and "IO_TYPE"=3
        and "START_POINT" = #{startPoint}
    </select>
 
    <select id="selectByWrkNo" resultMap="BaseResultMap">
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and "WRK_NO" = #{wrkNo}
    </select>
 
    <select id="selectPakIn" resultMap="BaseResultMap">
        select top 1 * from "SOURCE"."wcs_task_wrk"
        where "STATUS"=1
        and "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>
 
    <select id="selectReceive" resultMap="BaseResultMap">
        select * from "SOURCE"."wcs_task_wrk"
        where 1=1
        and "STATUS" = 1
    </select>
 
    <select id="selectPakOutIoType" resultMap="BaseResultMap">
        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 "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 "SOURCE"."wcs_task_wrk"
        where "CRN_NO"=#{crnNo}
        <if test="targetPoint!=null and targetPoint!='' ">
            and "TARGET_POINT"=#{targetPoint}
        </if>
        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 "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","WRK_NO" ASC
    </select>
 
    <select id="selectCrnWorking" 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}
        order by "IO_PRI" desc,"CREATE_TIME","WRK_NO" ASC
    </select>
 
    <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
    </select>
 
    <select id="selectToBeHistoryData" resultMap="BaseResultMap">
        select * from "SOURCE"."wcs_task_wrk"
        where 1=1
        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 "SOURCE"."wcs_task_wrk_log"
        select * from "SOURCE"."wcs_task_wrk"
        where "TASK_NO" = #{taskNo}
          and ("STATUS"=5 or "STATUS"=4 or "STATUS"=7)
    </insert>
 
    <insert id="saveToHistoryD">
        insert into "SOURCE"."wcs_task_wrk_log" select * from "SOURCE"."wcs_task_wrk" where TASK_NO = #{taskNo}
    </insert>
 
    <select id="selectWorkingTask" resultMap="BaseResultMap">
        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>
 
    <sql id="batchSeq">
        <if test="wrkNo != null">
            and WRK_NO = #{wrkNo}
        </if>
        <if test="taskNo != null">
            and TASK_NO = #{taskNo}
        </if>
        <if test="status != null">
            and STATUS = #{status}
        </if>
        <if test="modiTimeStart != null ">
            <if test="modiTimeEnd != null ">
                and MODI_TIME between #{modiTimeStart} and #{modiTimeEnd}
            </if>
        </if>
    </sql>
 
 
    <select id="selectTaskWrkList" resultMap="BaseResultMap">
        SELECT * FROM "SOURCE"."wcs_task_wrk"
        WHERE 1=1
        <include refid="batchSeq"></include>
        ORDER BY CREATE_TIME DESC
        LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize});
    </select>
 
    <select id="selectTaskWrkListTotal" resultType="Long">
        SELECT count(1) FROM "SOURCE"."wcs_task_wrk"
        WHERE 1=1
        <include refid="batchSeq"></include>
    </select>
 
</mapper>