chenlu
2024-06-07 2f640b1038fa331954f78ed1f4317212cf5bb34d
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?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.example.erp.mapper.pp.ReportingWorkDetailMapper">
    <!--返工新增-->
    <resultMap id="reworkAdd" type="com.example.erp.entity.pp.ReportingWorkDetail">
        <id column="id" property="id"/>
        <result column="rework_team" property="reworkTeam"/>
        <result column="breakage_quantity" property="breakageQuantity"/>
        <result column="return_process" property="returnProcess"/>
        <result column="breakage_reason" property="breakageReason"/>
        <result column="responsible_equipment" property="responsibleEquipment"/>
        <result column="responsible_team" property="responsibleTeam"/>
        <!--接收其他外键实体类数据-->
        <association property="reportingWork" javaType="com.example.erp.entity.pp.ReportingWork">
            <result column="process_id" property="processId"/>
        </association>
 
        <association property="order" javaType="com.example.erp.entity.sd.Order">
            <result column="order_id" property="orderId"/>
            <result column="project" property="project"/>
            <result column="batch" property="batch"/>
        </association>
 
        <association property="orderDetail" javaType="com.example.erp.entity.sd.OrderDetail">
            <result column="shape" property="shape"/>
 
        </association>
 
        <association property="orderGlassDetail" javaType="com.example.erp.entity.sd.OrderGlassDetail">
            <result column="glass_child" property="glassChild"/>
            <result column="order_number" property="orderNumber"/>
            <result column="technology_number" property="technologyNumber"/>
            <result column="glass_address" property="glassAddress"/>
            <result column="child_height" property="childHeight"/>
 
        </association>
 
        <!-- <result column="order_id" property="orderId"/>-->
 
    </resultMap>
 
    <!--返工管理页面-->
    <resultMap id="reworkManage" type="com.example.erp.entity.pp.ReportingWorkDetail">
 
        <id column="id" property="id"/>
        <result column="rework_team" property="reworkTeam"/>
        <result column="breakage_number" property="breakageNumber"/>
        <result column="return_process" property="returnProcess"/>
        <result column="breakage_reason" property="breakageReason"/>
        <result column="breakage_type" property="breakageType"/>
        <result column="responsible_equipment" property="responsibleEquipment"/>
        <result column="responsible_team" property="responsibleTeam"/>
        <result column="rework_area" property="reworkArea"/>
        <result column="order_number" property="orderNumber"/>
        <result column="quality_inspector" property="qualityInspector"/>
 
        <!--接收其他外键实体类数据-->
        <association property="reportingWork" javaType="com.example.erp.entity.pp.ReportingWork">
            <result column="process_id" property="processId"/>
        </association>
 
        <association property="order" javaType="com.example.erp.entity.sd.Order">
            <result column="order_id" property="orderId"/>
            <result column="project" property="project"/>
            <result column="batch" property="batch"/>
        </association>
 
        <association property="orderDetail" javaType="com.example.erp.entity.sd.OrderDetail">
            <result column="shape" property="shape"/>
        </association>
 
        <association property="orderGlassDetail" javaType="com.example.erp.entity.sd.OrderGlassDetail">
            <result column="glass_child" property="glassChild"/>
            <!--<result column="order_number" property="orderNumber"/>-->
            <result column="technology_number" property="technologyNumber"/>
            <result column="glass_address" property="glassAddress"/>
            <result column="child_height" property="childHeight"/>
            <result column="child_width" property="childWidth"/>
 
        </association>
        <association property="OrderProcessDetail" javaType="com.example.erp.entity.sd.OrderProcessDetail">
            <result column="reporting_work_num" property="reportingWorkNum"/>
        </association>
 
 
    </resultMap>
 
    <!--获取返工新增数据-->
    <select id="queryReworkAdd" resultMap="reworkAdd">
        select * from v_rework
        <where>
            rework_team is null
 
            <if test="order_id != null and order_id != ''">
                and order_id = #{order_id}
            </if>
 
            <if test="process_id != null and process_id != ''">
                and process_id = #{process_id}
            </if>
 
            <if test="project != null and project != ''">
                and project = #{project}
            </if>
        </where>
 
        order by id desc
        limit #{pageNum},#{pageSize}
        ;
    </select>
 
 
    <!--返工管理-->
    <select id="reworkDataManage" resultMap="reworkManage">
        select * from v_rework
 
 
 
        order by id desc
        limit #{pageNum},#{pageSize}
        ;
    </select>
 
 
    <!--返工管理-->
    <select id="reworkDataManage2" resultMap="reworkManage">
        select * from v_rework
 
        <where>
 
            /*create_time <![CDATA[>=]]> #{sDate} and create_time <![CDATA[<=]]> #{eDate}}*/
            /*大于等于,小于等于*/
            create_time &gt;= #{sDate} and create_time &lt;= #{eDate}}
 
            and rework_team is not null
 
            <if test="order_id != null and order_id != ''">
                and order_id = #{order_id}
            </if>
 
            <if test="process_id != null and process_id != ''">
                and process_id = #{process_id}
            </if>
 
            <if test="project != null and project != ''">
                and project = #{project}
            </if>
 
 
        </where>
 
        order by id desc
        limit #{pageNum},#{pageSize}
        ;
    </select>
 
 
 
    <!--查询detail明细-->
    <select id="reportingWorkId">
        select * from reporting_work_detail
        where reporting_work_id =  #{reportingWorkId}
    </select>
 
    <select id="selectInventory">
        select reporting_work_num
        FROM sd.order_process_detail as opd
        where opd.process_id = #{processId}
          and opd.order_number = #{orderNumber}
          and opd.technology_number = #{technologyNumber}
          and opd.process = '包装'
    </select>
    <!--<where>
 
            create_time <![CDATA[>=]]> #{startTime} and create_time <![CDATA[<=]]> #{endTime}}
            &lt;!&ndash;返工编号&ndash;&gt;
            <if test="rework_id!=null and rework != ''">
                and rework_id = #{reworkId}
            </if>
            &lt;!&ndash;流程卡号&ndash;&gt;
            <if test="process_id != null and process_id != ''">
                and process_id=#{processId}
            </if>
            &lt;!&ndash;返工类型&ndash;&gt;
            <if test="rework_Type != null and rework_Type!=''">
                and rework_Type=#{rework_Type}
            </if>
            &lt;!&ndash;返工原因&ndash;&gt;
            <if test="rework_Reason != null and rework_Reason!=''">
                and rework_Reason=#{rework_Reason}
            </if>
            &lt;!&ndash;返工工序&ndash;&gt;
            <if test="rework_Processes != null and rework_Processes!=''">
                and rework_Processes=#{rework_Processes}
            </if>
            &lt;!&ndash;返工数量&ndash;&gt;
            <if test="rework_Num != null and rework_Num!=''">
                and rework_Num=#{rework_Num}
            </if>
            &lt;!&ndash;返工班组&ndash;&gt;
            <if test="rework_Team != null and rework_Team!=''">
                and rework_Team=#{rework_Team}
            </if>
            &lt;!&ndash;审核人&ndash;&gt;
            <if test="reviewer != null and reviewer!=''">
                and reviewer=#{reviewer}
            </if>
            &lt;!&ndash;审核状态&ndash;&gt;
            <if test="review_Status != null and review_Status!=''">
                and review_Status=#{review_Status}
            </if>
            &lt;!&ndash;返工面积&ndash;&gt;
            <if test="rework_Area != null and rework_Area!=''">
                and rework_Area=#{rework_Area}
            </if>
 
        </where>-->
 
    <!--获取返工新增数据-->
    <!--<select id="getReworkAdd">
        SELECT `b`.`id`                                                                                 AS `id`,
               `b`.`rework_team`                                                                        AS `rework_team`,
               `c`.`order_id`                                                                           AS `order_id`,
               `a`.`process_id`                                                                         AS `process_id`,
               `c`.`project`                                                                            AS `project`,
               `c`.`batch`                                                                              AS `batch`,
               `d`.`glass_child`                                                                        AS `glass_child`,
               `d`.`order_number`                                                                       AS `order_Number`,
               `d`.`technology_number`                                                                  AS `technology_number`,
               `d`.`glass_address`                                                                      AS `glass_address`,
               `b`.`breakage_number`                                                                    AS `breakage_number`,
               `d`.`child_width`                                                                        AS `child_width`,
               `d`.`child_height`                                                                       AS `child_height`,
               `e`.`shape`                                                                              AS `shape`,
               `b`.`return_process`                                                                     AS `return_process`,
               `b`.`breakage_reason`                                                                    AS `breakage_reason`,
               `b`.`responsible_equipment`                                                              AS `responsible_equipment`,
               `b`.`responsible_team`                                                                   AS `responsible_team`,
               round((((`d`.`child_width` * `d`.`child_height`) * `b`.`breakage_number`) / 1000000),
                     2)                                                                                 AS `rework_area`,
               `b`.`qualityIns_pector`                                                                  AS `qualityIns_pector`
        FROM ((((
            `reporting_work_detail` `b`
                LEFT JOIN `reporting_work` `a` ON ((
                `a`.`reporting_work_id` = `b`.`reporting_work_id`
                )))
            LEFT JOIN `sd`.`order` `c` ON ((
            `a`.`order_id` = `c`.`order_id`
            )))
            LEFT JOIN `sd`.`order_detail` `e` ON (((
                                                       `c`.`order_id` = `e`.`order_id`
                                                       )
            AND (`e`.`order_number` = `b`.`order_number`))))
            LEFT JOIN `sd`.`order_glass_detail` `d` ON (((
                                                             `d`.`order_id` = `c`.`order_id`
                                                             )
            AND (`b`.`order_number` = `d`.`order_number`)
            AND (`b`.`technology_number` = `d`.`technology_number`))))
        WHERE (
                  `b`.`available` = 1)
    </select>-->
 
 
 
</mapper>