自动化立体仓库 - WCS系统
Junjie
2023-11-27 5ac80d6a06f686a62c307c52c652e511e3896fb7
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
<?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="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
        where 1=1
        and task_no = #{taskNo}
    </select>
 
    <select id="selectByStartPoint" resultMap="BaseResultMap">
        select top 1 * from wcs_task_wrk
        where 1=1
        and io_type=3
        and start_point = #{startPoint}
    </select>
 
    <select id="selectByWrkNo" resultMap="BaseResultMap">
        select top 1 * from wcs_task_wrk
        where 1=1
        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>
 
    <select id="selectReceive" resultMap="BaseResultMap">
        select * from wcs_task_wrk
        where 1=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>
 
    <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>
 
    <select id="selectPakOut" resultMap="BaseResultMap">
        select * from dbo.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 dbo.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 dbo.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="selectCrnNoWorking" resultMap="BaseResultMap">
        select top 1 * from dbo.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 dbo.wcs_task_wrk
        where 1=1
        and (status=3 or status=4)
        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=3 or status=4)
    </insert>
 
</mapper>