diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java index e596c64..08404a5 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java @@ -298,6 +298,15 @@ public class DeviceController { return new ResponseEntity<>(HttpStatus.CREATED); } + @PostMapping("/cleans4") + @Log("多选清空区域四设备") + @ApiOperation("多选清空区域四设备") + //@PreAuthorize("@el.check('device:add')") + public ResponseEntity cleans4(@RequestBody JSONObject json) { + deviceService.cleans4(json); + return new ResponseEntity<>(HttpStatus.CREATED); + } + @PostMapping("/enterSite1") @Log("人工进出区域一库位") @ApiOperation("人工进出区域一库位") @@ -316,6 +325,15 @@ public class DeviceController { return new ResponseEntity<>(HttpStatus.CREATED); } + @PostMapping("/enterSite3") + @Log("人工进出区域三库位") + @ApiOperation("人工进出区域三库位") + //@PreAuthorize("@el.check('device:add')") + public ResponseEntity enterSite3(@RequestBody JSONObject json) { + deviceService.enterSite3(json); + return new ResponseEntity<>(HttpStatus.CREATED); + } + @GetMapping("/selectDriverCodeList/{device_code}") @Log("下拉选设备驱动") @ApiOperation("下拉选设备驱动") diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java index 9ead3a9..2583b1a 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java @@ -166,6 +166,13 @@ public interface DeviceService { */ JSONArray selectDeviceListThree(); + /** + * 查询区域四设备 + * + * @return + */ + JSONArray selectDeviceListFour(); + /** * 更新驱动配置信息 * @@ -227,10 +234,14 @@ public interface DeviceService { void cleans3(JSONObject json); + void cleans4(JSONObject json); + void enterSite1(JSONObject json); void enterSite2(JSONObject json); + void enterSite3(JSONObject json); + /** * 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找 * diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 2d8cb11..e8b872e 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -529,6 +529,42 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial return result; } + @Override + public JSONArray selectDeviceListFour() { + //设备基础信息表【acs_device】 + JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '4'", "seq_num").getResultJSONArray(0); + JSONArray result = new JSONArray(); + for (int i = 0; i < arr.size(); i++) { + JSONObject obj = arr.getJSONObject(i); + JSONObject json = new JSONObject(); + json.put("device_id", obj.optString("device_id")); + json.put("device_code", obj.optString("device_code")); + json.put("checked", false); + json.put("device_name", obj.optString("device_name")); + Device device = deviceAppService.findDeviceByCode(obj.optString("device_code")); + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + json.put("quantity", standardOrdinarySiteDeviceDriver.getQty()); + json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial()); + json.put("remark", standardOrdinarySiteDeviceDriver.getRemark()); + json.put("islock",standardOrdinarySiteDeviceDriver.getIslock()); + json.put("hasGood",standardOrdinarySiteDeviceDriver.getHasGoods()); + } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + json.put("quantity", standardInspectSiteDeviceDriver.getQty()); + json.put("material_type", standardInspectSiteDeviceDriver.getMaterial()); + json.put("remark", standardInspectSiteDeviceDriver.getRemark()); + json.put("islock",standardInspectSiteDeviceDriver.getIslock()); + json.put("hasGood",standardInspectSiteDeviceDriver.getHasGoods()); + } + result.add(json); + } + return result; + } + @Override public JSONArray selectDeviceDevicerInfo(String status) { @@ -1436,6 +1472,41 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } + @Override + public void cleans4(JSONObject json) { + JSONArray array = json.optJSONArray("data"); + + if (array.size() == 0) { + throw new RuntimeException("请选择库位"); + } else { + for (int i = 0; i < array.size(); i++) { + JSONObject arrjo = array.getJSONObject(i); + String device_code = arrjo.get("device_code").toString(); + + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + Device device = deviceAppService.findDeviceByCode(device_code); + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setHasGoods(0); + standardOrdinarySiteDeviceDriver.setMaterial(""); + standardOrdinarySiteDeviceDriver.setQty(""); + standardOrdinarySiteDeviceDriver.setRemark(""); + JSONObject jsonjo = new JSONObject(); + jsonjo.put("device_code", device_code); + jsonjo.put("hasGoodStatus", "0"); + changeDeviceStatus(jsonjo); + } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.setMaterial(""); + standardInspectSiteDeviceDriver.setQty(""); + standardInspectSiteDeviceDriver.setRemark(""); + } + } + } + } + @Override public void enterSite1(JSONObject json) { JSONArray array = json.optJSONArray("data"); @@ -1486,6 +1557,31 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } + @Override + public void enterSite3(JSONObject json) { + JSONArray array = json.optJSONArray("data"); + String islock = json.optString("islock"); + + for (int i = 0; i < array.size(); i++) { + JSONObject arrjo = array.getJSONObject(i); + String device_code = arrjo.get("device_code").toString(); + if (ObjectUtil.isNotEmpty(taskService.findByNextCode(device_code))) { + throw new RuntimeException("当前行的库位有任务!"); + } + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + Device device = deviceAppService.findDeviceByCode(device_code); + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setIslock(Boolean.valueOf(islock)); + } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.setIslock(Boolean.valueOf(islock)); + } + } + } + @Override public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) { final JSONObject extraObj = new JSONObject(); diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java index 8a23dde..981b131 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/HsDeviceStatus.java @@ -38,11 +38,14 @@ public class HsDeviceStatus { JSONObject json = new JSONObject(); JSONArray device = new JSONArray(); JSONArray device2 = new JSONArray(); + JSONArray device3 = new JSONArray(); JSONObject jo = new JSONObject(); Map whereJson1; Map whereJson2; + Map whereJson3; JSONArray array1 = deviceService.selectDeviceListOne(); JSONArray array2 = deviceService.selectDeviceListTwo(); + JSONArray array3 = deviceService.selectDeviceListFour(); for (int i = 0; i < array1.size(); i++) { whereJson1 = (Map) array1.get(i); String device_code = MapUtil.getStr(whereJson1, "device_code"); @@ -95,8 +98,35 @@ public class HsDeviceStatus { } device2.add(jo); } + for (int i = 0; i < array3.size(); i++) { + whereJson3 = (Map) array3.get(i); + String device_code = MapUtil.getStr(whereJson3, "device_code"); + Device deviceApp = deviceAppService.findDeviceByCode(device_code); + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + if (deviceApp.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) deviceApp.getDeviceDriver(); + jo.put("device_code", device_code); + jo.put("quantity", standardOrdinarySiteDeviceDriver.getQty()); + jo.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial()); + jo.put("hasGood", standardOrdinarySiteDeviceDriver.getHasGoods()); + jo.put("remark", standardOrdinarySiteDeviceDriver.getRemark()); + jo.put("islock", standardOrdinarySiteDeviceDriver.getIslock()); + } + if (deviceApp.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) deviceApp.getDeviceDriver(); + jo.put("device_code", device_code); + jo.put("quantity", standardInspectSiteDeviceDriver.getQty()); + jo.put("material_type", standardInspectSiteDeviceDriver.getMaterial()); + jo.put("hasGood", standardInspectSiteDeviceDriver.getHasGoods()); + jo.put("remark", standardInspectSiteDeviceDriver.getRemark()); + jo.put("islock", standardInspectSiteDeviceDriver.getIslock()); + } + device3.add(jo); + } json.put("device", device); json.put("device2", device2); + json.put("device3", device3); SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO); WebSocketServer.sendInfo(deviceInfo, "hs_data"); diff --git a/qd/src/api/acs/device/device.js b/qd/src/api/acs/device/device.js index 49433cc..36adce7 100644 --- a/qd/src/api/acs/device/device.js +++ b/qd/src/api/acs/device/device.js @@ -64,6 +64,13 @@ export function selectDeviceListThree() { }) } +export function selectDeviceListFour() { + return request({ + url: 'api/device/selectListFour', + method: 'get' + }) +} + export function selectDeviceDevicerInfo(status) { return request({ url: 'api/device/selectDeviceDevicerInfo/' + status, @@ -189,6 +196,14 @@ export function enterSite2(data) { }) } +export function enterSite3(data) { + return request({ + url: 'api/device/enterSite3', + method: 'post', + data + }) +} + export function cleans3(data) { return request({ url: 'api/device/cleans3', @@ -197,6 +212,14 @@ export function cleans3(data) { }) } +export function cleans4(data) { + return request({ + url: 'api/device/cleans4', + method: 'post', + data + }) +} + export function selectAGVList() { return request({ url: 'api/device/selectAGVList', @@ -214,4 +237,5 @@ export function agvTaskType(data) { export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask, changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree, - addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType} + addMaterial, cleanMaterial, changeFenceStatus,reload, cleans1, cleans2, enterSite1, enterSite2, cleans3, selectAGVList, agvTaskType, selectDeviceListFour, + cleans4, enterSite3} diff --git a/qd/src/views/bigscreen/hs.vue b/qd/src/views/bigscreen/hs.vue index 343de4b..09e5805 100644 --- a/qd/src/views/bigscreen/hs.vue +++ b/qd/src/views/bigscreen/hs.vue @@ -3,7 +3,7 @@ -
+ 进入 @@ -96,6 +96,52 @@ + + + + 进入 + 离开 + 清空货位 + + + + + 全选 +
+
+ + + {{ '设备:' + item.device_code }} + +
+
+ + + {{ '设备:' + item.device_code }} + +
+ {{ '物料类型:' + item.material_type }} +
+
{{ '物料数量:' + item.quantity }}
+
+
+ + + {{ '设备:' + item.device_code }} + +
+
+
+
@@ -114,8 +160,10 @@ export default { return { resultAll1: false, resultAll12: false, + resultAll13: false, requestDialogVisible: false, requestDialogVisible2: false, + requestDialogVisible3: false, responseDialogVisible: false, region: '', imgUrl: '站点', @@ -140,6 +188,14 @@ export default { quantity: 0, remark: '' }, + form3: { + device_id: '', + device_code: '', + device_name: '', + material_type: '', + quantity: 0, + remark: '' + }, testdata: { check: null, device_code: null @@ -147,8 +203,10 @@ export default { material_types: [], deviceList: [], deviceList2: [], + deviceList3: [], deviceListOne: [], deviceListTwo: [], + deviceListThree: [], currentDate: new Date(), getTime: '', getDate: '' @@ -176,6 +234,11 @@ export default { this.deviceListTwo = data }) }) + this.$nextTick(() => { + deviceCrud.selectDeviceListFour().then(data => { + this.deviceListThree = data + }) + }) }, methods: { cleans1() { @@ -225,6 +288,29 @@ export default { this.resultAll12 = false }) }, + cleans3() { + var obj = this.deviceList3 + var arr = [] + for (let i = 0; i < obj.length; i++) { + if (obj[i].checked) { + arr.push(obj[i]) + } + } + const data = { + 'data': arr + } + deviceCrud.cleans4(data).then(res => { + this.$notify({ + title: '操作成功', + type: 'success', + duration: 3000 + }) + for (let i = 0; i < arr.length; i++) { + arr[i].checked = false + } + this.resultAll13 = false + }) + }, checkeds(value) { this.deviceList.forEach((item) => { item.checked = value @@ -237,6 +323,12 @@ export default { }) this.$forceUpdate(); }, + checkeds3(value) { + this.deviceList3.forEach((item) => { + item.checked = value + }) + this.$forceUpdate(); + }, enterSite1() { const data = { 'data': this.deviceList, @@ -289,6 +381,32 @@ export default { }) }) }, + enterSite3() { + const data = { + 'data': this.deviceList3, + 'islock': 'true' + } + deviceCrud.enterSite3(data).then(res => { + this.$notify({ + title: '操作成功', + type: 'success', + duration: 3000 + }) + }) + }, + outSite3() { + const data = { + 'data': this.deviceList3, + 'islock': 'false' + } + deviceCrud.enterSite3(data).then(res => { + this.$notify({ + title: '操作成功', + type: 'success', + duration: 3000 + }) + }) + }, saveRequest() { deviceCrud.addMaterial(this.form).then(res => { this.$notify({ @@ -315,6 +433,19 @@ export default { console.log(err.response.data.message) }) }, + saveRequest3() { + deviceCrud.addMaterial(this.form3).then(res => { + this.$notify({ + title: '操作成功', + type: 'success', + duration: 3000 + }) + this.requestDialogVisible3 = false + }).catch(err => { + this.requestDialogVisible3 = false + console.log(err.response.data.message) + }) + }, // 钩子:在获取表格数据之前执行,false 则代表不获取数据 [CRUD.HOOK.beforeRefresh]() { return true @@ -419,6 +550,44 @@ export default { } } } + for (let i = 0; i < data.msg.device3.length; i++) { + const item = data.msg.device3[i] + + // 刷新页面第一次加载数据 + if (that.deviceList3.length != data.msg.device3.length) { + const obj = { + device_code: item.device_code, + hasGood: item.hasGood, + material_type: item.material_type, + quantity: item.quantity, + remark: item.remark, + islock: item.islock, + checked: false + } + that.deviceList3.push(obj) + } else { + for (let j = 0; j < that.deviceList3.length; j++) { + if (that.deviceList3[j].device_code == item.device_code) { + if (that.deviceList3[j].hasGood != item.hasGood) { + that.deviceList3[j].device_code = item.device_code + that.deviceList3[j].hasGood = item.hasGood + } + if (that.deviceList3[j].material_type != item.material_type) { + that.deviceList3[j].material_type = item.material_type + } + if (that.deviceList3[j].quantity != item.quantity) { + that.deviceList3[j].quantity = item.quantity + } + if (that.deviceList3[j].remark != item.remark) { + that.deviceList2[j].remark = item.remark + } + if (that.deviceList3[j].islock != item.islock) { + that.deviceList3[j].islock = item.islock + } + } + } + } + } } // 监听socket错误 this.socket.onerror = function() {