From a177e3bc2103941710c5a63ae696cb84f03b6016 Mon Sep 17 00:00:00 2001 From: lyd <1419499670@qq.com> Date: Wed, 17 Aug 2022 13:43:16 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acs/qd/src/views/acs/device/index.vue | 26 +++++++++------ .../src/views/acs/produceshiftorder/index.vue | 32 +++---------------- 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/acs/qd/src/views/acs/device/index.vue b/acs/qd/src/views/acs/device/index.vue index 8595b47..080ccbe 100644 --- a/acs/qd/src/views/acs/device/index.vue +++ b/acs/qd/src/views/acs/device/index.vue @@ -139,23 +139,29 @@ - + + + + + + + + + + - - - diff --git a/acs/qd/src/views/acs/produceshiftorder/index.vue b/acs/qd/src/views/acs/produceshiftorder/index.vue index 593aa16..6d84715 100644 --- a/acs/qd/src/views/acs/produceshiftorder/index.vue +++ b/acs/qd/src/views/acs/produceshiftorder/index.vue @@ -59,18 +59,6 @@ - - - @@ -84,12 +72,16 @@ - + @@ -147,13 +139,6 @@ export default { [CRUD.HOOK.beforeRefresh]() { return true }, - beforeHandleCommand(index, row, command) { - return { - 'index': index, - 'row': row, - 'command': command - } - }, finish(index, row) { debugger crudProduceshiftorder.finish(row.order_id).then(res => { @@ -162,13 +147,6 @@ export default { }).catch(err => { console.log(err.response.data.message) }) - }, - handleCommand(command) { - switch (command.command) { - case 'a':// 完成 - this.finish(command.index, command.row) - break - } } } } From 785bc936135733585195bdb61355c0f03038fd91 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Wed, 17 Aug 2022 14:07:01 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device_driver/driver/OpcDeviceDriver.java | 12 +++- .../ItemProtocol.java | 2 +- .../ItemProtocol.java | 2 +- ...agePalletSplitManipulatorDeviceDriver.java | 59 ++++++++++++++++++- 4 files changed, 67 insertions(+), 8 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java index cf07de0..ebc6edf 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java @@ -64,15 +64,21 @@ public interface OpcDeviceDriver extends DeviceDriver { } default Float getFloatValue(String protocol) { - return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol)); + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + return (Float)redisUtils.get(this.getItem(protocol)); +// return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol)); } default int[] getIntegeregerArrayValue(String protocol) { - return (int[]) this.getOpcValueAccessor().getValue(this.getItem(protocol)); +// return (int[]) this.getOpcValueAccessor().getValue(this.getItem(protocol)); + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + return (int[])redisUtils.get(this.getItem(protocol)); } default String getStringValue(String protocol) { - return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol)); +// return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol)); + RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); + return (String)redisUtils.get(this.getItem(protocol)); } default Object getValue(String protocol) { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java index 9360938..cec9072 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java @@ -152,7 +152,7 @@ public class ItemProtocol { } else { return value; } - return "0"; + return ""; } public static List getReadableItemDtos() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java index b7f0557..009b60d 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java @@ -767,7 +767,7 @@ public class ItemProtocol { } else { return value; } - return "0"; + return ""; } public static List getReadableItemDtos() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java index c64fda9..d474f29 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java @@ -689,12 +689,14 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe case 6: //码垛完成 if (!requireSucess) { + applyEmpty(); palletizing(); } break; case 7: - //码垛强制完成 + //码垛强制完成 半托缓存 if (!requireSucess) { + applyEmpty(); mandatoryPalletizing(); } break; @@ -716,6 +718,19 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe enterProduction(json); } break; + case 10: + //叫料 + if (!requireSucess && getStation>0 && StrUtil.isNotEmpty(material)) { + callMaterial(); + } + break; + case 11: + //强制去包装 + if (!requireSucess) { + applyEmpty(); + mandatoryPalletizing(); + } + break; } switch (flag) { @@ -819,6 +834,43 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } } + + /** + * 叫料 + * + * @param + */ + public synchronized boolean callMaterial() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(getStation-1).replace("\"","")); + json.put("type","2"); + json.put("material_code",material); + json.put("vehicle_code",barcode); + json.put("is_full","1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + this.writing(1); + } + this.setRequireSucess(true); + } + return true; + } + } + + + /** * 排产单确认 * @@ -1109,9 +1161,10 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe String demosub = linkobj.substring(1,linkobj.length()-1); String demoArray[] = demosub.split(","); List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); + json.put("qty",qty); json.put("vehicle_code",barcode); - json.put("is_full","0"); + json.put("is_full","1"); json.put("product_code",product_code); json.put("AlongSide",AlongSide); json.put("BshortSide",BshortSide); From e17604b6d779a5ad0030b4f5e448a60d52ed98a8 Mon Sep 17 00:00:00 2001 From: lyd <1419499670@qq.com> Date: Wed, 17 Aug 2022 15:40:49 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E4=BF=AE=E5=A4=8D=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/acs/monitor/DeviceStageMonitor.java | 22 ++++++++ .../rest/DeviceStageMonitorController.java | 27 ++++++++++ .../service/DeviceStageMonitorService.java | 18 +++++++ .../impl/DeviceStageMonitorServiceImpl.java | 54 +++++++++++++++++++ acs/qd/src/views/acs/device/index.vue | 18 +++---- acs/qd/src/views/monitor/logback/index.vue | 19 +++++-- 6 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java new file mode 100644 index 0000000..2cc1e37 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/DeviceStageMonitor.java @@ -0,0 +1,22 @@ +package org.nl.acs.monitor; + +import com.alibaba.fastjson.JSONObject; + +/** + * @Author: lyd + * @Description: 设备监控服务 + * @Date: 2022-08-17 + */ +public interface DeviceStageMonitor { + /** + * 根据设备获取设备状态(中文名:如故障、联机等) + * @return + */ + public JSONObject getDeviceStatusName(); + + /** + * 根据舞台数据修改设备驱动状态 + * @param data + */ + public void setDeviceStatus(JSONObject data); +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java new file mode 100644 index 0000000..233c892 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/rest/DeviceStageMonitorController.java @@ -0,0 +1,27 @@ +package org.nl.acs.monitor.rest; + +import com.alibaba.fastjson.JSONArray; +import io.swagger.annotations.ApiOperation; +import org.nl.annotation.Log; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @Author: lyd + * @Description: + * @Date: 2022-08-17 + */ +public class DeviceStageMonitorController { + + + +// @PostMapping("/getDeviceByCodes") +// @Log("获取舞台设备信息") +// @ApiOperation("获取舞台设备信息") +// public ResponseEntity getDeviceByCodes(@RequestBody String json) throws Exception{ +// JSONArray jsonArray = JSONArray.parseArray(json); +// return new ResponseEntity<>(stageService.getDeviceByCodes(jsonArray), HttpStatus.OK); +// } +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java new file mode 100644 index 0000000..485f6a0 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/DeviceStageMonitorService.java @@ -0,0 +1,18 @@ +package org.nl.acs.monitor.service; + +import com.alibaba.fastjson.JSONArray; + +/** + * @Author: lyd + * @Description: 取设备舞台监控数据 + * @Date: 2022-08-17 + */ +public interface DeviceStageMonitorService { + /** + * 取设备舞台监控数据 + * + * @param jsonArray 前端传来设备编号和节点的id + * @return + */ + public JSONArray getData(JSONArray jsonArray); +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java new file mode 100644 index 0000000..25efbd6 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/monitor/service/impl/DeviceStageMonitorServiceImpl.java @@ -0,0 +1,54 @@ +package org.nl.acs.monitor.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.monitor.service.DeviceStageMonitorService; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.springframework.stereotype.Service; + +/** + * @Author: lyd + * @Description: + * @Date: 2022-08-17 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService { + private final DeviceAppService deviceAppService; + + + @Override + public JSONArray getData(JSONArray jsonArray) { + JSONArray arr = new JSONArray(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject obj = new JSONObject(); + JSONObject js = jsonArray.getJSONObject(i); + String device_code = js.getString("device_code"); + + if (ObjectUtil.isEmpty(device_code)) continue; + + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isNull(device)) continue; + + + JSONObject json = new JSONObject(); + if (device.getDeviceDriver() instanceof DeviceStageMonitor) { + DeviceStageMonitor monitorService = (DeviceStageMonitor) device.getDeviceDriver(); + json = monitorService.getDeviceStatusName(); + } + + obj.put("data", json); + obj.put("device_code", js.get("device_code")); + obj.put("id", js.getString("id")); // 设备不存在就只保留id,方便前端查看 + arr.add(obj); + } + + return arr; + } +} diff --git a/acs/qd/src/views/acs/device/index.vue b/acs/qd/src/views/acs/device/index.vue index 080ccbe..daafed9 100644 --- a/acs/qd/src/views/acs/device/index.vue +++ b/acs/qd/src/views/acs/device/index.vue @@ -139,15 +139,15 @@ - - - - - - - - - + + + + + + + + +