|
@@ -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);
|