Commit 0f0aa675dc031650c9faa297208a245ca54b92ee

Authored by 房远帅
1 parent 09fa860f

试样订单:新增产品试样确认单

@@ -11,12 +11,16 @@ import com.lframework.starter.web.core.components.security.SecurityUtil; @@ -11,12 +11,16 @@ import com.lframework.starter.web.core.components.security.SecurityUtil;
11 import com.lframework.starter.web.core.utils.IdUtil; 11 import com.lframework.starter.web.core.utils.IdUtil;
12 import com.lframework.starter.web.core.utils.JsonUtil; 12 import com.lframework.starter.web.core.utils.JsonUtil;
13 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; 13 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
  14 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  15 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
14 import com.lframework.starter.web.inner.service.system.SysUserRoleService; 16 import com.lframework.starter.web.inner.service.system.SysUserRoleService;
15 import com.lframework.xingyun.basedata.entity.Workshop; 17 import com.lframework.xingyun.basedata.entity.Workshop;
16 import com.lframework.xingyun.basedata.service.workshop.WorkshopService; 18 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
17 import com.lframework.xingyun.sc.entity.*; 19 import com.lframework.xingyun.sc.entity.*;
18 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus; 20 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  21 +import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService;
19 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService; 22 import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  23 +import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
20 import com.lframework.xingyun.sc.service.contract.SpecLockDelayApplicationService; 24 import com.lframework.xingyun.sc.service.contract.SpecLockDelayApplicationService;
21 import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService; 25 import com.lframework.xingyun.sc.service.customer.CorePersonnelHistoryService;
22 import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; 26 import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
@@ -26,6 +30,7 @@ import com.lframework.xingyun.sc.service.ledger.FundCoordinationService; @@ -26,6 +30,7 @@ import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
26 import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; 30 import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService;
27 import com.lframework.xingyun.sc.service.order.*; 31 import com.lframework.xingyun.sc.service.order.*;
28 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; 32 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
  33 +import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService;
29 import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; 34 import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService;
30 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; 35 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
31 import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; 36 import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService;
@@ -39,6 +44,8 @@ import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo; @@ -39,6 +44,8 @@ import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo;
39 import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; 44 import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
40 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; 45 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
41 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo; 46 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo;
  47 +import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipDetailVo;
  48 +import com.lframework.xingyun.sc.vo.sample.confirm.CreateProductSampleConfirmationSlipVo;
42 import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; 49 import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo;
43 import com.lframework.xingyun.sc.vo.shipments.car.CreateRequestCarTicketVo; 50 import com.lframework.xingyun.sc.vo.shipments.car.CreateRequestCarTicketVo;
44 import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo; 51 import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo;
@@ -58,9 +65,7 @@ import java.math.BigDecimal; @@ -58,9 +65,7 @@ import java.math.BigDecimal;
58 import java.time.LocalDate; 65 import java.time.LocalDate;
59 import java.time.LocalTime; 66 import java.time.LocalTime;
60 import java.time.format.DateTimeFormatter; 67 import java.time.format.DateTimeFormatter;
61 -import java.util.ArrayList;  
62 -import java.util.List;  
63 -import java.util.Map; 68 +import java.util.*;
64 import java.util.stream.Collectors; 69 import java.util.stream.Collectors;
65 70
66 @Component 71 @Component
@@ -122,6 +127,14 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -122,6 +127,14 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
122 private ShipmentsOrderInfoService shipmentsOrderInfoService; 127 private ShipmentsOrderInfoService shipmentsOrderInfoService;
123 @Resource 128 @Resource
124 private ReceiptLedgerInfoService receiptLedgerInfoService; 129 private ReceiptLedgerInfoService receiptLedgerInfoService;
  130 + @Resource
  131 + private ContractDistributorLineService contractDistributorLineService;
  132 + @Resource
  133 + private ContractStdProcessingLineService contractStdProcessingLineService;
  134 + @Resource
  135 + private SysDataDicItemService sysDataDicItemService;
  136 + @Resource
  137 + private ProductSampleConfirmationSlipService productSampleConfirmationSlipService;
125 138
126 139
127 140
@@ -757,6 +770,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -757,6 +770,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
757 createPurchaseOrderLineVo.setAssessmentExceedsAgreement(purchaseOrderLine.getAssessmentExceedsAgreement()); 770 createPurchaseOrderLineVo.setAssessmentExceedsAgreement(purchaseOrderLine.getAssessmentExceedsAgreement());
758 createPurchaseOrderLineVo.setPackagingFee(purchaseOrderLine.getPackagingFee()); 771 createPurchaseOrderLineVo.setPackagingFee(purchaseOrderLine.getPackagingFee());
759 createPurchaseOrderLineVo.setSampleOrder(purchaseOrderLine.isSampleOrder()); 772 createPurchaseOrderLineVo.setSampleOrder(purchaseOrderLine.isSampleOrder());
  773 + createPurchaseOrderLineVo.setContractDistributorLineId(purchaseOrderLine.getContractDistributorLineId());
760 list.add(createPurchaseOrderLineVo); 774 list.add(createPurchaseOrderLineVo);
761 775
762 totalQuantity = totalQuantity.add(purchaseOrderLine.getQuantity()); 776 totalQuantity = totalQuantity.add(purchaseOrderLine.getQuantity());
@@ -766,7 +780,57 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -766,7 +780,57 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
766 780
767 vo.setTotalQuantity(totalQuantity); 781 vo.setTotalQuantity(totalQuantity);
768 vo.setCreatePurchaseOrderLineVoList(list); 782 vo.setCreatePurchaseOrderLineVoList(list);
769 - purchaseOrderInfoService.create(vo); 783 + String id = purchaseOrderInfoService.create(vo);
  784 +
  785 + //新增产品试样确认单
  786 + CreateProductSampleConfirmationSlipVo vo2 = new CreateProductSampleConfirmationSlipVo();
  787 + vo2.setOrderId(id);
  788 + vo2.setRegion(vo.getRegion());
  789 + vo2.setOrderingUnit(vo.getOrderingUnit());
  790 + vo2.setWorkshopId(vo.getWorkshopId());
  791 + vo2.setTotalQuantity(vo.getTotalQuantity());
  792 + QueryPurchaseOrderLineVo vo3 = new QueryPurchaseOrderLineVo();
  793 + vo3.setPurchaseOrderId(id);
  794 + List<PurchaseOrderLine> lines = purchaseOrderLineService.query(vo3);
  795 + List<CreateProductSampleConfirmationSlipDetailVo> detailVoList = new ArrayList<>();
  796 + Set<String> set = new HashSet<>();
  797 + for (PurchaseOrderLine line : lines) {
  798 + CreateProductSampleConfirmationSlipDetailVo detailVo = new CreateProductSampleConfirmationSlipDetailVo();
  799 + detailVo.setPurchaseOrderLineId(line.getId());
  800 + detailVo.setBrand(line.getBrand());
  801 + detailVo.setThickness(line.getThickness());
  802 + detailVo.setThicknessTolPos(line.getThicknessTolPos());
  803 + detailVo.setThicknessTolNeg(line.getThicknessTolNeg());
  804 + detailVo.setWidth(line.getWidth());
  805 + detailVo.setWidthTolPos(line.getWidthTolPos());
  806 + detailVo.setWidthTolNeg(line.getWidthTolNeg());
  807 + detailVo.setLength(line.getLength());
  808 + detailVo.setLengthTolPos(line.getLengthTolPos());
  809 + detailVo.setLengthTolNeg(line.getLengthTolNeg());
  810 + detailVo.setStatus(line.getStatus());
  811 + detailVo.setQuantity(line.getQuantity());
  812 + detailVoList.add(detailVo);
  813 + String contractDistributorLineId = line.getContractDistributorLineId();
  814 + ContractDistributorLine contractDistributorLine = contractDistributorLineService.findById(contractDistributorLineId);
  815 + if (contractDistributorLine != null) {
  816 + String productId = contractDistributorLine.getProductId();
  817 + set.add(productId);
  818 + } else {
  819 + ContractStdProcessingLine stdProcessingLine = contractStdProcessingLineService.findById(contractDistributorLineId);
  820 + if (stdProcessingLine != null) {
  821 + set.add(stdProcessingLine.getProductId());
  822 + }
  823 + }
  824 + }
  825 + String names = set.stream()
  826 + .map(key -> sysDataDicItemService.findByCode("CONTRACT_PRODUCT", key))
  827 + .filter(Objects::nonNull) // 防止 findByCode 返回 null 导致 NPE
  828 + .map(SysDataDicItem::getName)
  829 + .filter(Objects::nonNull) // 可选:过滤掉 name 为 null 的情况
  830 + .collect(Collectors.joining(",")); // 中文逗号
  831 + vo2.setBelongingBreed(names);
  832 + vo2.setProductSampleConfirmationSlipDetailList(detailVoList);
  833 + productSampleConfirmationSlipService.create(vo2);
770 834
771 //更新原来订货单总数量 835 //更新原来订货单总数量
772 if (purchaseOrderInfo.getTotalQuantity() != null) { 836 if (purchaseOrderInfo.getTotalQuantity() != null) {
@@ -35,4 +35,10 @@ public class QueryProductSampleConfirmationSlipVo extends PageVo implements Base @@ -35,4 +35,10 @@ public class QueryProductSampleConfirmationSlipVo extends PageVo implements Base
35 @ApiModelProperty("所属厂别") 35 @ApiModelProperty("所属厂别")
36 private String workshopId; 36 private String workshopId;
37 37
  38 + /**
  39 + * 审核状态
  40 + */
  41 + @ApiModelProperty("审核状态")
  42 + private String status;
  43 +
38 } 44 }
@@ -127,6 +127,9 @@ @@ -127,6 +127,9 @@
127 <if test="vo.workshopId != null and vo.workshopId != ''"> 127 <if test="vo.workshopId != null and vo.workshopId != ''">
128 AND tb.workshop_id = #{vo.workshopId} 128 AND tb.workshop_id = #{vo.workshopId}
129 </if> 129 </if>
  130 + <if test="vo.status != null and vo.status != ''">
  131 + AND tb.status = #{vo.status}
  132 + </if>
130 </where> 133 </where>
131 ORDER BY tb.create_time DESC 134 ORDER BY tb.create_time DESC
132 </select> 135 </select>