Commit 364c5e00 zshaohui

增加获取mes数量接口

1 个父辈 1523e274
......@@ -194,21 +194,21 @@ public class LizhenApi extends DefaultSmfApiListener {
if (barcodeInfoUrl == null) {
return null;
}
log.info("获取MES物料数量入参为:" + barcode.getBarcode());
log.info(barcode.getBarcode()+"获取MES物料数量入参为:" + barcode.getBarcode()+"地址为:"+barcodeInfoUrl);
String result = "";
try {
result = HttpHelper.postJson(barcodeInfoUrl, barcode.getBarcode());
} catch (ApiException e) {
e.printStackTrace();
}
log.info("获取MES物料数量出参为:" + result);
log.info(barcode.getBarcode()+"获取MES物料数量出参为:" + result);
JSONObject resultJson = JsonUtil.toObj(result, JSONObject.class);
Integer status = resultJson.getInteger("status");
if (status != null) {
if (status == 200) {
JSONObject dataJson = resultJson.getJSONObject("data");
String reelID = dataJson.get("reelID") == null ? "" : dataJson.get("reelID").toString();
//String partNum = dataJson.get("partNum") == null ? "" : dataJson.get("partNum").toString();
String partNum = dataJson.get("partNum") == null ? "" : dataJson.get("partNum").toString();
String partSpec = dataJson.get("partSpec") == null ? "" : dataJson.get("partSpec").toString();
int qty = dataJson.get("qty") == null ? 0 : Integer.valueOf(dataJson.get("qty").toString());
//String vendor = dataJson.get("vendor") == null ? "" : dataJson.get("vendor").toString();
......@@ -220,10 +220,14 @@ public class LizhenApi extends DefaultSmfApiListener {
}
if (StringUtils.isNotBlank(reelID)){
barcode.setBarcode(reelID);
}
if (StringUtils.isNotBlank(partNum)){
barcode.setPartNumber(partNum);
}*/
if (StringUtils.isNotBlank(partNum)){
if(!partNum.equals(barcode.getPartNumber())){
throw new ValidateException("smfcore.mesApi.inCheck.ng", reelID + "对应的料号为:"+barcode.getPartNumber()+"与mes返回的料号:"+partNum
+"不一致,请检查物料的唯一码是否重复");
}
//barcode.setPartNumber(partNum);
}
if (StringUtils.isNotBlank(reelID)) {
if (qty == 0) {
throw new ValidateException("smfcore.mesApi.inCheck.ng", reelID + "mes数量返回为0,不允许进行入库");
......
......@@ -194,8 +194,8 @@ public class LizhenController {
@AnonymousAccess
public ResultBean machineCallMaterial(@RequestBody Map<String, String> data) {
boolean startJob = dataCache.getCache(Constants.CACHE_StartJob);
if (!startJob){
return ResultBean.newErrorResult(-1,"","定时任务未开启");
if (!startJob) {
return ResultBean.newErrorResult(-1, "", "定时任务未开启");
}
log.info("Mes缺料预警---" + JSONObject.toJSONString(data));
PreWarningItem item = new PreWarningItem();
......@@ -215,6 +215,42 @@ public class LizhenController {
}
/**
* 机器人转发缺料预警信息
*
* @param paramList
* @return
*/
@PostMapping("/robotMachineCallMaterial")
@AnonymousAccess
public synchronized ResultBean robotMachineCallMaterial(@RequestBody List<Map<String, String>> paramList) {
boolean startJob = dataCache.getCache(Constants.CACHE_StartJob);
if (!startJob) {
return ResultBean.newErrorResult(-1, "", "定时任务未开启");
}
log.info("收到机器人缺料预警---" + JSONObject.toJSONString(paramList));
List<PreWarningItem> warningItemList = new ArrayList<>();
for (Map<String, String> data : paramList) {
PreWarningItem item = new PreWarningItem();
item.setMachinename(data.get("MACHINENAME"));
item.setStation(data.get("STATION"));
item.setSide(data.get("SIDE"));
item.setSlot(data.get("SLOT"));
item.setSubslot(data.get("SUBSLOT"));
item.setPartnumber(data.get("PARTNUMBER"));
item.setLine(data.get("LINE"));
item.setItemId(data.get("ID"));
item.setPriority(Integer.valueOf(data.get("PRIORITY")));
item.setReel(data.get("REEL"));
item.setBrand(data.get("VENDOR"));
warningItemList.add(item);
}
//PreWarningItemCache.addItems(Arrays.asList(item));
return ResultBean.newOkResult("");
}
private String getForwardUrl(String line) {
String url = "";
for (Map.Entry<String, String> lineUrlEntry : lineUrlMap.entrySet()) {
......
......@@ -9,7 +9,7 @@ api:
outNotifyUrlPK:
inNotifyUrl: 1
fetchOrderUrl:
barcodeInfoUrl:
barcodeInfoUrl: http://10.68.25.42:8001/Sct/GetReelInfo
fetchGRUrl:
brandQtyUrl:
importUrl: http://10.68.27.83/smf-core/ext/getDatalogs #虚拟仓从1F导入数据接口
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!