fix:1.采购/销售入库去掉审批
2.返工下载附件内容变更
3.生产/库存入库生产日期添加
4.仓库导入导出字段优化
| | |
| | | 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; |
| | |
| | | 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)) { |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Collections; |
| | | |
| | | @Component |
| | |
| | | * @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) { |
| | |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | stockInventoryDto.setCustomer(customer); |
| | | if (stockInventoryDto.getProductionDate() == null) { |
| | | stockInventoryDto.setProductionDate(LocalDate.now()); |
| | | }else { |
| | | stockInventoryDto.setProductionDate(productionDate); |
| | | } |
| | | stockInventoryService.addstockInventory(stockInventoryDto); |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @ApiModel("领料单DTO") |
| | |
| | | |
| | | @ApiModelProperty("供应商名称") |
| | | private String customer; |
| | | |
| | | @ApiModelProperty("有效期") |
| | | private LocalDate productionDate; |
| | | } |
| | |
| | | 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() |
| | | ); |
| | | } |
| | | } |
| | |
| | | //直接入库 |
| | | 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 |
| | | ); |
| | | } |
| | | /*更新工单和生产订单*/ |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | @Autowired |
| | | private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | |
| | | } |
| | | 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()); |
| | |
| | | @TableField(exist = false) |
| | | private String purchaseContractNo; |
| | | |
| | | private String BatchNo; |
| | | private String batchNo; |
| | | private String manufacturingTeam; |
| | | |
| | | /** |
| | |
| | | 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; |
| | | |
| | |
| | | @ApiModelProperty("是否不合格处理自己新增") |
| | | @TableField(exist = false) |
| | | private Boolean method; |
| | | |
| | | @ApiModelProperty("生产日期") |
| | | private LocalDate productionDate; |
| | | |
| | | @ApiModelProperty("批号") |
| | | private String batchNo; |
| | | } |
| | |
| | | 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()) { |
| | |
| | | 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);//已提交 |
| | |
| | | //调用提交合格的接口 |
| | | String customer = "长治市轴承制造有限公司"; |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockInQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId(), |
| | | orders.getBatchNo(), customer |
| | | orders.getBatchNo(), customer,null |
| | | ); |
| | | break; |
| | | case "返工": |
| | |
| | | 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; |
| | |
| | | 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"); |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | |
| | | //出库 |
| | | 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(); |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @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(); |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type){ |
| | | public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type) { |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, relateId); |
| | | productWrapper.eq(SalesLedgerProduct::getType, type.getCode()); |
| | |
| | | // 4. 处理子表数据 |
| | | List<SalesLedgerProduct> productList = salesLedgerDto.getProductData(); |
| | | if (productList != null && !productList.isEmpty()) { |
| | | handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class,salesLedgerDto.getType())); |
| | | handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType())); |
| | | updateMainContractAmount( |
| | | salesLedger.getId(), |
| | | productList, |
| | |
| | | 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<>(); |
| | |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导出失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Override |
| | | public boolean add(SalesQuotationDto salesQuotationDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SalesQuotation salesQuotation = new SalesQuotation(); |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | | String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT"); |
| | |
| | | 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 |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | |
| | | @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; |
| | | |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty("供应商名称") |
| | | private String customer; |
| | | |
| | | @ApiModelProperty("生产日期") |
| | | private LocalDate productionDate; |
| | | |
| | | } |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private ProductMapper productMapper; |
| | | @Autowired |
| | | private ProductModelMapper productModelMapper; |
| | | private static final DateTimeFormatter YYYYMMDD_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | |
| | | |
| | | @Override |
| | |
| | | newStockInventory.setWarnNum(stockInventoryDto.getWarnNum()); |
| | | newStockInventory.setBatchNo(stockInventoryDto.getBatchNo()); |
| | | newStockInventory.setCustomer(stockInventoryDto.getCustomer()); |
| | | newStockInventory.setProductionDate(stockInventoryDto.getProductionDate()); |
| | | stockInventoryMapper.insert(newStockInventory); |
| | | }else { |
| | | stockInventoryMapper.updateAddStockInventory(stockInventoryDto); |
| | |
| | | // 查询所有的产品 |
| | | 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()); |
| | | |
| | | // 记录未找到匹配项的数据 |
| | |
| | | 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()); |
| | |
| | | } |
| | | 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; // 找到匹配项后跳出循环 |
| | |
| | | } |
| | | 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); |
| | | } |
| | | }); |
| | |
| | | qu.deal_result, |
| | | qu.deal_name, |
| | | qu.deal_time, |
| | | qu.production_date, |
| | | pm.uid_no, |
| | | CASE |
| | | WHEN qu.model = pm.id THEN pm.model |
| | |
| | | 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 |
| | |
| | | <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> |
| | |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | 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, |
| | |
| | | pm.uid_no AS uidNo, |
| | | p.product_name, |
| | | si.batch_no, |
| | | si.customer |
| | | 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 product p1 ON p.parent_id = p1.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}, '%') |
| | |
| | | <if test="ew.productScope != null and ew.productScope != ''"> |
| | | <choose> |
| | | <when test="ew.productScope == '成品'"> |
| | | AND p1.product_name = #{ew.productScope} |
| | | AND rp.product_name = '成品' |
| | | </when> |
| | | <otherwise> |
| | | AND p1.product_name != '成品' |
| | | AND rp.product_name != '成品' |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | |
| | | 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, |