chenlu
2025-07-02 3a91fc2b0e923f1b697113cd7de879f61a452e9b
north-glass-erp/src/main/resources/mapper/mm/FinishedOperateLog.xml
@@ -71,6 +71,9 @@
            <if test="finishedOperateLog.quantity != null and finishedOperateLog.quantity != ''">
                and fol.quantity regexp #{finishedOperateLog.quantity}
            </if>
            <if test="finishedOperateLog.processId != null and finishedOperateLog.processId != ''">
                and fol.process_id regexp #{finishedOperateLog.processId}
            </if>
            <if test="finishedOperateLog.operator != null and finishedOperateLog.operator != ''">
                and fol.operator regexp #{finishedOperateLog.operator}
            </if>
@@ -808,7 +811,135 @@
    </select>
<select id="getPrimaryListLimt">
    select  o.order_id,
    o.customer_name,
    o.project,
    fol.remarks,
    SUM(fol.quantity) as quantity,
    ROUND( sum(od.width * od.height * fol.quantity) / 1000000, 2 ) as area
    from (select *
    from mm.finished_operate_log aa where aa.operate_type = '入库'  and aa.status!='已作废') fol
    left join sd.order_detail od on fol.order_id = od.order_id and fol.operation_number = od.order_number
    left join sd.`order` o on o.order_id=fol.order_id
    where
    o.order_id=#{orderId}  and fol.remarks=#{remarks}
    and (fol.remarks is not null and fol.remarks !="") and (fol.process_id !="" and fol.process_id is not null)
    group by fol.remarks,od.order_id
    order by fol.operate_time desc
</select>
    <select id="getPrimaryListLimts">
        select kkk.*,rw.teams_groups_name as teams_groups_name2 from(select  o.order_id,
                                                       o.customer_name,
                                                       o.project,
                                                       fol.remarks,
                                                       SUM(fol.quantity) as quantity,
                                                       ROUND( sum(od.width * od.height * fol.quantity) / 1000000, 2 ) as area,
                                                       fol.process_id,
                                                       aaa.teams_groups_name,
                                                       aaa.previous_process,
                                                       date( aaa.reporting_work_time) as reporting_work_time
                                               from (select *
                                                     from mm.finished_operate_log aa where aa.operate_type = '入库'  and aa.status!='已作废') fol
                                                        left join sd.order_detail od on fol.order_id = od.order_id and fol.operation_number = od.order_number
                                                        left join sd.`order` o on o.order_id=fol.order_id
                                                        left join (select teams_groups_name,process_id,previous_process,reporting_work_time from pp.reporting_work  where this_process='包装') aaa on  aaa.process_id=fol.process_id
                                               where
                                                   o.order_id=#{orderId}  and fol.remarks=#{remarks}
                                                 and (fol.remarks is not null and fol.remarks !="") and (fol.process_id !="" and fol.process_id is not null)
                                               group by fol.remarks,od.order_id
                                              ) as kkk
                                                  left join  pp.reporting_work rw on  rw.process_id=kkk.process_id and rw.this_process=kkk.previous_process
        group by kkk.remarks,kkk.order_id
    </select>
<select id="getDetailList">
    SELECT
        od.building_number,
        od.width,
        od.height,
        fol.quantity,
        ROUND( od.width * od.height * fol.quantity / 1000000, 2 ) as area
    FROM
        ( SELECT * FROM mm.finished_operate_log aa WHERE aa.operate_type = '入库' AND aa.STATUS != '已作废' ) fol
            LEFT JOIN sd.order_detail od ON fol.order_id = od.order_id
            AND fol.operation_number = od.order_number
            LEFT JOIN sd.`order` o ON o.order_id = fol.order_id
    WHERE
        o.order_id=#{orderId} and fol.remarks=#{remarks}
    ORDER BY
        fol.operate_time DESC
</select>
    <select id="getDetailLists">
        SELECT
            od.building_number,
            od.width,
            od.height,
            fol.quantity,
            od.product_name,
            od.product_id,
            ROUND( od.width * od.height * fol.quantity / 1000000, 2 ) as area
        FROM
            ( SELECT * FROM mm.finished_operate_log aa WHERE aa.operate_type = '入库' AND aa.STATUS != '已作废' ) fol
                LEFT JOIN sd.order_detail od ON fol.order_id = od.order_id
                AND fol.operation_number = od.order_number
                LEFT JOIN sd.`order` o ON o.order_id = fol.order_id
        WHERE
            o.order_id=#{orderId} and fol.remarks=#{remarks} and od.product_id=#{productId}
        ORDER BY
            fol.operate_time DESC
    </select>
    <select id="getDetailList2">
        SELECT
            od.product_id,
            od.product_name
        FROM
            ( SELECT * FROM mm.finished_operate_log aa WHERE aa.operate_type = '入库' AND aa.STATUS != '已作废' ) fol
                LEFT JOIN sd.order_detail od ON fol.order_id = od.order_id
                AND fol.operation_number = od.order_number
                LEFT JOIN sd.`order` o ON o.order_id = fol.order_id
        WHERE
            o.order_id=#{orderId} and fol.remarks=#{remarks}
        group by
            od.product_id
    </select>
    <select id="getSelectStorageRecordDeliveryId" resultMap="selectFinishedGoodsInventory">
        select fol.id,
        fol.operation_order_number,
        fol.order_id,
        fol.operate_type,
        fol.process_id,
        fol.operation_number,
        fol.quantity,
        fol.operator,
        od.product_id,
        od.product_name,
        od.width,
        od.height,
        fol.operate_time,
        fol.`status`,
        fol.is_state,
        fol.reviewed,
        fol.reviewed_time,
        fol.type,
        fol.remarks
        from (select *
        from mm.finished_operate_log aa where aa.operate_type = #{type}  and aa.status!='已作废') fol
        left join sd.order_detail od on fol.order_id = od.order_id and fol.operation_number = od.order_number
        left join sd.`order` o on o.order_id=fol.order_id
        where fol.operation_order_number=#{deliveryId}
    </select>
</mapper>