天眼增加判断上次请求是否满足条件,如果与上次同步时间戳不同且点位状态相同,视为稳定状态

This commit is contained in:
psh
2024-06-27 15:44:48 +08:00
parent c41db16f77
commit ef163770e9

View File

@@ -38,6 +38,8 @@ public class SyncPoint {
@Autowired @Autowired
private IPdmBdProductionProcessTrackingService processTrackingService; private IPdmBdProductionProcessTrackingService processTrackingService;
private JSONArray last_jsonArray = new JSONArray();
public void run() throws Exception { public void run() throws Exception {
try { try {
@@ -55,6 +57,12 @@ public class SyncPoint {
JSONArray jsonArray = JSONObject.parseObject(result.body()).getJSONArray("data"); JSONArray jsonArray = JSONObject.parseObject(result.body()).getJSONArray("data");
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i); JSONObject jsonObject = jsonArray.getJSONObject(i);
for (int j = 0; j < last_jsonArray.size(); j++) {
JSONObject last_jsonObject = last_jsonArray.getJSONObject(j);
//如果与上次同步时间戳不同且点位状态相同,视为稳定状态
if(ObjectUtil.equals(jsonObject.getString("binNo"),last_jsonObject.getString("binNo"))&&
!ObjectUtil.equals(jsonObject.getString("timestamp"),last_jsonObject.getString("timestamp"))&&
ObjectUtil.equals(jsonObject.getString("pred"),last_jsonObject.getString("pred"))) {
for (SchBasePoint temp : schBasePointList) { for (SchBasePoint temp : schBasePointList) {
if (temp.getPoint_code().equals(jsonObject.getString("binNo"))) { if (temp.getPoint_code().equals(jsonObject.getString("binNo"))) {
if (jsonObject.getInteger("pred") == 0 && "2".equals(temp.getPoint_status()) if (jsonObject.getInteger("pred") == 0 && "2".equals(temp.getPoint_status())
@@ -86,8 +94,11 @@ public class SyncPoint {
} }
} }
} }
}
}
} }
last_jsonArray = jsonArray;
} catch (Exception e) { } catch (Exception e) {
log.error("自动线程查询天眼点位失败{}{}", e, e.getMessage()); log.error("自动线程查询天眼点位失败{}{}", e, e.getMessage());
} }