|
|
@ -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);
|
|
|
|