| | |
| | | </select> |
| | | |
| | | |
| | | <select id="getSelectMaterialInventoryEngineeringDate"> |
| | | select |
| | | ou.id as useId, |
| | | ou.project_no as projectNo, |
| | | ou.use_count AS inventoryQuantity, |
| | | ou.not_use_count AS availableQuantity, |
| | | mi.id, |
| | | mi.inventory_organization as inventoryOrganization, |
| | | mi.material_code AS materialCode, |
| | | mi.producer, |
| | | mi.safety_stock AS safetyStock, |
| | | mi.total_area AS totalArea, |
| | | mi.single_piece_area singlePieceArea, |
| | | date(mi.date_of_manufacture) AS dateOfManufacture, |
| | | mi.quality_guarantee_period qualityGuaranteePeriod, |
| | | mi.inventory_area AS inventoryArea, |
| | | mi.dead_stock AS deadStock, |
| | | mi.remarks, |
| | | date(mi.create_time) AS createTime, |
| | | ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id |
| | | <where> |
| | | ou.not_use_count>0 and ou.state=1 and |
| | | date(ou.create_time)>=#{startDate} and date(ou.create_time) <= #{endDate} |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectMaterialInventoryEngineeringDatePageTotal"> |
| | | select |
| | | CEILING(count(id)/#{pageSize}) as 'pageTotal', |
| | | count(id) as 'total' |
| | | from |
| | | pp.optimize_use ou |
| | | <where> |
| | | ou.not_use_count>0 and ou.state=1 and |
| | | date(ou.create_time)>=#{startDate} and date(ou.create_time) <= #{endDate} |
| | | |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | |
| | | <select id="getSelectMaterialInventory"> |
| | | select |
| | | mi.id, |
| | |
| | | <where> |
| | | <if test="materialInventory.id != null and materialInventory.id != ''"> |
| | | and mi.id regexp #{materialInventory.id} |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectMaterialInventoryEngineering"> |
| | | select |
| | | ou.id as useId, |
| | | ou.project_no as projectNo, |
| | | ou.use_count AS inventoryQuantity, |
| | | ou.not_use_count AS availableQuantity, |
| | | mi.id, |
| | | mi.inventory_organization as inventoryOrganization, |
| | | mi.material_code AS materialCode, |
| | | mi.producer, |
| | | mi.safety_stock AS safetyStock, |
| | | mi.total_area AS totalArea, |
| | | mi.single_piece_area singlePieceArea, |
| | | date(mi.date_of_manufacture) AS dateOfManufacture, |
| | | mi.quality_guarantee_period qualityGuaranteePeriod, |
| | | mi.inventory_area AS inventoryArea, |
| | | mi.dead_stock AS deadStock, |
| | | mi.remarks, |
| | | date(mi.create_time) AS createTime, |
| | | ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id |
| | | |
| | | <where> |
| | | <if test="optimizeUse.rawStockCode != null and optimizeUse.rawStockCode != ''"> |
| | | and ou.id regexp #{optimizeUse.rawStockCode} |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectMaterialInventoryEngineeringPageTotal"> |
| | | select |
| | | CEILING(count(id)/#{pageSize}) as 'pageTotal', |
| | | count(id) as 'total' |
| | | from |
| | | pp.optimize_use ou |
| | | <where> |
| | | <if test="optimizeUse.rawStockCode != null and optimizeUse.rawStockCode != ''"> |
| | | and ou.id regexp #{optimizeUse.rawStockCode} |
| | | </if> |
| | | |
| | | </where> |
| | |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="SelectMaterialOutboundDetail" > |
| | | select |
| | | * |
| | | from mm.material_outbound_detail modd |
| | | <where> |
| | | <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''"> |
| | | and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getSelectMaterialOutboundDetail" > |
| | | select |
| | | modd.use_id as useId, |
| | | modd.inventory_id as id, |
| | | modd.inventory_organization as inventoryOrganization, |
| | | modd.material_code as materialCode, |
| | |
| | | from mm.material_outbound_detail modd left join mm.material_inventory mi on modd.inventory_id=mi.id |
| | | left join mm.material_outbound mo on modd.material_outbound_id=mo.material_outbound_id |
| | | left join mm.material_store ms on modd.material_code=ms.id |
| | | <where> |
| | | <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''"> |
| | | and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId} |
| | | </if> |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectMaterialOutboundEngineering" > |
| | | select |
| | | ou.project_no as projectNo, |
| | | modd.inventory_id as id, |
| | | modd.inventory_organization as inventoryOrganization, |
| | | modd.material_code as materialCode, |
| | | modd.material_name as materialName, |
| | | modd.producer, |
| | | modd.width, |
| | | modd.height, |
| | | modd.thickness, |
| | | modd.unit, |
| | | modd.outbound_quantity as outboundQuantity, |
| | | date(modd.date_of_manufacture) as dateOfManufacture, |
| | | modd.single_piece_area as singlePieceArea, |
| | | modd.inventory_area as inventoryArea, |
| | | modd.remarks, |
| | | ou.use_count as inventoryQuantity, |
| | | if(mo.reviewed_state!=1,modd.outbound_quantity+ou.not_use_count,ou.not_use_count) as availableQuantity, |
| | | ms.json |
| | | from mm.material_outbound_detail modd left join pp.optimize_use ou on modd.use_id=ou.id |
| | | left join mm.material_outbound mo on modd.material_outbound_id=mo.material_outbound_id |
| | | left join mm.material_store ms on modd.material_code=ms.id |
| | | <where> |
| | | <if test="materialOutboundDetail.materialOutboundId != null and materialOutboundDetail.materialOutboundId != ''"> |
| | | and modd.material_outbound_id regexp #{materialOutboundDetail.materialOutboundId} |
| | |
| | | </insert> |
| | | |
| | | <insert id="insertMaterialOutboundDetail" useGeneratedKeys="true" > |
| | | insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,material_name,inventory_id,inventory_organization,producer,unit,width, |
| | | insert into mm.material_outbound_detail (material_outbound_id,material_outbound_number,material_code,material_name,use_id,inventory_id,inventory_organization,producer,unit,width, |
| | | height,thickness,outbound_quantity,single_piece_area,inventory_area,date_of_manufacture,remarks) |
| | | values ( |
| | | #{number} ,#{materialOutboundNumber},#{materialOutboundDetail.materialCode},#{materialOutboundDetail.materialName},#{materialOutboundDetail.id}, |
| | | #{number} ,#{materialOutboundNumber},#{materialOutboundDetail.materialCode},#{materialOutboundDetail.materialName},#{materialOutboundDetail.useId},#{materialOutboundDetail.id}, |
| | | #{materialOutboundDetail.inventoryOrganization},#{materialOutboundDetail.producer},#{materialOutboundDetail.unit}, |
| | | #{materialOutboundDetail.width},#{materialOutboundDetail.height},#{materialOutboundDetail.thickness},#{materialOutboundDetail.outboundQuantity}, |
| | | #{materialOutboundDetail.singlePieceArea},#{materialOutboundDetail.inventoryArea},#{materialOutboundDetail.dateOfManufacture},#{materialOutboundDetail.remarks} |
| | |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateMaterialInventoryAvailableOptOut"> |
| | | update pp.optimize_use |
| | | set not_use_count=not_use_count-#{quantity} |
| | | where id=#{useId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryAvailableOptInt"> |
| | | update pp.optimize_use |
| | | set not_use_count=not_use_count+#{quantity} |
| | | where id=#{useId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryAvailableOut"> |
| | | update mm.material_inventory |
| | | set available_quantity=available_quantity-#{quantity} |