| | |
| | | import com.example.erp.dto.pp.*; |
| | | import com.example.erp.entity.pp.DamageDetails; |
| | | import com.example.erp.entity.pp.Report; |
| | | import com.example.erp.mapper.pp.FlowCardMapper; |
| | | import com.example.erp.mapper.pp.ProductionSchedulingMapper; |
| | | import com.example.erp.mapper.pp.ReportMapper; |
| | | import com.example.erp.mapper.sd.OrderProcessDetailMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.sql.Date; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.concurrent.Executor; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @DS("pp") |
| | |
| | | private final OrderProcessDetailMapper orderProcessDetailMapper; |
| | | private final ProductionSchedulingMapper productionSchedulingMapper; |
| | | |
| | | FlowCardMapper flowCardMapper; |
| | | |
| | | public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper, ProductionSchedulingMapper productionSchedulingMapper) { |
| | | |
| | | private void mergeTeamsGroupsName( |
| | | List<WorkInProgressDTO> dataList1, |
| | | List<WorkInProgressDTO> dataList2 |
| | | ) { |
| | | Function<WorkInProgressDTO, String> keyFn = dto -> |
| | | dto.getProcessId() + "|" + |
| | | dto.getOrderNumber() + "|" + |
| | | dto.getTechnologyNumber(); |
| | | |
| | | Map<String, WorkInProgressDTO> map2 = dataList2.stream() |
| | | .collect(Collectors.toMap( |
| | | keyFn, |
| | | Function.identity(), |
| | | (existing, replacement) -> existing |
| | | )); |
| | | |
| | | for (WorkInProgressDTO dto1 : dataList1) { |
| | | WorkInProgressDTO dto2 = map2.get(keyFn.apply(dto1)); |
| | | if (dto2 != null) { |
| | | String tgn = dto2.getTeamsGroupsName(); |
| | | if (StringUtils.hasText(tgn)) { |
| | | dto1.setTeamsGroupsName(tgn); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public ReportService(ReportMapper reportMapper, OrderProcessDetailMapper orderProcessDetailMapper, ProductionSchedulingMapper productionSchedulingMapper,FlowCardMapper flowCardMapper) { |
| | | this.reportMapper = reportMapper; |
| | | this.orderProcessDetailMapper = orderProcessDetailMapper; |
| | | this.productionSchedulingMapper = productionSchedulingMapper; |
| | | this.flowCardMapper = flowCardMapper; |
| | | } |
| | | |
| | | //流程卡进度方法 |
| | |
| | | if ("null".equals(optionVal)) { |
| | | optionVal = (""); |
| | | } |
| | | |
| | | if (selectProcesses.equals("全部")){ |
| | | selectProcesses=""; |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<WorkInProgressDTO> dataList2 =reportMapper.workInProgressMpdataList2(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO); |
| | | if (optionVal.equals("1")){ |
| | | /* 根据销售单号汇总*/ |
| | | map.put("data", reportMapper.workInProgressOrderMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total", reportMapper.workInProgressOrderTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("footSum" ,reportMapper.workInProgressOrderFootSum(orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | //map.put("data", reportMapper.workInProgressOrderMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | List<WorkInProgressDTO> dataList1 =reportMapper.workInProgressOrderMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO); |
| | | mergeTeamsGroupsName(dataList1, dataList2); |
| | | map.put("data",dataList1); |
| | | // map.put("total", reportMapper.workInProgressOrderTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | }else if(optionVal.equals("2")){ |
| | | /* 根流程卡号汇总*/ |
| | | map.put("data", reportMapper.workInProgressProcessMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total", reportMapper.workInProgressProcessTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("footSum" ,reportMapper.workInProgressOrderFootSum(orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | /* 根据流程卡号汇总*/ |
| | | //map.put("data", reportMapper.workInProgressProcessMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | List<WorkInProgressDTO> dataList1 =reportMapper.workInProgressProcessMpList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO); |
| | | mergeTeamsGroupsName(dataList1, dataList2); |
| | | map.put("data",dataList1); |
| | | // map.put("total", reportMapper.workInProgressProcessTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | |
| | | } else if (optionVal.equals("3")) { |
| | | |
| | | } else { |
| | | //没有选择分组 |
| | | map.put("data", reportMapper.workInProgressMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total", reportMapper.workInProgressTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("footSum" ,reportMapper.workInProgressOrderFootSum(orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | //map.put("data", reportMapper.workInProgressMp(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | List<WorkInProgressDTO> dataList1 =reportMapper.workInProgressMpdataList1(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO); |
| | | mergeTeamsGroupsName(dataList1, dataList2); |
| | | map.put("data",dataList1); |
| | | //map.put("total", reportMapper.workInProgressTotal(offset, pageSize, orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | map.put("total" ,reportMapper.workInProgressOrderFootSum(offset, pageSize,orderId, inputProject, selectProcesses, workInProgressDTO)); |
| | | |
| | | } |
| | | map.put("process", productionSchedulingMapper.selectProcess()); |
| | |
| | | public Map<String, Object> splittingDetailsOutsideSv(String orderId, Report report) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", reportMapper.splittingDetailsOutsideMp(orderId, report)); |
| | | map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | if (dates != null && dates.size() > 1) { |
| | | dates.set(1, dates.get(1).plusDays(1)); // 将第二个日期加一天 |
| | | } |
| | | System.out.println(dates); |
| | | return reportMapper.exportDamageReportMp(dates); |
| | | } |
| | | |
| | |
| | | |
| | | public List exportWorkInProgressSv(Map<String, Object> dates) { |
| | | String process= (String) dates.get("processes"); |
| | | if (process.equals("全部")){ |
| | | process=""; |
| | | } |
| | | String inputVal= (String) dates.get("inputVal"); |
| | | String project= (String) dates.get("project"); |
| | | if ("null".equals(inputVal)) { |
| | |
| | | if ("null".equals(project)) { |
| | | project = ""; |
| | | } |
| | | return reportMapper.exportWorkInProgressMp(process,inputVal,project); |
| | | List<WorkInProgressDTO> dataList1 =reportMapper.exportWorkInProgressMp(process,inputVal,project); |
| | | List<WorkInProgressDTO> dataList2 =reportMapper.exportWorkInProgressMpdataList2(process); |
| | | |
| | | mergeTeamsGroupsName(dataList1, dataList2); |
| | | return dataList1; |
| | | } |
| | | |
| | | public List exportTaskCompletionStatusSv(Map<String, Object> dates) { |
| | |
| | | String laminating = reportMapper.getLaminating(selectProcesses); |
| | | map.put("data", reportMapper.teamOutputMp(offset, pageSize, selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO)); |
| | | map.put("process", productionSchedulingMapper.selectProcess()); |
| | | map.put("total", reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2,selectProcesses, teamOutputDTO)); |
| | | map.put("footSum" ,reportMapper.teamOutputFootSum(selectTime1, selectTime2,selectProcesses, teamOutputDTO)); |
| | | map.put("total", reportMapper.teamOutputPageTotal(offset, pageSize, selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO)); |
| | | map.put("footSum" ,reportMapper.teamOutputFootSum(selectTime1, selectTime2,selectProcesses,laminating, teamOutputDTO)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | if (process.equals("全部")){ |
| | | process=""; |
| | | } |
| | | return reportMapper.exportTeamOutputMp(date,process); |
| | | String laminating = reportMapper.getLaminating(process); |
| | | return reportMapper.exportTeamOutputMp(date,process,laminating); |
| | | } |
| | | } |