廖井涛
2025-09-05 8112ef4d25672733c725b105e0bb6d8d2d2027c0
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -625,19 +625,19 @@
    </select>
    <select id="getMaterialInventoryCount" >
        select * 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} and producer=#{producer}
    </select>
    <select id="getMaterialInventoryCountNull" >
        select * 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  and producer=#{producer}
    </select>
    <select id="getMaterialInventoryCountId" >
        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture}
        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} and producer=#{producer}
    </select>
    <select id="getMaterialInventoryCountNullId" >
        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null
        select id from mm.material_inventory where  material_code=#{materialCode} and date_of_manufacture is null and producer=#{producer}
    </select>
    <select id="getIsNotMaterialOutboundDetail" >
@@ -817,33 +817,34 @@
                                         available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
                                         total_area=single_piece_area*inventory_quantity
                                     where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
                                       and producer=#{materialInventory.producer}
    </update>
    <update id="updateMaterialInventoryNull" >
        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} and date_of_manufacture is null
        where  material_code=#{materialCode} and date_of_manufacture is null and producer=#{materialInventory.producer}
    </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}
        where  material_code=#{materialCode} and date_of_manufacture=#{dateOfManufacture} and producer=#{producer}
    </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
        where  material_code=#{materialCode} and date_of_manufacture is null and producer=#{producer}
    </update>
    <update id="updateMaterialInventoryReturning" >
        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
       where  material_code=#{materialCode} and
                date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
                date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture} and producer=#{returningWarehouseDetail.producer}
    </update>
@@ -851,7 +852,7 @@
    <update id="updateMaterialInventoryReturningNull" >
        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
        where  material_code=#{materialCode} and
            date_of_manufacture is null
            date_of_manufacture is null and producer=#{returningWarehouseDetail.producer}
    </update>
@@ -1319,4 +1320,15 @@
        where id=#{materialInventoryId}
    </update>
    <update id="updateMaterialInventoryOne" >
        update mm.material_inventory set
                                         quality_guarantee_period=#{materialInventory.qualityGuaranteePeriod},
                                         inventory_area=#{materialInventory.inventoryArea},
                                         remarks=#{materialInventory.remarks},
                                         available_quantity=available_quantity+#{materialInventory.availableQuantity},
                                         inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                         total_area=inventory_quantity*single_piece_area
        where id=#{materialInventoryId}
    </update>
</mapper>