|
|
|
@ -8,8 +8,10 @@ import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
|
|
|
|
|
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.model.WorkCenter;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.OperationService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterService;
|
|
|
|
|
import com.foreverwin.mesnac.production.dto.WorkShopTransferDto;
|
|
|
|
@ -20,6 +22,7 @@ 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;
|
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
|
import com.foreverwin.modular.core.util.FrontPage;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -50,6 +53,8 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
|
|
|
|
|
@Autowired
|
|
|
|
|
private OperationService operationService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WorkCenterMapper workCenterMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SfcCrossService sfcCrossService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SfcCrossMapper sfcCrossMapper;
|
|
|
|
@ -75,18 +80,17 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
|
|
|
|
|
//条码是否在工作中心下
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
String sfc = workShopTransfer.getSfc();
|
|
|
|
|
String workCenter = workShopTransfer.getWorkCenter();
|
|
|
|
|
if (StringUtil.isBlank(sfc)) {
|
|
|
|
|
throw new BaseException("产品条码不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String type = workShopTransfer.getType();
|
|
|
|
|
WorkShopTransferDto dto = workShopTransferMapper.getSfcData(site, sfc);
|
|
|
|
|
if (dto == null) {
|
|
|
|
|
throw new BaseException("未找到该产品条码");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtil.isBlank(dto.getWorkCenter()) || !dto.getWorkCenter().equals(workCenter)) {
|
|
|
|
|
throw new BaseException("产品条码不在所选车间");
|
|
|
|
|
}
|
|
|
|
|
String currentOperation = dto.getOperation();
|
|
|
|
|
String operationDesc = dto.getOperationDesc();
|
|
|
|
|
|
|
|
|
|
//查询上一工序
|
|
|
|
|
Router router = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
|
|
|
|
|
int seq = 0;
|
|
|
|
@ -97,11 +101,37 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
|
|
|
|
|
seq = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (seq != 0) {
|
|
|
|
|
StepOperation stepOperation = stepOperationList.get(seq - 1);
|
|
|
|
|
dto.setLastOperation(stepOperation.getOperation());
|
|
|
|
|
dto.setLastOperationDesc(stepOperation.getDescription());
|
|
|
|
|
String operation = "";
|
|
|
|
|
if (type.equals("IN")){
|
|
|
|
|
if (stepOperationList.size()!=seq+1){
|
|
|
|
|
StepOperation stepOperation = stepOperationList.get(seq + 1);
|
|
|
|
|
operation=stepOperation.getOperation();
|
|
|
|
|
dto.setOperation(operation);
|
|
|
|
|
dto.setOperationDesc(stepOperation.getDescription());
|
|
|
|
|
}
|
|
|
|
|
dto.setLastOperation(currentOperation);
|
|
|
|
|
dto.setLastOperationDesc(operationDesc);
|
|
|
|
|
}else {
|
|
|
|
|
//转出本工序
|
|
|
|
|
operation=dto.getOperation();
|
|
|
|
|
if (seq != 0) {
|
|
|
|
|
StepOperation stepOperation = stepOperationList.get(seq - 1);
|
|
|
|
|
dto.setLastOperation(stepOperation.getOperation());
|
|
|
|
|
dto.setLastOperationDesc(stepOperation.getDescription());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String workCenter;
|
|
|
|
|
if (StringUtil.notBlank(operation)&&operation.contains("_")) {
|
|
|
|
|
workCenter = operation.split("_")[0];
|
|
|
|
|
} else {
|
|
|
|
|
workCenter = operation;
|
|
|
|
|
}
|
|
|
|
|
WorkCenter workCenterModel = workCenterMapper.findWorkCenterDescriptionByWorkCenter(site, workCenter, LocaleContextHolder.getLocale().getLanguage());
|
|
|
|
|
if (workCenterModel == null) {
|
|
|
|
|
throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
|
|
|
|
|
}
|
|
|
|
|
dto.setWorkCenterDesc(workCenterModel.getDescription());
|
|
|
|
|
dto.setWorkCenter(workCenter);
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,6 +151,15 @@ public class WorkShopTransferServiceImpl extends ServiceImpl<WorkShopTransferMap
|
|
|
|
|
//更改派工单状态
|
|
|
|
|
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dto.getDispatchNo(), DispatchStatusEnum.START.getCode());
|
|
|
|
|
} else {
|
|
|
|
|
//查询是否有转出记录
|
|
|
|
|
QueryWrapper<WorkShopTransfer> queryWrapper=new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq(WorkShopTransfer.SFC,workShopTransfer.getSfc());
|
|
|
|
|
queryWrapper.eq(WorkShopTransfer.STEP_ID,dto.getStepId());
|
|
|
|
|
queryWrapper.eq(WorkShopTransfer.TYPE,"OUT");
|
|
|
|
|
List<WorkShopTransfer> list = list(queryWrapper);
|
|
|
|
|
if (list.isEmpty()){
|
|
|
|
|
throw BusinessException.build("没有转出记录");
|
|
|
|
|
}
|
|
|
|
|
//转入完成
|
|
|
|
|
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), dto.getResrce(), sfcBO, dto.getQty());
|
|
|
|
|
//更改派工单状态
|
|
|
|
|