| | |
| | | delete from mm.material_log where operation_order_number=#{materialOutboundId} |
| | | </delete> |
| | | |
| | | <delete id="deleteMaterialLogById" > |
| | | delete from mm.material_log where id=#{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteReturningWarehouseDetail" > |
| | | delete from mm.returning_warehouse_detail where returning_id=#{returningId} |
| | | </delete> |
| | |
| | | </select> |
| | | |
| | | <select id="getMaterialInventoryCount" > |
| | | select count(*) from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} |
| | | select * from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} |
| | | </select> |
| | | |
| | | <select id="getMaterialInventoryCountNull" > |
| | | select count(*) from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture is null |
| | | select * from mm.material_inventory where material_code=#{materialCode} and date_of_manufacture is null |
| | | </select> |
| | | |
| | | <select id="getMaterialInventoryCountId" > |
| | |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryInventoryOut"> |
| | | <update id="updateMaterialInventoryInventoryPlanQuantityOut"> |
| | | update mm.material_inventory |
| | | set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0),total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryInventoryInt"> |
| | | <update id="updateMaterialInventoryInventoryPlanQuantityInt"> |
| | | update mm.material_inventory |
| | | set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryInventoryOut"> |
| | | update mm.material_inventory |
| | | set inventory_quantity=inventory_quantity-#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryInventoryInt"> |
| | | update mm.material_inventory |
| | | set inventory_quantity=inventory_quantity+#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity}, |
| | | available_quantity=available_quantity+#{materialInventory.inventoryQuantity}, |
| | | total_area=single_piece_area*inventory_quantity |
| | | where material_code=#{materialCode} |
| | | where material_code=#{materialCode} and date_of_manufacture is null |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryOut" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity-#{quantity}, |
| | | available_quantity=available_quantity-#{quantity}, |
| | | total_area=single_piece_area*inventory_quantity |
| | | where material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryNullOut" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity-#{quantity}, |
| | | available_quantity=available_quantity-#{quantity}, |
| | | total_area=single_piece_area*inventory_quantity |
| | | where material_code=#{materialCode} and date_of_manufacture is null |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryReturning" > |
| | |
| | | </if> |
| | | |
| | | <if test="materialLog.inventoryId != null and materialLog.inventoryId != ''"> |
| | | and ml.inventoryId regexp #{materialLog.inventoryId} |
| | | and ml.inventory_id regexp #{materialLog.inventoryId} |
| | | </if> |
| | | <if test="materialLog.materialCode != null and materialLog.materialCode != ''"> |
| | | and ml.materialCode regexp #{materialLog.materialCode} |
| | | and ml.material_code regexp #{materialLog.materialCode} |
| | | </if> |
| | | <if test="materialLog.materialName != null and materialLog.materialName != ''"> |
| | | and ml.materialName regexp #{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.remarks != null and materialLog.remarks != ''"> |
| | | and ml.remarks regexp #{materialLog.remarksr} |
| | | </if> |
| | | <if test="materialLog.projectNo != null and materialLog.projectNo != ''"> |
| | | and ml.project_no regexp #{materialLog.projectNo} |
| | | </if> |
| | | </where> |
| | | order by ml.id desc |
| | |
| | | </if> |
| | | |
| | | <if test="materialLog.inventoryId != null and materialLog.inventoryId != ''"> |
| | | and ml.inventoryId regexp #{materialLog.inventoryId} |
| | | and ml.inventory_id regexp #{materialLog.inventoryId} |
| | | </if> |
| | | <if test="materialLog.materialCode != null and materialLog.materialCode != ''"> |
| | | and ml.materialCode regexp #{materialLog.materialCode} |
| | | and ml.material_code regexp #{materialLog.materialCode} |
| | | </if> |
| | | <if test="materialLog.materialName != null and materialLog.materialName != ''"> |
| | | and ml.materialName regexp #{materialLog.materialName} |
| | | and ml.material_name regexp #{materialLog.materialName} |
| | | </if> |
| | | <if test="materialLog.producer != null and materialLog.producer != ''"> |
| | | and ml.producer regexp #{materialLog.producer} |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="updateMaterialOutboundOptimizeUses"> |
| | | <update id="updateMaterialOutboundOptimizeUses"> |
| | | update mm.material_outbound_detail set outbound_quantity=outbound_quantity+#{quantity} where use_id=#{useId}; |
| | | </select> |
| | | </update> |
| | | |
| | | <select id="updateOptimizeUsesMes"> |
| | | <update id="updateOptimizeUsesMes"> |
| | | update pp.optimize_use set not_use_count=not_use_count-#{quantity} where id=#{useId}; |
| | | </select> |
| | | </update> |
| | | |
| | | <insert id="insertMaterialOutboundDetailOptimizeUses" useGeneratedKeys="true" > |
| | | insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,use_id,inventory_id,inventory_organization, |
| | |
| | | ) |
| | | </insert> |
| | | |
| | | <select id="selectProjectNo"> |
| | | 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) <= #{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) <= #{endDate} |
| | | and ml.operate_type=#{type} |
| | | </select> |
| | | </mapper> |