天眼增加判断上次请求是否满足条件,如果与上次同步时间戳不同且点位状态相同,视为稳定状态
This commit is contained in:
@@ -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,39 +57,48 @@ 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 (SchBasePoint temp : schBasePointList) {
|
for (int j = 0; j < last_jsonArray.size(); j++) {
|
||||||
if (temp.getPoint_code().equals(jsonObject.getString("binNo"))) {
|
JSONObject last_jsonObject = last_jsonArray.getJSONObject(j);
|
||||||
if (jsonObject.getInteger("pred") == 0 && "2".equals(temp.getPoint_status())
|
//如果与上次同步时间戳不同且点位状态相同,视为稳定状态
|
||||||
|| jsonObject.getInteger("pred") == 1 && "1".equals(temp.getPoint_status())) {
|
if(ObjectUtil.equals(jsonObject.getString("binNo"),last_jsonObject.getString("binNo"))&&
|
||||||
log.info("检测到点位{}当前库存有变动pred={},更新lms库存", jsonObject.getString("binNo"), jsonObject.getInteger("pred"));
|
!ObjectUtil.equals(jsonObject.getString("timestamp"),last_jsonObject.getString("timestamp"))&&
|
||||||
temp.setPoint_status(String.valueOf(jsonObject.getInteger("pred") + 1));
|
ObjectUtil.equals(jsonObject.getString("pred"),last_jsonObject.getString("pred"))) {
|
||||||
temp.setVehicle_type("");
|
for (SchBasePoint temp : schBasePointList) {
|
||||||
temp.setVehicle_code("");
|
if (temp.getPoint_code().equals(jsonObject.getString("binNo"))) {
|
||||||
temp.setIng_task_code("");
|
if (jsonObject.getInteger("pred") == 0 && "2".equals(temp.getPoint_status())
|
||||||
temp.setVehicle_qty(0);
|
|| jsonObject.getInteger("pred") == 1 && "1".equals(temp.getPoint_status())) {
|
||||||
temp.setUpdate_time(DateUtil.now());
|
log.info("检测到点位{}当前库存有变动pred={},更新lms库存", jsonObject.getString("binNo"), jsonObject.getInteger("pred"));
|
||||||
schBasePointService.update(temp);
|
temp.setPoint_status(String.valueOf(jsonObject.getInteger("pred") + 1));
|
||||||
SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getVehicleGroupInfo(
|
temp.setVehicle_type("");
|
||||||
temp.getVehicle_code(),
|
temp.setVehicle_code("");
|
||||||
temp.getVehicle_type(),
|
temp.setIng_task_code("");
|
||||||
GroupBindMaterialStatusEnum.BOUND.getValue());
|
temp.setVehicle_qty(0);
|
||||||
// 插入生产过程跟踪表
|
temp.setUpdate_time(DateUtil.now());
|
||||||
PdmBdProductionProcessTracking processTracking = new PdmBdProductionProcessTracking();
|
schBasePointService.update(temp);
|
||||||
if (ObjectUtil.isNotEmpty(groupInfo)) {
|
SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getVehicleGroupInfo(
|
||||||
groupInfo.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
|
temp.getVehicle_code(),
|
||||||
vehiclematerialgroupService.update(groupInfo);
|
temp.getVehicle_type(),
|
||||||
processTracking.setBuss_move_id(groupInfo.getBuss_move_id());
|
GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||||
|
// 插入生产过程跟踪表
|
||||||
|
PdmBdProductionProcessTracking processTracking = new PdmBdProductionProcessTracking();
|
||||||
|
if (ObjectUtil.isNotEmpty(groupInfo)) {
|
||||||
|
groupInfo.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
|
||||||
|
vehiclematerialgroupService.update(groupInfo);
|
||||||
|
processTracking.setBuss_move_id(groupInfo.getBuss_move_id());
|
||||||
|
}
|
||||||
|
processTracking.setProcess_action("暂存区人工出库");
|
||||||
|
processTracking.setProcess_location(temp.getPoint_code());
|
||||||
|
processTracking.setRecord_time(DateUtil.now());
|
||||||
|
processTrackingService.create(processTracking);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
processTracking.setProcess_action("暂存区人工出库");
|
|
||||||
processTracking.setProcess_location(temp.getPoint_code());
|
|
||||||
processTracking.setRecord_time(DateUtil.now());
|
|
||||||
processTrackingService.create(processTracking);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
last_jsonArray = jsonArray;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("自动线程查询天眼点位失败{}{}", e, e.getMessage());
|
log.error("自动线程查询天眼点位失败{}{}", e, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user