From 5f8de1a5a3efb1227e0bc245780e406ba52ab188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Sat, 4 Feb 2023 09:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=A0=E7=9B=98=E6=9C=BA=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=92=8C=E8=A6=86=E8=86=9C=E6=9C=BA=E4=B8=8B=E6=89=98=E7=9B=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LnshFoldDiscSiteDeviceDriver.java | 39 ++++++++++++++++++- .../acs/ext/wms/rest/WmsToAcsController.java | 7 ++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java index d62ec23..f130984 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_fold_disc_site/LnshFoldDiscSiteDeviceDriver.java @@ -1,5 +1,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import lombok.Data; @@ -70,7 +72,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem private Date instruction_require_time = new Date(); private Date instruction_finished_time = new Date(); - private int instruction_require_time_out; + private int instruction_require_time_out = 3000; private int instruction_finished_time_out; String message; @@ -143,6 +145,7 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + "->" + error_time); } if (container_qty != last_container_qty) { + this.setRequireSucess(false); logServer.deviceItemValue(this.device_code,"container_qty" ,String.valueOf(container_qty)); logServer.deviceExecuteLog(this.device_code,"","","信号container_qty:" + last_container_qty + "->" + container_qty); } @@ -181,7 +184,11 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem log.debug("设备运转模式:等待工作"); break; case 2: - + int max_emptypalletnum = Integer.parseInt(this.getDevice().getExtraValue().get("max_emptypalletnum").toString()); + //当前数量等于最大数量,则生成搬运任务 + if (!requireSucess && container_qty == max_emptypalletnum) { + putStorage(); + } break; case 3: if (!requireSucess) { @@ -259,4 +266,32 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem } + /** + * 申请入库 + * + * @param + */ + public synchronized boolean putStorage() { + 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(); + json.put("device_code",this.device_code); + json.put("qty", container_qty); + json.put("type","3"); + 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(this.mode); + this.setRequireSucess(true); + } + } + return true; + } + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 081f5bc..16fb105 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -77,4 +77,11 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK); } + @PostMapping("/queryTray") + @Log("覆膜机下托盘") + @ApiOperation("覆膜机下托盘") + public ResponseEntity queryTray(@RequestBody String whereJson) { + return new ResponseEntity<>(wmstoacsService.queryTray(whereJson), HttpStatus.OK); + } + }