| | |
| | | */ |
| | | @Override |
| | | public ApsStandardProcessRouteLine getRouteLineTotalTime(ApsPlateStandardRequire require) { |
| | | // 定义独占生产模式常量 |
| | | String productivityModel_monopolize = "独占"; |
| | | // 初始化总工时为0 |
| | | BigDecimal totalRouteTime = BigDecimal.ZERO; |
| | | //工厂 |
| | |
| | | ApsStandardProcessRouteLine ret=new ApsStandardProcessRouteLine(); |
| | | ret.setRouteId(String.valueOf(routId)); |
| | | ret.setRouteTime(BigDecimal.ZERO); |
| | | |
| | | // 查询标准工艺路线头部信息 |
| | | Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemNumber).stream().findFirst(); |
| | | if (firstProcessRoute.isPresent()) { |
| | |
| | | // 构建工艺路线行参数对象 |
| | | ApsStandardProcessRouteLine routeLineParam =new ApsStandardProcessRouteLine(); |
| | | routeLineParam.setRouteId(routeHeader.getRouteId()); |
| | | |
| | | // 查询标准工艺路线行信息 |
| | | List<ApsStandardProcessRouteLine> apsStandardProcessRouteLines = apsStandardProcessRouteLineMapper.selectApsStandardProcessRouteLineList(routeLineParam); |
| | | /*工艺路线Line 总工时*/ |
| | | |
| | | if(apsStandardProcessRouteLines.isEmpty()){ |
| | | saveRequireError(require,"工序不存在"); |
| | | }else { |
| | | // 遍历每个工艺路线行 |
| | | apsStandardProcessRouteLines.forEach(line -> { |
| | | // 默认将设计产能设置为路线时间 |
| | | line.setRouteTime(line.getDesignCapacity()); |
| | | // 如果生产模式为独占,则路线时间为设计产能乘以净需求量 |
| | | if (line.getProductivityModel().equals(productivityModel_monopolize)) { |
| | | line.setRouteTime(line.getDesignCapacity().multiply(require.getNetRequirement())); |
| | | } |
| | | |
| | | }); |
| | | // 累加路线时间到总工时中 |
| | | totalRouteTime = apsStandardProcessRouteLines.stream() |
| | | .map(ApsStandardProcessRouteLine::getRouteTime) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | BigDecimal standardTime = apsStandardProcessRouteLineMapper.selectTotalStandTime(routeHeader.getRouteId()).getStandardTime(); |
| | | totalRouteTime =standardTime.multiply(require.getNetRequirement()); |
| | | ret.setRouteTime(totalRouteTime); |
| | | ret.setRouteId(routeHeader.getRouteId()); |
| | | }else { |