|
|
|
@ -83,6 +83,63 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
|
|
|
|
|
return sfcData;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public SfcDto getGoodSfcData(String sfc) {
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
String handle = HandleEnum.SFC.getHandle(site, sfc);
|
|
|
|
|
//根据sfc找工单等信息
|
|
|
|
|
SfcDto sfcData = splitSfcMapper.getSfcData(handle);
|
|
|
|
|
if (sfcData==null){
|
|
|
|
|
throw new BaseException("未找到产品条码信息");
|
|
|
|
|
}
|
|
|
|
|
if (!sfcData.getStatus().equals("401")&&!sfcData.getStatus().equals("402")){
|
|
|
|
|
throw new BaseException("产品状态不可拆分");
|
|
|
|
|
}
|
|
|
|
|
if (sfcData.getQty()==1){
|
|
|
|
|
throw new BaseException("数量为1不可拆分");
|
|
|
|
|
}
|
|
|
|
|
return sfcData;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public SplitSfc goodSfcSplit(SfcDto sfcDto){
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
String sfc = sfcDto.getSfc();
|
|
|
|
|
BigDecimal splitQty = new BigDecimal(sfcDto.getQty());
|
|
|
|
|
|
|
|
|
|
//根据sfc找工单等信息
|
|
|
|
|
SfcDto sfcData =getGoodSfcData(sfc);
|
|
|
|
|
|
|
|
|
|
SplitSfcRequest splitSfcRequest=new SplitSfcRequest();
|
|
|
|
|
try {
|
|
|
|
|
SplitSerializeServiceInterface splitService = MEServices.create("com.sap.me.production", "SplitSerializeService",site);
|
|
|
|
|
//拆sfc
|
|
|
|
|
List<SplitSfcDetail> newList=new ArrayList<>();
|
|
|
|
|
SplitSfcDetail splitDetail=new SplitSfcDetail();
|
|
|
|
|
splitDetail.setQuantity(splitQty);
|
|
|
|
|
newList.add(splitDetail);
|
|
|
|
|
splitSfcRequest.setNewSfcList(newList);
|
|
|
|
|
splitSfcRequest.setSfcRef(HandleEnum.SFC.getHandle(site,sfc));
|
|
|
|
|
Collection<SplitSfcResponse> splitSfcResponses = splitService.splitSfc(splitSfcRequest);
|
|
|
|
|
SplitSfcResponse splitSfcResponse = splitSfcResponses.iterator().next();
|
|
|
|
|
String newSfcRef = splitSfcResponse.getNewSfcRef();
|
|
|
|
|
|
|
|
|
|
SplitSfc splitSfc=new SplitSfc();
|
|
|
|
|
String newSfc = StringUtil.trimHandle(newSfcRef);
|
|
|
|
|
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));
|
|
|
|
|
splitSfc.setSite(site);
|
|
|
|
|
splitSfc.setSfc(sfc);
|
|
|
|
|
splitSfc.setSplitSfc(newSfc);
|
|
|
|
|
splitSfc.setSplitQty(splitQty);
|
|
|
|
|
splitSfc.setCreateUser(CommonMethods.getUser());
|
|
|
|
|
splitSfc.setCreatedDateTime(LocalDateTime.now());
|
|
|
|
|
save(splitSfc);
|
|
|
|
|
String workCenterBo = shopOrderService.getById(HandleEnum.SHOP_ORDER.getHandle(site, sfcData.getShopOrder())).getPlannedWorkCenterBo();
|
|
|
|
|
return splitSfc;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
ExceptionUtil.throwException(e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public SplitSfc splitSfc(SfcDto sfcDto){
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
String sfc = sfcDto.getSfc();
|
|
|
|
|