|
@@ -86,6 +86,8 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
private IContractManagementInfoService contractManagementInfoService;
|
|
|
@Autowired
|
|
|
private GeTuiUtils geTuiUtils;
|
|
|
+ @Autowired
|
|
|
+ private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
|
|
|
|
/**
|
|
|
* 待完成页面列表
|
|
@@ -502,6 +504,10 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
stockPurchaseReceiptReport.setAmountIngPayable
|
|
|
(warehouseInOutInfo.getNetWeight() *
|
|
|
(Float.valueOf(String.valueOf(contractManagementInfo.getUnitContractPrice())) - Float.valueOf(warehouseInOutInfo.getDeductionAmount())));
|
|
|
+ stockPurchaseReceiptReport.setAmountEdPayable(0.0f);
|
|
|
+ stockPurchaseReceiptReport.setAmountNotPayable(stockPurchaseReceiptReport.getAmountIngPayable());
|
|
|
+ stockPurchaseReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
+ stockPurchaseReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
}
|
|
|
|
|
|
// 客户确认
|
|
@@ -609,89 +615,141 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
throw new YException(YExceptionEnum.WAREHOUSE_NO_ERROR);
|
|
|
}
|
|
|
|
|
|
- // 销售出库统计
|
|
|
- SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
|
|
|
- salesDeliveryReport.setId(IdGenerator.generateUUID());
|
|
|
- salesDeliveryReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
- salesDeliveryReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
- salesDeliveryReport.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
- salesDeliveryReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
- salesDeliveryReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
|
|
|
- salesDeliveryReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
- salesDeliveryReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
- salesDeliveryReport.setRetrievalDate(warehouseInOutInfo.getInOutDate());
|
|
|
- salesDeliveryReport.setProtein(warehouseInOutDetail.getProtein());
|
|
|
- salesDeliveryReport.setWaterContent(warehouseInOutDetail.getWaterContent());
|
|
|
- salesDeliveryReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
- salesDeliveryReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
- salesDeliveryReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
- salesDeliveryReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
- if (saleOrder != null) {
|
|
|
- salesDeliveryReport.setUnitPrice(saleOrder.getUnitPrice());
|
|
|
- salesDeliveryReport.setInvoiceFee(saleOrder.getInvoiceFee());
|
|
|
- //期货
|
|
|
- if (saleOrder.getBasis()!=null){
|
|
|
- salesDeliveryReport.setBasisPrice(saleOrder.getBasis());
|
|
|
- BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
- BigDecimal basis = new BigDecimal(Float.toString(salesDeliveryReport.getBasisPrice()));
|
|
|
- BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
- salesDeliveryReport.setSettlementPrice(unitPrice.add(basis).add(invoiceFee).floatValue());
|
|
|
- tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice() + saleOrder.getBasis() + saleOrder.getInvoiceFee());
|
|
|
- }
|
|
|
- //现货
|
|
|
- else{
|
|
|
- BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
- BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
- salesDeliveryReport.setSettlementPrice(unitPrice.add(invoiceFee).floatValue());
|
|
|
- tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice()+ saleOrder.getInvoiceFee());
|
|
|
+ //查询期货现货合同
|
|
|
+ ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
+ .eq("contract_no",warehouseInOutInfo.getContractNo()));
|
|
|
+ if("2".equals(contractManagementInfo.getGoodsType())){
|
|
|
+ // 期货销售出库统计
|
|
|
+ SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
|
|
|
+ salesDeliveryReport.setId(IdGenerator.generateUUID());
|
|
|
+ salesDeliveryReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
+ salesDeliveryReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
+ salesDeliveryReport.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
+ salesDeliveryReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
+ salesDeliveryReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
|
|
|
+ salesDeliveryReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
+ salesDeliveryReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
+ salesDeliveryReport.setRetrievalDate(warehouseInOutInfo.getInOutDate());
|
|
|
+ salesDeliveryReport.setProtein(warehouseInOutDetail.getProtein());
|
|
|
+ salesDeliveryReport.setWaterContent(warehouseInOutDetail.getWaterContent());
|
|
|
+ salesDeliveryReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
+ salesDeliveryReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
+ salesDeliveryReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
+ salesDeliveryReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
+ if (saleOrder != null) {
|
|
|
+ salesDeliveryReport.setUnitPrice(saleOrder.getUnitPrice());
|
|
|
+ salesDeliveryReport.setInvoiceFee(saleOrder.getInvoiceFee());
|
|
|
+ //期货
|
|
|
+ if (saleOrder.getBasis()!=null){
|
|
|
+ salesDeliveryReport.setBasisPrice(saleOrder.getBasis());
|
|
|
+ BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
+ BigDecimal basis = new BigDecimal(Float.toString(salesDeliveryReport.getBasisPrice()));
|
|
|
+ BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
+ salesDeliveryReport.setSettlementPrice(unitPrice.add(basis).add(invoiceFee).floatValue());
|
|
|
+ tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice() + saleOrder.getBasis() + saleOrder.getInvoiceFee());
|
|
|
+ }
|
|
|
+ //现货
|
|
|
+// else{
|
|
|
+// BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
+// BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
+// salesDeliveryReport.setSettlementPrice(unitPrice.add(invoiceFee).floatValue());
|
|
|
+// tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice()+ saleOrder.getInvoiceFee());
|
|
|
+// }
|
|
|
+ salesDeliveryReport.setCustomerName(saleOrder.getBuyer());
|
|
|
+ salesDeliveryReport.setCollectionIngPayable(CalculationUtil.mulToFloat(salesDeliveryReport.getSettlementPrice(), salesDeliveryReport.getNetWeight()));
|
|
|
+ salesDeliveryReport.setCollectionEdPayable(0f);
|
|
|
+ salesDeliveryReport.setCollectionNotPayable(salesDeliveryReport.getCollectionIngPayable());
|
|
|
+ tranCarInfoService.insert(tranCarInfo);
|
|
|
}
|
|
|
- salesDeliveryReport.setCustomerName(saleOrder.getBuyer());
|
|
|
- salesDeliveryReport.setCollectionIngPayable(CalculationUtil.mulToFloat(salesDeliveryReport.getSettlementPrice(), salesDeliveryReport.getNetWeight()));
|
|
|
- salesDeliveryReport.setCollectionEdPayable(0f);
|
|
|
- salesDeliveryReport.setCollectionNotPayable(salesDeliveryReport.getCollectionIngPayable());
|
|
|
- tranCarInfoService.insert(tranCarInfo);
|
|
|
- }
|
|
|
|
|
|
- // 客户确认
|
|
|
- TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
- .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
- .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
- .eq("delete_flag", "0"));
|
|
|
- if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
- salesDeliveryReport.setCustomerConfirmationStatusFlag("1");
|
|
|
- salesDeliveryReport.setCustomerConfirmationStatus("是");
|
|
|
- geTuiUtils.pushByCid("发货通知", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "已发出", saleOrder.getCommonId());
|
|
|
- tesk(warehouseInOutInfo, "1");
|
|
|
- } else {
|
|
|
- salesDeliveryReport.setCustomerConfirmationStatusFlag("3");
|
|
|
- salesDeliveryReport.setCustomerConfirmationStatus("否");
|
|
|
- }
|
|
|
- salesDeliveryReportService.insert(salesDeliveryReport);
|
|
|
+ // 客户确认
|
|
|
+ TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatusFlag("1");
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatus("是");
|
|
|
+ geTuiUtils.pushByCid("发货通知", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "已发出", saleOrder.getCommonId());
|
|
|
+ tesk(warehouseInOutInfo, "1");
|
|
|
+ } else {
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatusFlag("3");
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatus("否");
|
|
|
+ }
|
|
|
+ salesDeliveryReportService.insert(salesDeliveryReport);
|
|
|
+
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesDeliveryReport.getWorkflowId());
|
|
|
+ // 不是退回的单子
|
|
|
+ if (isStartWorkflow) {
|
|
|
+ Workflow workflow = workflowService
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(saleOrder.getCompId(), "SALE-RECEIPT-REPORT");
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
+ if (workflow == null) {
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
+ }
|
|
|
+ // 开启审核流
|
|
|
+ else {
|
|
|
|
|
|
- boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesDeliveryReport.getWorkflowId());
|
|
|
- // 不是退回的单子
|
|
|
- if (isStartWorkflow) {
|
|
|
- Workflow workflow = workflowService
|
|
|
- .findLatestWorkflowByBusinessCodeByApp(saleOrder.getCompId(), "SALE-RECEIPT-REPORT");
|
|
|
- // 没配置审核流程,直接结束并处理信息
|
|
|
- if (workflow == null) {
|
|
|
- throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
+ // 设置状态 已提交审核
|
|
|
+ salesDeliveryReport.setWorkflowId(workflow.getId());
|
|
|
+ salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
|
+ workflowService.startInstance(workflow.getId(), salesDeliveryReport.getId());
|
|
|
+ }
|
|
|
}
|
|
|
- // 开启审核流
|
|
|
+ // 退回的单子 再启用
|
|
|
else {
|
|
|
|
|
|
- // 设置状态 已提交审核
|
|
|
- salesDeliveryReport.setWorkflowId(workflow.getId());
|
|
|
salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
|
- workflowService.startInstance(workflow.getId(), salesDeliveryReport.getId());
|
|
|
+ workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
|
|
|
}
|
|
|
- }
|
|
|
- // 退回的单子 再启用
|
|
|
- else {
|
|
|
+ }else {
|
|
|
+ //现货销售统计
|
|
|
+ StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
|
|
|
+ stockSaleReceiptReport.setId(IdGenerator.generateUUID());
|
|
|
+ stockSaleReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
+ stockSaleReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
+ stockSaleReceiptReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
+ stockSaleReceiptReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
+ stockSaleReceiptReport.setGrossWeight(warehouseInOutInfo.getGrossWeight());
|
|
|
+ stockSaleReceiptReport.setTare(warehouseInOutInfo.getTare());
|
|
|
+ stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
+ if("1".equals(warehouseInOutInfo.getTaskTypeKey())){
|
|
|
+ stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getUnitPrice() * stockSaleReceiptReport.getSettlementWeight());
|
|
|
+ }else if ("4".equals(warehouseInOutInfo.getTaskTypeKey())){
|
|
|
+ stockSaleReceiptReport.setReturnDate(warehouseInOutInfo.getInOutDate());
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(-warehouseInOutInfo.getNetWeight());
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(0.0f);
|
|
|
+ stockSaleReceiptReport.setReturnFlag("1");
|
|
|
+ }
|
|
|
+ stockSaleReceiptReportService.insert(stockSaleReceiptReport);
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(stockSaleReceiptReport.getWorkflowId());
|
|
|
+ // 不是退回的单子
|
|
|
+ if (isStartWorkflow) {
|
|
|
+ Workflow workflow = workflowService
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(saleOrder.getCompId(), "SALE-RECEIPT-REPORT");
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
+ if (workflow == null) {
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
+ }
|
|
|
+ // 开启审核流
|
|
|
+ else {
|
|
|
|
|
|
- salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
|
- workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
|
|
|
+ // 设置状态 已提交审核
|
|
|
+ stockSaleReceiptReport.setWorkflowId(workflow.getId());
|
|
|
+ stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
|
|
|
+ workflowService.startInstance(workflow.getId(), stockSaleReceiptReport.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 退回的单子 再启用
|
|
|
+ else {
|
|
|
+
|
|
|
+ stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
|
|
|
+ workflowService.activateInstance(stockSaleReceiptReport.getWorkflowId(), stockSaleReceiptReport.getId());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
warehouseInOutInfo.setStatusFlag(StatusEnum.SUBMITTED.getFlag());
|
|
|
warehouseInOutInfo.setStatus(StatusEnum.SUBMITTED.getName());
|