Merge remote-tracking branch 'origin/dev_长治_健齿齿科器材' into dev_长治_健齿齿科器材
已修改31个文件
422 ■■■■■ 文件已修改
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/dto/DrawMaterialDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/controller/ShipmentApprovalController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInventory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/sales/SalesQuotationMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/return-record.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/采购台账导入模板.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/销售台账导入模板.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -12,7 +12,6 @@
import com.ruoyi.approve.pojo.ApproveProcess;
import com.ruoyi.approve.service.IApproveNodeService;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.device.mapper.DeviceRepairMapper;
import com.ruoyi.device.pojo.DeviceRepair;
@@ -206,8 +205,8 @@
                            purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct);
                        }else {
                            //直接入库
                            stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
                                    purchaseLedger.getId(),salesLedgerProduct.getBatchNo(),salesLedgerProduct.getCustomer());
//                            stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
//                                    purchaseLedger.getId(),salesLedgerProduct.getBatchNo(),salesLedgerProduct.getCustomer());
                        }
                    }
                } else if (status.equals(3)) {
src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -16,6 +16,7 @@
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Collections;
@Component
@@ -67,7 +68,7 @@
     * @param recordType
     * @param recordId
     */
    public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId,String batchNo,String customer) {
    public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo, String customer, LocalDate productionDate) {
        StockInventoryDto stockInventoryDto = new StockInventoryDto();
        stockInventoryDto.setRecordId(recordId);
        if (recordType != null) {
@@ -77,6 +78,11 @@
        stockInventoryDto.setProductModelId(productModelId);
        stockInventoryDto.setBatchNo(batchNo);
        stockInventoryDto.setCustomer(customer);
        if (stockInventoryDto.getProductionDate() == null) {
            stockInventoryDto.setProductionDate(LocalDate.now());
        }else {
            stockInventoryDto.setProductionDate(productionDate);
        }
        stockInventoryService.addstockInventory(stockInventoryDto);
    }
src/main/java/com/ruoyi/production/dto/DrawMaterialDto.java
@@ -4,6 +4,7 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@ApiModel("领料单DTO")
@@ -41,4 +42,7 @@
    @ApiModelProperty("供应商名称")
    private String customer;
    @ApiModelProperty("有效期")
    private LocalDate productionDate;
}
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -277,11 +277,11 @@
        }
        // å¦‚果有数据先加库存
        ProductOrder productOrder = productOrderMapper.selectById(productOrderDto.getId());
        if (productOrder != null) {
        if (productOrder.getDrawMaterials() != null) {
            List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class);
            for (DrawMaterialDto drawMaterialDto : materialDtoList) {
                stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId(),
                        drawMaterialDto.getBatchNo(), drawMaterialDto.getCustomer()
                        drawMaterialDto.getBatchNo(), drawMaterialDto.getCustomer(),drawMaterialDto.getProductionDate()
                );
            }
        }
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -246,7 +246,6 @@
                    throw new RuntimeException("生产订单不存在");
                }
                Product product = productMapper.selectById(productModel.getProductId());
                QualityInspect qualityInspect = new QualityInspect();
                qualityInspect.setProductId(product.getId());
@@ -280,7 +279,7 @@
                //直接入库
                String customer = "长治市轴承制造有限公司";
                stockUtils.addStock(productProcessRouteItem.getProductModelId(), productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()),
                        StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer
                        StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(),order.getBatchNo(),customer,null
                );
            }
            /*更新工单和生产订单*/
src/main/java/com/ruoyi/purchase/dto/PurchaseLedgerProductImportDto.java
@@ -1,7 +1,6 @@
package com.ruoyi.purchase.dto;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.sales.dto.SalesLedgerProductImportDto;
import lombok.Data;
import java.math.BigDecimal;
@@ -17,16 +16,6 @@
    private String purchaseContractNumber;
    /**
     * é¢„警数量
     */
    @Excel(name = "库存预警数量")
    private BigDecimal warnNum;
    @Excel(name = "销售单号")
    private String salesContractNo;
    /**
     * äº§å“å¤§ç±»
     */
    @Excel(name = "产品大类")
@@ -39,16 +28,22 @@
    private String specificationModel;
    /**
     * UID码
     */
    @Excel(name = "UID码")
    private String uidNo;
    /**
     * æ‰¹æ¬¡å·
     */
    @Excel(name = "批次号")
    private String batchNo;
    /**
     * å•位
     */
    @Excel(name = "单位")
    private String unit;
    /**
     * æ•°é‡
     */
    @Excel(name = "数量")
    private BigDecimal quantity;
    /**
     * ç¨Žçއ
@@ -63,6 +58,12 @@
    private BigDecimal taxInclusiveUnitPrice;
    /**
     * æ•°é‡
     */
    @Excel(name = "数量")
    private BigDecimal quantity;
    /**
     * å«ç¨Žæ€»ä»·
     */
    @Excel(name = "含税总价")
@@ -75,6 +76,12 @@
    private String invoiceType;
    /**
     * é¢„警数量
     */
    @Excel(name = "库存预警数量")
    private BigDecimal warnNum;
    /**
     * æ˜¯å¦è´¨æ£€
     */
    @Excel(name = "是否质检", readConverterExp = "0=否,1=是")
src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -17,6 +17,7 @@
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.basic.pojo.SupplierManage;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -27,6 +28,7 @@
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.purchase.dto.PurchaseLedgerDto;
@@ -150,6 +152,8 @@
    private  PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper;
    @Autowired
    private  SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper;
    @Autowired
    private StockUtils stockUtils;
    @Value("${file.upload-dir}")
    private String uploadDir;
@@ -201,23 +205,25 @@
            }
            purchaseLedgerMapper.updateById(purchaseLedger);
        }
        // 6.采购审核新增
        addApproveByPurchase(loginUser, purchaseLedger);
        // 4. å¤„理子表数据
        List<SalesLedgerProduct> productList = purchaseLedgerDto.getProductData();
        if (productList != null && !productList.isEmpty()) {
            handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType(),supplierManage);
        }
        //新增原材料检验  å®¡æ‰¹ä¹‹åŽæ‰ç”Ÿæˆæ£€éªŒ
//        if (productList != null) {
//            for (SalesLedgerProduct saleProduct : productList) {
//                //是否推送质检,如果true就添加
//                if (saleProduct.getIsChecked()) {
//                    addQualityInspect(purchaseLedger, saleProduct);
//                }
//            }
//        }
        //不审批
        if (productList != null) {
            for (SalesLedgerProduct saleProduct : productList) {
                //是否推送质检,如果true就添加
                if (saleProduct.getIsChecked()) {
                    addQualityInspect(purchaseLedger, saleProduct);
                } else {
                    //直接入库
                    stockUtils.addStock(saleProduct.getProductModelId(), saleProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
                            purchaseLedger.getId(), saleProduct.getBatchNo(), saleProduct.getCustomer(), null);
                }
            }
        }
        // 5. è¿ç§»ä¸´æ—¶æ–‡ä»¶åˆ°æ­£å¼ç›®å½•
        if (purchaseLedgerDto.getTempFileIds() != null && !purchaseLedgerDto.getTempFileIds().isEmpty()) {
            migrateTempFilesToFormal(purchaseLedger.getId(), purchaseLedgerDto.getTempFileIds());
@@ -240,7 +246,7 @@
        qualityInspect.setQuantity(saleProduct.getQuantity());
        qualityInspectMapper.insert(qualityInspect);
        List<QualityTestStandard> qualityTestStandard = qualityTestStandardMapper.getQualityTestStandardByProductId(saleProduct.getProductId(), 0,null);
        if (qualityTestStandard.size()>0){
        if (!qualityTestStandard.isEmpty()) {
            qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId());
            qualityInspectMapper.updateById(qualityInspect);
            qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery()
@@ -739,6 +745,24 @@
                for (PurchaseLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) {
                    SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct();
                    // æŸ¥è¯¢äº§å“
                    Product product = productMapper.selectOne(new LambdaQueryWrapper<Product>()
                            .eq(Product::getProductName, salesLedgerProductImportDto.getProductCategory()));
                    if (product == null) {
                        throw new RuntimeException("请维护产品:" + salesLedgerProductImportDto.getProductCategory());
                    }
                    // æŸ¥è¯¢äº§å“åž‹å·
                    ProductModel productModel = productModelMapper.selectOne(new LambdaQueryWrapper<ProductModel>()
                            .eq(ProductModel::getProductId, product.getId())
                            .eq(ProductModel::getModel, salesLedgerProductImportDto.getSpecificationModel())
                            .eq(ProductModel::getUidNo, salesLedgerProductImportDto.getUidNo()));
                    if (productModel == null) {
                        throw new RuntimeException("请维护产品【" + salesLedgerProductImportDto.getProductCategory() + "】的型号【"
                                + salesLedgerProductImportDto.getSpecificationModel() + "】和UID码【"
                                + salesLedgerProductImportDto.getUidNo() + "】");
                    }
                    salesLedgerProduct.setProductModelId(productModel.getId());
                    salesLedgerProduct.setProductId(product.getId());
                    BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct);
                    salesLedgerProduct.setSalesLedgerId(salesLedger.getId());
                    salesLedgerProduct.setType(2);
@@ -758,21 +782,25 @@
                    salesLedgerProduct.setApproveStatus(0);
                    salesLedgerProduct.setPendingTicketsTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
                    // æ˜¯å¦è´¨æ£€åˆ¤æ–­
                    if (salesLedgerProductImportDto.getIsChecked() == null) {
                        throw new RuntimeException("请填写是否质检!");
                    }
                    salesLedgerProduct.setIsChecked(salesLedgerProductImportDto.getIsChecked() == 1);
                    if(salesLedgerProductImportDto.getIsChecked() == 1){
                        addQualityInspect(salesLedger, salesLedgerProduct);
                    } else {
                        //直接入库
                        stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
                                salesLedger.getId(), salesLedgerProduct.getBatchNo(), salesLedger.getSupplierName(), LocalDate.now());
                    }
                    salesLedgerProductMapper.insert(salesLedgerProduct);
                }
                // é‡‡è´­å®¡æ ¸
                addApproveByPurchase(loginUser,salesLedger);
            }
            return AjaxResult.success("导入成功");
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
        return AjaxResult.success("导入失败");
    }
    @Override
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
@@ -214,7 +214,7 @@
    @TableField(exist = false)
    private String purchaseContractNo;
    private String BatchNo;
    private String batchNo;
    private String manufacturingTeam;
    /**
src/main/java/com/ruoyi/quality/pojo/QualityUnqualified.java
@@ -10,6 +10,7 @@
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
@@ -144,4 +145,10 @@
    @ApiModelProperty("是否不合格处理自己新增")
    @TableField(exist = false)
    private Boolean method;
    @ApiModelProperty("生产日期")
    private LocalDate productionDate;
    @ApiModelProperty("批号")
    private String batchNo;
}
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -78,6 +78,9 @@
    public int add(QualityInspectDto qualityInspectDto) {
        QualityInspect qualityInspect = new QualityInspect();
        BeanUtils.copyProperties(qualityInspectDto, qualityInspect);
        if (qualityInspectDto.getInspectType() != 0) {
            qualityInspectDto.setCustomer("长治市轴承制造有限公司");
        }
        qualityInspect.setInspectState(0);//默认未提交
        qualityInspectMapper.insert(qualityInspect);
        for (QualityInspectParam qualityInspectParam : qualityInspectDto.getQualityInspectParams()) {
@@ -128,11 +131,13 @@
            String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(","));
            qualityUnqualified.setDefectivePhenomena(text + "这些指标中存在不合格");//不合格现象
            qualityUnqualified.setInspectId(qualityInspect.getId());
            qualityUnqualified.setProductionDate(inspect.getProductionDate());
            qualityUnqualified.setBatchNo(inspect.getBatchNo());
            qualityUnqualifiedMapper.insert(qualityUnqualified);
        } else {
            //合格直接入库
            stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(),
                    qualityInspect.getId(), batchNo, customer
                    qualityInspect.getId(), batchNo, customer,inspect.getProductionDate()
            );
        }
        qualityInspect.setInspectState(1);//已提交
src/main/java/com/ruoyi/quality/service/impl/QualityUnqualifiedServiceImpl.java
@@ -137,7 +137,7 @@
                    //调用提交合格的接口
                    String customer = "长治市轴承制造有限公司";
                    stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(),
                            orders.getBatchNo(), customer
                            orders.getBatchNo(), customer,null
                    );
                    break;
                case "返工":
@@ -155,7 +155,7 @@
                case "让步放行":
                    //调用提交合格的接口
                    String customer = "长治市轴承制造有限公司";
                    stockUtils.addStock(modelId, unqualified.getQuantity(), StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(), orders.getBatchNo(), customer);
                    stockUtils.addStock(modelId, unqualified.getQuantity(), StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(), orders.getBatchNo(), customer,null);
                    break;
                default:
                    break;
@@ -182,6 +182,10 @@
            Map<String, Object> data = new HashMap<>();
            data.put("productName", info.getProductName());
            data.put("model", info.getModel());
            data.put("batchNo", info.getBatchNo());
            data.put("productionDate", info.getProductionDate());
            data.put("defectivePhenomena", info.getDefectivePhenomena());
            data.put("quantity", info.getQuantity());
            // åŠ è½½æ¨¡æ¿
            inputStream = getClass().getResourceAsStream("/static/return-record.docx");
src/main/java/com/ruoyi/sales/controller/ShipmentApprovalController.java
@@ -2,7 +2,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.controller.BaseController;
@@ -87,7 +86,7 @@
            //出库
            stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),null,null);
//            stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),null,null);
        }
        return AjaxResult.success();
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -1,43 +1,28 @@
package com.ruoyi.sales.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.approve.mapper.ApproveProcessMapper;
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.approve.vo.ApproveProcessVO;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.service.impl.TempFileServiceImpl;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.mapper.ShipmentApprovalMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
import com.ruoyi.sales.pojo.SalesLedger;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.pojo.ShipmentApproval;
import com.ruoyi.sales.pojo.ShippingInfo;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
import com.ruoyi.sales.service.ShippingInfoService;
import com.ruoyi.sales.service.impl.CommonFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
/**
@@ -73,20 +58,10 @@
    @Transactional(rollbackFor = Exception.class)
    @Log(title = "发货信息管理", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH");
        // å‘货审批
        ApproveProcessVO approveProcessVO = new ApproveProcessVO();
        approveProcessVO.setApproveType(7);
        approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
        approveProcessVO.setApproveReason(req.getType() + ":" +sh);
        approveProcessVO.setApproveUserIds(req.getApproveUserIds());
        approveProcessVO.setApproveUser(loginUser.getUserId());
        approveProcessVO.setApproveTime(LocalDate.now().toString());
        approveProcessService.addApprove(approveProcessVO);
        // æ·»åŠ å‘è´§æ¶ˆæ¯
        req.setShippingNo(sh);
        req.setStatus("待审核");
        req.setStatus("待发货");
        boolean save = shippingInfoService.save(req);
        return save ? AjaxResult.success() : AjaxResult.error();
    }
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
@@ -1,12 +1,9 @@
package com.ruoyi.sales.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @author :yys
@@ -32,6 +29,18 @@
    private String specificationModel;
    /**
     * æ‰¹å·
     */
    @Excel(name = "批号")
    private String batchNo;
    /**
     * UID码
     */
    @Excel(name = "UID码")
    private String uniNo;
    /**
     * å•位
     */
    @Excel(name = "单位")
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -285,7 +285,7 @@
        List<ProcessRoute> processRoutes = processRouteMapper.selectList(new QueryWrapper<ProcessRoute>().lambda()
                .eq(ProcessRoute::getProductModelId, salesLedgerProduct.getProductModelId())
                .orderByDesc(ProcessRoute::getCreateTime));
        if (processRoutes.size()>0){
        if (!processRoutes.isEmpty()){
            ProcessRoute processRoute = processRoutes.get(0);
            //新增生产订单工艺路线主表
            ProductProcessRoute productProcessRoute = new ProductProcessRoute();
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -31,10 +31,6 @@
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.production.mapper.*;
import com.ruoyi.production.pojo.ProductOrder;
import com.ruoyi.production.pojo.ProductProcessRouteItem;
import com.ruoyi.production.pojo.ProductWorkOrder;
import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -45,6 +41,8 @@
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.*;
import com.ruoyi.sales.service.ISalesLedgerService;
import com.ruoyi.stock.mapper.StockInventoryMapper;
import com.ruoyi.stock.pojo.StockInventory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
@@ -139,6 +137,8 @@
    private final ProductionProductInputMapper productionProductInputMapper;
    private final QualityInspectMapper qualityInspectMapper;
    private final StockInventoryMapper stockInventoryMapper;
    @Autowired
    private SysDeptMapper sysDeptMapper;
@@ -429,6 +429,10 @@
                for (SalesLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) {
                    SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct();
                    List<StockInventory> stockInventories = stockInventoryMapper.selectList(new LambdaQueryWrapper<StockInventory>().in(StockInventory::getBatchNo, salesLedgerProductImportDto.getBatchNo()));
                    if (CollectionUtils.isEmpty(stockInventories)) {
                        throw new RuntimeException("产品批号:" + salesLedgerProductImportDto.getBatchNo() + ",库存无对应产品数据!");
                    }
                    BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct);
                    salesLedgerProduct.setSalesLedgerId(salesLedger.getId());
                    salesLedgerProduct.setType(1);
@@ -458,16 +462,13 @@
                    salesLedgerProduct.setApproveStatus(0);
                    salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
                    salesLedgerProductMapper.insert(salesLedgerProduct);
                    // æ·»åŠ ç”Ÿäº§æ•°æ®
                    salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
                }
            }
            return AjaxResult.success("导入成功");
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
        return AjaxResult.success("导入失败");
    }
    @Override
@@ -928,32 +929,20 @@
                map.put("filingCertificateNo", productModel.getFilingCertificateNo());
            }
            amount = amount.add(product.getTaxInclusiveTotalPrice());
            List<ProductOrder> productOrders = productOrderMapper.selectList(new LambdaQueryWrapper<ProductOrder>()
                    .eq(ProductOrder::getBatchNo, product.getBatchNo()));
            if (CollectionUtils.isEmpty(productOrders)) {
            List<StockInventory> stockInventoryList = stockInventoryMapper.selectList(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, product.getProductModelId())
                    .eq(StockInventory::getBatchNo, product.getBatchNo())
                    .eq(StockInventory::getCustomer, product.getCustomer()));
            if (CollectionUtils.isEmpty(stockInventoryList)) {
                throw new RuntimeException("批号不存在");
            }
            List<ProductWorkOrder> productWorkOrders = productWorkOrderMapper.selectList(new LambdaQueryWrapper<ProductWorkOrder>()
                    .eq(ProductWorkOrder::getProductOrderId, productOrders.get(0).getId()));
            List<Long> ids = productWorkOrders.stream().map(ProductWorkOrder::getId).collect(Collectors.toList());
            List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(new LambdaQueryWrapper<ProductionProductMain>()
                    .in(ProductionProductMain::getWorkOrderId, ids)
                    .orderByDesc(ProductionProductMain::getCreateTime));
            List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(new LambdaQueryWrapper<ProductProcessRouteItem>()
                    .in(ProductProcessRouteItem::getId, productionProductMains.stream()
                            .map(ProductionProductMain::getProductProcessRouteItemId).collect(Collectors.toList()))
                    .eq(ProductProcessRouteItem::getProductModelId, product.getProductModelId())
                    .orderByDesc(ProductProcessRouteItem::getCreateTime));
            if (CollectionUtils.isEmpty(productProcessRouteItems)) {
                throw new RuntimeException("生产数据不存在");
            }
            String productionDate = productProcessRouteItems.get(0).getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            if (productModel.getValidityPeriod() == null) {
                throw new RuntimeException("有效期不能为空");
            }
            String expiryDate = productProcessRouteItems.get(0).getCreateTime().plusYears(productModel.getValidityPeriod().longValue()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            String productionDate = stockInventoryList.get(0).getProductionDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            map.put("productionDate", productionDate);
            map.put("expiryDate", expiryDate);
            List<ProductModel> productModelList = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().eq(ProductModel::getId, product.getProductModelId()));
            BigDecimal validityPeriod = productModelList.get(0).getValidityPeriod();
            LocalDate expiryDate = stockInventoryList.get(0).getProductionDate()
                    .plusYears(validityPeriod.longValue());
            String expiryDateStr = expiryDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            map.put("expiryDate", expiryDateStr);
            products.add(map);
        }
        Map<String, Object> data = new HashMap<>();
@@ -993,6 +982,5 @@
            e.printStackTrace();
            throw new RuntimeException("导出失败");
        }
    }
}
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -4,18 +4,13 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.approve.pojo.ApproveProcess;
import com.ruoyi.approve.service.IApproveProcessService;
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.approve.vo.ApproveGetAndUpdateVo;
import com.ruoyi.approve.vo.ApproveProcessVO;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.sales.dto.SalesQuotationDto;
import com.ruoyi.sales.mapper.SalesQuotationMapper;
import com.ruoyi.sales.mapper.SalesQuotationProductMapper;
@@ -24,11 +19,9 @@
import com.ruoyi.sales.service.SalesQuotationProductService;
import com.ruoyi.sales.service.SalesQuotationService;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -60,7 +53,6 @@
    @Override
    public boolean add(SalesQuotationDto salesQuotationDto) {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        SalesQuotation salesQuotation = new SalesQuotation();
        BeanUtils.copyProperties(salesQuotationDto, salesQuotation);
        String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT");
@@ -77,21 +69,6 @@
            return salesQuotationProduct;
        }).collect(Collectors.toList());
        salesQuotationProductService.saveBatch(products);
        // æŠ¥ä»·å®¡æ‰¹
        ApproveProcessVO approveProcessVO = new ApproveProcessVO();
        approveProcessVO.setApproveType(6);
        approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
        approveProcessVO.setApproveReason(quotationNo);
        approveProcessVO.setApproveUserIds(salesQuotationDto.getApproveUserIds());
        approveProcessVO.setApproveUser(loginUser.getUserId());
        approveProcessVO.setApproveTime(LocalDate.now().toString());
        approveProcessVO.setPrice(salesQuotationDto.getTotalAmount());
        try {
            approveProcessService.addApprove(approveProcessVO);
        }catch (Exception e){
            log.error("SalesQuotationServiceImpl error:{}", e);
            throw new RuntimeException("审批失败");
        }
        return true;
    }
    @Override
src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -68,7 +68,7 @@
        if(!"已发货".equals(byId.getStatus())){
            SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId());
            stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(),
                    StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),null,null
                    StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(),salesLedgerProduct.getBatchNo(),salesLedgerProduct.getCustomer()
            );
        }
        byId.setExpressNumber(req.getExpressNumber());
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
@@ -45,4 +45,5 @@
    private Long productId;      // äº§å“ID
    private Long parentId;  // çˆ¶çº§äº§å“ID
    private Long productModelId;   // äº§å“åž‹å·ID
    private String productScope;  //产品类型
}
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
@@ -1,5 +1,6 @@
package com.ruoyi.stock.execl;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
@@ -16,6 +17,19 @@
    @Excel(name = "规格")
    private String model;
    @Excel(name = "UID码")
    private String uidNo;
    @Excel(name = "批号")
    private String batchNo;
    @Excel(name = "生产日期")
    @JsonFormat(pattern = "yyyyMMdd")
    private String productionDate;
    @Excel(name = "供应商")
    private String customer;
    @Excel(name = "单位")
    private String unit;
src/main/java/com/ruoyi/stock/pojo/StockInventory.java
@@ -13,6 +13,7 @@
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
@@ -69,4 +70,8 @@
    @ApiModelProperty("供应商名称")
    private String customer;
    @ApiModelProperty("生产日期")
    private LocalDate productionDate;
}
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -34,6 +34,8 @@
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
@@ -59,6 +61,7 @@
    private ProductMapper productMapper;
    @Autowired
    private ProductModelMapper productModelMapper;
    private static final DateTimeFormatter YYYYMMDD_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd");
    @Override
@@ -99,6 +102,7 @@
            newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
            newStockInventory.setBatchNo(stockInventoryDto.getBatchNo());
            newStockInventory.setCustomer(stockInventoryDto.getCustomer());
            newStockInventory.setProductionDate(stockInventoryDto.getProductionDate());
            stockInventoryMapper.insert(newStockInventory);
        }else {
             stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
@@ -148,7 +152,7 @@
            // æŸ¥è¯¢æ‰€æœ‰çš„产品
            List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectProduct();
            ExcelUtil<StockInventoryExportData> util = new ExcelUtil<StockInventoryExportData>(StockInventoryExportData.class);
            ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class);
            List<StockInventoryExportData> list = util.importExcel(file.getInputStream());
            // è®°å½•未找到匹配项的数据
@@ -158,7 +162,8 @@
                boolean matched = false;
                for (SalesLedgerProduct item : salesLedgerProducts) {
                    if (item.getProductCategory().equals(dto.getProductName()) &&
                            item.getSpecificationModel().equals(dto.getModel())) {
                            item.getSpecificationModel().equals(dto.getModel()) &&
                            item.getUidNo().equals(dto.getUidNo())) {
                        StockInventoryDto stockInventoryDto = new StockInventoryDto();
                        stockInventoryDto.setRecordId(0L);
                        stockInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode());
@@ -170,6 +175,14 @@
                        }
                        stockInventoryDto.setLockedQuantity(dto.getLockedQuantity());
                        stockInventoryDto.setProductModelId(item.getProductModelId());
                        stockInventoryDto.setBatchNo(dto.getBatchNo());
                        stockInventoryDto.setCustomer(dto.getCustomer());
                        String productionDate = dto.getProductionDate();
                        if (productionDate != null && productionDate.length() == 8) {
                            stockInventoryDto.setProductionDate(LocalDate.parse(productionDate, YYYYMMDD_FORMAT));
                        } else {
                            stockInventoryDto.setProductionDate(null);
                        }
                        this.addstockInventory(stockInventoryDto);
                        matched = true;
                        break; // æ‰¾åˆ°åŒ¹é…é¡¹åŽè·³å‡ºå¾ªçޝ
@@ -177,8 +190,8 @@
                }
                if (!matched) {
                    // è®°å½•未匹配的数据
                    String unmatchedInfo = String.format("产品名称:%s,规格型号:%s",
                            dto.getProductName(), dto.getModel());
                    String unmatchedInfo = String.format("产品名称:%s,规格型号:%s,UID码:%s",
                            dto.getProductName(), dto.getModel(),dto.getUidNo());
                    unmatchedRecords.add(unmatchedInfo);
                }
            });
src/main/resources/mapper/purchase/PaymentRegistrationMapper.xml
@@ -217,7 +217,11 @@
                T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%')
            </if>
        </where>
        GROUP BY  T1.purchase_contract_number,T2.payment_date
        GROUP BY
        T1.supplier_id,
        T1.supplier_name,
        T1.purchase_contract_number,
        T2.payment_date
    </select>
</mapper>
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
@@ -16,6 +16,7 @@
        qu.deal_result,
        qu.deal_name,
        qu.deal_time,
        qu.production_date,
        pm.uid_no,
        CASE
        WHEN qu.model = pm.id THEN pm.model
@@ -78,6 +79,8 @@
            qu.deal_result,
            qu.deal_name,
            qu.deal_time,
            qu.production_date,
            qu.batch_no,
            CASE
                WHEN qu.model = pm.id THEN pm.model
                ELSE qu.model
src/main/resources/mapper/sales/InvoiceLedgerMapper.xml
@@ -123,7 +123,7 @@
                T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%')
            </if>
        </where>
        GROUP BY T1.customer_name
        GROUP BY T1.customer_id, T1.customer_name
    </select>
    <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto">
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -5,15 +5,22 @@
<mapper namespace="com.ruoyi.sales.mapper.SalesLedgerProductMapper">
    <select id="selectSalesLedgerProductList" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct">
        WITH stock_summary AS (
        SELECT
        product_model_id,
        SUM(qualitity) AS total_quantity,
        SUM(locked_quantity) AS total_locked
        FROM stock_inventory
        GROUP BY product_model_id
        )
        SELECT
        T1.*,
        CASE
        WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1
        WHEN (IFNULL(s.total_quantity, 0) - IFNULL(s.total_locked, 0)) >= IFNULL(T1.quantity, 0) THEN 1
        ELSE 0
        END as has_sufficient_stock
        FROM
        sales_ledger_product T1
        LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
        FROM sales_ledger_product T1
        LEFT JOIN stock_summary s ON T1.product_model_id = s.product_model_id
        <where>
            <if test="salesLedgerProduct.salesLedgerId != null">
                AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
@@ -127,8 +134,10 @@
        <if test="req.productCategory != null and req.productCategory != ''">
            AND slp.product_category = #{req.productCategory}
        </if>
        <!-- æŒ‰äº§å“å¤§ç±»åˆ†ç»„聚合 -->
        GROUP BY slp.product_category
        GROUP BY
        slp.product_category,
        slp.specification_model,
        sl.supplier_name
        <!-- æŒ‰äº§å“å¤§ç±»æŽ’序 -->
        ORDER BY slp.product_category
    </select>
src/main/resources/mapper/sales/SalesQuotationMapper.xml
@@ -15,8 +15,5 @@
        <if test="salesQuotationDto.customer != null and salesQuotationDto.customer != '' ">
            AND t1.customer = #{salesQuotationDto.customer}
        </if>
        <if test="salesQuotationDto.status != null and salesQuotationDto.status != '' ">
            AND t1.status = #{salesQuotationDto.status}
        </if>
    </select>
</mapper>
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -52,34 +52,79 @@
        where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity}
    </update>
    <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto">
        select si.id,
        WITH RECURSIVE get_root AS (
        SELECT
        id,
        parent_id,
        id AS root_id
        FROM product
        WHERE parent_id IS NULL  -- æ ¹èŠ‚ç‚¹
        UNION ALL
        SELECT
        p.id,
        p.parent_id,
        gr.root_id
        FROM product p
        INNER JOIN get_root gr ON p.parent_id = gr.id
        )
        SELECT
        si.id,
        si.qualitity,
        COALESCE(si.locked_quantity, 0) as locked_quantity,
        COALESCE(si.locked_quantity, 0) AS locked_quantity,
        si.product_model_id,
        si.create_time,
        si.update_time,
        COALESCE(si.warn_num, 0) as warn_num,
        COALESCE(si.warn_num, 0) AS warn_num,
        si.version,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) AS un_locked_quantity,
        pm.model,
        si.remark,
        pm.unit,
        pm.uid_no as uidNo,
        pm.uid_no AS uidNo,
        p.product_name,
        si.batch_no,
        si.customer
        from stock_inventory si
        left join product_model pm on si.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        where 1 = 1
        si.customer,
        rp.product_name AS root_product_name,
        si.production_date
        FROM
        stock_inventory si
        LEFT JOIN product_model pm ON si.product_model_id = pm.id
        LEFT JOIN product p ON pm.product_id = p.id
        LEFT JOIN get_root gr ON gr.id = p.id
        LEFT JOIN product rp ON rp.id = gr.root_id
        <where>
        <if test="ew.productName != null and ew.productName !=''">
            and p.product_name like concat('%',#{ew.productName},'%')
                AND p.product_name LIKE CONCAT('%', #{ew.productName}, '%')
        </if>
            <if test="ew.model != null and ew.model != ''">
                AND pm.model LIKE CONCAT('%', #{ew.model}, '%')
            </if>
            <if test="ew.uidNo != null and ew.uidNo != ''">
                AND pm.uid_no LIKE CONCAT('%', #{ew.uidNo}, '%')
            </if>
            <if test="ew.batchNo != null and ew.batchNo != ''">
                AND si.batch_no LIKE CONCAT('%', #{ew.batchNo}, '%')
            </if>
            <if test="ew.productScope != null and ew.productScope != ''">
                <choose>
                    <when test="ew.productScope == '成品'">
                        AND rp.product_name = '成品'
                    </when>
                    <otherwise>
                        AND rp.product_name != '成品'
                    </otherwise>
                </choose>
            </if>
        </where>
    </select>
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
        select si.qualitity,
        pm.model,
        pm.unit,
        si.batchNo,
        pm.uid_no,
        si.production_date,
        si.customer,
        p.product_name,
        coalesce(si.warn_num, 0) as warn_num,
        coalesce(si.locked_quantity, 0) as locked_quantity,
@@ -283,14 +328,14 @@
        LEFT JOIN product_model pm ON si.product_model_id = pm.id
        LEFT JOIN product p ON pm.product_id = p.id
        LEFT JOIN product p1 ON p1.id = p.parent_id
        WHERE
            p1.product_name = '原材料';
        <where>
        <if test="ew.batchNo != null and ew.batchNo !=''">
            and si.batch_no like concat('%',#{ew.batchNo},'%')
        </if>
        <if test="ew.customer != null and ew.customer !=''">
            and si.customer like concat('%',#{ew.customer},'%')
        </if>
        </where>
    </select>
    <select id="getStockInventoryAll" resultType="com.ruoyi.stock.dto.StockInventoryDto">
src/main/resources/static/return-record.docx
Binary files differ
src/main/resources/static/²É¹ºÌ¨Õ˵¼ÈëÄ£°å.xlsx
Binary files differ
src/main/resources/static/ÏúÊŲ̂Õ˵¼ÈëÄ£°å.xlsx
Binary files differ