diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/SplitSfcController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/SplitSfcController.java index d63abafb..cd01bbea 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/SplitSfcController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/SplitSfcController.java @@ -32,6 +32,21 @@ public class SplitSfcController { return R.ok(result); } + @ResponseBody + @GetMapping("/getGoodSfcData") + public R getGoodSfcData(String sfc){ + SfcDto result; + result = splitSfcService.getGoodSfcData(sfc); + return R.ok(result); + } + + + @ResponseBody + @GetMapping("/goodSfcSplit") + public R goodSfcSplit(SfcDto sfcDto){ + return R.ok(splitSfcService.goodSfcSplit(sfcDto)); + } + @ResponseBody @GetMapping("/splitSfc") public R getSfcData(SfcDto sfcDto){ diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/SplitSfcService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/SplitSfcService.java index 4e8e4c27..7a7e9309 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/SplitSfcService.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/SplitSfcService.java @@ -29,5 +29,9 @@ public interface SplitSfcService extends IService { SfcDto getSfcData(String sfc); + SfcDto getGoodSfcData(String sfc); + + SplitSfc goodSfcSplit(SfcDto sfcDto); + SplitSfc splitSfc(SfcDto sfcDto); } \ No newline at end of file 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 54b6ccee..a7d5f1f1 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 @@ -83,6 +83,63 @@ public class SplitSfcServiceImpl extends ServiceImpl 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 newList=new ArrayList<>(); + SplitSfcDetail splitDetail=new SplitSfcDetail(); + splitDetail.setQuantity(splitQty); + newList.add(splitDetail); + splitSfcRequest.setNewSfcList(newList); + splitSfcRequest.setSfcRef(HandleEnum.SFC.getHandle(site,sfc)); + Collection 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(); diff --git a/production/src/main/resources/mapper/SplitSfcMapper.xml b/production/src/main/resources/mapper/SplitSfcMapper.xml index 10a68aa5..66587280 100644 --- a/production/src/main/resources/mapper/SplitSfcMapper.xml +++ b/production/src/main/resources/mapper/SplitSfcMapper.xml @@ -367,8 +367,9 @@