diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java index f9a4ab44..fb1d44cb 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/SplitSfcServiceImpl.java @@ -3,6 +3,8 @@ 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.dto.SfcDispatchDto; +import com.foreverwin.mesnac.common.enums.DispatchStatusEnum; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.util.ExceptionUtil; @@ -18,7 +20,6 @@ import com.foreverwin.mesnac.production.dto.SplitSfcDto; import com.foreverwin.mesnac.production.mapper.SfcCrossMapper; import com.foreverwin.mesnac.production.mapper.SplitSfcMapper; import com.foreverwin.mesnac.production.model.SplitSfc; -import com.foreverwin.mesnac.production.model.StepOperation; import com.foreverwin.mesnac.production.service.SplitSfcService; import com.foreverwin.modular.core.exception.BaseException; import com.foreverwin.modular.core.meext.MEServices; @@ -182,6 +183,14 @@ public class SplitSfcServiceImpl extends ServiceImpl i if (sfcData==null){ throw new BaseException("未找到产品条码信息"); } + SfcDispatchDto sfcDispatchDto = new SfcDispatchDto(); + sfcDispatchDto.setSite(site); + sfcDispatchDto.setSfc(sfc); + sfcDispatchDto.setStepId(sfcData.getStepId()); + SfcDispatchDto sfcDispatchBySfc = sfcDispatchCommonService.findSfcDispatchBySfc(sfcDispatchDto); + if (sfcDispatchBySfc.equals(DispatchStatusEnum.CANCEL.getCode())){ + throw new BaseException("产品已取消派工"); + } //查询质量异常记录数量 处置工艺路线及不良代码 SplitSfcDto splitSfcDto=splitSfcMapper.getAbnormalQty(site,sfc,operation, abnormalNo); String routerBo = splitSfcDto.getRouterBo(); @@ -224,11 +233,10 @@ public class SplitSfcServiceImpl extends ServiceImpl i stepIdentifier.setStepId(sfcData.getStepId()); stepIdentifier.setOperationId(sfcData.getOperation()); productionContext.setStepIdentifier(stepIdentifier); - List resourceBySfc = sfcCrossMapper.getResourceBySfc(site, sfc); - if (resourceBySfc.isEmpty()){ - throw new BaseException("产品不在工作中"); + if (StringUtil.isBlank(sfcDispatchBySfc.getResrce())){ + throw new BaseException("未派工到设备"); } - productionContext.setResourceRef(resourceBySfc.get(0).getResourceBo()); + productionContext.setResourceRef(sfcDispatchBySfc.getResrce()); createNCRequest.setProdCtx(productionContext); createNCRequest.setNcCodeRef(HandleEnum.NC_CODE.getHandle(site,splitNcCode[0])); ncProductionService.createNC(createNCRequest);