| | |
| | | if (salesLedgerProduct.getId() == null) { |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | result = salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | addProductionData(salesLedgerProduct); |
| | | } else { |
| | | //查询原本的产品型号id |
| | | result = salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | |
| | | * 新增生产数据 |
| | | */ |
| | | public void addProductionData(SalesLedgerProduct salesLedgerProduct) { |
| | | addProductionDataInternal(salesLedgerProduct, null); |
| | | } |
| | | |
| | | /** |
| | | * 审批通过后创建生产主计划(带审批状态) |
| | | */ |
| | | public void addProductionDataForApproved(SalesLedgerProduct salesLedgerProduct, int approvalStatus) { |
| | | addProductionDataInternal(salesLedgerProduct, approvalStatus); |
| | | } |
| | | |
| | | private void addProductionDataInternal(SalesLedgerProduct salesLedgerProduct, Integer approvalStatus) { |
| | | //先判断该产品是否需要生产 |
| | | if (!salesLedgerProduct.getIsProduction()) { |
| | | return; |
| | |
| | | productionPlan.setQtyRequired(salesLedgerProduct.getQuantity()); |
| | | productionPlan.setSource("销售"); |
| | | productionPlan.setStatus(0); |
| | | productionPlan.setRequiredDate(salesLedger.getDeliveryDate());//需求日期=交货日期 |
| | | productionPlan.setPromisedDeliveryDate(salesLedger.getDeliveryDate());//承诺日期=交货日期 |
| | | productionPlan.setRequiredDate(salesLedger.getDeliveryDate()); |
| | | productionPlan.setPromisedDeliveryDate(salesLedger.getDeliveryDate()); |
| | | if (approvalStatus != null) { |
| | | productionPlan.setApprovalStatus(approvalStatus); |
| | | } |
| | | productionPlanMapper.insert(productionPlan); |
| | | |
| | | } |
| | | |
| | | /** |