yangys
2024-10-15 131d4bcb26e721c09c89d330f78639af7a0eda72
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
<?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.qianwen.smartman.modules.coproduction.mapper.OrderReportRecordMapper">
 
    <select id="getOrderHead" resultType="com.qianwen.smartman.modules.coproduction.dto.OrderReportDTO">
        select op.plan_id                                        as planId,
               op.order_id                                       as orderId,
               op.process_code                                   as processCode,
               op.process_name                                   as processName,
               pr.name                                           as productName,
               o.assign_num                                      as assignNum,
               (op.qualify_num + op.scrapped_num)                as workReportedNum,
               (op.input_num - op.qualify_num - op.scrapped_num) as stayReportedNum
        from blade_order_process op
                 left join blade_order o on op.order_id = o.id and o.is_deleted = 0
                 left join blade_plan p on p.id = op.plan_id and p.is_deleted = 0
                 left join blade_product pr on pr.id = p.product_id and pr.is_deleted = 0
        WHERE op.is_deleted = 0
          and op.id = #{orderProcessId}
    </select>
 
    <sql id="orderReportRecordColumnSql">
        borr
        .
        id
        ,
        bp.product_id                        as product,
        bp.product_name                      as productName,
        bp.product_code                      as productCode,
        pro.standard_model                   as standardModel,
        borr.plan_id                         as planId,
        borr.order_id                        as orderId,
        borr.process_id                      as orderProcessId,
        bop.process_code                     as processCode,
        bop.process_name                     as processName,
        borr.workstation_id                  as workstationId,
        bw.code                              as workstationCode,
        borr.workstation_name                as workstationName,
        borr.producer_user_id                as workEmployeeId,
        borr.producer_user_code              as workEmployeeCode,
        borr.producer_user_name              as workEmployeeName,
        borr.workshop_user_id                as reportEmployeeId,
        borr.workshop_user_code              as reportEmployeeCode,
        borr.workshop_user_name              as reportEmployeeName,
        bo.assign_num                        as assignNum,
        borr.qualify_num + borr.scrapped_num as reportNum,
        borr.qualify_num                     as qualifnum,
        borr.start_time                      as startTime,
        borr.workshop_time                   as endTime,
        borr.remark                          as remark,
        borr.record_status                   as recordStatus,
        borr.scrapped_num                    as scrappedNum,
        borr.system_or_ordinary as systemOrOrdinary
    </sql>
 
    <select id="pageQuery" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderReportRecordResVO">
        select
        <include refid="orderReportRecordColumnSql"/>
        from blade_order_report_record borr
        left join blade_plan bp on borr.plan_id = bp.id
        left join blade_product pro on bp.product_id = pro.id
        left join blade_order bo on borr.order_id = bo.id
        left join blade_order_process bop on borr.process_id = bop.id
        left join blade_workstation bw on borr.workstation_id = bw.id
        where borr.is_deleted = 0
        and borr.open_sequence_id is null
        <if test="ew != null">
            and ${ew.sqlSegment}
        </if>
    </select>
 
    <select id="recordExport" resultType="com.qianwen.smartman.modules.coproduction.vo.OrderReportRecordResVO">
        select
        <include refid="orderReportRecordColumnSql"/>
        from blade_order_report_record borr
        left join blade_plan bp on borr.plan_id = bp.id
        left join blade_product pro on bp.product_id = pro.id
        left join blade_order bo on borr.order_id = bo.id
        left join blade_order_process bop on borr.process_id = bop.id
        left join blade_workstation bw on borr.workstation_id = bw.id
        where borr.is_deleted = 0
        and borr.open_sequence_id is null
        <if test="ew != null">
            and ${ew.sqlSegment}
        </if>
    </select>
</mapper>