Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro
# Conflicts:
# src/main/java/com/ruoyi/purchase/service/impl/PurchaseReturnOrdersServiceImpl.java
| | |
| | | addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | } else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId()); |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(),purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | |
| | | } |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | // åºåºå®¡æ¹ä¿®æ¹ |
| | | // åºåºå®¡æ¹ä¿®æ¹=åè´§å®¡æ¹ |
| | | if (approveProcess.getApproveType().equals(7)) { |
| | | String[] split = approveProcess.getApproveReason().split(":"); |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>() |
| | | .eq(ShippingInfo::getShippingNo, split[1]) |
| | | .eq(ShippingInfo::getShippingNo, approveProcess.getApproveReason()) |
| | | .orderByDesc(ShippingInfo::getCreateTime) |
| | | .last("limit 1")); |
| | | if (shippingInfo != null) { |
| | |
| | | } |
| | | shippingInfoMapper.updateById(shippingInfo); |
| | | } |
| | | //åºåæ£å |
| | | |
| | | } |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.APPROVE_NODE, approveNode.getId(), approveNode.getStorageBlobDTOS()); |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ISysNoticeService sysNoticeService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | private final ApproveProcessConfigNodeService approveProcessConfigNodeService; |
| | |
| | | if (CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | if (sysDept == null) throw new RuntimeException("é¨é¨ä¸åå¨"); |
| | | if (sysUser == null) throw new RuntimeException("ç³è¯·äººä¸åå¨"); |
| | | // String today = LocalDate.now().format(DATE_FORMAT); |
| | | // Long approveId = dailyRedisCounter.incrementAndGetByDb(); |
| | | // String formattedCount = String.format("%03d", approveId); |
| | | // //æµç¨ ID |
| | | // String approveID = today + formattedCount; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | String no = OrderUtils.countTodayByCreateTime(approveProcessMapper, "", "approve_id"); |
| | |
| | | || !StringUtils.hasText(approveProcessVO.getApproveReason())) { |
| | | throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | } |
| | | |
| | | purchaseLedgerMapper.update(null, new LambdaUpdateWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason()) |
| | | .set(PurchaseLedger::getApprovalStatus, 3)); |
| | | //éè´å
¥åº |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectOne(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, approveProcessVO.getApproveReason()) |
| | | .last("limit 1")); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | stockUtils.addStockWithBatchNo(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId(),purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | /** |
| | | * åæ ¼å
¥åºå¸¦æ¹æ¬¡å· |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addStockWithBatchNo(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | stockInventoryService.addStockInRecordOnly(stockInventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * åæ ¼åºåº |
| | | * |
| | | * @param productModelId |
| | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "ProductionAccountDto", description = "production account query dto") |
| | | @Schema(name = "ProductionAccountDto", description = "çäº§æ ¸ç®æ¥è¯¢åæ°") |
| | | public class ProductionAccountDto extends ProductionAccount { |
| | | |
| | | @Schema(description = "sales contract no") |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @Schema(description = "customer contract no") |
| | | @Schema(description = "客æ·ååå·") |
| | | private String customerContractNo; |
| | | |
| | | @Schema(description = "project name") |
| | | @Schema(description = "项ç®åç§°") |
| | | private String projectName; |
| | | |
| | | @Schema(description = "customer name") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "product category") |
| | | @Schema(description = "产åç±»å«") |
| | | private String productCategory; |
| | | |
| | | @Schema(description = "specification model") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "scheduling user id") |
| | | @Schema(description = "æäº§äººåID") |
| | | private Long schedulingUserId; |
| | | |
| | | @Schema(description = "scheduling user name") |
| | | @Schema(description = "æäº§äººååç§°") |
| | | private String schedulingUserName; |
| | | |
| | | @Schema(description = "process") |
| | | @Schema(description = "å·¥åº") |
| | | private String process; |
| | | |
| | | @Schema(description = "date type(day/month)") |
| | | @Schema(description = "æ¥æç±»åï¼æå¤©/ææï¼") |
| | | private String dateType; |
| | | |
| | | @Schema(description = "day query date") |
| | | @Schema(description = "æå¤©æ¥è¯¢æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDate; |
| | | |
| | | @Schema(description = "date range") |
| | | @Schema(description = "æ¥æèå´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate[] dateRange; |
| | | |
| | | @Schema(description = "start date") |
| | | @Schema(description = "å¼å§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateStart; |
| | | |
| | | @Schema(description = "end date") |
| | | @Schema(description = "ç»ææ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateEnd; |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate requiredDateEnd; |
| | | |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | } |
| | |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @Schema(name = "ProductionProductMainDto", description = "production report query dto") |
| | | @Schema(name = "ProductionProductMainDto", description = "ç产æ¥å·¥æ¥è¯¢åæ°") |
| | | public class ProductionProductMainDto extends ProductionProductMain { |
| | | |
| | | @Schema(description = "product process route item id") |
| | | @Schema(description = "产åå·¥èºè·¯çº¿å·¥åºID") |
| | | private Long productProcessRouteItemId; |
| | | |
| | | @Schema(description = "production report id") |
| | | @Schema(description = "æ¥å·¥ID") |
| | | private Long productMainId; |
| | | |
| | | @Schema(description = "tenant id") |
| | | @Schema(description = "ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | @Schema(description = "work order no") |
| | | @Schema(description = "å·¥åç¼å·") |
| | | private String workOrderNo; |
| | | |
| | | @Schema(description = "work order status") |
| | | @Schema(description = "å·¥åç¶æ") |
| | | private String workOrderStatus; |
| | | |
| | | @Schema(description = "nick name") |
| | | @Schema(description = "æµç§°") |
| | | private String nickName; |
| | | |
| | | @Schema(description = "quantity") |
| | | @Schema(description = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "scrap quantity") |
| | | @Schema(description = "æ¥åºæ°é") |
| | | private BigDecimal scrapQty; |
| | | |
| | | @Schema(description = "product name") |
| | | @Schema(description = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "product model name") |
| | | @Schema(description = "产åè§æ ¼åå·") |
| | | private String productModelName; |
| | | |
| | | @Schema(description = "unit") |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "sales contract no") |
| | | @Schema(description = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | @Schema(description = "scheduling date") |
| | | @Schema(description = "æäº§æ¥æ") |
| | | private LocalDate schedulingDate; |
| | | |
| | | @Schema(description = "scheduling user name") |
| | | @Schema(description = "æäº§äººååç§°") |
| | | private String schedulingUserName; |
| | | |
| | | @Schema(description = "customer name") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "process") |
| | | @Schema(description = "å·¥åº") |
| | | private String process; |
| | | |
| | | @Schema(description = "salary quota") |
| | | @Schema(description = "å·¥èµå®é¢") |
| | | private BigDecimal workHours; |
| | | |
| | | @Schema(description = "wages") |
| | | @Schema(description = "å·¥èµ") |
| | | private BigDecimal wages; |
| | | |
| | | @Schema(description = "operation param list") |
| | | @Schema(description = "å·¥åºåæ°å表") |
| | | private List<ProductionOrderRoutingOperationParam> productionOperationParamList; |
| | | } |
| | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @Schema(name = "ProductionAccountVo", description = "production account page result") |
| | | @Schema(name = "ProductionAccountVo", description = "çäº§æ ¸ç®åé¡µç»æ") |
| | | public class ProductionAccountVo { |
| | | |
| | | @Schema(description = "customer contract no") |
| | | @Schema(description = "客æ·ååå·") |
| | | private String customerContractNo; |
| | | |
| | | @Schema(description = "project name") |
| | | @Schema(description = "项ç®åç§°") |
| | | private String projectName; |
| | | |
| | | @Schema(description = "customer name") |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "product category") |
| | | @Schema(description = "产åç±»å«") |
| | | private String productCategory; |
| | | |
| | | @Schema(description = "specification model") |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | @Schema(description = "unit") |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "scheduling user id") |
| | | @Schema(description = "æäº§äººåID") |
| | | private Long schedulingUserId; |
| | | |
| | | @Schema(description = "scheduling user name") |
| | | @Schema(description = "æäº§äººååç§°") |
| | | private String schedulingUserName; |
| | | |
| | | @Schema(description = "wages") |
| | | @Schema(description = "å·¥èµ") |
| | | private BigDecimal wages; |
| | | |
| | | @Schema(description = "finished quantity") |
| | | @Schema(description = "宿æ°é") |
| | | private BigDecimal finishedNum; |
| | | |
| | | @Schema(description = "salary quota") |
| | | @Schema(description = "å·¥èµå®é¢") |
| | | private BigDecimal workHours; |
| | | |
| | | @Schema(description = "output rate") |
| | | @Schema(description = "å·¥æ¶") |
| | | private BigDecimal workHour; |
| | | |
| | | @Schema(description = "产åºç") |
| | | private String outputRate; |
| | | |
| | | @Schema(description = "process") |
| | | @Schema(description = "å·¥åº") |
| | | private String process; |
| | | |
| | | @Schema(description = "scheduling date") |
| | | @Schema(description = "æäº§æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate schedulingDate; |
| | | |
| | | @Schema(description = "scheduling month(yyyy-MM)") |
| | | @Schema(description = "æäº§æä»½(yyyy-MM)") |
| | | private String schedulingMonth; |
| | | } |
| | |
| | | |
| | | @Schema(description = "æ¯å¦ç»æï¼") |
| | | private Boolean endOrder; |
| | | |
| | | @Schema(description = "ç±»å åºå计æ¶å计件(0计æ¶1计件)") |
| | | private Integer type; |
| | | } |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | @Schema(description = "æ¥å·¥ä¸»ä¿¡æ¯") |
| | | private ProductionProductMain reportMain; |
| | | |
| | | @Schema(description = "å·¥æ¶") |
| | | private BigDecimal workHour; |
| | | |
| | | @Schema(description = "æ¥å·¥äº§åºæç»") |
| | | private List<ProductionProductOutput> reportOutputList; |
| | | |
| | |
| | | @Schema(description = "æ¥å·¥ä¸»ä¿¡æ¯") |
| | | private ProductionProductMain reportMain; |
| | | |
| | | @Schema(description = "å·¥æ¶") |
| | | private BigDecimal workHour; |
| | | |
| | | @Schema(description = "è´¨æ£ä¸»ä¿¡æ¯") |
| | | private QualityInspect inspect; |
| | | |
| | |
| | | |
| | | @Schema(description = "å·¥åºè¡¨id") |
| | | private Long technologyOperationId; |
| | | |
| | | @Schema(description = "ç±»å åºå计æ¶å计件ï¼0计æ¶ï¼1计件") |
| | | private Integer type; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "å·¥æ¶") |
| | | private BigDecimal workHour; |
| | | |
| | | } |
| | |
| | | BigDecimal totalReturnQty = oldReturnQty.add(currentReturnQty); |
| | | if (currentReturnQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | String returnBatchNo = resolveInventoryBatchNoFromStored(oldPick.getBatchNo()); |
| | | addInventory(oldPick.getId(), oldPick.getProductModelId(), returnBatchNo, currentReturnQty, FEED_RETURN_IN_RECORD_TYPE); |
| | | addInventoryRecordOnly(oldPick.getId(), oldPick.getProductModelId(), returnBatchNo, currentReturnQty, FEED_RETURN_IN_RECORD_TYPE); |
| | | } |
| | | |
| | | BigDecimal actualQty = defaultDecimal(oldPick.getQuantity()) |
| | |
| | | } |
| | | } |
| | | |
| | | private void addInventoryRecordOnly(Long recordId, |
| | | Long productModelId, |
| | | String batchNo, |
| | | BigDecimal quantity, |
| | | String stockInRecordType) { |
| | | // ä»
è®°å½å
¥åºç³è¯·ï¼ä¸åå®¡æ ¸éè¿ã |
| | | BigDecimal addQuantity = defaultDecimal(quantity); |
| | | if (addQuantity.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return; |
| | | } |
| | | try { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | stockInventoryDto.setQualitity(addQuantity); |
| | | stockInventoryDto.setRecordType(stockInRecordType); |
| | | stockInventoryDto.setRecordId(recordId == null ? 0L : recordId); |
| | | stockInventoryService.addStockInRecordOnly(stockInventoryDto); |
| | | } catch (ServiceException ex) { |
| | | throw ex; |
| | | } catch (Exception ex) { |
| | | throw new ServiceException("éæå
¥åºè®°å½ä¿å失败ï¼" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private List<ProductionOrderPickDto> resolvePickItems(ProductionOrderPickDto dto) { |
| | | // è§£ææ°å¢åºæ¯ç颿æç»éåã |
| | | if (dto == null) { |
| | |
| | | ProductionOrder update = new ProductionOrder(); |
| | | update.setId(productionOrder.getId()); |
| | | update.setTechnologyRoutingId(targetRoutingId); |
| | | // æä¹
åæè¾åºå¤çç»æ |
| | | if (!this.updateById(update)) { |
| | | throw new ServiceException("ç»å®å·¥èºè·¯çº¿å¤±è´¥"); |
| | | } |
| | |
| | | clearProductionSnapshot(productionOrderId); |
| | | ProductionOrderBom orderBom = syncProductionOrderBomSnapshot(productionOrder, technologyRouting); |
| | | |
| | | //ç产订åå·¥èºè·¯çº¿è¡¨ |
| | | ProductionOrderRouting orderRouting = new ProductionOrderRouting(); |
| | | orderRouting.setProductionOrderId(productionOrder.getId()); |
| | | orderRouting.setTechnologyRoutingId(technologyRouting.getId()); |
| | |
| | | orderRouting.setDescription(technologyRouting.getDescription()); |
| | | orderRouting.setBomId(technologyRouting.getBomId()); |
| | | orderRouting.setOrderBomId(orderBom == null ? null : orderBom.getId()); |
| | | // æä¹
åæè¾åºå¤çç»æ |
| | | productionOrderRoutingMapper.insert(orderRouting); |
| | | |
| | | int syncedParamCount = 0; |
| | |
| | | targetOperation.setIsQuality(sourceOperation.getIsQuality()); |
| | | targetOperation.setOperationName(operationNameMap.get(sourceOperation.getTechnologyOperationId())); |
| | | targetOperation.setTechnologyOperationId(sourceOperation.getTechnologyOperationId()); |
| | | targetOperation.setType(sourceOperation.getType()); |
| | | productionOrderRoutingOperationMapper.insert(targetOperation); |
| | | |
| | | boolean isLastOperation = lastDragSort != null && Objects.equals(sourceOperation.getDragSort(), lastDragSort); |
| | |
| | | : workOrderPage.getRecords().stream() |
| | | .filter(Objects::nonNull) |
| | | .sorted(Comparator.comparing(ProductionOperationTaskVo::getId, Comparator.nullsLast(Comparator.naturalOrder()))) |
| | | .collect(Collectors.toList()); |
| | | if (workOrderList == null || workOrderList.isEmpty()) { |
| | | .toList(); |
| | | if (workOrderList.isEmpty()) { |
| | | detailVo.setWorkOrderList(Collections.emptyList()); |
| | | return detailVo; |
| | | } |
| | |
| | | |
| | | ProductionOrderWorkOrderDetailVo.ReportDetail reportDetail = new ProductionOrderWorkOrderDetailVo.ReportDetail(); |
| | | reportDetail.setReportMain(reportMain); |
| | | reportDetail.setWorkHour(reportMain.getWorkHour()); |
| | | reportDetail.setReportOutputList(reportOutputMap.getOrDefault(reportMainId, Collections.emptyList())); |
| | | reportDetail.setReportParamList(reportParamMap.getOrDefault(reportMainId, Collections.emptyList())); |
| | | reportDetailList.add(reportDetail); |
| | |
| | | inspectDetail.setReportId(reportMainId); |
| | | inspectDetail.setReportNo(reportMain.getProductNo()); |
| | | inspectDetail.setReportMain(reportMain); |
| | | inspectDetail.setWorkHour(reportMain.getWorkHour()); |
| | | inspectDetail.setInspect(inspect); |
| | | inspectDetail.setInspectParamList(inspectParamMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | | inspectDetail.setInspectFileList(inspectFileMap.getOrDefault(inspect.getId(), Collections.emptyList())); |
| | |
| | | productionProductMain.setUserName(user == null ? dto.getUserName() : user.getNickName()); |
| | | productionProductMain.setProductionOperationTaskId(taskId); |
| | | productionProductMain.setStatus(0); |
| | | productionProductMain.setWorkHour(dto.getWorkHour()); |
| | | productionProductMainMapper.insert(productionProductMain); |
| | | syncOperationParamInputValue(dto, routingOperation.getId(), productionProductMain.getId()); |
| | | |
| | |
| | | } |
| | | purchaseLedgerMapper.updateById(purchaseLedger); |
| | | } |
| | | // 6.éè´å®¡æ ¸æ°å¢ï¼å®¡æ¹ç®¡çæªé
ç½®éè´å®¡æ¹äººæ¶ï¼å®¡æ¹æå¡ä¼èªå¨ç½®ä¸ºå®¡æ¹éè¿ã |
| | | addApproveByPurchase(loginUser, purchaseLedger); |
| | | |
| | | // 4. å¤çåè¡¨æ°æ® |
| | | List<SalesLedgerProduct> productList = purchaseLedgerDto.getProductData(); |
| | | if (productList != null && !productList.isEmpty()) { |
| | | handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType()); |
| | | } |
| | | //æ°å¢åæææ£éª 审æ¹ä¹åæçææ£éª |
| | | // if (productList != null) { |
| | | // for (SalesLedgerProduct saleProduct : productList) { |
| | | // //æ¯å¦æ¨éè´¨æ£ï¼å¦ætrue就添å |
| | | // if (saleProduct.getIsChecked()) { |
| | | // addQualityInspect(purchaseLedger, saleProduct); |
| | | // } |
| | | // } |
| | | // } |
| | | // 6.éè´å®¡æ ¸æ°å¢ï¼å®¡æ¹ç®¡çæªé
ç½®éè´å®¡æ¹äººæ¶ï¼å®¡æ¹æå¡ä¼èªå¨ç½®ä¸ºå®¡æ¹éè¿ã |
| | | addApproveByPurchase(loginUser, purchaseLedger); |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.PURCHASE_LEDGER, purchaseLedger.getId(), purchaseLedgerDto.getStorageBlobDTOS()); |
| | | return 1; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderProductsDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrderProducts; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnDetailsVo; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderHasAllInfoDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper; |
| | | private final ISalesLedgerService salesLedgerService; |
| | | private final AccountIncomeService accountIncomeService; |
| | | private final StockUtils stockUtils; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | private final StockOutRecordMapper stockOutRecordMapper; |
| | | |
| | | @Override |
| | | public IPage<PurchaseReturnOrderHasAllInfoDto> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | |
| | | // è¿é为æ°å¢å æ¤id为null |
| | | purchaseReturnOrderProductsDto.setId(null); |
| | | purchaseReturnOrderProductsMapper.insert(purchaseReturnOrderProductsDto); |
| | | //åºåéè¦åºåº(éè´éè´§) |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(purchaseReturnOrderDto.getPurchaseLedgerId()); |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(purchaseReturnOrderProductsDto.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), purchaseReturnOrderProductsDto.getReturnQuantity(), StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode(), purchaseReturnOrderDto.getId(), purchaseLedger.getPurchaseContractNumber()+"-"+salesLedgerProduct.getId()); |
| | | } |
| | | }else { |
| | | throw new RuntimeException("è¯·éæ©éè´§åå"); |
| | |
| | | LambdaUpdateWrapper<PurchaseReturnOrderProducts> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(PurchaseReturnOrderProducts::getPurchaseReturnOrderId, id); |
| | | purchaseReturnOrderProductsMapper.delete(updateWrapper); |
| | | |
| | | //(éè´éè´§çæ°æ®éè¦å æ) |
| | | stockOutRecordMapper.delete(Wrappers.<StockOutRecord>lambdaQuery() |
| | | .eq(StockOutRecord::getRecordType,StockOutQualifiedRecordTypeEnum.PURCHASE_RETURN_STOCK_OUT.getCode()) |
| | | .eq(StockOutRecord::getRecordId, id)); |
| | | // è´¢å¡ |
| | | LambdaUpdateWrapper<AccountIncome> updateWrapperAccountIncome = new LambdaUpdateWrapper<>(); |
| | | updateWrapperAccountIncome.eq(AccountIncome::getBusinessId, id); |
| | |
| | | if (CollUtil.isEmpty(list)) { |
| | | return AjaxResult.success(list); |
| | | } |
| | | // |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | | Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getSalesLedgerProductId, item -> item.getSumReturnQuantity())); |
| | |
| | | if (item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTicketsAmount(BigDecimal.ZERO); |
| | | } |
| | | // ProcurementPageDto procurementDto = new ProcurementPageDto(); |
| | | // procurementDto.setSalesLedgerProductId(item.getId()); |
| | | // procurementDto.setProductCategory(item.getProductCategory()); |
| | | // IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto); |
| | | // BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity"); |
| | | |
| | | // ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | approveProcessVO.setApproveType(7); |
| | | approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId()); |
| | | approveProcessVO.setApproveReason(req.getType() + ":" +sh); |
| | | approveProcessVO.setApproveReason(sh);//åè´§ç¼å· |
| | | approveProcessVO.setApproveUserIds(req.getApproveUserIds()); |
| | | approveProcessVO.setApproveUser(loginUser.getUserId()); |
| | | approveProcessVO.setApproveTime(LocalDate.now().toString()); |
| | |
| | | } |
| | | |
| | | @GetMapping("/getDateil/{id}") |
| | | @Operation(summary = "éè¿idæ¥è¯¢è¯¦æ
") |
| | | public R getDateil(@PathVariable("id") Long id) { |
| | | return R.ok(shippingInfoService.getDetail(id)); |
| | | } |
| | | |
| | | @GetMapping("/getDateilByShippingNo") |
| | | @Operation(summary = "éè¿åè´§åå·æ¥è¯¢è¯¦æ
") |
| | | public R getDateilByShippingNo(String shippingNo) { |
| | | return R.ok(shippingInfoService.getDateilByShippingNo(shippingNo)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | //åè´§å®¡æ¹æ¥ç详æ
|
| | | @Data |
| | | public class ShippingApproveDto { |
| | | |
| | | private ShippingInfo shippingInfo; |
| | | |
| | | private List<ShippingProductDetailDto> shippingProductDetailDtoList; |
| | | } |
| | |
| | | import com.ruoyi.sales.dto.ShippingProductDetailDto; |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public interface ShippingProductDetailMapper extends BaseMapper<ShippingProductDetail> { |
| | | |
| | | List<ShippingProductDetailDto> getDetail(Long id); |
| | | |
| | | List<ShippingProductDetailDto> getDateilByShippingNo(@Param("shippingNo") String shippingNo); |
| | | } |
| | |
| | | private Boolean isProduction; |
| | | |
| | | @TableField(exist = false) |
| | | @Schema(description = "å¾
åè´§æ°é") |
| | | private BigDecimal noQuantity; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingApproveDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.dto.ShippingProductDetailDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | |
| | | boolean add(ShippingInfoDto req); |
| | | |
| | | List<ShippingProductDetailDto> getDetail(Long id); |
| | | |
| | | ShippingApproveDto getDateilByShippingNo(String shippingNo); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) { |
| | | // LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId()) |
| | | // .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if(!CollectionUtils.isEmpty(salesLedgerProducts)){ |
| | | salesLedgerProducts.forEach(item -> { |
| | |
| | | public boolean add(SalesQuotationDto salesQuotationDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SalesQuotation salesQuotation = new SalesQuotation(); |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | | salesQuotation.setId(null); |
| | | Customer customer = customerMapper.selectById(Long.valueOf(salesQuotationDto.getCustomerId())); |
| | | if (ObjectUtils.isNotEmpty(customer)) { |
| | | salesQuotation.setCustomer(customer.getCustomerName()); |
| | |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingApproveDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.dto.ShippingProductDetailDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | |
| | | } |
| | | //æ£ååºå |
| | | if(!"å·²åè´§".equals(byId.getStatus())){ |
| | | // SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | List<ShippingProductDetail> shippingProductDetails = shippingProductDetailMapper.selectList(new LambdaQueryWrapper<ShippingProductDetail>().eq(ShippingProductDetail::getShippingInfoId, req.getId())); |
| | | if (CollectionUtils.isEmpty(shippingProductDetails)) { |
| | | throw new RuntimeException("åè´§ä¿¡æ¯ä¸åå¨"); |
| | |
| | | public List<ShippingProductDetailDto> getDetail(Long id) { |
| | | return shippingProductDetailMapper.getDetail(id); |
| | | } |
| | | |
| | | @Override |
| | | public ShippingApproveDto getDateilByShippingNo(String shippingNo) { |
| | | ShippingApproveDto shippingApproveDto = new ShippingApproveDto(); |
| | | ShippingInfo shippingInfo = new ShippingInfo(); |
| | | shippingInfo.setShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingInfo(shippingInfoMapper.listPage(new Page(1, -1),shippingInfo).getRecords().get(0)); |
| | | List<ShippingProductDetailDto> dateilByShippingNo = shippingProductDetailMapper.getDateilByShippingNo(shippingNo); |
| | | shippingApproveDto.setShippingProductDetailDtoList(dateilByShippingNo); |
| | | return shippingApproveDto; |
| | | } |
| | | } |
| | |
| | | @Schema(description = "æ¯å¦è´¨æ£") |
| | | private Boolean isQuality; |
| | | |
| | | @Schema(description = "ç±»å åºå计æ¶å计件") |
| | | @Schema(description = "ç±»å åºå计æ¶å计件ï¼0计æ¶ï¼1计件") |
| | | private Integer type; |
| | | |
| | | @Schema(description = "设å¤id") |
| | |
| | | @Schema(description = "é¨é¨ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "ç±»å åºå计æ¶å计件ï¼0计æ¶ï¼1计件") |
| | | private Integer type; |
| | | } |
| | |
| | | routingOperation.setProductModelId(resolveOutputProductModelId(bomStructure, structureById, technologyRouting.getProductModelId())); |
| | | routingOperation.setTechnologyOperationId(bomStructure.getOperationId()); |
| | | routingOperation.setDragSort(dragSort++); |
| | | routingOperation.setIsQuality(getOperationQuality(bomStructure.getOperationId())); |
| | | TechnologyOperation technologyOperation = getOperation(bomStructure.getOperationId()); |
| | | routingOperation.setIsQuality(technologyOperation != null ? technologyOperation.getIsQuality() : null); |
| | | routingOperation.setIsProduction(technologyOperation != null ? technologyOperation.getIsProduction() : null); |
| | | routingOperation.setType(technologyOperation != null ? technologyOperation.getType() : null); |
| | | technologyRoutingOperationMapper.insert(routingOperation); |
| | | syncRoutingOperationParams(routingOperation.getId(), bomStructure.getOperationId()); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è´¨æ£æ è¯ä»¥å·¥åºåºç¡è¡¨å®ä¹ä¸ºåã |
| | | */ |
| | | private Boolean getOperationQuality(Long operationId) { |
| | | TechnologyOperation technologyOperation = technologyOperationMapper.selectById(operationId); |
| | | return technologyOperation != null ? technologyOperation.getIsQuality() : null; |
| | | private TechnologyOperation getOperation(Long operationId) { |
| | | if (operationId == null) { |
| | | return null; |
| | | } |
| | | return technologyOperationMapper.selectById(operationId); |
| | | } |
| | | |
| | | private String buildProcessRouteCode(Long id) { |
| | |
| | | pa.scheduling_user_id as schedulingUserId, |
| | | pa.scheduling_user_name as schedulingUserName, |
| | | cast(sum( |
| | | ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) * |
| | | case |
| | | when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$' |
| | | then cast(substring_index(pm.model, '*', -1) as decimal(18,4)) |
| | | else 1 |
| | | when poro.type = 0 then ifnull(pa.work_hours, 0) * ifnull(ppm.work_hour, 0) |
| | | else ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) * |
| | | case |
| | | when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$' |
| | | then cast(substring_index(pm.model, '*', -1) as decimal(18,4)) |
| | | else 1 |
| | | end |
| | | end |
| | | ) as decimal(18,4)) as wages, |
| | | cast(sum(ifnull(pa.finished_num, 0)) as decimal(18,4)) as finishedNum, |
| | | cast(sum(ifnull(pa.work_hours, 0)) as decimal(18,4)) as workHours, |
| | | cast(sum(ifnull(ppm.work_hour, 0)) as decimal(18,4)) as workHour, |
| | | case |
| | | when sum(ifnull(ppo.quantity, 0) + ifnull(ppo.scrapQty, 0)) = 0 then '0%' |
| | | else concat( |
| | |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | poro.operation_name as operationName, |
| | | poro.type as type, |
| | | IFNULL(scrapStat.scrapQty, 0) AS scrapQty, |
| | | ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus, |
| | | CASE |
| | |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="drag_sort" property="dragSort" /> |
| | | <result column="is_quality" property="isQuality" /> |
| | | <result column="type" property="type" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |
| | |
| | | <if test="c.requiredDateStart != null and c.requiredDateEnd != null"> |
| | | and pp.required_date between #{c.requiredDateStart} and #{c.requiredDateEnd} |
| | | </if> |
| | | <if test="c.salesContractNo != null and c.salesContractNo != ''"> |
| | | and sl.sales_contract_no like concat('%', #{c.salesContractNo}, '%') |
| | | </if> |
| | | </if> |
| | | </where> |
| | | ORDER BY COALESCE(pp.id) DESC |
| | |
| | | ifnull(ppo.scrap_qty, 0) as scrapQty, |
| | | date(pa.scheduling_date) as schedulingDate, |
| | | pa.scheduling_user_name as schedulingUserName, |
| | | cast(ifnull(ppm.work_hour, 0) as decimal(18,4)) as workHour, |
| | | cast(ifnull(pa.work_hours, 0) as decimal(18,4)) as workHours, |
| | | cast( |
| | | ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) * |
| | | case |
| | | when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$' |
| | | then cast(substring_index(pm.model, '*', -1) as decimal(18,4)) |
| | | else 1 |
| | | when poro.type = 0 then ifnull(pa.work_hours, 0) * ifnull(ppm.work_hour, 0) |
| | | else ifnull(pa.work_hours, 0) * ifnull(pa.finished_num, 0) * |
| | | case |
| | | when substring_index(pm.model, '*', -1) regexp '^[0-9]+(\\.[0-9]+)?$' |
| | | then cast(substring_index(pm.model, '*', -1) as decimal(18,4)) |
| | | else 1 |
| | | end |
| | | end |
| | | as decimal(18,4) |
| | | ) as wages |
| | |
| | | left join product p on p.id = pm.product_id |
| | | where spd.shipping_info_id = #{id} |
| | | </select> |
| | | <select id="getDateilByShippingNo" resultType="com.ruoyi.sales.dto.ShippingProductDetailDto"> |
| | | select si.batch_no, pm.model as specification_model, p.product_name, spd.quantity as delivery_quantity |
| | | from shipping_product_detail spd |
| | | left join shipping_info sp on sp.id = spd.shipping_info_id |
| | | left join stock_inventory si on si.id = spd.stock_inventory_id |
| | | left join product_model pm on pm.id = si.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | where sp.shipping_no = #{shippingNo} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="drag_sort" property="dragSort" /> |
| | | <result column="is_quality" property="isQuality" /> |
| | | <result column="type" property="type" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |