public Boolean erpUnAudit(WorkOrderErpUnAuditDto workOrderErpUnAuditDto) { List<WorkOrderErpUnAuditDto.ModelDTO> listWorkOrderErpUnAuditDto = workOrderErpUnAuditDto.getModel(); List<String> billNos = listWorkOrderErpUnAuditDto.stream().map(vo -> vo.getFBillNo()).collect(Collectors.toList()); if (CollectionUtils.isEmpty(billNos)) return true; List<WorkOrderProductionPlan> workOrderProductionPlans = workOrderProductionPlanMapper.selectList(Wrappers.lambdaQuery(WorkOrderProductionPlan.class).in(WorkOrderProductionPlan::getBillNo, billNos)); if (CollectionUtils.isEmpty(workOrderProductionPlans)) return true; List<String> onlyNos = workOrderProductionPlans.stream().map(vo -> vo.getOnlyNo()).collect(Collectors.toList()); if (CollectionUtils.isEmpty(onlyNos)) return true; List<TerminalProductPlan> terminalProductPlanList = terminalProductPlanMapper.selectList(Wrappers.lambdaQuery(TerminalProductPlan.class).in(TerminalProductPlan::getPlanId, onlyNos).isNotNull(TerminalProductPlan::getStartDate));//注意:傳送機器後,終端會上傳一條WorkState=0,StartDate=Null資料 if (CollectionUtils.isEmpty(terminalProductPlanList)) { getWorkInfoToMachine(workOrderProductionPlans); workOrderProductionPlanMapper.delete(Wrappers.lambdaQuery(WorkOrderProductionPlan.class).in(WorkOrderProductionPlan::getBillNo, billNos)); return true; } List<TerminalProductPlan> terminalProductPlans = terminalProductPlanList.stream().filter(vo -> vo.getWorkState() != 0).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(terminalProductPlans)) return false; getPlanInfoToMachine(terminalProductPlans); terminalProductPlanMapper.delete(Wrappers.lambdaQuery(TerminalProductPlan.class).in(TerminalProductPlan::getPlanId, onlyNos)); workOrderProductionPlanMapper.delete(Wrappers.lambdaQuery(WorkOrderProductionPlan.class).in(WorkOrderProductionPlan::getBillNo, billNos)); return true; }