liyong
7 小时以前 1cf91e355038837f30f2d727507b2229263d7de7
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -29,19 +29,19 @@
    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;
    }
//    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;
//    }
    /**
     * 不合格入库
@@ -50,7 +50,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 +82,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 +98,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 +108,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));