Browse Source

售后问题处理

yzc 1 năm trước cách đây
mục cha
commit
e539754ff4

+ 34 - 0
hx-mes/src/main/java/com/fjhx/mes/service/SaleServiceImpl.java

@@ -0,0 +1,34 @@
+package com.fjhx.mes.service;
+
+import com.fjhx.mes.entity.production.dto.ProductionOrderDto;
+import com.fjhx.mes.service.production.ProduceOrderService;
+import com.fjhx.sale.service.SaleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+@Service
+public class SaleServiceImpl implements SaleService {
+
+    @Autowired
+    private ProduceOrderService produceOrderService;
+
+    /**
+     * 直接生产
+     */
+    @Override
+    public void directProd(Long contractId, Date deliveryPeriod, Long produceCompanyId) {
+        //下发生产
+        ProductionOrderDto produceOrderDto = new ProductionOrderDto();
+        produceOrderDto.setContractId(contractId);
+        produceOrderDto.setDeliveryPeriod(deliveryPeriod);
+        produceOrderDto.setProduceCompanyId(produceCompanyId);
+        produceOrderService.createOrder(produceOrderDto);
+
+        //确认交期
+        produceOrderDto.setConfirmStatus(1);
+        produceOrderService.deliveryConfirm(produceOrderDto);
+    }
+
+}

+ 10 - 2
hx-sale/src/main/java/com/fjhx/sale/flow/AfterSalesFlow.java

@@ -14,6 +14,7 @@ import com.fjhx.sale.entity.after.dto.AfterSalesDto;
 import com.fjhx.sale.entity.after.po.AfterSales;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.po.ContractProduct;
+import com.fjhx.sale.service.SaleService;
 import com.fjhx.sale.service.after.AfterSalesService;
 import com.fjhx.sale.service.contract.ContractProductService;
 import com.fjhx.sale.service.contract.ContractService;
@@ -36,14 +37,17 @@ public class AfterSalesFlow extends FlowDelegate {
     private final AccountPaymentService accountPaymentService;
     private final ContractService contractService;
 
+    private final SaleService saleService;
+
     @Autowired
-    public AfterSalesFlow(AfterSalesService afterSalesService, CodingRuleService codingRuleService, ContractProductService contractProductService, ISysUserService userService, AccountPaymentService accountPaymentService, ContractService contractService) {
+    public AfterSalesFlow(AfterSalesService afterSalesService, CodingRuleService codingRuleService, ContractProductService contractProductService, ISysUserService userService, AccountPaymentService accountPaymentService, ContractService contractService, SaleService saleService) {
         this.afterSalesService = afterSalesService;
         this.codingRuleService = codingRuleService;
         this.contractProductService = contractProductService;
         this.userService = userService;
         this.accountPaymentService = accountPaymentService;
         this.contractService = contractService;
+        this.saleService = saleService;
     }
 
     @Override
@@ -120,21 +124,25 @@ public class AfterSalesFlow extends FlowDelegate {
         }
         //如果售后类型=补发10/换货20。审批通过后,生成一条销售订单,与原销售订单信息基本一致:商品清单只有这一条,数量=售后数量,价格=0。默认审批通过
         if (ObjectUtil.equals(afterSales.getType(), "10") || ObjectUtil.equals(afterSales.getType(), "20")) {
+            //合同信息
             Contract contract1 = contractService.getById(contractProduct.getContractId());
             Assert.notEmpty(contract1, "查询不到合同信息!");
             contract1.setId(null);
             contract1.setAmount(BigDecimal.ZERO);
             contract1.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract1.getBuyCorporationId()));
             contractService.save(contract1);
-
             afterSales.setNewContractId(contract1.getId());
 
+            //合同产品
             ContractProduct contractProduct1 = contractProductService.getById(contractProductId);
             contractProduct1.setId(null);
             contractProduct1.setContractId(contract1.getId());
             contractProduct1.setPrice(BigDecimal.ZERO);
             contractProduct1.setQuantity(afterSales.getQuantity());
             contractProductService.save(contractProduct1);
+
+            //直接生产
+            saleService.directProd(contract1.getId(), new Date(), contract1.getCompanyId());
         }
 
         afterSalesService.updateById(afterSales);

+ 11 - 0
hx-sale/src/main/java/com/fjhx/sale/service/SaleService.java

@@ -0,0 +1,11 @@
+package com.fjhx.sale.service;
+
+import java.util.Date;
+
+public interface SaleService {
+
+    /**
+     * 直接生产
+     */
+    void directProd(Long contractId, Date deliveryPeriod, Long produceCompanyId);
+}