diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java index baf1967..1ceb380 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/service/impl/AMHandServiceImpl.java @@ -214,7 +214,7 @@ public class AMHandServiceImpl implements AMHandService { allow_update = "1"; } else if (device_driver.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device_driver.getDeviceDriver(); - // int move = standardInspectSiteDeviceDriver.getMove(); + // int move = standardInspectSiteDeviceDriver.getMove(); TaskDto taskDto = taskService.findByStartAndNextCode(device_code); if (ObjectUtil.isNotEmpty(taskDto)) { status = "2"; @@ -622,7 +622,7 @@ public class AMHandServiceImpl implements AMHandService { } if (type.equals("2")) { try { - agvService.sendAgvInstToNDC(instdto.getAgv_system_type(),instdto); + agvService.sendAgvInstToNDC(instdto.getAgv_system_type(), instdto); } catch (Exception e) { jo.put("code", "2"); jo.put("desc", "下发agv失败"); @@ -764,7 +764,7 @@ public class AMHandServiceImpl implements AMHandService { @Override public Map bindPoint(JSONObject reqParam) { WQLObject wo_runPoint = WQLObject.getWQLObject("acs_device_runpoint"); - JSONArray device_codes = MapUtil.get(reqParam,"device_codes",JSONArray.class); + 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"; @@ -873,42 +873,65 @@ public class AMHandServiceImpl implements AMHandService { jo.put("desc", "呼叫失败,起点或终点不能为空!"); return jo; } + if (start_device_codes.size() > 2) { + throw new BadRequestException("起点个数不能大于2!"); + } + + if (start_device_codes.size() == 2) { + //将数组转换为集合判断是否为同一排的库位,并按照库位顺序号排序 + List start_device_code_list = JSONArray.parseArray(start_device_codes.toJSONString(), String.class); + Collections.sort(start_device_code_list, new Comparator() { + @Override + public int compare(String s1, String s2) { + String start_i = s1.split("_")[0]; + String start_j = s2.split("_")[0]; + if (!StrUtil.equals(start_i, start_j)) { + throw new BadRequestException("请选择同一排待塑区库位!"); + } + int end_i = Integer.parseInt(s1.split("_")[s1.split("_").length - 1]); + int end_j = Integer.parseInt(s2.split("_")[s2.split("_").length - 1]); + if (end_i > end_j) { + return 1; + } else if (end_i < end_j) { + return -1; + } + return 0; + } + }); + String s = start_device_code_list.get(0); + String e = start_device_code_list.get(1); + String row_num = s.split("_")[0]; + int s_col_num = Integer.parseInt(s.split("_")[s.split("_").length - 1]); + int e_col_num = Integer.parseInt(e.split("_")[e.split("_").length - 1]); + start_device_codes = new JSONArray(); +// start_device_codes = JSONArray.parseArray(JSON.toJSONString(start_device_code_list)); + for (int i = s_col_num; i <= e_col_num; i++) { + String col_num = ""; + if (i < 10){ + col_num = "0" + i; + } else { + col_num = String.valueOf(i); + } + String point_code = row_num + "_" + col_num; + start_device_codes.add(point_code); + } + } + for (int i = 0; i < start_device_codes.size(); i++) { String device_code = start_device_codes.getString(i); Device device = deviceAppService.findDeviceByCode(device_code); if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { JSONObject jsonObject = wo_runPoint.query("device_code = '" + device_code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonObject)){ + if (ObjectUtil.isNotEmpty(jsonObject)) { String hasgoods = jsonObject.getString("hasgoods"); - if (StrUtil.equals(hasgoods,"0")){ + if (StrUtil.equals(hasgoods, "0")) { throw new BadRequestException("设备:" + device_code + "库存为无货状态,请手动绑定货物!"); } } - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - } } - //将数组转换为集合判断是否为同一排的库位,并按照库位顺序号排序 - List start_device_code_list = JSONArray.parseArray(start_device_codes.toJSONString(), String.class); - Collections.sort(start_device_code_list, new Comparator() { - @Override - public int compare(String s1, String s2) { - String start_i = s1.split("_")[0]; - String start_j = s2.split("_")[0]; - if (!StrUtil.equals(start_i, start_j)) { - throw new BadRequestException("请选择同一排待塑区库位!"); - } - int end_i = Integer.parseInt(s1.split("_")[s1.split("_").length - 1]); - int end_j = Integer.parseInt(s2.split("_")[s2.split("_").length - 1]); - if (end_i > end_j) { - return 1; - } else if (end_i < end_j) { - return -1; - } - return 0; - } - }); - start_device_codes = JSONArray.parseArray(JSON.toJSONString(start_device_code_list)); + + int start_size = start_device_codes.size(); if (start_size > 0) { //获取起点点位数组的第一个点位 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/wql/QJN_QUERY001.wql b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/wql/QJN_QUERY001.wql index 03fb6dd..d10c427 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/wql/QJN_QUERY001.wql +++ b/acs/nladmin-system/src/main/java/org/nl/acs/hand/amb/wql/QJN_QUERY001.wql @@ -98,7 +98,7 @@ OPTION 输入.next_point <> "" task.next_point_code like 输入.next_point ENDOPTION - ORDER BY task.create_time + ORDER BY task.create_time desc,task.task_code ENDSELECT ENDQUERY ENDIF @@ -159,7 +159,7 @@ inst.next_point_code like 输入.next_point ENDOPTION ORDER BY - inst.create_time DESC + inst.create_time DESC,inst.instruction_code ENDSELECT ENDQUERY ENDIF diff --git a/acs/nladmin-system/src/main/resources/config/application.yml b/acs/nladmin-system/src/main/resources/config/application.yml index a4d00ab..7e3fbea 100644 --- a/acs/nladmin-system/src/main/resources/config/application.yml +++ b/acs/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: