|
|
|
@ -7,10 +7,14 @@ 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.dto.RouterStepDto;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.dto.SfcDto;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.Router;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.WorkCenter;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterStepService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.ShopOrderService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
|
|
|
|
|
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
|
|
|
|
|
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
|
|
|
|
|
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
|
|
|
|
@ -18,6 +22,7 @@ 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.exception.BusinessException;
|
|
|
|
|
import com.foreverwin.modular.core.meext.MEServices;
|
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
|
import com.foreverwin.modular.core.util.FrontPage;
|
|
|
|
@ -53,10 +58,14 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
|
|
|
|
|
@Autowired
|
|
|
|
|
private SfcDispatchCommonService sfcDispatchCommonService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WorkCenterService workCenterService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopOrderService shopOrderService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RouterService routerService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RouterStepService routerStepService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SfcCrossMapper sfcCrossMapper;
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<SplitSfc> selectPage(FrontPage<SplitSfc> frontPage, SplitSfc splitSfc) {
|
|
|
|
@ -122,7 +131,10 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
|
|
|
|
|
|
|
|
|
|
//根据sfc找工单等信息
|
|
|
|
|
SfcDto sfcData =getGoodSfcData(sfc);
|
|
|
|
|
|
|
|
|
|
if (sfcData==null){
|
|
|
|
|
throw new BaseException("未找到产品条码信息");
|
|
|
|
|
}
|
|
|
|
|
String operation = sfcData.getOperation();
|
|
|
|
|
SplitSfcRequest splitSfcRequest=new SplitSfcRequest();
|
|
|
|
|
try {
|
|
|
|
|
SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",site);
|
|
|
|
@ -147,9 +159,19 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
|
|
|
|
|
splitSfc.setCreateUser(CommonMethods.getUser());
|
|
|
|
|
splitSfc.setCreatedDateTime(LocalDateTime.now());
|
|
|
|
|
save(splitSfc);
|
|
|
|
|
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
|
|
|
|
|
String workCenter = null;
|
|
|
|
|
if (operation.contains("_")) {
|
|
|
|
|
workCenter = operation.split("_")[0];
|
|
|
|
|
} else {
|
|
|
|
|
workCenter = operation;
|
|
|
|
|
}
|
|
|
|
|
String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
|
|
|
|
|
WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
|
|
|
|
|
if (workCenterModel == null) {
|
|
|
|
|
throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
|
|
|
|
|
}
|
|
|
|
|
Router routerBySfcBo = routerService.getRouterBySfcBo(HandleEnum.SFC.getHandle(site, sfc));
|
|
|
|
|
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle());
|
|
|
|
|
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),routerBySfcBo.getHandle());
|
|
|
|
|
return splitSfc;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionUtil.throwException(e);
|
|
|
|
@ -235,8 +257,23 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
|
|
|
|
|
dispositionSfcsRequest.setDispositionSelection(dispositionSelection);
|
|
|
|
|
dispositionSfcsRequest.setProdCtx(new ProductionContext());
|
|
|
|
|
ncProductionService.dispositionMultipleSfcs(dispositionSfcsRequest);
|
|
|
|
|
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
|
|
|
|
|
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),StringUtil.trimHandle(workCenterBo),newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle());
|
|
|
|
|
String workCenter;
|
|
|
|
|
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, routerBo);
|
|
|
|
|
if (routerOperationByRouterBo.isEmpty()){
|
|
|
|
|
throw new BaseException("处置工艺路线没有步骤");
|
|
|
|
|
}
|
|
|
|
|
String routerOperation = routerOperationByRouterBo.get(0).getOperation();
|
|
|
|
|
if (routerOperation.contains("_")) {
|
|
|
|
|
workCenter = routerOperation.split("_")[0];
|
|
|
|
|
} else {
|
|
|
|
|
workCenter = routerOperation;
|
|
|
|
|
}
|
|
|
|
|
String workCenterBo = HandleEnum.WORK_CENTER.getHandle(site, workCenter);
|
|
|
|
|
WorkCenter workCenterModel = workCenterService.getById(workCenterBo);
|
|
|
|
|
if (workCenterModel == null) {
|
|
|
|
|
throw BusinessException.build("生产车间【" +workCenter+ "】不存在");
|
|
|
|
|
}
|
|
|
|
|
sfcDispatchCommonService.saveSfcDispatch(site,CommonMethods.getUser(),workCenter,newSfc, sfcData.getShopOrder(),maxRevisionRouter.getHandle());
|
|
|
|
|
}
|
|
|
|
|
SplitSfc splitSfc=new SplitSfc();
|
|
|
|
|
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));
|
|
|
|
|