良品拆分

master
philip 4 years ago
parent dc4b176938
commit 12f3e7b257

@ -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){

@ -29,5 +29,9 @@ public interface SplitSfcService extends IService<SplitSfc> {
SfcDto getSfcData(String sfc);
SfcDto getGoodSfcData(String sfc);
SplitSfc goodSfcSplit(SfcDto sfcDto);
SplitSfc splitSfc(SfcDto sfcDto);
}

@ -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();

@ -367,8 +367,9 @@
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="getSfcData" resultType="com.foreverwin.mesnac.meapi.dto.SfcDto">
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.qty FROM SFC S
SELECT SO.SHOP_ORDER,cf.VALUE WORK_ORDER,OP.OPERATION,ss.STEP_ID,s.QTY,ST.STATUS FROM SFC S
JOIN SHOP_ORDER SO ON so.HANDLE=S.SHOP_ORDER_BO
JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO
LEFT JOIN CUSTOM_FIELDS CF ON cf.HANDLE=s.SHOP_ORDER_BO AND CF."ATTRIBUTE"='WORK_ORDER'
JOIN SFC_ROUTING SR ON s.HANDLE=sr.SFC_BO
JOIN SFC_ROUTER SR2 ON SR.HANDLE =SR2.SFC_ROUTING_BO AND SR2.IN_USE = 'true'

Loading…
Cancel
Save