| | |
| | | select |
| | | ou.id as useId, |
| | | ou.project_no as projectNo, |
| | | ou.use_count AS inventoryQuantity, |
| | | mi.inventory_quantity AS inventoryQuantity, |
| | | mi.plan_quantity AS availableQuantity, |
| | | mi.plan_quantity AS planQuantity, |
| | | mi.id, |
| | |
| | | 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 |
| | | ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.raw_stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id |
| | | left join pp.optimize_project op on op.project_no=ou.project_no |
| | | <where> |
| | | ou.not_use_count>0 and ou.state=1 and |
| | | mi.plan_quantity>0 and op.state>=100 and |
| | | date(ou.create_time)>=#{startDate} and date(ou.create_time) <= #{endDate} |
| | | |
| | | </where> |
| | |
| | | from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id |
| | | <where> |
| | | <if test="materialInventory.stockId != null and materialInventory.stockId != ''"> |
| | | and mi.id regexp #{materialInventory.stockId} |
| | | and mi.id in |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </where> |
| | |
| | | select |
| | | ou.id as useId, |
| | | ou.project_no as projectNo, |
| | | ou.use_count AS inventoryQuantity, |
| | | mi.inventory_quantity AS inventoryQuantity, |
| | | mi.plan_quantity AS availableQuantity, |
| | | mi.plan_quantity AS planQuantity, |
| | | mi.id, |
| | |
| | | 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 |
| | | ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.raw_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} |
| | | and ou.id in |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </where> |
| | |
| | | pp.optimize_use ou |
| | | <where> |
| | | <if test="optimizeUse.rawStockCode != null and optimizeUse.rawStockCode != ''"> |
| | | and ou.id regexp #{optimizeUse.rawStockCode} |
| | | and ou.id in |
| | | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </where> |
| | |
| | | |
| | | <update id="updateMaterialInventoryInventoryOut"> |
| | | update mm.material_inventory |
| | | set inventory_quantity=inventory_quantity-#{quantity},plan_quantity=if(plan_quantity-#{quantity}>=0,plan_quantity-#{quantity},0) |
| | | 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 mm.material_inventory |
| | | set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity} |
| | | set inventory_quantity=inventory_quantity+#{quantity},plan_quantity=plan_quantity+#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryAvailableInventoryOut"> |
| | | update mm.material_inventory |
| | | set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity} |
| | | set available_quantity=available_quantity-#{quantity},inventory_quantity=inventory_quantity-#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryAvailableInventoryInt"> |
| | | update mm.material_inventory |
| | | set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity} |
| | | set available_quantity=available_quantity+#{quantity},inventory_quantity=inventory_quantity+#{quantity},total_area=inventory_quantity*single_piece_area |
| | | where id=#{inventoryId} |
| | | </update> |
| | | |
| | |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryReturning" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | total_area=total_area+#{totalArea} |
| | | where material_code=#{materialCode} and |
| | | date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture} |
| | |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryReturningNull" > |
| | | update mm.material_inventory set inventory_quantity=inventory_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}, |
| | | total_area=total_area+#{totalArea} |
| | | where material_code=#{materialCode} and |
| | | date_of_manufacture is null |
| | |
| | | where returning_id=#{number} and returning_number=#{returningWarehouseNumber} |
| | | </update> |
| | | |
| | | <update id="updateMaterialInventoryArea" > |
| | | update mm.material_inventory set single_piece_area=#{singlePieceArea}, |
| | | total_area=inventory_quantity*#{singlePieceArea} |
| | | where material_code=#{materialCode} |
| | | </update> |
| | | |
| | | |
| | | </mapper> |