From 09381335e11d32e01c8067b71d897c7064ec279d Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 20 五月 2024 14:38:18 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
---
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java | 77 +++++++++++++++++++++++---------------
1 files changed, 46 insertions(+), 31 deletions(-)
diff --git a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
index 8aeeffd..3fd3a87 100644
--- a/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
+++ b/hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -34,11 +34,12 @@
* fixedDelay : 涓婁竴涓皟鐢ㄧ粨鏉熷悗鍐嶆璋冪敤鐨勫欢鏃�
*/
- @Scheduled(fixedDelay = 3000000)
+ @Scheduled(fixedDelay = 300)
public void plcLoadGlassTask() throws InterruptedException {
try {
//鑾峰彇鏄惁鏈変笂鐗囪姹�
String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue();
+ String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue();
//鍒ゆ柇寮�濮嬩笂鐗囩殑宸ョ▼鍙�
Engineering engineering = engineeringService.selectInitiate(1);
if ("1".equals(loadRequest) && engineering != null) {
@@ -60,25 +61,9 @@
}
}
- //鑾峰彇鏄惁鏈夋眹鎶�
- String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue();
- if (loadStatus != null) {
- log.info(loadStatus);
- if ("1".equals(loadStatus)) {
- log.info("鏀跺埌姹囨姤浠诲姟瀹屾垚");
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1);
- } else if ("2".equals(loadStatus)) {
- log.info("鏀跺埌姹囨姤鏈畬鎴愪换鍔�");
- //鍑忓皯宸ヤ綅鏁伴噺,鎭㈠浠诲姟鐘舵��
- overTask(loadStatus,0);
- } else if ("3".equals(loadStatus)) {
- log.info("鏀跺埌姹囨姤鐜荤拑鐮存崯");
- overTask(loadStatus,0);
- } else if("0".equals(loadStatus)){
- log.info("鏀跺埌姹囨姤娓�0鐘舵��");
- //鍑忓皯宸ヤ綅鏁伴噺,瀹屾垚浠诲姟鐘舵��
- overTask(loadStatus,100);
- }
+ if("1".equals(mesToPlc)&& "0".equals(loadRequest)){
+ //璇锋眰瀛椾负闆舵椂锛屼换鍔″瓧娓呴浂
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0);
}
//鎵ц鍚庝紤鐪�300姣
//Thread.sleep(300);
@@ -86,16 +71,46 @@
e.printStackTrace();
}
}
- public void overTask(String loadStatus,int state) throws InterruptedException {
- UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask();
- if (upPattenUsage != null) {
- log.info("鏀跺埌姹囨姤娓厈}鐘舵��",loadStatus);
- //鍑忓皯宸ヤ綅鏁伴噺
- upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState());
- //瀹屾垚涓婄墖琛ㄧ姸鎬�
- upPattenUsageService.updateUpPattenUsageState(upPattenUsage, state);
- S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0);
- }
- }
+
+ @Scheduled(fixedDelay = 300)
+ public void plcLoadGlassReport(){
+ //鑾峰彇鏄惁鏈夋眹鎶�
+ String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue();
+ if (loadStatus != null) {
+ log.info(loadStatus);
+ switch (loadStatus) {
+ case "1":
+ log.info("鏀跺埌姹囨姤浠诲姟瀹屾垚");
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1);
+ break;
+ case "2":
+ log.info("鏀跺埌姹囨姤鏈畬鎴愪换鍔�");
+ //鍑忓皯宸ヤ綅鏁伴噺,鎭㈠浠诲姟鐘舵��
+ overTask(loadStatus, 0);
+ break;
+ case "3":
+ log.info("鏀跺埌姹囨姤鐜荤拑鐮存崯");
+ overTask(loadStatus, 0);
+ break;
+ case "0":
+ log.info("鏀跺埌姹囨姤娓�0鐘舵��");
+ //鍑忓皯宸ヤ綅鏁伴噺,瀹屾垚浠诲姟鐘舵��
+ overTask(loadStatus, 100);
+ break;
+ }
+ }
+ }
+
+ public void overTask(String loadStatus, int state) {
+ UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask();
+ if (upPattenUsage != null) {
+ log.info("鏀跺埌姹囨姤娓厈}鐘舵��", loadStatus);
+ //鍑忓皯宸ヤ綅鏁伴噺
+ upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState());
+ //瀹屾垚涓婄墖琛ㄧ姸鎬�
+ upPattenUsageService.updateUpPattenUsageState(upPattenUsage, state);
+ S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0);
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0