zss
22 小时以前 5a662d3a4aa00efac7cfb102f794e7c18cd7d9f0
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -28,21 +28,6 @@
    private final StockInventoryService stockInventoryService;
    private final StockInRecordService stockInRecordService;
    // 获取商品入库数量,出库数量,剩余库存
    public Map<String, BigDecimal> getStockQuantity(Long productModelId) {
        // 入库数量
        BigDecimal sumQuantity = procurementRecordMapper.getSumQuantity(productModelId);
        // 出库数量
        BigDecimal outQuantity = procurementRecordOutMapper.getSumQuantity(productModelId);
        // 剩余库存
        BigDecimal stockQuantity = outQuantity.compareTo(sumQuantity) > 0 ? BigDecimal.ZERO : sumQuantity.subtract(outQuantity);
        Map<String, BigDecimal> stockMap = new HashMap<>();
        stockMap.put("inboundNum", sumQuantity);
        stockMap.put("outboundNum", outQuantity);
        stockMap.put("stockQuantity", stockQuantity);
        return stockMap;
    }
    /**
     * 不合格入库
     * @param productModelId
@@ -50,7 +35,7 @@
     * @param recordType
     * @param recordId
     */
    public void addUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
    public void addUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
        StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
        stockUninventoryDto.setRecordId(recordId);
        stockUninventoryDto.setRecordType(String.valueOf(recordType));
@@ -82,7 +67,7 @@
     * @param recordType
     * @param recordId
     */
    public void addStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
    public void addStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
        StockInventoryDto stockInventoryDto = new StockInventoryDto();
        stockInventoryDto.setRecordId(recordId);
        stockInventoryDto.setRecordType(String.valueOf(recordType));
@@ -98,7 +83,7 @@
     * @param recordType
     * @param recordId
     */
    public void substractStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
    public void substractStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
        StockInventoryDto stockInventoryDto = new StockInventoryDto();
        stockInventoryDto.setRecordId(recordId);
        stockInventoryDto.setRecordType(String.valueOf(recordType));
@@ -108,7 +93,7 @@
    }
    //不合格库存删除
    public void deleteStockRecord(Long recordId, Integer recordType) {
    public void deleteStockRecord(Long recordId, String recordType) {
        StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>()
                .lambda().eq(StockInRecord::getRecordId, recordId)
                .eq(StockInRecord::getRecordType, recordType));