车间转出时校验专检是否已合格

master
philip 3 years ago
parent c491ef775f
commit 6d008da326

@ -15,7 +15,15 @@ public class WorkShopTransferDto extends WorkShopTransfer {
private String resrce; private String resrce;
private String workCenterDesc; private String workCenterDesc;
private String employeeDescription; private String employeeDescription;
private String lastStepId;
public String getLastStepId() {
return lastStepId;
}
public void setLastStepId(String lastStepId) {
this.lastStepId = lastStepId;
}
public String getEmployeeDescription() { public String getEmployeeDescription() {
return employeeDescription; return employeeDescription;

@ -1,15 +1,19 @@
package com.foreverwin.mesnac.production.service.impl; package com.foreverwin.mesnac.production.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.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.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.DateUtil; import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil; 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.Operation;
import com.foreverwin.mesnac.meapi.model.Router; 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.OperationService;
import com.foreverwin.mesnac.meapi.service.RouterService; import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.production.dto.WorkShopTransferDto; 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.mapper.WorkShopTransferMapper;
import com.foreverwin.mesnac.production.model.StepOperation; import com.foreverwin.mesnac.production.model.StepOperation;
import com.foreverwin.mesnac.production.model.WorkShopTransfer; import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.mesnac.production.service.WorkShopTransferService; import com.foreverwin.mesnac.production.service.WorkShopTransferService;
import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.exception.BusinessException;
@ -50,11 +53,11 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
@Autowired @Autowired
private WorkShopTransferMapper workShopTransferMapper; private WorkShopTransferMapper workShopTransferMapper;
@Autowired @Autowired
private OperationService operationService; private InspectionTaskService inspectionTaskService;
@Autowired @Autowired
private WorkCenterMapper workCenterMapper; private CustomFieldsService customFieldsService;
@Autowired @Autowired
private SfcCrossService sfcCrossService; private OperationService operationService;
@Autowired @Autowired
private SfcCrossMapper sfcCrossMapper; private SfcCrossMapper sfcCrossMapper;
@Autowired @Autowired
@ -162,8 +165,28 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
queryWrapper.eq(WorkShopTransfer.SFC_DISPATCH_BO, dto.getSfcDispatchBo()); queryWrapper.eq(WorkShopTransfer.SFC_DISPATCH_BO, dto.getSfcDispatchBo());
List<WorkShopTransfer> workShopTransfers = list(queryWrapper); List<WorkShopTransfer> workShopTransfers = list(queryWrapper);
if (!workShopTransfers.isEmpty()) { 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<InspectionTask> taskQueryWrapper=new QueryWrapper<>();
taskQueryWrapper.eq(InspectionTask.SFC,sfc);
taskQueryWrapper.eq(InspectionTask.STEP_ID,lastStepId);
taskQueryWrapper.orderByDesc(InspectionTask.CREATED_DATE_TIME);
List<InspectionTask> 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.setSfcDispatchBo(dto.getSfcDispatchBo());
transferLog.setSite(site); transferLog.setSite(site);
transferLog.setTransferNo(taskNo); transferLog.setTransferNo(taskNo);

@ -631,7 +631,7 @@
</delete> </delete>
<!-- BaseMapper标准查询/修改/删除 --> <!-- BaseMapper标准查询/修改/删除 -->
<select id="getOutList" resultType="com.foreverwin.mesnac.production.dto.WorkShopTransferDto"> <select id="getOutList" resultType="com.foreverwin.mesnac.production.dto.WorkShopTransferDto">
SELECT zsd.handle SFC_DISPATCH_BO,zsd.sfc, PREZSD.OPERATION LAST_OPERATION,PREZSD.WORK_CENTER TRANSFER_WORK_CENTER,zsd.WORK_CENTER,WCT.DESCRIPTION WORK_CENTER_DESC,zsd.SHOP_ORDER,c1.VALUE WORK_ORDER,IT.DESCRIPTION ITEM_DESC,ZSD.BLANKING_SIZE,SFC.QTY,PREOT.DESCRIPTION LAST_OPERATION_DESC,PREZSD.EMPLOYEE_DESCRIPTION,OT.DESCRIPTION OPERATION_DESC, SELECT zsd.handle SFC_DISPATCH_BO,zsd.sfc, PREZSD.OPERATION LAST_OPERATION,PREZSD.STEP_ID LAST_STEP_ID,PREZSD.WORK_CENTER TRANSFER_WORK_CENTER,zsd.WORK_CENTER,WCT.DESCRIPTION WORK_CENTER_DESC,zsd.SHOP_ORDER,c1.VALUE WORK_ORDER,IT.DESCRIPTION ITEM_DESC,ZSD.BLANKING_SIZE,SFC.QTY,PREOT.DESCRIPTION LAST_OPERATION_DESC,PREZSD.EMPLOYEE_DESCRIPTION,OT.DESCRIPTION OPERATION_DESC,
CASE WHEN ZWST.IS_IN='Y' THEN '已接收' WHEN ZWST.IS_OUT='Y' THEN '转序中' ELSE '待转出' END STATUS CASE WHEN ZWST.IS_IN='Y' THEN '已接收' WHEN ZWST.IS_OUT='Y' THEN '转序中' ELSE '待转出' END STATUS
FROM Z_SFC_DISPATCH zsd FROM Z_SFC_DISPATCH zsd
JOIN sfc sfc ON sfc.sfc=zsd.sfc AND zsd.site=sfc.site JOIN sfc sfc ON sfc.sfc=zsd.sfc AND zsd.site=sfc.site

Loading…
Cancel
Save