|
@@ -4,6 +4,7 @@ import cn.hutool.extra.spring.SpringUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.github.rholder.retry.*;
|
|
@@ -14,6 +15,7 @@ import com.warewms.hailiang.MES.MesService;
|
|
|
import com.warewms.hailiang.config.DeviceMessageSocket;
|
|
|
import com.warewms.hailiang.domain.Device;
|
|
|
import com.warewms.hailiang.domain.DeviceLog;
|
|
|
+import com.warewms.hailiang.domain.RetroactiveNow;
|
|
|
import com.warewms.hailiang.enums.DaSanPanPlcEnum;
|
|
|
import com.warewms.hailiang.enums.DeviceNameEnum;
|
|
|
import com.warewms.hailiang.init.PlcConnectServiceRunner;
|
|
@@ -55,6 +57,9 @@ public class MesServiceImpl implements MesService {
|
|
|
@Value("${MES.sanPanGetBatchNoUrl}")
|
|
|
private String sanPanGetBatchNoUrl;
|
|
|
|
|
|
+ @Value("${MES.tuiHuoShangLiaoUrl}")
|
|
|
+ private String tuiHuoShangLiaoUrl;
|
|
|
+
|
|
|
@Autowired
|
|
|
private DeviceMessageSocket deviceMessageSocket;
|
|
|
|
|
@@ -151,6 +156,26 @@ public class MesServiceImpl implements MesService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String tuiHuoShangLiao(RetroactiveNow retroactiveNow) {
|
|
|
+ JSONObject entries = new JSONObject();
|
|
|
+ JSONArray matDatas = new JSONArray();
|
|
|
+ entries.set("matDatas",matDatas);
|
|
|
+ entries.set("unit_code",retroactiveNow.getUniuCode());
|
|
|
+ JSONObject matDate = new JSONObject();
|
|
|
+ matDate.set("mat_no",retroactiveNow.getBatchNo());
|
|
|
+ matDate.set("stand_no",retroactiveNow.getShelfNumber());
|
|
|
+ matDate.set("stand_position",retroactiveNow.getNumberOfLayers());
|
|
|
+ matDate.set("loaction",retroactiveNow.getLotAddress());
|
|
|
+ matDate.set("layerno",retroactiveNow.getLayerno());
|
|
|
+ String body = HttpRequest.post( MESAddress+ tuiHuoShangLiaoUrl).body(entries.toString()).execute().body();
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
+ if ("0".equals(jsonObject.get("res_flag").toString())) {
|
|
|
+ retryTofeedback(MESAddress + tuiHuoShangLiaoUrl, entries, "tuiHuoUP");
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* MES反馈重试
|
|
|
* @param URl
|
|
@@ -185,12 +210,19 @@ public class MesServiceImpl implements MesService {
|
|
|
}
|
|
|
}
|
|
|
if ("sanpan".equals(type)){
|
|
|
- if ("false".equals(jsonObject.get("ret").toString())) {
|
|
|
+ if ("0".equals(jsonObject.get("RES_FLAG").toString())) {
|
|
|
log.error("散盘托盘号反馈MES失败,msg:{}", jsonObject.get("message"));
|
|
|
invokeAlarms("大散盘", "获取批次号失败!"+ jsonObject.get("message"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+ if ("tuiHuoUP".equals(type)) {
|
|
|
+ if ("0".equals(jsonObject.get("res_flag").toString())) {
|
|
|
+ log.error("退火上料料架信息反馈失败,msg:{}", jsonObject.get("message"));
|
|
|
+ invokeAlarms("退货上料工序", "工序读码成功反馈MES失败!"+ jsonObject.get("message"));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
});
|
|
|
} catch (RetryException | ExecutionException e) {
|