huang
2024-11-11 93b80ffb7f7ffc02bc414271b8ebeac82be6bcb9
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -67,10 +67,10 @@
        b.customer_name,
        if(a.layout_status=0,'不可排版',if(a.layout_status=1,'可排版','已排版')) as layout_status,
        a.merge
        from (select id,order_id,process_id,order_number, quantity,founder,layout_status,create_time,merge from flow_card
        from (select id,order_id,process_id,order_number, quantity,founder,max(layout_status) as layout_status,create_time,merge from flow_card
        group by process_Id,order_number) as a left join sd.`order` as b on a.order_Id=b.order_id
        left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
        where a.create_time between #{selectTime1} and #{selectTime2}
        where date(a.create_time)>=#{selectTime1} and date(a.create_time) <= #{selectTime2}
        <if test="flowCard.orderId != null and flowCard.orderId != ''">
            and a.order_id regexp #{flowCard.orderId}
        </if>
@@ -114,7 +114,7 @@
        count(distinct a.process_Id) as 'total'
        from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
        left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
        where a.create_time between #{selectTime1} and #{selectTime2}
        where date(a.create_time)>=#{selectTime1} and date(a.create_time) &lt;= #{selectTime2}
        <if test="flowCard.orderId != null and flowCard.orderId != ''">
            and a.order_id regexp #{flowCard.orderId}
        </if>
@@ -162,8 +162,8 @@
        o.delivery_address
        from sd.`order` as o
        left join sd.order_glass_detail ogd on o.order_id = ogd.order_id
        where o.production_order=2 and ogd.splitting_status=0 and o.create_time between #{selectTime1} and
        #{selectTime2}
        where o.production_order=2 and ogd.splitting_status=0 and
        date(o.create_time)>=#{selectTime1} and date(o.create_time) &lt;= #{selectTime2}
        <if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
            and o.order_id regexp #{flowCard.order.orderId}
@@ -257,12 +257,14 @@
               ifnull(p.thickness,'') as thickness,
               od.weight,
               od.remarks,
               od.processing_note,
               ifnull(od.bend_radius,'') as bend_radius,
               ods.S01,
               ods.S02,
               ods.S03,
               ods.S04,
               ods.S05
               ods.S05,
               od.building_number
        from sd.order_detail as od
                 left join sd.order_glass_detail as ogd
                           on od.order_id = ogd.order_id and od.order_number = ogd.order_number
@@ -412,7 +414,7 @@
                 left join sd.order as o on od.order_id = o.order_id
                 left join production_scheduling as ps
                           on ps.order_id = od.order_id and ps.order_number = od.order_number
        where od.create_time between #{selectTime1} and #{selectTime2}
        where  date(od.create_time)>=#{selectTime1} and date(od.create_time) &lt;= #{selectTime2}
    </select>
    <!--   查询对应序号的层数-->
@@ -468,7 +470,7 @@
               pack_type,
               batch
        from sd.order
        where create_time between #{selectTime1} and #{selectTime2}
        where date(create_time)>=#{selectTime1} and date(create_time) &lt;= #{selectTime2}
          and position(#{orderId} in order_id)
          and position(#{project} in project)
          and processing_card >0
@@ -478,7 +480,7 @@
    <select id="selectPrintFlowCard">
        select *
        from pp.optimize_project
        where create_time between #{selectTime1} and #{selectTime2}
        where date(create_time)>=#{selectTime1} and date(create_time) &lt;= #{selectTime2}
          and state >= 20
        order by create_time desc
    </select>
@@ -515,13 +517,14 @@
                                          ogds.glass_child                                  AS concatenated_glass_child,
                                          process                                           AS processed_part,
                                          ogds.child_width,
                                          ogds.child_height
                                          ogds.child_height,
                                          ogds.group
                                   from sd.order_glass_detail as ogds
                                   where ogds.order_id = #{orderId}
                                   GROUP BY order_id, order_number, ogds.glass_child, process) as ogdss
                                   GROUP BY order_id, order_number, ogds.glass_child, process,ogds.group) as ogdss
                                  on fc.order_id = ogdss.order_id and ogdss.order_number = fc.order_number
               where fc.order_id = #{orderId}
               GROUP BY fc.process_id, ogdss.concatenated_glass_child, ogdss.processed_part
               GROUP BY fc.process_id, ogdss.concatenated_glass_child, ogdss.processed_part,ogdss.group
               order by fc.process_id, ogdss.technology_number)
              UNION
@@ -657,13 +660,14 @@
               fc.quantity,
               round(ogd.total_area, 2)                                       as total_area,
               od.perimeter,
               od.bend_radius,
               if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),od.bend_radius) as bend_radius,
               concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
               od.other_columns,
               round(ogd.child_width)                                         as width,
               round(ogd.child_height)                                        as height,
               pd.separation,
               fc.technology_number
               fc.technology_number,
               IFNULL(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')),'') as mapNumber
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -718,7 +722,9 @@
               opd.stock_id,
               od.quantity,
               od.other_columns,
               od.bend_radius
               od.bend_radius,
               od.order_number as heat_layout_id,
               a.id as heat_layout_sort
        from pp.optimize_detail opd
                 left join sd.`order` o on SUBSTR(opd.process_id, 1, 10) = o.order_id
                 left join sd.order_detail od
@@ -729,8 +735,11 @@
                 left join sd.product p on od.product_id = p.id
                 left join sd.basic_glass_type e on e.type_id = p.type_id
                 left join sd.customer c on c.id = o.customer_id
        left join
        (select (@row_number := @row_number + 1) as id,process_id as process_id from (select process_id from pp.optimize_detail tt where project_no =#{projectNo} group by process_id) tt,(select @row_number := 0) as t) a
        on a.process_id=opd.process_id
        where opd.project_no = #{projectNo}
        order by opd.stock_id
        order by opd.stock_id,opd.polys_id
    </select>
    <select id="getPrintLabel2">
@@ -744,7 +753,6 @@
               ogd.glass_child,
               ogd.process,
               e.type_name,
               opd.stock_id,
               od.quantity,
               od.other_columns,
               od.bend_radius,
@@ -794,6 +802,43 @@
        where fc.process_id = #{processId}
          and fc.technology_number = #{technologyNumber}
        group by od.order_number, od.width, od.height
    </select>
    <select id="getPrintLabelDetail">
        select o.order_id,
               o.project,
               o.customer_id,
               ogd.child_width                as width,
               ogd.child_height               as height,
               fc.quantity,
               od.order_number                as orderNumber,
               fc.technology_number           as technologyNumber,
               ogd.glass_child,
               ogd.process,
               c.customer_abbreviation        as customer_name,
               ifnull(od.processing_note, '') as processing_note,
               bgt.type_name,
               od.other_columns,
               od.building_number,
               od.bend_radius
        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 pp.flow_card as fc on o.order_id = fc.order_id and
                                                 od.order_number = fc.order_number and
                                                 fc.technology_number = ogd.technology_number
                 left join sd.product pt on pt.id = od.product_id
                 left join sd.customer c on c.id = o.customer_id
                 left join sd.basic_glass_type bgt on bgt.type_id = pt.type_id
        <where>
            and fc.process_id = #{flowCard.processId}
            and fc.order_number = #{flowCard.orderNumber}
            <if test="flowCard.technologyNumber != null and flowCard.technologyNumber != ''">
                and fc.technology_number = #{flowCard.technologyNumber}
            </if>
        </where>
        group by od.order_number,fc.technology_number, od.width, od.height
    </select>
    <select id="printFlowCardDetailsMp">
@@ -958,7 +1003,8 @@
               ogd.glass_child,
               fc.print_status,
               pl.reporting_work_id,
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                AS glassNumber
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                AS glassNumber,
               pl.patch_id
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
@@ -969,7 +1015,7 @@
                 left join patch_log as pl on pl.order_id = fc.order_id and pl.process_id = fc.process_id and
                                              pl.order_sort = fc.order_number and
                                              pl.technology_number = fc.technology_number
        where pl.create_time between #{selectTime1} and #{selectTime2}
        where date(pl.create_time)>=#{selectTime1} and date(pl.create_time) &lt;= #{selectTime2}
          and pl.review_status > 0
        GROUP BY pl.id, fc.process_id, ogd.technology_number
        order by pl.id desc, fc.process_id, ogd.technology_number
@@ -1153,7 +1199,7 @@
                 left join rework as pl on pl.order_id = fc.order_id and pl.process_id = fc.process_id and
                                           pl.order_sort = fc.order_number and
                                           pl.technology_number = fc.technology_number
        where pl.create_time between #{selectTime1} and #{selectTime2}
        where  date(pl.create_time)>=#{selectTime1} and date(pl.create_time) &lt;= #{selectTime2}
        GROUP BY fc.process_id,fc.order_number, ogd.technology_number, pl.reporting_work_id
        order by pl.id desc, fc.process_id, ogd.technology_number
    </select>
@@ -1164,13 +1210,14 @@
               fc.quantity,
               round(ogd.total_area, 2)                                       as total_area,
               od.perimeter,
               od.bend_radius,
               if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),od.bend_radius) as bend_radius,
               concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
               od.other_columns,
               round(ogd.child_width)                                         as width,
               round(ogd.child_height)                                        as height,
               pd.separation,
               fc.technology_number
               fc.technology_number,
               IFNULL(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')),'') as mapNumber
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -1236,7 +1283,7 @@
               sum(pl.patch_num)                                                 as quantity,
               round(ogd.total_area, 2)                                       as total_area,
               od.perimeter,
               od.bend_radius,
               if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),od.bend_radius) as bend_radius,
               concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
               od.other_columns,
               round(ogd.child_width)                                         as width,
@@ -1246,7 +1293,8 @@
               pl.patch_type,
               pl.patch_reason,
               pl.patch_processes,
               pl.responsible_team
               pl.responsible_team,
               pl.responsible_personnel
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -1315,7 +1363,7 @@
        where fc.process_id = #{processId}
          and fc.order_number = #{orderNumber}
          and fc.technology_number = #{technologyNumber}
          and rw.reporting_work_id = #{reportingWorkId}
          and pl.reporting_work_id = #{reportingWorkId}
          and dd.breakage_reason = #{patchReason}
        group by fc.process_id, fc.technology_number
    </select>
@@ -1409,7 +1457,7 @@
               (pl.rework_num)                                              as quantity,
               round(ogd.total_area, 2)                                     as total_area,
               od.perimeter,
               od.bend_radius,
               if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),od.bend_radius) as bend_radius,
               concat(od.processing_note, od.remarks)                       as remarks,
               od.other_columns,
               round(ogd.child_width)                                       as width,
@@ -1420,7 +1468,8 @@
               pl.rework_reason as patch_reason,
               pl.rework_processes as patch_processes,
               pl.responsible_team,
               pl.rework_team
               pl.rework_team,
               pl.responsible_personnel
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -1966,9 +2015,10 @@
               fc.process_id,
               o.customer_name,
               o.project,
               ogd.technology_number,
               /*ogd.technology_number,*/
               ogd.glass_address,
               (fc.quantity)                                                          as quantity,
               (fc.quantity)                                                          as printQuantity,
               round((ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
               od.product_name,
               ogd.glass_child,
@@ -1988,6 +2038,37 @@
        where fc.order_id = #{orderId}
        GROUP BY fc.process_id, od.order_number
        order by fc.process_id, od.order_number
    </select>
    <select id="selectPrintDetailsMp1">
        select fc.id,
               fc.order_id,
               fc.process_id,
               o.customer_name,
               o.project,
               ogd.technology_number,
               ogd.glass_address,
               (fc.quantity)                                                          as quantity,
               (fc.quantity)                                                          as printQuantity,
               round((ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
               od.product_name,
               ogd.glass_child,
               fc.founder,
               date(fc.splitFrame_time)                                               as splitFrame_time,
            /* if(fc.print_status=0,'未打印','已打印') as  print_status*/
               fc.print_status,
               ogd.process,
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                  AS glassNumber,
               od.order_number
        from flow_card as fc
                 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 = fc.order_id and od.order_number = fc.order_number
                 left join sd.`order` as o on o.order_id = fc.order_id
        where fc.order_id = #{orderId}
        GROUP BY fc.process_id, od.order_number,fc.technology_number
        order by fc.process_id, od.order_number,fc.technology_number
    </select>
    <select id="getPrintCustomDataDetails">
@@ -2010,7 +2091,7 @@
               od.processing_note                                    as processingNote,
               width,
               height,
               fc.quantity,
               #{printQuantity}                                      as quantity,
               od.order_number                                       as orderNumber,
               fc.technology_number                                  as technologyNumber,
               od.building_number                                    as buildingNumber,
@@ -2034,7 +2115,13 @@
               od.other_columns,
               ogd.glass_child                                       as glassChild,
               ogd.glass_address                                     as glassAddress,
               JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.color'))  AS color
               JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.color'))  AS color,
               '文本' as custom1,
               '文本' as custom2,
               '文本' as custom3,
               '文本' as custom4,
               '文本' as custom5,
               od.quantity
        from sd.order as o
                 left join sd.order_detail as od on o.order_id = od.order_id
                 left join flow_card as fc on o.order_id = fc.order_id and
@@ -2050,6 +2137,67 @@
          and fc.order_number = #{orderNumber}
        group by od.order_number, width, height
        order by fc.process_id
    </select>
    <select id="getPrintCustomDataProjectNo">
        select
            o.order_id                                            as orderId,
            project,
            customer_id                                           as customerId,
            o.customer_name                                       as customerName,
            order_type                                            as orderType,
            order_classify                                        as orderClassify,
            batch,
            o.icon,
            pack_type                                             as packType,
            delivery_date                                         as deliveryDate,
            al_type                                               as alType,
            money,
            contract_id                                           as contractId,
            customer_batch                                           customerBatch,
            contacts,
            delivery_address                                      as deliveryAddress,
            od.processing_note                                    as processingNote,
            od.width,
            od.height,
            fc.quantity,
            od.order_number                                       as orderNumber,
            fc.technology_number                                  as technologyNumber,
            od.building_number                                    as buildingNumber,
            od.product_name                                       as productName,
            od.edging_type                                        as edgingType,
            od.remarks,
            c.customer_abbreviation                               as customerAbbreviation,
            p.product_abbreviation                                as productAbbreviation,
            fc.process_id                                 as processId,
            o.create_time                                         as createTime,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS glassNumber,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')) AS figureNumber,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S03')) AS colourCeramicGlaze,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')) AS remarks1,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S05')) AS remarks2,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S06')) AS remarks3,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S07')) AS remarks4,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S08')) AS remarks5,
            p.remarks                                             as filmNumber,
            od.bend_radius                                        as bendRadius,
            od.other_columns,
            JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.color'))  AS color,
            '文本' as custom1,
            '文本' as custom2,
            '文本' as custom3,
            '文本' as custom4,
            '文本' as custom5
        from optimize_detail as opt
                 left join flow_card as fc on opt.project_no=fc.project_no and opt.process_id=fc.process_id and opt.layer=fc.technology_number and opt.order_sort=fc.order_number
                 left join sd.order as o on o.order_id=fc.order_id
                 left join sd.order_detail as od on fc.order_id = od.order_id and od.order_number = fc.order_number
                 left join sd.product as p on p.id = od.product_id
                 left join sd.customer as c on c.id = o.customer_id
                 left join sd.product_detail as pd on pd.prod_id = p.id and pd.sort_num = od.order_number and
                                                      pd.glass_sort = fc.technology_number
        where opt.project_no=#{projectNo}
        order by opt.stock_id,opt.polys_id
    </select>
    <select id="selectUserMp">
@@ -2085,11 +2233,11 @@
    <select id="remakList">
        SELECT
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S01')) AS S01,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S04')) AS S02,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S05')) AS S03,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S06')) AS S04,
            JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S07')) AS S05
            ifnull(JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S01')),'') AS S01,
            ifnull(JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S04')),'') AS S02,
            ifnull(JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S05')),'') AS S03,
            ifnull(JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S06')),'') AS S04,
            ifnull(JSON_UNQUOTE(JSON_EXTRACT(other_columns, '$.S07')),'') AS S05
        FROM flow_card as fc left join sd.order_detail as od on  fc.order_id = od.order_id
        and fc.order_number = od.order_number
        WHERE fc.process_id=#{processId}
@@ -2109,7 +2257,7 @@
    </select>
    <select id="selectFlowCardMerge">
        select *
        select *,GROUP_CONCAT(DISTINCT fc.technology_number) as count1,count(DISTINCT fc.technology_number)  as count2
        from pp.flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
@@ -2120,12 +2268,83 @@
    </select>
    <update id="updateFlowCardMerge">
        update  pp.flow_card fc set fc.merge=1
        where fc.process_id = #{processId}
        update  pp.flow_card fc set fc.merge=#{index}
        where fc.process_id = #{processId} and fc.technology_number  in
        <foreach item="technologyNumber" collection="technologyNumbers" open="(" separator="," close=")">
            #{technologyNumber}
        </foreach>
    </update>
    <delete id="deleteflowCardSort">
        delete from flow_card_sort where process_id = #{processId}
    </delete>
    <select id="getPrintProjectDetailsMp">
        SELECT opd.project_no,opd.stock_id,opl.glass_count FROM optimize_detail as opd left join optimize_layout as opl on opl.project_no=opd.project_no and opl.stock_id=opd.stock_id
        where opd.project_no=#{projectNo}
        GROUP BY opd.stock_id
        ORDER BY opd.stock_id
    </select>
    <select id="getPrintCustomDataProjectDetail">
        select
            o.order_id                                            as orderId,
            project,
            customer_id                                           as customerId,
            o.customer_name                                       as customerName,
            order_type                                            as orderType,
            order_classify                                        as orderClassify,
            batch,
            o.icon,
            pack_type                                             as packType,
            delivery_date                                         as deliveryDate,
            al_type                                               as alType,
            money,
            contract_id                                           as contractId,
            customer_batch                                           customerBatch,
            contacts,
            delivery_address                                      as deliveryAddress,
            od.processing_note                                    as processingNote,
            od.width,
            od.height,
            fc.quantity,
            od.order_number                                       as orderNumber,
            fc.technology_number                                  as technologyNumber,
            od.building_number                                    as buildingNumber,
            od.product_name                                       as productName,
            od.edging_type                                        as edgingType,
            od.remarks,
            c.customer_abbreviation                               as customerAbbreviation,
            p.product_abbreviation                                as productAbbreviation,
            fc.process_id                                 as processId,
            o.create_time                                         as createTime,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS glassNumber,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')) AS figureNumber,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S03')) AS colourCeramicGlaze,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')) AS remarks1,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S05')) AS remarks2,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S06')) AS remarks3,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S07')) AS remarks4,
            JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S08')) AS remarks5,
            p.remarks                                             as filmNumber,
            od.bend_radius                                        as bendRadius,
            od.other_columns,
            JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.color'))  AS color,
            '文本' as custom1,
            '文本' as custom2,
            '文本' as custom3,
            '文本' as custom4,
            '文本' as custom5
        from optimize_detail as opt
                 left join flow_card as fc on opt.project_no=fc.project_no and opt.process_id=fc.process_id and opt.layer=fc.technology_number and opt.order_sort=fc.order_number
                 left join sd.order as o on o.order_id=fc.order_id
                 left join sd.order_detail as od on fc.order_id = od.order_id and od.order_number = fc.order_number
                 left join sd.product as p on p.id = od.product_id
                 left join sd.customer as c on c.id = o.customer_id
                 left join sd.product_detail as pd on pd.prod_id = p.id and pd.sort_num = od.order_number and
                                                      pd.glass_sort = fc.technology_number
        where opt.project_no=#{projectNo} and opt.stock_id=#{stockId}
        order by opt.stock_id,opt.polys_id
    </select>
</mapper>