czt
2025-06-12 930d29f39d115fe76c305af4320c2acbcb30c445
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
<?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.ld.igds.inout.mapper.InoutRecordMapper">
    <!-- 基本返回信息 -->
    <sql id="BASE_COLUMN">
        ID_
        as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        NOTICE_ID_ as noticeId,
        DEPOT_ID_ as depotId,
        TYPE_ as type,
        PROGRESS_ as progress,
        RECORD_STATUS_ as recordStatus,
        CUSTOMER_NAME_ as customerName,
        INTEL_CARD_ as intelCard,
        REGISTER_TIME_ as registerTime,
        REGISTER_USER_ as registerUser,
        USER_NAME_ as userName,
        USER_CONTACT_ as userContact,
        USER_ID_ as userId,
        USER_BIRTHDAY_ as userBirthday,
        USER_SEX_ as userSex,
        USER_NATION_ as userNation,
        USER_ADDRESS_ as userAddress,
        PLATE_NUM_ as plateNum,
        TRANS_TYPE_ as transType,
        FOOD_VARIETY_ as foodVariety,
        FOOD_TYPE_ as foodType,
        FOOD_LEVEL_ as foodLevel,
        FOOD_LOCATION_ID_ as foodLocationId,
        FOOD_LOCATION_ as foodLocation,
        FOOD_YEAR_ as foodYear,
        CHECK_STATUS_ as checkStatus,
        CHECK_USER_ as checkUser,
        CHECK_TIME_ as checkTime,
        SAMPLE_USER_ as sampleUser,
        SAMPLE_TIME_ as sampleTime,
        SAMPLE_TYPE_ as sampleType,
        CHECK_ID_ as checkId,
        DE_CHECK_ as deCheck,
        ADD_CHECK_ as addCheck,
        jjlx as jjlx,
        FULL_WEIGHT_ as fullWeight,
        FULL_WEIGHT_TIME_ as fullWeightTime,
        FULL_WEIGHT_USER_ as fullWeightUser,
        EMPTY_WEIGHT_ as emptyWeight,
        EMPTY_WEIGHT_TIME_ as emptyWeightTime,
        EMPTY_WEIGHT_USER_ as emptyWeightUser,
        NET_WEIGHT_ as netWeight,
        DE_HANDLE_ as deHandle,
        DE_PACKAGE_ as dePackage,
        DE_OTHER_ as deOther,
        DE_OTHER_INTO_ as deOtherInfo,
        SETTLE_WEIGHT_ as settleWeight,
        RECORD_WEIGHT_ as recordWeight,
        PRICE_ as price,
        SETTLE_MONEY_ as settleMoney,
        SETTLE_ID_ as settleId,
        HANDLE_USER_ as handleUser,
        COMPLETE_TIME_ as completeTime,
        COMPLETE_USER_ as completeUser,
        REMARKS_ as remarks,
        bzw as bzw,
        dbz as dbz,
        bzbjs as bzbjs
    </sql>
 
    <!-- 根据条件查询,数据必须是流程中的数据 -->
    <select id="inoutProgressQuery" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.userId != null and param.userId != '' ">AND USER_ID_ = #{param.userId}</if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if>
            <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            AND PROGRESS_ != 'RECORD'
            AND RECORD_STATUS_ != 'DEL'
        </where>
    </select>
 
    <!-- 根据条件查询,要求时间条件必须,必须是正常数据 -->
    <select id="listRecordData" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if>
            <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            <if test="param.end != null">AND
                UPDATE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            <if test="param.start != null">AND
                UPDATE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            AND PROGRESS_ = 'RECORD'
            AND RECORD_STATUS_ != 'DEL'
            ORDER BY UPDATE_TIME_
        </where>
    </select>
 
    <!-- 根据条件查询,根据主键查询 -->
    <select id="inoutQueryById" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if>
            <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
        </where>
        AND ID_ = #{param.id}
    </select>
 
    <!-- 根据条件查询,获取最后一车信息 -->
    <select id="getLastRecord" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if>
            <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.userId != null and param.userId != '' ">AND USER_ID_ = #{param.userId}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            <if test="param.start != null">AND
                REGISTER_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                COMPLETE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        ORDER BY UPDATE_TIME_ DESC
        LIMIT 1
    </select>
 
    <!--根据参数获取系统中的个数 -->
    <select id="validateInoutData" parameterType="com.ld.igds.inout.dto.InoutParam"
            resultType="java.lang.Integer">
        select count(1) from D_INOUT_RECORD
        <where>
            <if test="param.companyId != null">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.intelCard != null and param.plateNum != null">
                AND ( INTEL_CARD_ = #{param.intelCard} OR PLATE_NUM_ = #{param.plateNum} )
            </if>
            and PROGRESS_ &lt;&gt; 'RECORD' and RECORD_STATUS_ != 'DEL'
        </where>
    </select>
 
    <update id="deleteData" parameterType="com.ld.igds.inout.dto.InoutParam">
        update D_INOUT_RECORD
        <set>
            RECORD_STATUS_ ='DEL',
            PROGRESS_ = 'RECORD',
            <if test="param.msg != null and param.msg != '' ">REMARKS_ = concat(REMARKS_,#{param.msg})</if>
        </set>
        where COMPANY_ID_ = #{param.companyId}
        AND ID_ = #{param.id}
    </update>
 
    <update id="inoutStop" parameterType="com.ld.igds.inout.dto.InoutParam">
        update D_INOUT_RECORD
        <set>
            PROGRESS_ = 'RECORD',
            <if test="param.recordStatus != null and param.recordStatus != '' ">RECORD_STATUS_ =
                #{param.recordStatus},
            </if>
            <if test="param.checkStatus != null and param.checkStatus != '' ">CHECK_STATUS_ = #{param.checkStatus},</if>
            <if test="param.msg != null and param.msg != '' ">REMARKS_ = concat(REMARKS_,#{param.msg}),</if>
            <if test="param.updateTime != null">UPDATE_TIME_ = #{param.updateTime}</if>
        </set>
 
        <where>
            COMPANY_ID_ = #{param.companyId}
            AND ID_ = #{param.id}
        </where>
    </update>
 
 
    <select id="getMaxId" parameterType="java.lang.String"
            resultType="java.util.Map">
        select MAX(ID_) AS maxId
        from D_INOUT_RECORD
        where company_Id_
            = #{companyId}
          and id_ like #{likeKey}
    </select>
 
    <update id="updateData" parameterType="com.ld.igds.inout.dto.InoutData">
        update D_INOUT_RECORD set
        TYPE_ = #{data.type},
        <if test="data.depotId != null">DEPOT_ID_ = #{data.depotId},</if>
        <if test="data.noticeId != null">NOTICE_ID_ = #{data.noticeId},</if>
        <if test="data.recordStatus != null">RECORD_STATUS_ = #{data.recordStatus},</if>
        <if test="data.checkStatus != null">CHECK_STATUS_ = #{data.checkStatus},</if>
        <if test="data.checkId != null">CHECK_ID_ = #{data.checkId},</if>
        <if test="data.checkUser != null">CHECK_USER_ = #{data.checkUser},</if>
        <if test="data.checkTime != null">CHECK_TIME_ = #{data.checkTime},</if>
        <if test="data.registerTime != null">REGISTER_TIME_ = #{data.registerTime},</if>
        <if test="data.registerUser != null">REGISTER_USER_ = #{data.registerUser},</if>
        <if test="data.userName != null">USER_NAME_ = #{data.userName},</if>
        <if test="data.userBirthday != null">USER_BIRTHDAY_ = #{data.userBirthday},</if>
        <if test="data.userSex != null">USER_SEX_ = #{data.userSex},</if>
        <if test="data.userNation != null">USER_NATION_ = #{data.userNation},</if>
        <if test="data.userId != null">USER_ID_ = #{data.userId},</if>
        <if test="data.userContact != null">USER_CONTACT_ = #{data.userContact},</if>
        <if test="data.userAddress != null">USER_ADDRESS_ = #{data.userAddress},</if>
        <if test="data.intelCard != null">INTEL_CARD_ = #{data.intelCard},</if>
        <if test="data.plateNum != null">PLATE_NUM_ = #{data.plateNum},</if>
        <if test="data.transType != null">TRANS_TYPE_ = #{data.transType},</if>
        <if test="data.customerName != null">CUSTOMER_NAME_ = #{data.customerName},</if>
        <if test="data.foodVariety != null">FOOD_VARIETY_ = #{data.foodVariety},</if>
        <if test="data.foodLevel != null">FOOD_LEVEL_ = #{data.foodLevel},</if>
        <if test="data.foodLocationId != null">FOOD_LOCATION_ID_ = #{data.foodLocationId},</if>
        <if test="data.foodLocation != null">FOOD_LOCATION_ = #{data.foodLocation},</if>
        <if test="data.foodYear != null">FOOD_YEAR_ = #{data.foodYear},</if>
        <if test="data.deHandle != null">DE_HANDLE_ = #{data.deHandle},</if>
        <if test="data.deOther != null">DE_OTHER_ = #{data.deOther},</if>
        <if test="data.dePackage != null">DE_PACKAGE_ = #{data.dePackage},</if>
        <if test="data.deOtherInfo != null">DE_OTHER_INTO_ = #{data.deOtherInfo},</if>
        <if test="data.fullWeight != null">FULL_WEIGHT_ = #{data.fullWeight},</if>
        <if test="data.fullWeightTime != null">FULL_WEIGHT_TIME_ = #{data.fullWeightTime},</if>
        <if test="data.fullWeightUser != null">FULL_WEIGHT_USER_ = #{data.fullWeightUser},</if>
        <if test="data.emptyWeight != null">EMPTY_WEIGHT_ = #{data.emptyWeight},</if>
        <if test="data.emptyWeightTime != null">EMPTY_WEIGHT_TIME_ = #{data.emptyWeightTime},</if>
        <if test="data.emptyWeightUser != null">EMPTY_WEIGHT_USER_ = #{data.emptyWeightUser},</if>
        <if test="data.netWeight != null">NET_WEIGHT_ = #{data.netWeight},</if>
        <if test="data.settleId != null">SETTLE_ID_ = #{data.settleId},</if>
        <if test="data.settleWeight != null">SETTLE_WEIGHT_ = #{data.settleWeight},</if>
        <if test="data.recordWeight != null">RECORD_WEIGHT_ = #{data.recordWeight},</if>
        <if test="data.handleUser != null">HANDLE_USER_ = #{data.handleUser},</if>
        <if test="data.completeTime != null">COMPLETE_TIME_ = #{data.completeTime},</if>
        <if test="data.completeUser != null">COMPLETE_USER_ = #{data.completeUser},</if>
        <if test="data.remarks != null">REMARKS_ = #{data.remarks},</if>
        <if test="data.foodType != null">FOOD_TYPE_ = #{data.foodType},</if>
        <if test="data.price != null">PRICE_ = #{data.price},</if>
        <if test="data.bzw != null">bzw = #{data.bzw},</if>
        <if test="data.bzw != null">bzbjs = #{data.bzbjs},</if>
        <if test="data.dbz != null">dbz = #{data.dbz},</if>
        <if test="data.settleMoney != null">SETTLE_MONEY_ = #{data.settleMoney},</if>
        PROGRESS_ = #{data.progress}
        where
        company_id_ =#{data.companyId}
        and id_=#{data.id}
    </update>
 
    <update id="updateDataByHandle" parameterType="com.ld.igds.inout.dto.InoutData">
        update D_INOUT_RECORD
        <trim prefix="SET" suffixOverrides=",">
            <if test="data.deHandle != null">DE_HANDLE_ = #{data.deHandle},</if>
            <if test="data.handleUser != null">HANDLE_USER_ = #{data.handleUser},</if>
            <if test="data.deOther != null">DE_OTHER_ = #{data.deOther},</if>
            <if test="data.deOtherInfo != null">DE_OTHER_INTO_ = #{data.deOtherInfo},</if>
            <if test="data.dePackage != null">DE_PACKAGE_ = #{data.dePackage},</if>
            <if test="data.bzw != null">bzw = #{data.bzw},</if>
            <if test="data.dbz != null">dbz = #{data.dbz},</if>
            <if test="data.bzbjs != null">bzbjs = #{data.bzbjs},</if>
            <if test="data.progress != null">PROGRESS_ = #{data.progress},</if>
            <if test="data.remarks != null">REMARKS_ = #{data.remarks},</if>
            <if test="data.updateTime != null">UPDATE_TIME_ = #{data.updateTime},</if>
        </trim>
        where
        company_id_ =#{data.companyId}
        and id_=#{data.id}
    </update>
 
 
    <!-- 新增数据 -->
    <insert id="insertData" parameterType="com.ld.igds.inout.dto.InoutData">
        insert into D_INOUT_RECORD(ID_,
                                   COMPANY_ID_,
                                   DEPT_ID_,
                                   NOTICE_ID_,
                                   DEPOT_ID_,
                                   TYPE_,
                                   PROGRESS_,
                                   RECORD_STATUS_,
                                   CUSTOMER_NAME_,
                                   INTEL_CARD_,
                                   REGISTER_TIME_,
                                   REGISTER_USER_,
                                   USER_NAME_,
                                   USER_CONTACT_,
                                   USER_ID_,
                                   USER_BIRTHDAY_,
                                   USER_SEX_,
                                   USER_NATION_,
                                   USER_ADDRESS_,
                                   PLATE_NUM_,
                                   TRANS_TYPE_,
                                   FOOD_VARIETY_,
                                   FOOD_TYPE_,
                                   FOOD_LEVEL_,
                                   FOOD_LOCATION_ID_,
                                   FOOD_LOCATION_,
                                   FOOD_YEAR_,
                                   CHECK_STATUS_,
                                   CHECK_USER_,
                                   CHECK_TIME_,
                                   SAMPLE_USER_,
                                   SAMPLE_TIME_,
                                   SAMPLE_TYPE_,
                                   CHECK_ID_,
                                   DE_CHECK_,
                                   ADD_CHECK_,
                                   jjlx,
                                   FULL_WEIGHT_,
                                   FULL_WEIGHT_TIME_,
                                   FULL_WEIGHT_USER_,
                                   EMPTY_WEIGHT_,
                                   EMPTY_WEIGHT_TIME_,
                                   EMPTY_WEIGHT_USER_,
                                   NET_WEIGHT_,
                                   DE_HANDLE_,
                                   DE_PACKAGE_,
                                   DE_OTHER_,
                                   DE_OTHER_INTO_,
                                   SETTLE_WEIGHT_,
                                   RECORD_WEIGHT_,
                                   PRICE_,
                                   SETTLE_MONEY_,
                                   SETTLE_ID_,
                                   HANDLE_USER_,
                                   COMPLETE_TIME_,
                                   COMPLETE_USER_,
                                   REMARKS_,
                                   bzw,
                                   dbz,
                                   bzbjs,
                                   UPDATE_TIME_)
        values (#{data.id},
                #{data.companyId},
                #{data.deptId},
                #{data.noticeId},
                #{data.depotId},
                #{data.type},
                #{data.progress},
                #{data.recordStatus},
                #{data.customerName},
                #{data.intelCard},
                #{data.registerTime},
                #{data.registerUser},
                #{data.userName},
                #{data.userContact},
                #{data.userId},
                #{data.userBirthday},
                #{data.userSex},
                #{data.userNation},
                #{data.userAddress},
                #{data.plateNum},
                #{data.transType},
                #{data.foodVariety},
                #{data.foodType},
                #{data.foodLevel},
                #{data.foodLocationId},
                #{data.foodLocation},
                #{data.foodYear},
                #{data.checkStatus},
                #{data.checkUser},
                #{data.checkTime},
                #{data.sampleUser},
                #{data.sampleTime},
                #{data.sampleType},
                #{data.checkId},
                #{data.deCheck},
                #{data.addCheck},
                #{data.jjlx},
                #{data.fullWeight},
                #{data.fullWeightTime},
                #{data.fullWeightUser},
                #{data.emptyWeight},
                #{data.emptyWeightTime},
                #{data.emptyWeightUser},
                #{data.netWeight},
                #{data.deHandle},
                #{data.dePackage},
                #{data.deOther},
                #{data.deOtherInfo},
                #{data.settleWeight},
                #{data.recordWeight},
                #{data.price},
                #{data.settleMoney},
                #{data.settleId},
                #{data.handleUser},
                #{data.completeTime},
                #{data.completeUser},
                #{data.remarks},
                #{data.bzw},
                #{data.dbz},
                #{data.bzbjs},
                #{data.updateTime})
    </insert>
 
    <select id="pageRecordData" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.foodVariety != null and param.foodVariety != '' ">AND FOOD_VARIETY_ = #{param.foodVariety}
            </if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ like #{param.plateNum}</if>
            <if test="param.customerId != null and param.customerId != '' ">AND CUSTOMER_ID_ = #{param.customerId}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            <if test="param.recordStatus != null and param.recordStatus != '' ">AND RECORD_STATUS_ =
                #{param.recordStatus}
            </if>
            <if test="param.userId != null and param.userId != '' ">AND USER_ID_ like #{param.userId}</if>
            <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if>
            <if test="param.checkId != null and param.checkId != '' ">AND CHECK_ID_ = #{param.checkId}</if>
            <if test="param.start != null">AND
                REGISTER_TIME_ <![CDATA[ >= ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                REGISTER_TIME_  <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            <if test="param.depotId != null and  param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.deptId != null and  param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if
                    test="param.customerName != null and param.customerName != '' and param.customerId == null ">AND
                CUSTOMER_NAME_ like CONCAT('%',#{param.customerName},'%')
            </if>
 
            <if test="param.checkStatus != null and param.checkStatus != 'NONE' ">AND CHECK_STATUS_ != 'NONE' AND
                CHECK_STATUS_ IS NOT NULL
            </if>
            <if test="param.checkStatus != null and param.checkStatus == 'NONE' ">AND CHECK_STATUS_ = 'NONE'</if>
 
        </where>
 
        <choose>
            <when test="param.recordStatus != null and param.recordStatus == 'DEL' ">
                AND RECORD_STATUS_ = 'DEL'
            </when>
            <otherwise>
                AND RECORD_STATUS_ != 'DEL'
            </otherwise>
        </choose>
 
 
        <choose>
            <when test="param.orderTag != null and param.orderTag == 'ASC' ">
                ORDER BY ID_ ASC
            </when>
 
            <otherwise>
                ORDER BY ID_ DESC
            </otherwise>
        </choose>
 
    </select>
 
 
    <!-- 完成出入库-->
    <update id="toComplete" parameterType="com.ld.igds.inout.dto.InoutParam">
        update D_INOUT_RECORD
        set PROGRESS_      = #{param.progress},
            COMPLETE_TIME_ =#{param.completeTime},
            COMPLETE_USER_ = #{param.userId},
            UPDATE_TIME_   = #{param.updateTime}
        where ID_ = #{param.id}
          and TYPE_ = #{param.type}
          and COMPANY_ID_ = #{param.companyId}
          and RECORD_STATUS_ != 'DEL'
    </update>
 
    <!-- 查询流程未完成的流水信息 -->
    <select id="pageUnCompleteData" resultType="com.ld.igds.inout.dto.InoutData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and  param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.depotId != null and  param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.customerName != null and param.customerName != '' ">AND CUSTOMER_NAME_ like
                #{param.customerName}
            </if>
            <if test="param.id != null and param.id != '' ">AND ID_ like #{param.id}</if>
            <if test="param.start != null">AND
                REGISTER_TIME_ <![CDATA[ >= ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            <if test="param.end != null">AND
                REGISTER_TIME_  <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        AND PROGRESS_ != 'RECORD'
        AND PROGRESS_ != 'PAY'
    </select>
 
 
    <!-- 获取开始周期-截至周期内,出入库入库重量汇总合计 -->
    <select id="sumRecordWeight" resultType="com.ld.igds.data.CommonData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select SUM(RECORD_WEIGHT_) as numValue1
        from D_INOUT_RECORD
        where
        PROGRESS_ = 'RECORD'
        AND RECORD_STATUS_ != 'DEL'
        <if test="param.type != null and param.type != ''">AND TYPE_ = #{param.type}</if>
        <if test="param.companyId != null and param.companyId != ''">AND COMPANY_ID_ = #{param.companyId}</if>
        <if test="param.deptId != null and param.deptId != ''">AND DEPT_ID_ = #{param.deptId}</if>
        <if test="param.depotId != null and param.depotId != ''">AND DEPOT_ID_ = #{param.depotId}</if>
        <if test="param.customerId != null and param.customerId != ''">AND CUSTOMER_ID_ = #{param.customerId}</if>
        <if test="param.foodVariety != null and param.foodVariety != ''">AND FOOD_VARIETY_ = #{param.foodVariety}</if>
        <if test="param.id != null and param.id != ''">AND NOTICE_ID_ = #{param.id}</if>
        <if test="param.start != null">AND
            UPDATE_TIME_  <![CDATA[ > ]]> #{param.start}
        </if>
        <if test="param.end != null">AND
            UPDATE_TIME_  <![CDATA[ < ]]> #{param.end}
        </if>
    </select>
 
    <!--根据车牌和卡号验证是否有重复信息-->
    <select id="checkExist" parameterType="com.ld.igds.inout.dto.InoutParam" resultType="int">
        select count(1)
        from
        D_INOUT_RECORD
        WHERE COMPANY_ID_ = #{param.companyId}
        AND TYPE_ = #{param.type}
        AND (PLATE_NUM_ = #{param.plateNum} or INTEL_CARD_ = #{param.intelCard})
        AND PROGRESS_ != 'RECORD'
        AND RECORD_STATUS_ != 'DEL'
        <if test="param.start != null">
            AND REGISTER_TIME_  <![CDATA[ > ]]> #{param.start,jdbcType=TIMESTAMP}
        </if>
    </select>
 
    <!-- 根据条件查询,要求时间条件必须,必须是正常数据 -->
    <select id="listLossOver" resultType="com.ld.igds.models.InoutLossOver"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        DEPOT_ID_ as depotId,
        TYPE_ as type,
        SUBMIT_TIME_ as submitTime,
        rkjz as rkjz,
        rksj as rksj,
        rksf as rksf,
        rkzz as rkzz,
        cksj as cksj,
        ckjz as ckjz,
        cksf as cksf,
        ckzz as ckzz,
        AMOUNT_ as amount,
        sysfzc as sysfzc,
        syyy as syyy,
        ccshr as ccshr,
        AUDIT_CCSH_ as auditCcsh,
        INFO_CCSH_ as InfoCcsh,
        zjshr as zjshr,
        AUDIT_ZJSH_ as auditZjsh,
        INFO_ZJSH_ as infoZjsh,
        AUDIT_TJSH_ as auditTjsh,
        INFO_TJSH_ as infoTjsh,
        kjshr as kjshr,
        AUDIT_KJSH_ as auditKjsh,
        INFO_KJSH_ as infoKjsh,
        ldshr as ldshr,
        AUDIT_LDSH_ as auditLdsh,
        INFO_LDSH_ as infoLdsh,
        REMARK_ as remark,
        UPDATE_TIME_ as updateTime,
        UPDATE_USER_ as updateUser
        from
        D_INOUT_LOSS_OVER
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != ''">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.end != null">AND
                UPDATE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            <if test="param.start != null">AND
                UPDATE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            ORDER BY UPDATE_TIME_
        </where>
    </select>
 
    <!-- 获取开始周期-截至周期内,出入库入库重量汇总合计 -->
    <select id="sumLossOverWeight" resultType="com.ld.igds.data.CommonData"
            parameterType="com.ld.igds.inout.dto.InoutParam">
        select SUM(AMOUNT_) as numValue1
        from D_INOUT_LOSS_OVER
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and param.deptId != ''">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if>
            <if test="param.end != null">AND
                UPDATE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP}
            </if>
            <if test="param.start != null">AND
                UPDATE_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP}
            </if>
            ORDER BY UPDATE_TIME_
        </where>
    </select>
 
</mapper>