| | |
| | | */ |
| | | public int deleteApsPlateStandardRequireBomStockDetailById(Long id); |
| | | |
| | | void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount); |
| | | void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount,String requireId); |
| | | } |
| | |
| | | /* 记录工单与净需求的匹配关系*/ |
| | | ApsPlateStandardRequireBomOrderDetail bomOrderDetail = ApsPlateStandardRequireBomOrderDetail.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | | .requireId(require.getRequireId()) |
| | | .requireId(require.getId().toString()) |
| | | .requireTrackId(require.getRequireId()) |
| | | .bomLineId(require.getBomLineId()) |
| | | .bomLineCode(require.getBomLineCode()) |
| | | .docNo(platePlan.getDocumentNumber()) |
| | |
| | | * 计算物料剩余库存 并保存物料剩余库存明细。 |
| | | * */ |
| | | @Override |
| | | public void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount){ |
| | | public void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount,String requireId){ |
| | | /*更新物料剩余库存*/ |
| | | itemStorageMapper.updateMaterialStorageByVersion(afterStockAmount,itemStorage.getVersion()); |
| | | /*记录扣减明细*/ |
| | | ApsPlateStandardRequireBomStockDetail bomStockDetail = ApsPlateStandardRequireBomStockDetail.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | | .requireId(plan.getRequireId()) |
| | | .requireId(requireId) |
| | | .requireTrackId(plan.getRequireId()) |
| | | .bomLineId(bomLine.getBomLineId()) |
| | | .bomLineCode(bomLine.getItemCode()) |
| | | .beforeStockAmount(itemStorage.getRemainderStock()) |
| | |
| | | String plantCode="FORTUNA"; |
| | | /*定义主单类型为钣金主单*/ |
| | | String mainOrderType = "钣金主件"; |
| | | /*定义子单类型为钣金子单*/ |
| | | String subOrderType = "钣金子件"; |
| | | /*生成新批次号*/ |
| | | String batchNum=getBatch(); |
| | | /*获取钣金主单信息*/ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 构建需求信息 |
| | | * */ |
| | | private void getBomRequires(String plant, ApsBom bomLine, String batchNum, Date upLevelStartDate, ApsPlatePlan plan, List<ApsPlateStandardRequire> allRequires, Long level) { |
| | | |
| | | String itemNumber = bomLine.getItemCode(); |
| | | String productivityModel_combined_batch = "合批"; |
| | | String productivityModel_monopolize = "独占"; |
| | | /*构建需求信息*/ |
| | | ApsPlateStandardRequire require = new ApsPlateStandardRequire(); |
| | | require.setId(IdUtil.getSnowflakeNextId()); |
| | |
| | | afterStockAmount = remainderStock.subtract(deductionAmount); |
| | | require.setNetRequirement(BigDecimal.ZERO); |
| | | } |
| | | bomStockDetailService.saveStorageAndDetail(storage, plan, bomLine, batchNum, deductionAmount, afterStockAmount); |
| | | bomStockDetailService.saveStorageAndDetail(storage, plan, bomLine, batchNum, deductionAmount, afterStockAmount,require.getId().toString()); |
| | | } |
| | | } |
| | | |
| | |
| | | require.setMatchState("待匹配"); |
| | | require.setMatchMode("工单匹配"); |
| | | } |
| | | require.setHasDelayRisk("无风险"); |
| | | /*使用子件工单进行需求匹配*/ |
| | | matchRequireAndSubPlan(require); |
| | | |
| | |
| | | getBomRequires(plant, line, batchNum, require.getStartDate(), plan, allRequires, level + 1); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | private BigDecimal getRouteLineTotalTime(ApsStandardProcessRouteHeader routeHeader, String productivityModel_monopolize, BigDecimal netRequirement) { |
| | | ApsStandardProcessRouteLine routeLineParam = ApsStandardProcessRouteLine.builder() |
| | | .routeId(routeHeader.getRouteId()) |
| | | .build(); |
| | | List<ApsStandardProcessRouteLine> apsStandardProcessRouteLines = ApsStandardProcessRouteLineMapper.selectApsStandardProcessRouteLineList(routeLineParam); |
| | | /*工艺路线Line 总工时*/ |
| | | BigDecimal totalRouteTime = BigDecimal.ZERO; |
| | | apsStandardProcessRouteLines.forEach(line -> { |
| | | line.setRouteTime(line.getDesignCapacity()); |
| | | if (line.getProductivityModel().equals(productivityModel_monopolize)) { |
| | | line.setRouteTime(line.getDesignCapacity().multiply(netRequirement)); |
| | | } |
| | | totalRouteTime.add(line.getRouteTime()); |
| | | }); |
| | | return totalRouteTime; |
| | | } |
| | | |
| | | /** |