|
|
@ -73,6 +73,90 @@ public class AMHandServiceImpl implements AMHandService { |
|
|
|
return jo; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject queryPoint() { |
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); |
|
|
|
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class); |
|
|
|
WQLObject wo_device = WQLObject.getWQLObject("acs_device"); |
|
|
|
WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint"); |
|
|
|
// 1.查询区域
|
|
|
|
JSONArray regionArr = WQL.getWO("QJN_QUERY001").addParam("flag", "1").process().getResultJSONArray(0); |
|
|
|
// 2.根据区域查询对应点位
|
|
|
|
JSONObject resultJson = new JSONObject(); |
|
|
|
for (int i = 0; i < regionArr.size(); i++) { |
|
|
|
JSONObject jsonRegion = regionArr.getJSONObject(i); |
|
|
|
String areaCode = jsonRegion.getString("region_code"); |
|
|
|
JSONArray deviceArrayByArea = wo_device.query("region = '" + areaCode + "' and is_delete = '0' and is_active = '1'", "seq_num").getResultJSONArray(0); |
|
|
|
JSONArray respArr = new JSONArray(); |
|
|
|
for (int j = 0; j < deviceArrayByArea.size(); j++) { |
|
|
|
JSONObject device = deviceArrayByArea.getJSONObject(j); |
|
|
|
String device_id = device.getString("device_id"); |
|
|
|
String device_code = device.getString("device_code"); |
|
|
|
String device_name = device.getString("device_name"); |
|
|
|
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; |
|
|
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; |
|
|
|
Device device_driver = deviceAppService.findDeviceByCode(device_code); |
|
|
|
//点位状态status对应status_name 0空 1有货 2有任务
|
|
|
|
String status = "0"; |
|
|
|
String status_name = "无货"; |
|
|
|
String input_material = "0"; |
|
|
|
String allow_update = "0"; |
|
|
|
String material_type = "0"; |
|
|
|
if (device_driver.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
JSONObject deviceRunPoint = wo_runPoint.query("device_id = '" + device_id + "'").uniqueResult(0); |
|
|
|
Integer hasgoods = deviceRunPoint.getInteger("hasgoods"); |
|
|
|
material_type = deviceRunPoint.getString("material_type"); |
|
|
|
TaskDto taskDto = taskService.findByStartAndNextCode(device_code); |
|
|
|
if (ObjectUtil.isNotEmpty(taskDto) && hasgoods == 1) { |
|
|
|
status = "2"; |
|
|
|
status_name = "有任务"; |
|
|
|
} else if (hasgoods == 1) { |
|
|
|
status = "1"; |
|
|
|
status_name = "有货"; |
|
|
|
} |
|
|
|
input_material = "1"; |
|
|
|
allow_update = "1"; |
|
|
|
} else if (device_driver.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { |
|
|
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device_driver.getDeviceDriver(); |
|
|
|
// int move = standardInspectSiteDeviceDriver.getMove();
|
|
|
|
TaskDto taskDto = taskService.findByStartAndNextCode(device_code); |
|
|
|
if (ObjectUtil.isNotEmpty(taskDto)) { |
|
|
|
status = "2"; |
|
|
|
status_name = "有任务"; |
|
|
|
material_type = "1"; |
|
|
|
} |
|
|
|
// } else if (move != 0) {
|
|
|
|
// status = "1";
|
|
|
|
// status_name = "有货";
|
|
|
|
// material_type = "1";
|
|
|
|
// }
|
|
|
|
} |
|
|
|
JSONObject map = new JSONObject(); |
|
|
|
map.put("device_id", device_id); |
|
|
|
map.put("device_code", device_code); |
|
|
|
map.put("device_name", device_name); |
|
|
|
map.put("status", status); |
|
|
|
map.put("status_name", status_name); |
|
|
|
map.put("input_material", input_material); |
|
|
|
map.put("allow_update", allow_update); |
|
|
|
map.put("material_type", material_type); |
|
|
|
respArr.add(map); |
|
|
|
} |
|
|
|
|
|
|
|
// JSONArray pointArr = WQL.getWO("QJN_QUERY001").addParam("flag", "6").addParam("region_id", jsonRegion.getString("region_code")).process().getResultJSONArray(0);
|
|
|
|
// for (int j = 0; j < pointArr.size(); j++) {
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
jsonRegion.put("deviceArr", respArr); |
|
|
|
} |
|
|
|
resultJson.put("regionja", regionArr); |
|
|
|
result.put("result", resultJson); |
|
|
|
result.put("code", "1"); |
|
|
|
result.put("desc", "查询成功"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> queryPointByArea(String areaCode) { |
|
|
|
JSONArray respArr = new JSONArray(); |
|
|
@ -663,9 +747,9 @@ public class AMHandServiceImpl implements AMHandService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> bindPoint(Map<String, String> reqParam) { |
|
|
|
public Map<String, Object> bindPoint(JSONObject reqParam) { |
|
|
|
WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint"); |
|
|
|
String device_code = MapUtil.getStr(reqParam, "device_code"); |
|
|
|
JSONArray device_codes = MapUtil.get(reqParam,"device_codes",JSONArray.class); |
|
|
|
String material_type = MapUtil.getStr(reqParam, "material_type"); |
|
|
|
String type = MapUtil.getStr(reqParam, "type"); |
|
|
|
String status = "0"; |
|
|
@ -675,7 +759,7 @@ public class AMHandServiceImpl implements AMHandService { |
|
|
|
jo.put("desc", "失败,操作类型不能为空!"); |
|
|
|
return jo; |
|
|
|
} |
|
|
|
if (StrUtil.isEmpty(device_code)) { |
|
|
|
if (ObjectUtil.isEmpty(device_codes)) { |
|
|
|
jo.put("code", "0"); |
|
|
|
jo.put("desc", "失败,设备号不能为空!"); |
|
|
|
return jo; |
|
|
@ -696,7 +780,10 @@ public class AMHandServiceImpl implements AMHandService { |
|
|
|
map.put("material_type", ""); |
|
|
|
map.put("hasgoods", "0"); |
|
|
|
} |
|
|
|
for (int i = 0; i < device_codes.size(); i++) { |
|
|
|
String device_code = device_codes.getString(i); |
|
|
|
wo_runPoint.update(map, "device_code = '" + device_code + "'"); |
|
|
|
} |
|
|
|
jo.put("code", "1"); |
|
|
|
jo.put("desc", "成功"); |
|
|
|
return jo; |
|
|
@ -871,5 +958,4 @@ public class AMHandServiceImpl implements AMHandService { |
|
|
|
return jo; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|