gx
This commit is contained in:
@@ -47,6 +47,15 @@ public class AMHandController {
|
||||
return new ResponseEntity<>(HandService.queryPointByArea(areaCode), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryDevice")
|
||||
@Log("查询区域点位")
|
||||
@ApiOperation("查询区域点位")
|
||||
//@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> queryDevice() {
|
||||
return new ResponseEntity<>(HandService.queryPoint(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryMaterial")
|
||||
@Log("查询物料信息")
|
||||
@ApiOperation("查询物料信息")
|
||||
@@ -61,7 +70,7 @@ public class AMHandController {
|
||||
@ApiOperation("点位绑定")
|
||||
@SaIgnore
|
||||
//@PreAuthorize("@el.check('sect:list')")
|
||||
public ResponseEntity<Object> bindPoint(@RequestBody Map<String, String> reqParam) {
|
||||
public ResponseEntity<Object> bindPoint(@RequestBody JSONObject reqParam) {
|
||||
return new ResponseEntity<>(HandService.bindPoint(reqParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public interface AMHandService {
|
||||
*/
|
||||
Map<String, Object> queryMaterial();
|
||||
|
||||
Map<String, Object> bindPoint(Map<String, String> reqParam);
|
||||
Map<String, Object> bindPoint(JSONObject reqParam);
|
||||
|
||||
Map<String, Object> createTask2(Map<String, String> whereJson);
|
||||
|
||||
@@ -123,4 +123,11 @@ public interface AMHandService {
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> callTask(JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 查询区域点位
|
||||
* @return json
|
||||
*/
|
||||
JSONObject queryPoint();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
wo_runPoint.update(map, "device_code = '" + device_code + "'");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.next_point TYPEAS s_string
|
||||
输入.detail_id TYPEAS s_string
|
||||
输入.region_id TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +55,8 @@
|
||||
LEFT JOIN sys_dict_detail dtl ON dtl.dict_id = sys.dict_id
|
||||
WHERE
|
||||
sys.NAME = "region_type"
|
||||
AND
|
||||
dtl.value <> '09'
|
||||
order by
|
||||
dict_sort
|
||||
ENDSELECT
|
||||
@@ -175,3 +178,24 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
SELECT
|
||||
device_id,
|
||||
device_code,
|
||||
device_name,
|
||||
seq_num
|
||||
FROM
|
||||
acs_device
|
||||
WHERE
|
||||
is_config = 'true'
|
||||
AND is_delete = '0'
|
||||
OPTION 输入.region_id <> ""
|
||||
region = 输入.region_id
|
||||
ENDOPTION
|
||||
order by
|
||||
seq_num
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user