guoyuji
2024-09-03 76bf2824bf55e8f4c3ccbc14b3b2719bf8fb219f
north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -83,11 +83,13 @@
                          process_id,a.reporting_work_id
                   from reporting_work as a
                       left join reporting_work_detail as b on a.reporting_work_id = b.reporting_work_id
                   where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr} and b.technology_number=#{technologyStr}) as rw
                   where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr}
                     and  POSITION(b.technology_number in #{technologyStr})
                   ) as rw
        on rw.process_id = fc.process_id
        left join reporting_work_detail as rwd on rw.reporting_work_id = rwd.reporting_work_id and rwd.technology_number=fc.technology_number
        where fc.process_id = #{processIdStr}
          and fc.technology_number = #{technologyStr}
          and POSITION(fc.technology_number in #{technologyStr})
          and if(#{reportType}=1,o.order_type!='样品订单',o.order_id!='')
        GROUP BY fc.process_id
    </select>
@@ -106,11 +108,13 @@
    <!--    查询流程卡工艺流程-->
    <select id="SelectTechnologicalProcess">
        select ogd.process
        from sd.order_glass_detail as ogd
        where ogd.production_id = LEFT(#{processIdStr}, 11)
          and ogd.technology_number=#{technologyStr}
        limit 1
        select ifnull((select ogd.process
                       from sd.order_glass_detail as ogd
                       left join sd.`order` as o on o.order_id=ogd.order_id
                       where ogd.production_id = LEFT(#{processIdStr}, 11)
                         and o.create_order>0
                         and POSITION(ogd.technology_number in #{technologyStr})
                       limit 1),'') as  process
    </select>
@@ -160,7 +164,7 @@
                where
                reporting_work.this_process = #{process}
                and a.process_id=#{processIdStr}
                and a.technology_number =  #{technologyStr}
                and POSITION(a.technology_number in #{technologyStr})
                and a.review_status = 1
                group by a.process_id,a.order_sort,a.technology_number
            ) as patch
@@ -171,9 +175,11 @@
        WHERE
            fc.process_id = #{processIdStr}
          AND fc.technology_number = #{technologyStr}
          AND  POSITION(fc.technology_number in #{technologyStr})
          AND odpd.process = #{process}
          and if(#{reportType}=1,o.order_type!='样品订单',o.order_id!='')
        group by fc.order_number,
                 ogd.technology_number
        order by fc.order_number
    </select>
@@ -206,12 +212,12 @@
        LEFT JOIN sd.order_glass_detail AS ogd
                ON od.order_id = ogd.order_id
                AND od.order_number = ogd.order_number
        <if test="process == '夹胶'">
        <if test="process == '夹胶' or (process == '打胶和粘框' and previousProcess=='夹胶')">
            AND ogd.`group` = (select `group`
                               from sd.order_glass_detail
                               where order_id = ogd.order_id
                               and order_number = ogd.order_number
                               and technology_number =#{technologyStr}
                               and POSITION(technology_number in #{technologyStr})
                               limit 1)
        </if>
@@ -248,8 +254,8 @@
        WHERE
            fc.process_id = #{processIdStr}
        <if test="process != '中空' and process != '夹胶' and process != '包装'">
           AND fc.technology_number = #{technologyStr}
        <if test="process != '中空' and process != '夹胶' and process != '包装' and process != '打胶和粘框' ">
           AND POSITION(fc.technology_number in #{technologyStr})
        </if>
        AND odpd.process = #{process}
        order by fc.order_number
@@ -501,7 +507,7 @@
        select rw.reporting_work_id,
               (rw.reporting_work_time) as reporting_work_time,
               o.order_id,
               rw.process_id,
               CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct rwd.technology_number SEPARATOR '')) as process_id,
               o.project,
               o.batch,
               rw.this_process,
@@ -524,6 +530,7 @@
          and rw.reporting_work_time between #{selectTime1} and #{selectTime2}
          and position(#{orderId} in rw.order_id)
          and rw.reviewed_state!=-1
          and o.create_order>0
        <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''">
            and rw.reporting_work_id regexp #{reportingWork.reportingWorkId}
        </if>
@@ -565,6 +572,7 @@
        where rw.reviewed_state != 2
          and rw.reporting_work_time between #{selectTime1} and #{selectTime2} and position(#{orderId} in rw.order_id)
          and rw.reviewed_state!=-1
          and o.create_order>0
        <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''">
            and rw.reporting_work_id regexp #{reportingWork.reportingWorkId}
        </if>
@@ -796,7 +804,7 @@
            left join reporting_work_detail as rwd on rw.reporting_work_id = rwd.reporting_work_id
        set rw.reviewed_state = 1
        where rw.process_id = #{substring} and rw.this_process=#{process}
          and rwd.technology_number = #{result} and reviewed_state=0
          and POSITION(rwd.technology_number in #{result}) and reviewed_state=0
    </update>
    <select id="getPatchConditionMp">