| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.example.erp.mapper.mm.MaterialInventoryMapper"> |
| | | |
| | | <resultMap id="selectMaterialOutboundDetail" type="com.example.erp.entity.mm.MaterialOutboundDetail" > |
| | | <id column="id" property="id"/> |
| | | <result column="material_outbound_id" property="materialOutboundId"/> |
| | | <result column="material_outbound_number" property="materialOutboundNumber"/> |
| | | <result column="inventory_id" property="inventoryId"/> |
| | | <result column="inventory_organization" property="inventoryOrganization"/> |
| | | <result column="material_code" property="materialCode"/> |
| | | <result column="material_name" property="materialName"/> |
| | | <result column="use_id" property="useId"/> |
| | | <result column="producer" property="producer"/> |
| | | <result column="unit" property="unit"/> |
| | | <result column="width" property="width"/> |
| | | <result column="height" property="height"/> |
| | | <result column="thickness" property="thickness"/> |
| | | <result column="outbound_quantity" property="outboundQuantity"/> |
| | | <result column="single_piece_area" property="singlePieceArea"/> |
| | | <result column="inventory_area" property="inventoryArea"/> |
| | | <result column="date_of_manufacture" property="dateOfManufacture"/> |
| | | <result column="remarks" property="remarks"/> |
| | | |
| | | <result column="material_requisition_personnel" property="materialOutbound.materialRequisitionPersonnel"/> |
| | | <result column="material_requisition_team" property="materialOutbound.materialRequisitionTeam"/> |
| | | <result column="order_id" property="materialOutbound.orderId"/> |
| | | <result column="outbound_type" property="materialOutbound.outboundType"/> |
| | | <result column="warehouse_manager" property="materialOutbound.warehouseManager"/> |
| | | <result column="material_requisition_date" property="materialOutbound.materialRequisitionDate"/> |
| | | <result column="reviewed" property="materialOutbound.reviewed"/> |
| | | <result column="reviewed_time" property="materialOutbound.reviewedTime"/> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="getSelectMaterialInventoryDate"> |
| | |
| | | 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> |