From 6d008da326e502b28b8a326f333b09f709185af5 Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Tue, 14 Sep 2021 16:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E9=97=B4=E8=BD=AC=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E4=B8=93=E6=A3=80=E6=98=AF=E5=90=A6=E5=B7=B2?= =?UTF-8?q?=E5=90=88=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../production/dto/WorkShopTransferDto.java | 8 +++++ .../impl/WorkShopTransferServiceImpl.java | 35 +++++++++++++++---- .../mapper/WorkShopTransferMapper.xml | 2 +- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/production/src/main/java/com/foreverwin/mesnac/production/dto/WorkShopTransferDto.java b/production/src/main/java/com/foreverwin/mesnac/production/dto/WorkShopTransferDto.java index 9fd6287b..83b3d918 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/dto/WorkShopTransferDto.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/dto/WorkShopTransferDto.java @@ -15,7 +15,15 @@ public class WorkShopTransferDto extends WorkShopTransfer { private String resrce; private String workCenterDesc; private String employeeDescription; + private String lastStepId; + public String getLastStepId() { + return lastStepId; + } + + public void setLastStepId(String lastStepId) { + this.lastStepId = lastStepId; + } public String getEmployeeDescription() { return employeeDescription; diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java index 7351bd4d..4b759387 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/WorkShopTransferServiceImpl.java @@ -1,15 +1,19 @@ package com.foreverwin.mesnac.production.service.impl; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.model.InspectionTask; +import com.foreverwin.mesnac.common.service.InspectionTaskService; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.util.DateUtil; import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; -import com.foreverwin.mesnac.meapi.mapper.WorkCenterMapper; import com.foreverwin.mesnac.meapi.model.Operation; import com.foreverwin.mesnac.meapi.model.Router; +import com.foreverwin.mesnac.meapi.service.CustomFieldsService; import com.foreverwin.mesnac.meapi.service.OperationService; import com.foreverwin.mesnac.meapi.service.RouterService; import com.foreverwin.mesnac.production.dto.WorkShopTransferDto; @@ -17,7 +21,6 @@ import com.foreverwin.mesnac.production.mapper.SfcCrossMapper; import com.foreverwin.mesnac.production.mapper.WorkShopTransferMapper; import com.foreverwin.mesnac.production.model.StepOperation; import com.foreverwin.mesnac.production.model.WorkShopTransfer; -import com.foreverwin.mesnac.production.service.SfcCrossService; import com.foreverwin.mesnac.production.service.WorkShopTransferService; import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.exception.BusinessException; @@ -50,11 +53,11 @@ public class WorkShopTransferServiceImpl extends ServiceImpl workShopTransfers = list(queryWrapper); if (!workShopTransfers.isEmpty()) { - throw BusinessException.build("产品已转出"); + throw BusinessException.build("产品"+sfc+"已转出"); } + //检查是否检验合格 + Operation currentRevisionRef = operationService.getCurrentRevisionRef(site, transferDto.getLastOperation()); + String special = customFieldsService.getCustomFieldsValue(currentRevisionRef.getHandle(), "SPECIAL"); + + if(StringUtil.isBlank(special) || !special.equals("N")){ + String lastStepId = transferDto.getLastStepId(); + QueryWrapper taskQueryWrapper=new QueryWrapper<>(); + taskQueryWrapper.eq(InspectionTask.SFC,sfc); + taskQueryWrapper.eq(InspectionTask.STEP_ID,lastStepId); + taskQueryWrapper.orderByDesc(InspectionTask.CREATED_DATE_TIME); + List inspectionTaskList = inspectionTaskService.list(taskQueryWrapper); + if(!inspectionTaskList.isEmpty()){ + String status = inspectionTaskList.get(0).getStatus(); + String result = inspectionTaskList.get(0).getResult(); + if(!status.equals(Constants.INSPECTION_TASK_STATUS_COMPLETE) ||StringUtil.isBlank(result)||!result.equals(Constants.RSESULT_OK)){ + throw BusinessException.build("产品"+sfc+"专检任务未完成或不合格"); + } + } + } + transferLog.setSfcDispatchBo(dto.getSfcDispatchBo()); transferLog.setSite(site); transferLog.setTransferNo(taskNo); diff --git a/production/src/main/resources/mapper/WorkShopTransferMapper.xml b/production/src/main/resources/mapper/WorkShopTransferMapper.xml index 3dbc2880..8aa2a3ed 100644 --- a/production/src/main/resources/mapper/WorkShopTransferMapper.xml +++ b/production/src/main/resources/mapper/WorkShopTransferMapper.xml @@ -631,7 +631,7 @@