zss
2 天以前 17d65c77c6fedf1b51afec166c5a9735c6e4d38e
Merge remote-tracking branch 'origin/jtwy' into jtwy
已修改5个文件
108 ■■■■ 文件已修改
src/main/java/com/ruoyi/basic/pojo/ProductModel.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/basic/ProductModelMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/pojo/ProductModel.java
@@ -63,4 +63,8 @@
    @TableField(exist = false)
    private LocalDateTime createTime;
    @TableField(exist = false)
    private Boolean  isFrozen;
}
src/main/java/com/ruoyi/procurementrecord/controller/ProcurementRecordController.java
@@ -156,26 +156,48 @@
        return AjaxResult.success(result);
    }
    @PostMapping("frozenQuality")
    @PostMapping("frozenStorageQuality")
    @Log(title = "采购入库-库存管理-冻结不合格产品", businessType = BusinessType.UPDATE)
    public AjaxResult frozenQuality(@RequestBody List<Integer> frozenIds) {
        boolean result = procurementRecordService.frozenQuality(frozenIds);
    public AjaxResult frozenStorageQuality(@RequestBody List<Integer> frozenIds) {
        boolean result = procurementRecordService.frozenStorageQuality(frozenIds);
        if (result) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    @PostMapping("thawQuality")
    @PostMapping("thawStorageQuality")
    @Log(title = "采购入库-库存管理-解冻不合格产品", businessType = BusinessType.UPDATE)
    public AjaxResult thawQuality(@RequestBody List<Integer> thawIds) {
        boolean result = procurementRecordService.thawQuality(thawIds);
    public AjaxResult thawStorageQuality(@RequestBody List<Integer> thawIds) {
        boolean result = procurementRecordService.thawStorageQuality(thawIds);
        if (result) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    @PostMapping("frozenFinishedQuality")
    @Log(title = "采购入库-库存管理-冻结不合格产品", businessType = BusinessType.UPDATE)
    public AjaxResult frozenFinishedQuality(@RequestBody List<Integer> frozenIds) {
        boolean result = procurementRecordService.frozenFinishedQuality(frozenIds);
        if (result) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    @PostMapping("thawFinishedQuality")
    @Log(title = "采购入库-库存管理-解冻不合格产品", businessType = BusinessType.UPDATE)
    public AjaxResult thawFinishedQuality(@RequestBody List<Integer> thawIds) {
        boolean result = procurementRecordService.thawFinishedQuality(thawIds);
        if (result) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    @GetMapping("/listPageCopyByProduction")
    @Log(title = "生产入库-库存管理-分页查询", businessType = BusinessType.OTHER)
    public AjaxResult listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) {
src/main/java/com/ruoyi/procurementrecord/service/ProcurementRecordService.java
@@ -64,7 +64,11 @@
    IPage<ProcurementPageDto> listPageByProductProduction(Page page, ProcurementPageDto procurementDto);
    boolean frozenQuality(List<Integer> frozenIds);
    boolean frozenStorageQuality(List<Integer> frozenIds);
    boolean thawQuality(List<Integer> thawIds);
    boolean thawStorageQuality(List<Integer> thawIds);
    boolean frozenFinishedQuality(List<Integer> frozenIds);
    boolean thawFinishedQuality(List<Integer> thawIds);
}
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.service.IProductModelService;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -55,6 +56,8 @@
    private final SalesLedgerProductMapper salesLedgerProductMapper;
    private final StockUtils stockUtils;
    private final ProductModelMapper productModelMapper;
    private final IProductModelService productModelService;
    @Override
    public List<ProcurementDto> listProcurementBySalesLedgerId(ProcurementDto procurementDto) {
@@ -483,6 +486,7 @@
        inventoryInformationDto.setInventoryChangeValue(inventoryChangeValue.subtract(totalInventoryValue));
        return inventoryInformationDto;
    }
    @Override
    public IPage<ProcurementPageDto> listPageByProduction(Page page, ProcurementPageDto procurementDto) {
        IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProduction(page, procurementDto);
@@ -932,31 +936,74 @@
    }
    @Override
    public boolean frozenQuality(List<Integer> frozenIds) {
    public boolean frozenStorageQuality(List<Integer> frozenIds) {
        if (frozenIds == null || frozenIds.isEmpty()) {
            return true;
        }
        LambdaUpdateWrapper<ProcurementRecordStorage> storageLambdaUpdateWrapper = new LambdaUpdateWrapper<ProcurementRecordStorage>()
                .set(ProcurementRecordStorage::getIsFrozen, true)
                .in(ProcurementRecordStorage::getId, frozenIds)
                .in(ProcurementRecordStorage::getSalesLedgerProductId, frozenIds)
                .eq(ProcurementRecordStorage::getIsFrozen, false);
        return update(storageLambdaUpdateWrapper);
    }
    @Override
    public boolean thawQuality(List<Integer> thawIds) {
    public boolean thawStorageQuality(List<Integer> thawIds) {
        if (thawIds == null || thawIds.isEmpty()) {
            return true;
        }
        LambdaUpdateWrapper<ProcurementRecordStorage> storageLambdaUpdateWrapper = new LambdaUpdateWrapper<ProcurementRecordStorage>()
                .set(ProcurementRecordStorage::getIsFrozen, false)
                .in(ProcurementRecordStorage::getId, thawIds)
                .in(ProcurementRecordStorage::getSalesLedgerProductId, thawIds)
                .eq(ProcurementRecordStorage::getIsFrozen, true);
        return update(storageLambdaUpdateWrapper);
    }
    @Override
    public boolean frozenFinishedQuality(List<Integer> frozenIds) {
        if (frozenIds == null || frozenIds.isEmpty()) {
            return true;
        }
        List<ProductModel> modelList = productModelService.list(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getProductId, frozenIds));
        List<Long> productModelIds = modelList.stream()
                .map(ProductModel::getId)
                .collect(Collectors.toList());
        if (productModelIds.isEmpty()) {
            return true;
        }
        LambdaUpdateWrapper<ProcurementRecordStorage> updateWrapper = new LambdaUpdateWrapper<ProcurementRecordStorage>()
                .in(ProcurementRecordStorage::getProductModelId, productModelIds).set(ProcurementRecordStorage::getIsFrozen, 1);
        return update(updateWrapper);
    }
    @Override
    public boolean thawFinishedQuality(List<Integer> thawIds) {
        if (thawIds == null || thawIds.isEmpty()) {
            return true;
        }
        List<ProductModel> modelList = productModelService.list(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getProductId, thawIds));
        List<Long> productModelIds = modelList.stream()
                .map(ProductModel::getId)
                .collect(Collectors.toList());
        if (productModelIds.isEmpty()) {
            return true;
        }
        LambdaUpdateWrapper<ProcurementRecordStorage> updateWrapper = new LambdaUpdateWrapper<ProcurementRecordStorage>()
                .in(ProcurementRecordStorage::getProductModelId, productModelIds).set(ProcurementRecordStorage::getIsFrozen, 0);
        return update(updateWrapper);
    }
}
src/main/resources/mapper/basic/ProductModelMapper.xml
@@ -41,10 +41,12 @@
        pm.model,
        pm.unit,
        p.product_name,
        GREATEST(s.last_in_time, o.last_out_time) AS create_time,
        COALESCE(s.inboundNum, 0) AS inboundNum,
        COALESCE(o.outboundNum, 0) AS outboundNum,
        COALESCE(s.inboundNum, 0) - COALESCE(o.outboundNum, 0) AS stockQuantity
        COALESCE(s.inboundNum, 0) - COALESCE(o.outboundNum, 0) AS stockQuantity,
        COALESCE(s.is_frozen, 0) AS is_frozen
        FROM product_model pm
        LEFT JOIN product p ON pm.product_id = p.id
@@ -53,7 +55,8 @@
        SELECT
        product_model_id,
        SUM(inbound_num) AS inboundNum,
        MAX(create_time) AS last_in_time
        MAX(create_time) AS last_in_time,
        MAX(is_frozen) AS is_frozen
        FROM procurement_record_storage
        <where>
            <if test="req.timeStr != null and req.timeStr != ''">