diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index f393f11..e4b84ba 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -461,7 +461,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } public JSONArray createBlocksData(Instruction inst) { - String ip = paramService.findByCode("local_ip").getValue(); + String ip = paramService.findByCode("local_host").getValue(); String addr = ip + port; JSONArray blocks = new JSONArray(); diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java index a9fde4c..d230a28 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java @@ -3,7 +3,7 @@ package org.nl.hand.amb.rest; import cn.dev33.satoken.annotation.SaIgnore; -import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -29,15 +29,15 @@ import java.util.Map; @RequestMapping("/api/hand") @Slf4j public class HFHandController { - private final HFHandService HandService; + private final HFHandService handService; - @PostMapping("/area") + @PostMapping("/region") @Log("查询区域") @ApiOperation("查询区域") @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity query() { - return new ResponseEntity<>(HandService.queryArea(null), HttpStatus.OK); + return new ResponseEntity<>(handService.queryArea(null), HttpStatus.OK); } @PostMapping("/point") @@ -47,8 +47,8 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") //@RequestBody JSONObject json public ResponseEntity queryPoint(@RequestBody Map whereJson) { - String region = (String) whereJson.get("region"); - return new ResponseEntity<>(HandService.queryPointByArea(region), HttpStatus.OK); + String region = whereJson.get("region_code"); + return new ResponseEntity<>(handService.queryPointByArea(region), HttpStatus.OK); } @PostMapping("/point/storage") @@ -58,7 +58,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") //@RequestBody JSONObject json public ResponseEntity queryDeviceAugmentabilityByCode(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.queryDeviceAugmentabilityByCode(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.queryDeviceAugmentabilityByCode(whereJson), HttpStatus.OK); } @PostMapping("/task_type") @@ -68,7 +68,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") //@RequestBody JSONObject json public ResponseEntity queryTaskType() { - return new ResponseEntity<>(HandService.queryTaskType(), HttpStatus.OK); + return new ResponseEntity<>(handService.queryTaskType(), HttpStatus.OK); } @PostMapping("/tasks") @@ -78,7 +78,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") public ResponseEntity queryTask(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.queryTask(whereJson), HttpStatus.OK); } @PostMapping("/insts") @@ -88,7 +88,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") public ResponseEntity queryInst(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.queryInst(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.queryInst(whereJson), HttpStatus.OK); } @PostMapping("/routeplan_type") @@ -97,7 +97,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity queryRouteplanType() { - return new ResponseEntity<>(HandService.queryRouteplanType(), HttpStatus.OK); + return new ResponseEntity<>(handService.queryRouteplanType(), HttpStatus.OK); } @PostMapping("/task") @@ -106,7 +106,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity createTask(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.createTask(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.createTask(whereJson), HttpStatus.OK); } @PostMapping("/inst") @@ -115,7 +115,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity Instoperation(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.Instoperation(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.Instoperation(whereJson), HttpStatus.OK); } @PostMapping("/taskoperation") @@ -124,7 +124,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity Taskoperation(@RequestBody Map whereJson) throws Exception { - return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.Taskoperation(whereJson), HttpStatus.OK); } @PostMapping("/deviceStatus") @@ -134,7 +134,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") public ResponseEntity updateDeviceStatus(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.updateDeviceStatus(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.updateDeviceStatus(whereJson), HttpStatus.OK); } @PostMapping("/handlogin") @@ -144,7 +144,7 @@ public class HFHandController { //@PreAuthorize("@el.check('sect:list')") public ResponseEntity handlogin(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.handleLogin(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.handleLogin(whereJson), HttpStatus.OK); } @PostMapping("/matrial") @@ -153,7 +153,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity queryMaterial() { - return new ResponseEntity<>(HandService.queryMaterial(), HttpStatus.OK); + return new ResponseEntity<>(handService.queryMaterial(), HttpStatus.OK); } @PostMapping("/task2") @@ -162,7 +162,7 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity createTask2(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.createTask2(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.createTask2(whereJson), HttpStatus.OK); } @PostMapping("/createChargingTask") @@ -171,7 +171,25 @@ public class HFHandController { @SaIgnore //@PreAuthorize("@el.check('sect:list')") public ResponseEntity createChargingTask(@RequestBody Map whereJson) { - return new ResponseEntity<>(HandService.createChargingTask(whereJson), HttpStatus.OK); + return new ResponseEntity<>(handService.createChargingTask(whereJson), HttpStatus.OK); + } + + @PostMapping("/material") + @Log("查询物料") + @ApiOperation("查询物料") + @SaIgnore + //@PreAuthorize("@el.check('sect:list')") + public ResponseEntity material() { + return new ResponseEntity<>(handService.material(), HttpStatus.OK); + } + + @PostMapping("/pointOpt") + @Log("点位操作") + @ApiOperation("点位操作") + @SaIgnore + //@PreAuthorize("@el.check('sect:list')") + public ResponseEntity pointOpt(@RequestBody JSONObject param) { + return new ResponseEntity<>(handService.pointOpt(param), HttpStatus.OK); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java index 7ad1bc1..a8630de 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java @@ -2,6 +2,8 @@ package org.nl.hand.amb.service; +import com.alibaba.fastjson.JSONObject; + import java.util.Map; /** @@ -119,4 +121,8 @@ public interface HFHandService { * @return */ Map createChargingTask(Map whereJson); + + JSONObject material(); + + JSONObject pointOpt(JSONObject param); } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java index d787c43..596bd0f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java @@ -35,6 +35,7 @@ import org.nl.hand.amb.service.HFHandService; import org.nl.modules.common.config.RsaProperties; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.RsaUtils; +import org.nl.modules.system.service.DictService; import org.nl.modules.system.service.UserService; import org.nl.modules.system.service.dto.UserDto; import org.nl.modules.system.util.CodeUtil; @@ -59,6 +60,7 @@ public class HFHandServiceImpl implements HFHandService { private final UserService userService; private final DeviceService deviceService; private final DeviceAppService deviceAppService; + private final DictService dictService; InstructionService instructionService = null; @@ -73,123 +75,41 @@ public class HFHandServiceImpl implements HFHandService { } @Override - public Map queryPointByArea(String dict_id) { - JSONArray resultArr = new JSONArray(); - JSONObject resultJson = new JSONObject(); - JSONObject jo = new JSONObject(); + public Map queryPointByArea(String region) { - if (StrUtil.isEmpty(dict_id)) { - throw new BadRequestException("区域id不能为空!"); - } - String value = ""; - String move = ""; - String status = ""; - String input_material = "0"; - String allow_update = ""; - String material = ""; - String batch = ""; - - //再字典中查询出value - //JSONObject valuejo = WQLObject.getWQLObject("sys_dict_detail").query("detail_id='" + dict_id + "'").uniqueResult(0); - JSONObject valuejo = WQL.getWO("QJN_QUERY001").addParam("flag", "3").addParam("detail_id", dict_id).process().uniqueResult(0); - if (!ObjectUtil.isEmpty(valuejo)) { - value = valuejo.getString("value"); - } - //根据value值去查所有的设备 - JSONArray acs_deviceja = WQLObject.getWQLObject("ACS_DEVICE").query("region='" + value + "' and device_type='conveyor' and is_config='true' ", "seq_num,device_name").getResultJSONArray(0); - for (int i = 0; i < acs_deviceja.size(); i++) { - JSONObject devicejo = acs_deviceja.getJSONObject(i); - String device_code = devicejo.getString("device_code"); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device device = appService.findDeviceByCode(device_code); - //无光电普通站点 - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - //检测站点 - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if (StrUtil.equals(device.getIslock(), "true")) { - status = "3"; - move = "有任务"; - } else { - if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) { - status = "0"; - move = "无货"; - } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) { - status = "1"; - move = "有托盘"; - } else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) { - status = "2"; - move = "有托盘有货"; - } - } + if (StrUtil.isEmpty(region)) { + throw new BadRequestException("区域不能为空!"); + } - material = device.getMaterial_type(); - //material = standardOrdinarySiteDeviceDriver.getMaterial(); - if (StrUtil.isNullOrUndefined(material)) { - material = ""; - } - batch = device.getBatch(); - //batch = standardOrdinarySiteDeviceDriver.getBatch(); - if (StrUtil.isNullOrUndefined(batch)) { - batch = ""; - } - String input_materialflag = (String) device.getExtraValue().get("input_material"); - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("false")) { - input_material = "0"; - } - if (!StrUtil.isEmpty(input_materialflag) && input_materialflag.equals("true")) { - input_material = "1"; - } - jo.put("material_type", material); - jo.put("batch", batch); - jo.put("islock", device.getIslock()); - jo.put("status_name", move); - jo.put("status", status); - jo.put("device_id", devicejo.getString("device_id")); - jo.put("device_code", devicejo.getString("device_code")); - jo.put("device_name", devicejo.getString("device_name")); - jo.put("allow_update", "1"); - jo.put("input_material", input_material); - // 特殊驱动 - } - //检测站点 - else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - - if (StrUtil.equals(device.getIslock(), "true")) { - status = "3"; - move = "有任务"; - } else { - if (standardInspectSiteDeviceDriver.getHasGoods() == 0) { - status = "0"; - move = "无货"; - } else if (standardInspectSiteDeviceDriver.getHasGoods() == 1) { - status = "1"; - move = "有托盘"; - } else if (standardInspectSiteDeviceDriver.getHasGoods() == 2) { - status = "2"; - move = "有托盘有货"; - } + JSONArray devices = WQLObject.getWQLObject("acs_device").query("region = '" + region + "' AND device_type = 'station' AND is_config = 'true' ", "seq_num").getResultJSONArray(0); + JSONArray resultArr = new JSONArray(); + for (int i = 0; i < devices.size(); i++) { + JSONObject device = devices.getJSONObject(i); + String deviceCode = device.getString("device_code"); + Device deviceCache = this.deviceAppService.findDeviceByCode(deviceCode); + + JSONObject row = new JSONObject(); + row.put("device_code", deviceCode); + row.put("device_name", device.getString("device_name")); + String status = "0"; + if ("true".equals(deviceCache.getExtraValue().get("station_manager"))) { + if ("1".equals(deviceCache.getIslock())) { + status = "2"; + } else if (1 == deviceCache.getHas_goods()) { + status = "1"; } - jo.put("material_type", standardInspectSiteDeviceDriver.getMaterial()); - jo.put("status_name", move); - jo.put("status", status); - jo.put("device_id", devicejo.getString("device_id")); - jo.put("device_code", devicejo.getString("device_code")); - jo.put("device_name", devicejo.getString("device_name")); - jo.put("allow_update", "1"); - jo.put("batch", standardInspectSiteDeviceDriver.getBatch()); - jo.put("input_material", input_material); - + row.put("material_type", deviceCache.getMaterial_type()); + row.put("qty", deviceCache.getBatch()); } - resultArr.add(jo); + row.put("status", status); + resultArr.add(row); } - resultJson.put("code", "1"); - resultJson.put("desc", "查询成功"); - resultJson.put("result", resultArr); - return resultJson; + + JSONObject result = new JSONObject(); + result.put("code", "1"); + result.put("desc", "查询成功"); + result.put("result", resultArr); + return result; } @Override @@ -778,4 +698,96 @@ public class HFHandServiceImpl implements HFHandService { jo.put("desc", "操作成功!"); return jo; } + + @Override + public JSONObject material() { + JSONArray materialType = WQLObject.getWQLObject("sys_dict_detail").query("`name` = 'material_type'").getResultJSONArray(0); + + JSONObject result = new JSONObject(); + result.put("code", "1"); + result.put("desc", "查询成功"); + result.put("result", materialType); + return result; + } + + @Override + public JSONObject pointOpt(JSONObject param) { + JSONObject result = new JSONObject(); + + String type = param.getString("type"); + if (StrUtil.isBlank(type)) { + result.put("code", "0"); + result.put("desc", "未知操作!"); + return result; + } + String deviceCode = param.getString("device_code"); + if (StrUtil.isBlank(deviceCode)) { + result.put("code", "0"); + result.put("desc", "未知点位!"); + return result; + } + Device device = this.deviceAppService.findDeviceByCode(deviceCode); + if ("1".equals(device.getIslock())) { + result.put("code", "0"); + result.put("desc", "当前点位有正在执行的任务,禁止操作!"); + return result; + } + + if ("1".equals(type)) { + // 确认 + String materialType = param.getString("material_type"); + if (StrUtil.isBlank(materialType) || "0".equals(materialType)) { + result.put("code", "0"); + result.put("desc", "物料不能为空!"); + return result; + } + int qty = param.getIntValue("qty"); + if (qty <= 0) { + result.put("code", "0"); + result.put("desc", "数量必须大于零!"); + return result; + } + + if ("true".equals(device.getExtraValue().get("station_manager"))) { + device.setHas_goods(1); + device.setMaterial_type(materialType); + device.setBatch(String.valueOf(qty)); + + JSONObject rpUpdate = new JSONObject(); + rpUpdate.put("hasgoods", "1"); + rpUpdate.put("material_type", materialType); + rpUpdate.put("batch", qty); + rpUpdate.put("update_by", "sc"); + rpUpdate.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code = '" + deviceCode + "'"); + } else { + result.put("code", "0"); + result.put("desc", "此点位在设备配置中未开启点位管理,无法保存物料等信息!"); + return result; + } + } else if ("2".equals(type)) { + // 清空 + if ("true".equals(device.getExtraValue().get("station_manager"))) { + device.setHas_goods(0); + device.setMaterial_type("0"); + device.setBatch("0"); + + JSONObject rpUpdate = new JSONObject(); + rpUpdate.put("hasgoods", "0"); + rpUpdate.put("material_type", "0"); + rpUpdate.put("batch", "0"); + rpUpdate.put("update_by", "sc"); + rpUpdate.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code = '" + deviceCode + "'"); + } + } else { + result.put("code", "0"); + result.put("desc", "未知操作!"); + return result; + } + + result.put("code", "1"); + result.put("desc", "操作成功!"); + return result; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql index 2f2e235..475c96d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/wql/QJN_QUERY001.wql @@ -46,14 +46,12 @@ IF 输入.flag = "1" QUERY SELECT - dtl.detail_id as region_id, - dtl.label as region_name, - dtl.value as region_code + label, + `value` FROM - sys_dict sys - LEFT JOIN sys_dict_detail dtl ON dtl.dict_id = sys.dict_id + sys_dict_detail WHERE - sys.NAME = "region_type" + `name` = 'region' ENDSELECT ENDQUERY ENDIF diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls b/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls index a73514e..7a0bb09 100644 Binary files a/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls and b/acs/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls differ diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java b/acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java index 62bb50f..7a09c65 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/wql/core/bean/ResultBean.java @@ -230,7 +230,7 @@ public class ResultBean implements Serializable, Cloneable { rows = new ArrayList(); } JSONArray jrows = this.rows2jsonarray(rows); - JSONObject jrow = null; + JSONObject jrow = new JSONObject(); if (jrows.size() > 0) { jrow = jrows.getJSONObject(0); } diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index 2c06f93..ec573e8 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -172,7 +172,7 @@ - + 完成 取消 下发