From f0a87eee6f609121e595e10c30bef4c8c4f9907d Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期四, 24 四月 2025 10:15:44 +0800
Subject: [PATCH] 初步调试
---
/dev/null | 272 --------------------------------------
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 56 +++++++
src/main/java/com/zy/core/thread/impl/NormalLedThread.java | 2
src/main/java/com/zy/asrs/controller/TVController.java | 68 +++++++--
src/main/resources/application.yml | 8
5 files changed, 109 insertions(+), 297 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/TVController.java b/src/main/java/com/zy/asrs/controller/TVController.java
index d4ba63c..27109c92 100644
--- a/src/main/java/com/zy/asrs/controller/TVController.java
+++ b/src/main/java/com/zy/asrs/controller/TVController.java
@@ -10,7 +10,6 @@
import com.zy.asrs.domain.dto.AxisBean;
import com.zy.asrs.domain.dto.WorkChartAxis;
import com.zy.asrs.domain.dto.LocChartPie;
-import com.zy.asrs.domain.dto.WrkDetl;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.BasShuttleErr;
@@ -26,11 +25,14 @@
import com.zy.common.utils.HttpHandler;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
+import com.zy.core.model.LedSlave;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.command.LedCommand;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.LedThread;
import com.zy.core.thread.ShuttleThread;
+import com.zy.core.thread.impl.NormalLedThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
@@ -223,7 +225,17 @@
*/
@GetMapping("/led")
public R monitorLed(@RequestParam("ledId") Integer ledId) {
- BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", ledId));
+ int dev_no = 1012;
+ if (ledId == 1) {
+ dev_no = 1012;
+ } else if (ledId == 2) {
+ dev_no = 1014;
+ } else if (ledId == 3) {
+ dev_no = 1022;
+ } else if (ledId == 4) {
+ dev_no = 1025;
+ }
+ BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", dev_no));
if (Cools.isEmpty(basDevp)) {
return R.ok();
}
@@ -308,22 +320,48 @@
*/
@GetMapping("/led/error")
public R monitorLedError(@RequestParam("ledId") Integer ledId) {
- BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", ledId));
- if (Cools.isEmpty(basDevp)) {
- return R.ok();
+ String errorMsg = "";
+ for (LedSlave slave : slaveProperties.getLed()) {
+ if (slave.getId() == ledId) {
+ NormalLedThread ledThread = (NormalLedThread) SlaveConnection.get(SlaveType.Led, slave.getId());
+ if (null != ledThread) {
+ errorMsg = ledThread.getErrorMsg().toString();
+ }
+ }
}
- if (Cools.isEmpty(basDevp.getArea())) {
- return R.ok();
- }
- if (basDevp.getLoading().equals("N")) {
- basDevp.setArea("");
- basDevpService.updateById(basDevp);
- return R.ok();
- }
- String errorMsg = basDevp.getArea();
-
return R.ok().add(errorMsg);
}
+ /**
+ * 寮傚父閫氱煡
+ */
+// @GetMapping("/led/error")
+// public R monitorLedError(@RequestParam("ledId") Integer ledId) {
+// int dev_no = 1012;
+// if (ledId == 1) {
+// dev_no = 1012;
+// } else if (ledId == 2) {
+// dev_no = 1014;
+// } else if (ledId == 3) {
+// dev_no = 1022;
+// } else if (ledId == 4) {
+// dev_no = 1025;
+// }
+// BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", dev_no));
+// if (Cools.isEmpty(basDevp)) {
+// return R.ok();
+// }
+// if (Cools.isEmpty(basDevp.getArea())) {
+// return R.ok();
+// }
+// if (basDevp.getLoading().equals("N")) {
+// basDevp.setArea("");
+// basDevpService.updateById(basDevp);
+// return R.ok();
+// }
+// String errorMsg = basDevp.getArea();
+//
+// return R.ok().add(errorMsg);
+// }
/**
* 璁惧寮傚父閫氱煡
diff --git a/src/main/java/com/zy/asrs/domain/dto/WrkDetl.java b/src/main/java/com/zy/asrs/domain/dto/WrkDetl.java
deleted file mode 100644
index c6ace7e..0000000
--- a/src/main/java/com/zy/asrs/domain/dto/WrkDetl.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package com.zy.asrs.domain.dto;
-
-import com.baomidou.mybatisplus.annotations.TableField;
-import com.baomidou.mybatisplus.annotations.TableName;
-import com.core.common.Cools;
-import com.core.common.SpringUtils;
-import com.zy.common.utils.Synchro;
-import com.zy.system.entity.User;
-import com.zy.system.service.UserService;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-@Data
-public class WrkDetl implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 宸ヤ綔鍙�
- */
- @ApiModelProperty(value= "宸ヤ綔鍙�")
- private Integer wrkNo;
-
- /**
- * 宸ヤ綔鏃堕棿
- */
- @ApiModelProperty(value= "宸ヤ綔鏃堕棿")
- private Date ioTime;
-
- /**
- * 鏁伴噺
- */
- @ApiModelProperty(value= "鏁伴噺")
- private Double anfme;
-
- /**
- * 鎵樼洏鏉$爜
- */
- @ApiModelProperty(value= "鎵樼洏鏉$爜")
- private String zpallet;
-
- /**
- * 鐗╂枡
- */
- @ApiModelProperty(value= "鍟嗗搧缂栧彿")
- private String matnr;
-
- /**
- * 鐗╂枡鎻忚堪
- */
- @ApiModelProperty(value= "鍟嗗搧鍚嶇О")
- private String maktx;
-
- /**
- * 鎵瑰彿
- */
- @ApiModelProperty(value= "鎵瑰彿")
- private String batch;
-
- /**
- * 鍗曟嵁缂栧彿
- */
- @ApiModelProperty(value= "鍗曟嵁缂栧彿")
- private String orderNo;
-
- /**
- * 瑙勬牸
- */
- @ApiModelProperty(value= "瑙勬牸")
- private String specs;
-
- /**
- * 鍨嬪彿
- */
- @ApiModelProperty(value= "鍨嬪彿")
- private String model;
-
- /**
- * 棰滆壊
- */
- @ApiModelProperty(value= "棰滆壊")
- private String color;
-
- /**
- * 鍝佺墝
- */
- @ApiModelProperty(value= "鍝佺墝")
- private String brand;
-
- /**
- * 鍗曚綅
- */
- @ApiModelProperty(value= "鍗曚綅")
- private String unit;
-
- /**
- * 鍗曚环
- */
- @ApiModelProperty(value= "鍗曚环")
- private Double price;
-
- /**
- * sku
- */
- @ApiModelProperty(value= "sku")
- private String sku;
-
- /**
- * 鍗曚綅閲�
- */
- @ApiModelProperty(value= "鍗曚綅閲�")
- private Double units;
-
- /**
- * 鏉$爜
- */
- @ApiModelProperty(value= "鏉$爜")
- private String barcode;
-
- /**
- * 浜у湴
- */
- @ApiModelProperty(value= "浜у湴")
- private String origin;
-
- /**
- * 鍘傚
- */
- @ApiModelProperty(value= "鍘傚")
- private String manu;
-
- /**
- * 鐢熶骇鏃ユ湡
- */
- @ApiModelProperty(value= "鐢熶骇鏃ユ湡")
- @TableField("manu_date")
- private String manuDate;
-
- /**
- * 鍝侀」鏁�
- */
- @ApiModelProperty(value= "鍝侀」鏁�")
- private String itemNum;
-
- /**
- * 瀹夊叏搴撳瓨閲�
- */
- @ApiModelProperty(value= "瀹夊叏搴撳瓨閲�")
- private Double safeQty;
-
- /**
- * 閲嶉噺
- */
- @ApiModelProperty(value= "閲嶉噺")
- private Double weight;
-
- /**
- * 闀垮害
- */
- @ApiModelProperty(value= "闀垮害")
- private Double length;
-
- /**
- * 浣撶Н
- */
- @ApiModelProperty(value= "浣撶Н")
- private Double volume;
-
- /**
- * 涓夋柟缂栫爜
- */
- @ApiModelProperty(value= "涓夋柟缂栫爜")
- private String threeCode;
-
- /**
- * 渚涘簲鍟�
- */
- @ApiModelProperty(value= "渚涘簲鍟�")
- private String supp;
-
- /**
- * 渚涘簲鍟嗙紪鐮�
- */
- @ApiModelProperty(value= "渚涘簲鍟嗙紪鐮�")
- private String suppCode;
-
- /**
- * 鏄惁鎵规 1: 鏄� 0: 鍚�
- */
- @ApiModelProperty(value= "鏄惁鎵规 1: 鏄� 0: 鍚� ")
- private Integer beBatch;
-
- /**
- * 淇濊川鏈�
- */
- @ApiModelProperty(value= "淇濊川鏈�")
- private String deadTime;
-
- /**
- * 棰勮澶╂暟
- */
- @ApiModelProperty(value= "棰勮澶╂暟")
- private Integer deadWarn;
-
- /**
- * 鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗
- */
- @ApiModelProperty(value= "鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 ")
- private Integer source;
-
- /**
- * 瑕佹眰妫�楠� 1: 鏄� 0: 鍚�
- */
- @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄� 0: 鍚� ")
- private Integer inspect;
-
- /**
- * 鍗遍櫓鍝� 1: 鏄� 0: 鍚�
- */
- @ApiModelProperty(value= "鍗遍櫓鍝� 1: 鏄� 0: 鍚� ")
- private Integer danger;
-
- /**
- * 淇敼浜哄憳
- */
- @ApiModelProperty(value= "淇敼浜哄憳")
- private Long modiUser;
-
- /**
- * 淇敼鏃堕棿
- */
- @ApiModelProperty(value= "淇敼鏃堕棿")
- private Date modiTime;
-
- /**
- * 鍒涘缓鑰�
- */
- @ApiModelProperty(value= "鍒涘缓鑰�")
- private Long appeUser;
-
- /**
- * 娣诲姞鏃堕棿
- */
- @ApiModelProperty(value= "娣诲姞鏃堕棿")
- private Date appeTime;
-
- /**
- * 澶囨敞
- */
- @ApiModelProperty(value= "澶囨敞")
- private String memo;
-
- @ApiModelProperty(value= "棰勭暀1")
- private String temp1;
- @ApiModelProperty(value= "棰勭暀1")
- private String temp2;
- @ApiModelProperty(value= "棰勭暀1")
- private String temp3;
- @ApiModelProperty(value= "棰勭暀1")
- private String temp4;
-
-
-
- public void sync(Object source) {
- Synchro.Copy(source, this);
- }
-
-}
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index cee0f9d..5360e02 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -34,6 +34,7 @@
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.DevpThread;
+import com.zy.core.thread.LedThread;
import com.zy.core.thread.LiftThread;
import com.zy.core.thread.ShuttleThread;
import com.zy.core.thread.impl.FyDevpThread;
@@ -177,12 +178,55 @@
staProtocol = staProtocol.clone();
}
Short workNo = staProtocol.getWorkNo();
-
-// // led 寮傚父鏄剧ず
-// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-// if (ledThread != null) {
-// ledThread.error(errMsg);
-// }
+ // 灏哄妫�娴嬪紓甯�
+ boolean back = false;
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ String errMsg = "";
+ if (staProtocol.isFrontErr()) {
+ errMsg = "鍓嶈秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isBackErr()) {
+ errMsg = "鍚庤秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isHighErr()) {
+ errMsg = "楂樿秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isLeftErr()) {
+ errMsg = "宸﹁秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isRightErr()) {
+ errMsg = "鍙宠秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isWeightErr()) {
+ errMsg = "瓒呴噸";
+ back = true;
+ }
+ if (!back && staProtocol.isBarcodeErr()) {
+ errMsg = "鎵爜澶辫触";
+ log.error("鐗╂枡鐮佹壂鐮佸け璐�");
+ back = true;
+ }
+ // 閫�鍥�
+ if (back) {
+ if (!staProtocol.isLoading()) {
+ continue;
+ }
+ if (!staProtocol.isPakMk()) {
+ continue;
+ }
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
+ }
+ }
+ if (ledThread != null) {
+ ledThread.error(errMsg);
+ }
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
if (staProtocol.isAutoing() && staProtocol.isLoading() && isInEnable(devpThread, inSta.getStaNo()) && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) && staProtocol.isPakMk()) {
String barcode = staProtocol.getBarcode();
diff --git a/src/main/java/com/zy/core/thread/impl/NormalLedThread.java b/src/main/java/com/zy/core/thread/impl/NormalLedThread.java
index 6921595..883155c 100644
--- a/src/main/java/com/zy/core/thread/impl/NormalLedThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NormalLedThread.java
@@ -8,12 +8,14 @@
import com.zy.core.model.Task;
import com.zy.core.model.command.LedCommand;
import com.zy.core.thread.LedThread;
+import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+@Data
@Slf4j
@SuppressWarnings("all")
public class NormalLedThread implements LedThread, Runnable {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a1979d1..d3fa179 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -116,25 +116,25 @@
# LED1
led[0]:
id: 1
- ip: 192.168.10.62
+ ip: 192.168.10.160
port: 5005
devpPlcId: ${wcs-slave.devp[0].id}
# LED2
led[1]:
id: 2
- ip: 192.168.10.63
+ ip: 192.168.10.161
port: 5005
devpPlcId: ${wcs-slave.devp[0].id}
# LED3
led[2]:
id: 3
- ip: 192.168.10.64
+ ip: 192.168.10.162
port: 5005
devpPlcId: ${wcs-slave.devp[0].id}
# LED4
led[3]:
id: 4
- ip: 192.168.10.65
+ ip: 192.168.10.163
port: 5005
devpPlcId: ${wcs-slave.devp[0].id}
--
Gitblit v1.9.1