guoyujie
2025-04-08 1e1c416c6aa6596feb333b75d882ffeede73d3c9
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -1149,5 +1149,86 @@
        select project_no from pp.optimize_use where id=#{useId};
    </select>
    <select id="getOptimizeOutboundReport">
        SELECT
            ml.operation_order_number,
            ml.project_no,
            ml.inventory_id,
            ml.material_name,
            ml.unit,
            ml.width,
            ml.height,
            ml.thickness,
            ml.quantity,
            round(ml.width*ml.height*ml.quantity/1000000,2) as area,
            ou.use_count,
            ou.not_use_count,
            ml.operator,
            ml.operate_time
        FROM
            mm.material_log AS ml
                LEFT JOIN pp.optimize_use AS ou ON ou.project_no = ml.project_no
                AND ou.raw_stock_code = ml.inventory_id
        WHERE
            ou.project_no IS NOT NULL
               AND date( ml.operate_time )>= #{startDate} and date(ml.operate_time) &lt;= #{endDate}
            and ml.operate_type=#{type}
        <if test="materialLog.operationOrderNumber != null and materialLog.operationOrderNumber != ''">
            and ml.operation_order_number regexp #{materialLog.operationOrderNumber}
        </if>
        <if test="materialLog.useCount != null and materialLog.useCount != ''">
            and ou.use_count regexp #{materialLog.useCount}
        </if>
        <if test="materialLog.quantity != null and materialLog.quantity != ''">
            and ml.quantity regexp #{materialLog.quantity}
        </if>
        <if test="materialLog.width != null and materialLog.width != ''">
            and  ml.width regexp  REGEXP_REPLACE(#{materialLog.width},'\\.0+$','')
        </if>
        <if test="materialLog.height != null and materialLog.height != ''">
            and  ml.height regexp  REGEXP_REPLACE(#{materialLog.height},'\\.0+$','')
        </if>
        <if test="materialLog.thickness != null and materialLog.thickness != ''">
            and  ml.thickness regexp  REGEXP_REPLACE(#{materialLog.thickness},'\\.0+$','')
        </if>
        <if test="materialLog.inventoryId != null and materialLog.inventoryId != ''">
            and  ml.inventory_id regexp  #{materialLog.inventoryId}
        </if>
        <if test="materialLog.materialName != null and materialLog.materialName != ''">
            and  ml.material_name regexp  #{materialLog.materialName}
        </if>
        <if test="materialLog.producer != null and materialLog.producer != ''">
            and  ml.producer regexp  #{materialLog.producer}
        </if>
        <if test="materialLog.unit != null and materialLog.unit != ''">
            and  ml.unit regexp  #{materialLog.unit}
        </if>
        <if test="materialLog.operator != null and materialLog.operator != ''">
            and  ml.operator regexp  #{materialLog.operator}
        </if>
        <if test="materialLog.remarks != null and materialLog.remarks != ''">
            and ml.remarks regexp #{materialLog.remarksr}
        </if>
        order by ml.id desc
        limit #{offset},#{pageSize};
    </select>
    <select id="getOptimizeOutboundReportTotal">
        SELECT
            CEILING(count(ml.id)/#{pageSize}) as 'pageTotal',
                count(ml.id) as 'total'
        FROM
            mm.material_log AS ml
                LEFT JOIN pp.optimize_use AS ou ON ou.project_no = ml.project_no
                AND ou.raw_stock_code = ml.inventory_id
        WHERE
            ou.project_no IS NOT NULL
          AND date( ml.operate_time )>= #{startDate} and date(ml.operate_time) &lt;= #{endDate}
          and ml.operate_type=#{type}
    </select>
</mapper>