diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java index ac7a6aa3..2dbcb9cf 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/InspectionTaskService.java @@ -34,4 +34,6 @@ public interface InspectionTaskService extends IService { Map createTask(Map paramMap); InspectionTask isCreateTask(String site, String category, String sfc, String operation, String stepId); + + void createCompleteTask(Map paramMap); } \ No newline at end of file diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java index 38c71ce0..a5cb53f9 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/InspectionTaskServiceImpl.java @@ -260,5 +260,48 @@ public class InspectionTaskServiceImpl extends ServiceImpl paramMap) { + String site = CommonMethods.getSite(); + String category = (String) paramMap.get("CATEGORY"); + String sfc = (String) paramMap.get("SFC"); + String shopOrder = (String) paramMap.get("SHOP_ORDER"); + String operation = (String) paramMap.get("OPERATION"); + String stepId = (String) paramMap.get("STEP_ID"); + String itemNumber = (String) paramMap.get("ITEM_NUMBER"); + + String handle = "InspectionTaskBO:" + site + "," + UUID.randomUUID().toString(); + Date date = new Date(System.currentTimeMillis()); + SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss"); + String taskNo = ""; + if (StringUtil.isBlank(itemNumber)) { + taskNo = "P_" + dateFormat1.format(date); + } else { + taskNo = "P_" + itemNumber + "_" + dateFormat1.format(date); + } + InspectionTask task = new InspectionTask(); + task.setHandle(handle); + task.setSite(site); + task.setCategory(category); + task.setTaskNo(taskNo); + task.setStatus(Constants.INSPECTION_TASK_STATUS_COMPLETE); + task.setResrce(Constants.RSESULT_OK); + task.setDescription("专检检验任务"); + task.setInspectionItemBo( null); + task.setShopOrder(shopOrder); + task.setWorkCenter((String) paramMap.get("WORK_CENTER")); + task.setSfc(sfc); + task.setOperation(operation); + task.setStepId(stepId); + task.setResrce((String) paramMap.get("RESRCE")); + task.setCreateUser(CommonMethods.getUser()); + task.setCreatedDateTime(LocalDateTime.now()); + task.setModifyUser(CommonMethods.getUser()); + task.setModifiedDateTime(LocalDateTime.now()); + task.setSfcDispatchBo((String) paramMap.get("SFC_DISPATCH_DETAIL_BO")); + task.setSfc(sfc); + save(task); + } + } \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java index 3afe0f08..8a6db676 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/PodTemplateServiceImpl.java @@ -219,6 +219,16 @@ public class PodTemplateServiceImpl implements PodTemplateService { throw new BaseException("互检任务不合格,不能开始请检查"); } } + //是否完成专检 + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq(InspectionTask.CATEGORY,Constants.INSPECTION_TYPE_P); + queryWrapper.eq(InspectionTask.SFC,sfc); + queryWrapper.ne(InspectionTask.STATUS,Constants.INSPECTION_TASK_STATUS_COMPLETE); + queryWrapper.ne(InspectionTask.RESULT,Constants.RSESULT_OK); + List list = inspectionTaskService.list(queryWrapper); + if (!list.isEmpty()) { + throw new BaseException("请完成专检检验任务"); + } try { sfcCrossService.startAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty); } catch (Exception e) { @@ -294,6 +304,9 @@ public class PodTemplateServiceImpl implements PodTemplateService { if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) { paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P); inspectionTaskService.createTask(paramMap); + }else { + paramMap.put("CATEGORY",Constants.INSPECTION_TYPE_P); + inspectionTaskService.createCompleteTask(paramMap); } //首件创建 inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc,operation, stepId, Constants.INSPECTION_TYPE_S);