guoyuji
2024-12-10 7b0d59dbd16a0f90eec1ad35eff64cf40d3b97e7
north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -50,19 +50,20 @@
    </resultMap>
    <resultMap id="damageDetailsTableMap" type="com.example.erp.entity.pp.DamageDetails">
    <resultMap id="damageDetailsTableMap" type="com.example.erp.dto.pp.CrossProcessBreakingDTO">
        <result column="responsible_process" property="responsibleProcess"/>
        <result column="responsible_team" property="responsibleTeam"/>
        <result column="breakage_type" property="breakageType"/>
        <result column="breakage_reason" property="breakageReason"/>
        <result column="breakage_quantity" property="breakageQuantity"/>
        <result column="area" property="area"/>
        <result column="reporting_work_id" property="reportingWork.reportingWorkId"/>
        <result column="reporting_work_time" property="reportingWork.reportingWorkTime"/>
        <result column="this_process" property="reportingWork.thisProcess"/>
        <result column="project" property="order.project"/>
        <result column="order_id" property="order.orderId"/>
        <result column="glass_child" property="orderGlassDetail.glassChild"/>
        <result column="reporting_work_time" property="reportingWorkTime"/>
        <result column="this_process" property="thisProcess"/>
        <result column="project" property="project"/>
        <result column="order_id" property="orderId"/>
        <result column="glass_child" property="glassChild"/>
        <result column="process_id" property="processId"/>
        <result column="code" property="code"/>
    </resultMap>
@@ -101,6 +102,7 @@
        <result column="breakage_reason" property="breakageReason"/>
        <result column="personnel" property="personnel"/>
        <result column="glass_child" property="glassChild"/>
        <result column="glassNumber" property="glassNumber"/>
    </resultMap>
    <resultMap id="teamOutputMap" type="com.example.erp.dto.pp.TeamOutputDTO">
@@ -149,6 +151,8 @@
        <result column="stockArea" property="stockArea"/>
        <result column="product_name" property="productName"/>
        <result column="bend_radius" property="bendRadius"/>
        <result column="glassNumber" property="glassNumber"/>
        <result column="teams_groups_name" property="teamsGroupsName"/>
    </resultMap>
    <!--    流程卡进度-->
@@ -165,7 +169,8 @@
               e.broken_num,
               ifnull(f.inventory, 0)                         as inventory,
               round(ifnull(f.inventory, 0) * a.area, 2)      as inventoryArea,
               ifnull(dd.quantity, 0)                         as shippedQuantity
               ifnull(dd.quantity, 0)                         as shippedQuantity,
               ifnull(JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')),'') AS glassNumber
        from flow_card as c
                 left join
             sd.order_detail as a
@@ -218,21 +223,48 @@
               o.project,
               o.order_id,
               ogd.glass_child,
               rw.this_process
        from damage_details as dd
                 left join reporting_work as rw
                           on rw.reporting_work_id = dd.reporting_work_id
                 left join sd.order as o
                           on rw.order_id = o.order_id
                 left join sd.order_glass_detail as ogd
                           on ogd.order_id = o.order_id and ogd.order_number = dd.order_number
                               and ogd.technology_number and dd.technology_number
               rw.this_process,
               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code,
               CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id
        from
            sd.`order` as o left join sd.order_detail as od on o.order_id=od.order_id
                             left join sd.order_glass_detail as ogd on ogd.order_id=od.order_id and ogd.order_number=od.order_number
                             left join reporting_work as rw on rw.order_id=o.order_id
                             left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id and dd.order_number=ogd.order_number
            and dd.technology_number=ogd.technology_number
        where date(rw.reporting_work_time) >= #{startDate}
          and date(rw.reporting_work_time) &lt;= #{endDate}
          and rw.this_worn_quantity > 0
          and dd.available = 0
          and reviewed_state != 2
          and rw.this_process != dd.responsible_process
        <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
            and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code}
        </if>
        <if test="crossProcessBreakingDTO.processId != null and crossProcessBreakingDTO.processId != ''">
            and rw.process_id regexp #{crossProcessBreakingDTO.processId}
        </if>
        <if test="crossProcessBreakingDTO.thisProcess != null and crossProcessBreakingDTO.thisProcess != ''">
            and rw.this_process regexp #{crossProcessBreakingDTO.thisProcess}
        </if>
        <if test="crossProcessBreakingDTO.responsibleProcess != null and crossProcessBreakingDTO.responsibleProcess != ''">
            and dd.responsible_process regexp #{crossProcessBreakingDTO.responsibleProcess}
        </if>
        <if test="crossProcessBreakingDTO.responsibleTeam != null and crossProcessBreakingDTO.responsibleTeam != ''">
            and dd.responsible_team regexp #{crossProcessBreakingDTO.responsibleTeam}
        </if>
        <if test="crossProcessBreakingDTO.glassChild != null and crossProcessBreakingDTO.glassChild != ''">
            and ogd.glass_child regexp #{crossProcessBreakingDTO.glassChild}
        </if>
        <if test="crossProcessBreakingDTO.breakageType != null and crossProcessBreakingDTO.breakageType != ''">
            and dd.breakage_type regexp #{crossProcessBreakingDTO.breakageType}
        </if>
        <if test="crossProcessBreakingDTO.project != null and crossProcessBreakingDTO.project != ''">
            and o.project regexp #{crossProcessBreakingDTO.project}
        </if>
        <if test="crossProcessBreakingDTO.orderId != null and crossProcessBreakingDTO.orderId != ''">
            and o.order_id regexp #{crossProcessBreakingDTO.orderId}
        </if>
        GROUP BY dd.id
        order by dd.id desc
        limit #{offset},#{pageSize}
@@ -255,6 +287,33 @@
          and dd.available = 0
          and reviewed_state != 2
          and rw.this_process != dd.responsible_process
        <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''">
            and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code}
        </if>
        <if test="crossProcessBreakingDTO.processId != null and crossProcessBreakingDTO.processId != ''">
            and rw.process_id regexp #{crossProcessBreakingDTO.processId}
        </if>
        <if test="crossProcessBreakingDTO.thisProcess != null and crossProcessBreakingDTO.thisProcess != ''">
            and rw.this_process regexp #{crossProcessBreakingDTO.thisProcess}
        </if>
        <if test="crossProcessBreakingDTO.responsibleProcess != null and crossProcessBreakingDTO.responsibleProcess != ''">
            and dd.responsible_process regexp #{crossProcessBreakingDTO.responsibleProcess}
        </if>
        <if test="crossProcessBreakingDTO.responsibleTeam != null and crossProcessBreakingDTO.responsibleTeam != ''">
            and dd.responsible_team regexp #{crossProcessBreakingDTO.responsibleTeam}
        </if>
        <if test="crossProcessBreakingDTO.glassChild != null and crossProcessBreakingDTO.glassChild != ''">
            and ogd.glass_child regexp #{crossProcessBreakingDTO.glassChild}
        </if>
        <if test="crossProcessBreakingDTO.breakageType != null and crossProcessBreakingDTO.breakageType != ''">
            and dd.breakage_type regexp #{crossProcessBreakingDTO.breakageType}
        </if>
        <if test="crossProcessBreakingDTO.project != null and crossProcessBreakingDTO.project != ''">
            and o.project regexp #{crossProcessBreakingDTO.project}
        </if>
        <if test="crossProcessBreakingDTO.orderId != null and crossProcessBreakingDTO.orderId != ''">
            and o.order_id regexp #{crossProcessBreakingDTO.orderId}
        </if>
        order by dd.id desc
    </select>
@@ -265,7 +324,8 @@
        o.project,
        o.order_id,
        o.batch,
        if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape,
        if(od.shape='' || ISNULL(od.shape),'普形',if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))) as shape,
        if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),od.bend_radius) as bend_radius,
        ogd.order_number,
        ogd.technology_number,
        ogd.process,
@@ -278,7 +338,9 @@
        (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num) / 1000000, 2) as stockArea,
        od.product_name,
        od.bend_radius
        od.bend_radius,
        ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber,
        rws.teams_groups_name
        from sd.order_detail AS od
        LEFT JOIN sd.order_glass_detail AS ogd
@@ -314,6 +376,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
                        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -340,6 +410,9 @@
        </if>
        <if test="workInProgressDTO.technologyNumber != null and workInProgressDTO.technologyNumber != ''">
            and ogd.technology_number regexp #{workInProgressDTO.technologyNumber}
        </if>
        <if test="workInProgressDTO.glassNumber != null and workInProgressDTO.glassNumber != ''">
            and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{workInProgressDTO.glassNumber}
        </if>
        group by fc.process_id, fc.order_number, fc.technology_number
        order by fc.process_id, fc.order_number, fc.technology_number
@@ -384,6 +457,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -427,14 +508,14 @@
               ogd.glass_child,
               ogd.child_width,
               ogd.child_height,
               od.quantity,
               fc.quantity,
               ROUND(ogd.child_width * ogd.child_height / 1000000, 2)               as childArea,
               ROUND(ogd.child_width * ogd.child_height * od.quantity / 1000000, 2) as actualArea,
               ROUND(ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2) as actualArea,
               odpd.reporting_work_num                                              as completeNum,
               ROUND(ogd.child_width * ogd.child_height * odpd.reporting_work_num / 1000000,
                     2)                                                             as completeArea,
               od.quantity - odpd.reporting_work_num                                as incompleteNum,
               ROUND(ogd.child_width * ogd.child_height * (od.quantity - odpd.reporting_work_num) / 1000000,
               fc.quantity - odpd.reporting_work_num                                as incompleteNum,
               ROUND(ogd.child_width * ogd.child_height * (fc.quantity - odpd.reporting_work_num) / 1000000,
                     2)                                                             as incompleteArea,
               od.product_name
@@ -456,10 +537,10 @@
                           on o.order_id = od.order_id
        where LENGTH(fc.process_id) = 14
          and odpd.process = #{selectProcesses}
          and o.create_time between #{selectTime1} and #{selectTime2}
          and  DATE_FORMAT((o.create_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
          and position(#{orderId} in od.order_id)
          and position(#{inputProject} in o.project)
          and od.quantity > odpd.reporting_work_num
          and fc.quantity - odpd.reporting_work_num>0
        group by fc.process_id, fc.order_number, fc.technology_number
        order by fc.process_id, fc.order_number, fc.technology_number
@@ -472,7 +553,7 @@
        rw.process_id,
        dd.order_number,
        dd.technology_number,
        date(rw.reporting_work_time) as reporting_work_time,
        rw.reporting_work_time as reporting_work_time,
        dd.responsible_process,
        dd.responsible_team,
        dd.responsible_equipment,
@@ -481,7 +562,8 @@
        dd.breakage_quantity,
        round( ogd.child_width * ogd.child_height * dd.breakage_quantity / 1000000, 2 ) as area,
        IFNULL(dd.responsible_personnel,'') as personnel,
        ogd.glass_child
        ogd.glass_child,
        ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber
        FROM
        sd.ORDER AS o
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
@@ -489,8 +571,9 @@
        LEFT JOIN damage_details AS dd ON dd.reporting_work_id = rw.reporting_work_id
        AND dd.order_number = ogd.order_number
        AND dd.technology_number = ogd.technology_number
        left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number
        WHERE
        rw.reporting_work_time between #{selectTime1} and #{selectTime2}
         DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        AND dd.available = 0
        AND LENGTH( rw.process_id )= 14
        <if test="damageReportDTO.orderId != null and damageReportDTO.orderId != ''">
@@ -522,6 +605,9 @@
        </if>
        <if test="damageReportDTO.breakageReason != null and damageReportDTO.breakageReason != ''">
            and dd.breakage_reason regexp #{damageReportDTO.breakageReason}
        </if>
        <if test="damageReportDTO.glassChild != null and damageReportDTO.glassChild != ''">
            and ogd.glass_child regexp #{damageReportDTO.glassChild}
        </if>
        GROUP BY
        dd.id
@@ -540,7 +626,7 @@
        AND dd.order_number = ogd.order_number
        AND dd.technology_number = ogd.technology_number
        WHERE
        rw.reporting_work_time between #{selectTime1} and #{selectTime2}
         DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        AND dd.available = 0
        AND LENGTH( rw.process_id )= 14
        <if test="damageReportDTO.orderId != null and damageReportDTO.orderId != ''">
@@ -573,7 +659,9 @@
        <if test="damageReportDTO.breakageReason != null and damageReportDTO.breakageReason != ''">
            and dd.breakage_reason regexp #{damageReportDTO.breakageReason}
        </if>
        <if test="damageReportDTO.glassChild != null and damageReportDTO.glassChild != ''">
            and ogd.glass_child regexp #{damageReportDTO.glassChild}
        </if>
        limit #{offset},#{pageSize};
    </select>
@@ -587,7 +675,7 @@
               ogd.child_height                                                     as childHeight,
               fc.quantity,
               round(ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2) as area,
               if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))               as shape,
               if(od.shape='' || ISNULL(od.shape),'普形',if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))) as shape,
               od.remarks
        FROM sd.ORDER AS o
                 LEFT JOIN sd.order_detail AS od ON od.order_id = od.order_id
@@ -633,7 +721,7 @@
            AND opd.order_number = fc.order_number
            AND opd.technology_number = fc.technology_number
        WHERE o.create_time BETWEEN #{selectTime1} and #{selectTime2}
        WHERE  DATE_FORMAT((o.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
        GROUP BY o.order_id,
                 fc.order_number,
@@ -664,14 +752,14 @@
            AND opd.order_number = fc.order_number
            AND opd.technology_number = fc.technology_number
        WHERE opd.reporting_work_num > 0
          and o.create_time BETWEEN #{selectTime1} and #{selectTime2}
          and  DATE_FORMAT((o.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
          AND position(#{selectProcesses} IN opd.process)
        GROUP BY opd.process, o.order_id
    </select>
    <select id="productionScheduleMp">
        select a.order_number,
               if(a.shape = 1, '普形', if(a.shape = 2, '异形', '')) as shape,
               if(a.shape='' || ISNULL(a.shape),'普形',if(a.shape = 1, '普形', if(a.shape = 2, '异形', ''))) as shape,
               a.product_name,
               b.child_width,
               b.child_height,
@@ -683,7 +771,8 @@
               ifnull(f.inventory, 0)                               as inventoryNum,
               round(ifnull(f.inventory, 0) * a.area, 2)            as inventoryArea,
               ifnull(dd.quantity, 0)                               as shippedQuantity,
               ifnull(dd.area, 0)                                   as area
               ifnull(dd.area, 0)                                   as area,
               ifnull(JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')),'') AS glassNumber
        from flow_card as c
                 left join
@@ -699,6 +788,7 @@
                 left join mm.finished_goods_inventory as f
                           on c.order_id = f.order_id and f.order_number = c.order_number
                 left join (SELECT process_id,
                                   order_number,
                                   technology_number,
                                   sum(a.broken_num) as broken_num,
                                   concat('{',
@@ -706,16 +796,18 @@
                                          '}'
                                       )             as reportWorkQuantity,
                                   concat('{',
                                          GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num, "\"")),
                                          GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num_count, "\"")),
                                          '}'
                                       )             as reportWorkQuantityCount
                            FROM sd.order_process_detail as a
                            where a.order_id = #{orderId}
                            GROUP BY process_id, a.technology_number) as e
                            GROUP BY process_id, a.order_number,a.technology_number) as e
                           on e.process_id = c.process_id
                                and   e.order_number=c.order_number
                               and e.technology_number = c.technology_number
                 left join sd.delivery_detail as dd on dd.order_id = a.order_id and dd.order_number = a.order_number
        where a.order_id = #{orderId}
        group by c.order_number,c.technology_number
        ORDER BY a.order_number
    </select>
@@ -756,12 +848,12 @@
                                       )             as reportWorkQuantityCount
                            FROM sd.order_process_detail as a
                                     left join sd.`order` as o on o.order_id = a.order_id
                            where o.create_time BETWEEN #{selectTime1} and #{selectTime2}
                            where  DATE_FORMAT((o.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
                            GROUP BY process_id, a.technology_number) as e
                           on e.process_id = c.process_id
                               and e.technology_number = c.technology_number
                 left join sd.delivery_detail as dd on dd.order_id = a.order_id and dd.order_number = a.order_number
        where d.create_time BETWEEN #{selectTime1} and #{selectTime2}
        where DATE_FORMAT((d.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
          and reportWorkQuantity is not null
        GROUP BY a.order_id
        ORDER BY a.order_id
@@ -790,18 +882,18 @@
                            FROM sd.`order` AS a
                                     LEFT JOIN reporting_work AS b ON a.order_id = b.order_id
                            WHERE b.this_process = '切割'
                              AND a.create_time BETWEEN #{selectTime1} and #{selectTime2}
                              AND  DATE_FORMAT((a.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
                            GROUP BY a.order_id) AS orw ON orw.order_id = o.order_id
                 LEFT JOIN (SELECT a.order_id,
                                   SUM(b.reporting_work_num) AS completionsNum
                            FROM sd.`order` AS a
                                     LEFT JOIN sd.order_process_detail AS b ON a.order_id = b.order_id
                            WHERE b.process = '包装'
                              AND a.create_time BETWEEN #{selectTime1} and #{selectTime2}
                              AND  DATE_FORMAT((a.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
                            GROUP BY a.order_id) AS oopd ON oopd.order_id = o.order_id
                 LEFT JOIN reporting_work AS rw ON rw.order_id = fc.order_id
            AND rw.process_id = fc.process_id
        WHERE o.create_time BETWEEN #{selectTime1} and #{selectTime2}
        WHERE  DATE_FORMAT((o.create_time), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
          AND fc.create_time IS NOT NULL
        GROUP BY o.order_id
    </select>
@@ -821,7 +913,7 @@
                 LEFT JOIN optimize_use AS ou ON modl.use_id = ou.id and ou.raw_stock_code = modl.inventory_id
                 LEFT JOIN flow_card AS fc ON ou.project_no = fc.project_no
        where modl.use_id IS NOT NULL
          and mo.material_requisition_date BETWEEN #{selectTime1} and #{selectTime2}
          and  DATE_FORMAT((mo.material_requisition_date), '%Y-%m-%d') BETWEEN #{selectTime1} and #{selectTime2}
        GROUP BY ou.width, ou.height, material_code
    </select>
@@ -987,7 +1079,7 @@
               o.project,
               o.order_id,
               o.batch,
               if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape,
               if(od.shape='' || ISNULL(od.shape),'普形',if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))) as shape,
               ogd.order_number,
               ogd.technology_number,
               ogd.process,
@@ -1040,8 +1132,6 @@
          and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
              odpd.broken_num != 0
          and odpd.process = #{process}
          and date(o.create_time) >= #{date[0]}
          and date(o.create_time) &lt;= #{date[1]}
          and position(ifnull(#{inputVal}, '') in od.order_id)
          and position(ifnull(#{project}, '') in o.project)
@@ -1197,41 +1287,22 @@
        rw.teams_groups_name,
        o.project,
        rw.process_id,
        rwd.order_number,
        fc.order_number,
        MAX( ogd.child_width ) as width,
        MAX( ogd.child_height ) as height,
        if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape,
        sum( pd.thickness ) as thickness,
        od.edging_type,
        opd.reporting_work_num as completed_quantity,
        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*opd.reporting_work_num/1000000,2) as area,
        rwd.completed_quantity as completed_quantity,
        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area,
        od.product_name,
        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code
        FROM
        reporting_work AS rw
        LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id
        LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id
        LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id
        AND od.order_number = rwd.order_number
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
        AND ogd.order_number = rwd.order_number
        AND ogd.technology_number = rwd.technology_number
        AND ogd.order_number = od.order_number
        LEFT JOIN (
        SELECT
        prod_id,
        glass_sort,
        REPLACE ( JSON_UNQUOTE( JSON_EXTRACT( separation, '$.thickness' )), 'mm', '' ) AS thickness
        FROM
        sd.product_detail
        WHERE
        detail_type = "glass"
        ) AS pd ON pd.prod_id = od.product_id AND pd.glass_sort = rwd.technology_number
        LEFT JOIN sd.order_process_detail AS opd ON opd.order_id = o.order_id
        AND opd.process_id = rw.process_id
        AND opd.order_number = ogd.order_number
        AND opd.technology_number = ogd.technology_number
        where opd.reporting_work_num > 0 and rw.reviewed_state=1 and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
        reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id
        left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id  and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number
        left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number
        left join sd.order_detail as od  on od.order_id=ogd.order_id and od.order_number=ogd.order_number
        left join sd.`order` as o on o.order_id=od.order_id
        where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 and
               DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        and position(#{selectProcesses} in rw.this_process)
        <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''">
            and rw.this_process regexp #{teamOutputDTO.thisProcess}
@@ -1245,17 +1316,15 @@
        <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''">
            and rw.process_id regexp #{teamOutputDTO.processId}
        </if>
        <if test="teamOutputDTO.thickness != null and teamOutputDTO.thickness != ''">
            and thickness regexp #{teamOutputDTO.thickness}
        </if>
        <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''">
            and od.edging_type regexp #{teamOutputDTO.edgingType}
        </if>
        GROUP BY
        rw.reporting_work_id,
        rw.process_id,
        rw.this_process,
        rw.teams_groups_name,
        rw.process_id,
        rwd.order_number
        ORDER BY
        rw.this_process,
@@ -1273,48 +1342,29 @@
        rw.teams_groups_name,
        o.project,
        rw.process_id,
        rwd.order_number,
        fc.order_number,
        MAX( ogd.child_width ) as width,
        MAX( ogd.child_height ) as height,
        if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape,
        sum( pd.thickness ) as thickness,
        od.edging_type,
        opd.reporting_work_num as completed_quantity,
        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*opd.reporting_work_num/1000000,2) as area,
        rwd.completed_quantity as completed_quantity,
        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area,
        od.product_name,
        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code
        FROM
        reporting_work AS rw
        LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id
        LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id
        LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id
        AND od.order_number = rwd.order_number
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
        AND ogd.order_number = rwd.order_number
        AND ogd.technology_number = rwd.technology_number
        AND ogd.order_number = od.order_number
        LEFT JOIN (
        SELECT
        prod_id,
        glass_sort,
        REPLACE ( JSON_UNQUOTE( JSON_EXTRACT( separation, '$.thickness' )), 'mm', '' ) AS thickness
        FROM
        sd.product_detail
        WHERE
        detail_type = "glass"
        ) AS pd ON pd.prod_id = od.product_id AND pd.glass_sort = rwd.technology_number
        LEFT JOIN sd.order_process_detail AS opd ON opd.order_id = o.order_id
        AND opd.process_id = rw.process_id
        AND opd.order_number = ogd.order_number
        AND opd.technology_number = ogd.technology_number
        where opd.reporting_work_num > 0 and rw.reviewed_state=1
        reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id
        left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id  and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number
        left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number
        left join sd.order_detail as od  on od.order_id=ogd.order_id and od.order_number=ogd.order_number
        left join sd.`order` as o on o.order_id=od.order_id
        where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0
          and date(rw.reporting_work_time) >= #{date[0]}
          and date(rw.reporting_work_time) &lt;= #{date[1]}
        and position(#{process} in rw.this_process)
        GROUP BY
        rw.reporting_work_id,
        rw.process_id,
        rw.this_process,
        rw.teams_groups_name,
        rw.process_id,
        rwd.order_number
        ORDER BY
        rw.this_process,
@@ -1326,33 +1376,32 @@
    <select id="teamOutputPageTotal">
        SELECT
        CEILING(count(rwd.id)/#{pageSize}) as 'pageTotal',
        count(distinct rwd.id) as 'total'
        CEILING(count(*)/#{pageSize}) as 'pageTotal',
        count(*) as 'total'
        FROM
        reporting_work AS rw
        LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id
        LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id
        LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id
        AND od.order_number = rwd.order_number
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
        AND ogd.order_number = rwd.order_number
        AND ogd.technology_number = rwd.technology_number
        AND ogd.order_number = od.order_number
        LEFT JOIN (
        (
        SELECT
        prod_id,
        glass_sort,
        REPLACE ( JSON_UNQUOTE( JSON_EXTRACT( separation, '$.thickness' )), 'mm', '' ) AS thickness
        rw.reporting_work_time,
        rw.this_process,
        rw.teams_groups_name,
        o.project,
        rw.process_id,
        fc.order_number,
        MAX( ogd.child_width ) as width,
        MAX( ogd.child_height ) as height,
        od.edging_type,
        rwd.completed_quantity as completed_quantity,
        ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area,
        od.product_name,
        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code
        FROM
        sd.product_detail
        WHERE
        detail_type = "glass"
        ) AS pd ON pd.prod_id = od.product_id AND pd.glass_sort = rwd.technology_number
        LEFT JOIN sd.order_process_detail AS opd ON opd.order_id = o.order_id
        AND opd.process_id = rw.process_id
        AND opd.order_number = ogd.order_number
        AND opd.technology_number = ogd.technology_number
        where opd.reporting_work_num > 0 and rw.reviewed_state=1 and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
        reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id
        left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id  and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number
        left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number
        left join sd.order_detail as od  on od.order_id=ogd.order_id and od.order_number=ogd.order_number
        left join sd.`order` as o on o.order_id=od.order_id
        where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 and
               DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        and position(#{selectProcesses} in rw.this_process)
        <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''">
            and rw.this_process regexp #{teamOutputDTO.thisProcess}
@@ -1366,14 +1415,24 @@
        <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''">
            and rw.process_id regexp #{teamOutputDTO.processId}
        </if>
        <if test="teamOutputDTO.thickness != null and teamOutputDTO.thickness != ''">
            and thickness regexp #{teamOutputDTO.thickness}
        </if>
        <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''">
            and od.edging_type regexp #{teamOutputDTO.edgingType}
        </if>
        limit #{offset},#{pageSize};
        GROUP BY
        rw.reporting_work_id,
        rw.process_id,
        rw.this_process,
        rw.teams_groups_name,
        rwd.order_number
        ORDER BY
        rw.this_process,
        rw.process_id,
        rwd.order_number,
        rw.reporting_work_time,
        rw.teams_groups_name
        ) as page_toal
        limit #{offset},#{pageSize}
    </select>
    <select id="workInProgressOrderMp" resultMap="workInProgressMap">
@@ -1382,14 +1441,15 @@
        o.project,
        o.order_id,
        o.batch,
        if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape,
        if(od.shape='' || ISNULL(od.shape),'普形',if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))) as shape,
        sum(od.quantity) as quantity,
        sum(odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num) as stockNum,
        sum(ROUND(ogd.child_width * ogd.child_height *
        (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num) / 1000000, 2)) as stockArea,
        od.product_name
        od.product_name,
        rws.teams_groups_name
        from sd.order_detail AS od
        LEFT JOIN sd.order_glass_detail AS ogd
@@ -1425,6 +1485,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -1486,6 +1554,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -1514,14 +1590,15 @@
        o.order_id,
        fc.process_id,
        o.batch,
        if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape,
        if(od.shape='' || ISNULL(od.shape),'普形',if(od.shape = 1, '普形', if(od.shape = 2, '异形', ''))) as shape,
        sum(od.quantity) as quantity,
        sum(odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num) as stockNum,
        sum(ROUND(ogd.child_width * ogd.child_height *
        (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num) / 1000000, 2)) as stockArea,
        od.product_name
        od.product_name,
        rws.teams_groups_name
        from sd.order_detail AS od
        LEFT JOIN sd.order_glass_detail AS ogd
@@ -1557,6 +1634,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -1621,6 +1706,14 @@
        and c.technology_number = fc.technology_number
        left join sd.`order` as o
        on o.order_id = od.order_id
        left join
        (
        select a.process_id,a.teams_groups_name,a.next_process,b.technology_number,b.order_number
        from reporting_work  as a
        left join reporting_work_detail as b on a.reporting_work_id=b.reporting_work_id
        GROUP BY a.process_id,a.teams_groups_name,a.next_process,b.order_number,b.technology_number
        ) as rws on rws.process_id=fc.process_id and rws.order_number=fc.order_number
        and  rws.technology_number=fc.technology_number and rws.next_process=#{selectProcesses}
        where LENGTH(fc.process_id) = 14
        and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count -
        odpd.broken_num != 0
@@ -1659,7 +1752,7 @@
        GROUP BY order_id, order_number) as ps
        left join sd.`order` as o on o.order_id = ps.order_id
        where ps.processes = #{processes}
        and ps.scheduled_start_time between #{selectTime1} and #{selectTime2}
        and  DATE_FORMAT((ps.scheduled_start_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        <if test="scheduleProductionScheduleDTO.orderId != null and scheduleProductionScheduleDTO.orderId != ''">
            and ps.order_id regexp #{scheduleProductionScheduleDTO.orderId}
        </if>
@@ -1685,7 +1778,7 @@
        GROUP BY order_id, order_number) as ps
        left join sd.`order` as o on o.order_id = ps.order_id
        where ps.processes = #{processes}
        and ps.scheduled_start_time between #{selectTime1} and #{selectTime2}
        and  DATE_FORMAT((ps.scheduled_start_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2}
        <if test="scheduleProductionScheduleDTO.orderId != null and scheduleProductionScheduleDTO.orderId != ''">
            and ps.order_id regexp #{scheduleProductionScheduleDTO.orderId}
        </if>