From ba2abf26af0633046d0ac25d966c326c83f71bd6 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 10 二月 2026 16:49:37 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 368 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 316 insertions(+), 52 deletions(-)
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 a4aaea2..2356ae6 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -10,23 +10,29 @@
import com.zy.asrs.domain.enums.LedErrorAreaType;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.entity.*;
+import com.zy.asrs.entity.param.InboundTaskApplyParam;
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.*;
import com.zy.common.model.LocTypeDto;
+import com.zy.common.model.MatDto;
import com.zy.common.model.SearchLocParam;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
+import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
+import com.zy.common.utils.News;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.cache.*;
import com.zy.core.enums.*;
import com.zy.core.model.*;
import com.zy.core.model.command.CrnCommand;
+import com.zy.core.model.command.LedCommand;
import com.zy.core.model.protocol.*;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
+import com.zy.core.thread.LedThread;
import com.zy.core.thread.RgvThread;
import com.zy.core.thread.SiemensDevpThread;
import com.zy.system.entity.license.LicenseVerify;
@@ -40,6 +46,7 @@
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
/**
* 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔�
@@ -61,6 +68,8 @@
@Autowired
private WrkDetlService wrkDetlService;
@Autowired
+ private BasDevpOptService basDevpOptService;
+ @Autowired
private LocMastService locMastService;
@Autowired
private BasCrnpService basCrnpService;
@@ -74,6 +83,8 @@
private BasDevpPositionService basDevpPositionService;
@Autowired
private TaskWrkService taskWrkService;
+ @Autowired
+ private OpenService openService;
@Value("${wms.url}")
private String wmsUrl;
@@ -129,16 +140,6 @@
if (barcodeThread == null) {
continue;
}
- String barcode = barcodeThread.getBarcode();
-
- if (!Cools.isEmpty(barcode)) {
-// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
- if ("00000000".endsWith(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
- continue;
- }
- } else {
- continue;
- }
// 鑾峰彇鍏ュ簱绔欎俊鎭�
// SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -148,6 +149,17 @@
continue;
} else {
staProtocol = staProtocol.clone();
+ }
+
+ String barcode = barcodeThread.getBarcode();
+
+ if (!Cools.isEmpty(barcode)) {
+// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+ if ("00000000".endsWith(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
+ continue;
+ }
+ } else {
+ continue;
}
// 灏哄妫�娴嬪紓甯�
@@ -183,6 +195,15 @@
}
// 閫�鍥�
if (back) {
+ barcodeThread.setBarcode("");
+ // 鑾峰彇宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(3);
+
+ staProtocol.setWorkNo(workNo);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
+
+ devpThread.setPakMk(staProtocol.getSiteId(), false,201);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
// led 寮傚父鏄剧ず
LedErrorThreadUtil.ledErrorThread(errMsg,inSta.getLed(), LedErrorAreaType.FOUR_BARCODE.getDesc());
continue;
@@ -240,46 +261,100 @@
try {
- LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
-
- SearchLocParam param = new SearchLocParam();
- param.setBarcode(barcode);
- param.setIoType(1);
- param.setSourceStaNo(inSta.getStaNo());
- param.setLocType1(locTypeDto.getLocType1());
+ // 鏇挎崲涓烘柊鐨勪换鍔$敵璇锋帴鍙�
+ InboundTaskApplyParam applyParam = new InboundTaskApplyParam();
+ applyParam.setBarcode(barcode);
+ applyParam.setStationCode(String.valueOf(inSta.getStaNo()));
+ applyParam.setStatus(1); // 1:婊℃澘
+
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
- .setPath("/rpc/pakin/loc/v1")
- .setJson(JSON.toJSONString(param))
+ .setPath("/inboundTaskApply")
+ .setJson(JSON.toJSONString(applyParam))
.build()
.doPost();
+
+ // 瑙f瀽鍝嶅簲锛屽彧纭鐢宠鏄惁鎴愬姛
JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
- StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-
-// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-
-
- barcodeThread.setBarcode("");
- staProtocol.setWorkNo(dto.getWorkNo());
-
-// if(Cools.isEmpty(dto.getRgvNo()) || dto.getRgvNo() <= 0) {
-// staProtocol.setStaNo(607);//607
-// } else {//濡傛灉瀛樺湪RGV缂栧彿锛岃鏄庨渶瑕丷GV鎺ラ┏锛屽厛涓嬪彂浠诲姟鍒癛GV婧愮珯
- staProtocol.setStaNo(dto.getRgvSstaNo().shortValue());
-// }
-
- devpThread.setPakMk(staProtocol.getSiteId(), false,283);
+ if (jsonObject != null && jsonObject.getInteger("code") != null && jsonObject.getInteger("code") == 200) {
+ log.info("鍏ュ簱浠诲姟鐢宠鎴愬姛锛岀瓑寰匴MS涓嬪彂浠诲姟銆傛潯鐮侊細{}锛岀珯鐐癸細{}", barcode, inSta.getStaNo());
+ staProtocol.setStaNo((short)0);
+ staProtocol.setWorkNo(0);//璁剧疆涓�9998绛夊緟涓婁綅鏈轰笅鍙戜换鍔�/9997鏄┖鏉垮叆搴撳垽鏂紝寰呬笅鍙戞椂涔熷啓鍏�9998
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
LedErrorThreadUtil.ledErrorThread("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣鍙凤細"+inSta.getStaNo(),inSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
+ Thread.sleep(300);
+ StaProtocol staProtocol2 = devpThread.getStation().get(inSta.getStaNo());
+ if (staProtocol2 == null) {
+ continue;
+ } else {
+ staProtocol2 = staProtocol2.clone();
+ }
+ staProtocol2.setStaNo(inSta.getStaNo().shortValue());
+ staProtocol2.setWorkNo(9998);//璁剧疆涓�9998绛夊緟涓婁綅鏈轰笅鍙戜换鍔�/9997鏄┖鏉垮叆搴撳垽鏂紝寰呬笅鍙戞椂涔熷啓鍏�9998
+ boolean result2 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol2));
+ if (!result2) {
+ LedErrorThreadUtil.ledErrorThread("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣鍙凤細"+inSta.getStaNo(),inSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+
} else {
+ // // 鑾峰彇宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(3);
+
+ staProtocol.setWorkNo(workNo);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
+
+ devpThread.setPakMk(staProtocol.getSiteId(), false,201);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
// led 寮傚父鏄剧ず
LedErrorThreadUtil.ledErrorThread("鍏ュ簱璇锋眰澶辫触"+jsonObject.getInteger("code"),inSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/inboundTaskApply", JSON.toJSONString(applyParam), response);
}
+
+ // 鍘熸湁閫昏緫娉ㄩ噴鎺�
+// LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
+//
+// SearchLocParam param = new SearchLocParam();
+// param.setBarcode(barcode);
+// param.setIoType(1);
+// param.setSourceStaNo(inSta.getStaNo());
+// param.setLocType1(locTypeDto.getLocType1());
+// String response = new HttpHandler.Builder()
+// .setUri(wmsUrl)
+// .setPath("/rpc/pakin/loc/v1")
+// .setJson(JSON.toJSONString(param))
+// .build()
+// .doPost();
+// JSONObject jsonObject = JSON.parseObject(response);
+// if (jsonObject.getInteger("code").equals(200)) {
+// StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+//
+// barcodeThread.setBarcode("");
+// staProtocol.setWorkNo(dto.getWorkNo());
+// staProtocol.setStaNo(wrkMast.getStaNoSou$().shortValue());
+//
+// devpThread.setPakMk(staProtocol.getSiteId(), false,283);
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// if (!result) {
+// LedErrorThreadUtil.ledErrorThread("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣鍙凤細"+inSta.getStaNo(),inSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
+// throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+// }
+// } else {
+// // 鑾峰彇宸ヤ綔鍙�
+// int workNo = commonService.getWorkNo(3);
+//
+// staProtocol.setWorkNo(workNo);
+// staProtocol.setStaNo(inSta.getBackSta().shortValue());
+//
+// devpThread.setPakMk(staProtocol.getSiteId(), false,201);
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// // led 寮傚父鏄剧ず
+// LedErrorThreadUtil.ledErrorThread("鍏ュ簱璇锋眰澶辫触"+jsonObject.getInteger("code"),inSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
+// log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+// }
} catch (Exception e) {
e.printStackTrace();
@@ -309,36 +384,35 @@
}
// 绔欑偣鏉′欢鍒ゆ柇
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
- && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 9000 && staProtocol.getWorkNo() <= 9999) || staProtocol.getWorkNo()==0) && staProtocol.isPakMk()) {
+ && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 9000 && staProtocol.getWorkNo() <= 9997) || staProtocol.getWorkNo()==0) && staProtocol.isPakMk()) {
try {
LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
- SearchLocParam param = new SearchLocParam();
- param.setIoType(10);
- param.setSourceStaNo(emptyInSta.getStaNo());
- param.setLocType1(locTypeDto.getLocType1());
+ InboundTaskApplyParam applyParam = new InboundTaskApplyParam();
+ applyParam.setBarcode(null);
+ applyParam.setStationCode(String.valueOf(emptyInSta.getStaNo()));
+ applyParam.setStatus(0); // 1:婊℃澘
+
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
- .setPath("/rpc/pakin/loc/v1")
- .setJson(JSON.toJSONString(param))
+ .setPath("/inboundTaskApply")
+ .setJson(JSON.toJSONString(applyParam))
.build()
.doPost();
- JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
- StartupDto dto = jsonObject.getObject("data", StartupDto.class);
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(dto.getWorkNo());
- staProtocol.setStaNo(dto.getStaNoSou$(dto.getStaNo(),staProtocol.getSiteId()).shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false,4087);
+ // 瑙f瀽鍝嶅簲锛屽彧纭鐢宠鏄惁鎴愬姛
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject != null && jsonObject.getInteger("code") != null && jsonObject.getInteger("code") == 200) {
+ log.info("鍏ュ簱浠诲姟鐢宠鎴愬姛锛岀瓑寰匴MS涓嬪彂浠诲姟锛岀珯鐐癸細{}",emptyInSta.getStaNo());
+ staProtocol.setWorkNo(9998);//璁剧疆涓�9998绛夊緟涓婁綅鏈轰笅鍙戜换鍔�
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
LedErrorThreadUtil.ledErrorThread("鏇存柊plc绔欑偣淇℃伅澶辫触!绔欑偣鍙凤細"+emptyInSta.getStaNo(),emptyInSta.getLed(), LedErrorAreaType.ONE_OTHER.getDesc());
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
} else {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/inboundTaskApply", JSON.toJSONString(applyParam), response);
}
} catch (Exception e) {
e.printStackTrace();
@@ -517,6 +591,10 @@
if (wrkMastMapper.updateById(wrkMast) != 0) {
// 澶嶄綅鍫嗗灈鏈�
crnThread.setResetFlag(true);
+ if(wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107) { //鎷f枡鍑哄簱浠诲姟鐘舵�佷笂鎶ワ紝鍏朵粬涓婃姤鍦╳ms浠诲姟瀹屾垚瀹氭椂浠诲姟涓�
+ openService.reportTaskStatus(String.valueOf(wrkMast.getWrkNo()),3,1,wrkMast.getBarcode());
+ }
+
} else {
log.error("鏇存柊宸ヤ綔妗g殑宸ヤ綔鐘舵�佷负14澶辫触锛侊紒锛� [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
}
@@ -1138,6 +1216,192 @@
}
}
+
+ /**
+ * 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
+ */
+ public synchronized void ledExecute() {
+ for (LedSlave led : slaveProperties.getLed()) {
+ // 鑾峰彇杈撻�佺嚎plc绾跨▼
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
+ // 鍛戒护闆嗗悎
+ List<LedCommand> commands = new ArrayList<>();
+ // 宸ヤ綔妗i泦鍚�
+ List<WrkMast> wrkMasts = new ArrayList<>();
+ for (Integer staNo : led.getStaArr()) {
+ // 鑾峰彇鍙夎溅绔欑偣
+ StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ // 鑾峰彇宸ヤ綔妗f暟鎹�
+ WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
+ if (null == wrkMast) {
+ if(staProtocol.getWorkNo() > 9999){ //寮傚父閫�鍑�
+ String err = basDevpOptService.getErr(staProtocol.getWorkNo());
+ MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, err));
+ }
+ continue;
+ }
+ wrkMasts.add(wrkMast);
+ // 缁勮鍛戒护
+ LedCommand ledCommand = new LedCommand();
+ ledCommand.setWorkNo(wrkMast.getWrkNo());
+ ledCommand.setIoType(wrkMast.getIoType());
+ // 鍑哄簱妯″紡
+ switch (wrkMast.getIoType()) {
+ case 1:
+ ledCommand.setTitle("鍏ㄦ澘鍏ュ簱");
+ break;
+ case 10:
+ ledCommand.setTitle("绌烘澘鍏ュ簱");
+ break;
+ case 12:
+ ledCommand.setTitle("鐗╂枡琛旀帴");
+ break;
+ case 57:
+ ledCommand.setTitle("鐩樼偣鍐嶅叆搴�");
+ break;
+ case 53:
+ ledCommand.setTitle("鎷f枡鍐嶅叆搴�");
+ break;
+ case 101:
+ ledCommand.setTitle("鍏ㄦ澘鍑哄簱");
+ break;
+ case 103:
+ ledCommand.setTitle("鎷f枡鍑哄簱");
+ break;
+ case 104:
+ ledCommand.setTitle("骞舵澘鍑哄簱");
+ break;
+ case 107:
+ ledCommand.setTitle("鐩樼偣鍑哄簱");
+ break;
+ case 110:
+ ledCommand.setTitle("绌烘澘鍑哄簱");
+ ledCommand.setEmptyMk(true);
+ break;
+ default:
+ News.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
+ break;
+ }
+ ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
+ ledCommand.setStaNo(wrkMast.getStaNo());
+ ledCommand.setBarcode(wrkMast.getBarcode());
+ if(wrkMast.getIoType() == 12){
+ List<WrkDetl> wrkDetls = wrkDetlService.findByBarcode(wrkMast.getBarcode());
+ wrkDetls.forEach(wrkDetl -> {
+ Double total = 0.0;
+ EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
+ LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr()));
+ if (Cools.isEmpty(locDetl)) {
+ total = wrkDetl.getAnfme();
+ } else {
+ total = locDetl.getAnfme();
+ }
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getOrderNo(), wrkDetl.getSupp(), wrkDetl.getSku(),wrkDetl.getAnfme(),total));
+ });
+ }
+ if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
+ List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
+
+ wrkDetls.forEach(wrkDetl -> {
+ Double total = 0.0;
+ EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
+ LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr()));
+ if (Cools.isEmpty(locDetl)) {
+ total = wrkDetl.getAnfme();
+ } else {
+ total = locDetl.getAnfme();
+ }
+ if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 1) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getOrderNo(), wrkDetl.getSupp(), wrkDetl.getSku(),wrkDetl.getAnfme(),total));
+ }
+ if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getOrderNo(), wrkDetl.getSupp(), wrkDetl.getSku(),wrkDetl.getAnfme(),total));
+ }
+ if (wrkMast.getIoType() == 107) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getOrderNo(), wrkDetl.getSupp(), wrkDetl.getSku(),wrkDetl.getAnfme(),total));
+ }
+ });
+ }
+ commands.add(ledCommand);
+ }
+ Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
+ // 鑾峰彇LED绾跨▼
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
+ // 鐩稿悓宸ヤ綔鍙烽泦鍚堝垯杩囨护
+ if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
+ continue;
+ }
+ // 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
+ if (!commands.isEmpty()) {
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
+ News.error("{}鍙稬ED鏄剧ず鍐呭鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ continue;
+ }
+ }
+
+ try {
+ // 淇敼涓绘。led鏍囪
+ for (WrkMast wrkMast : wrkMasts) {
+ wrkMast.setOveMk("Y");
+ wrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+ }
+ }
+
+ // 鏇存柊绾跨▼褰撳墠宸ヤ綔鍙烽泦鍚�
+ ledThread.setWorkNos(workNos);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ }
+
+ }
+ }
+
+ /**
+ * 鍏朵粬 ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅
+ */
+ public synchronized void ledReset() {
+ for (LedSlave led : slaveProperties.getLed()) {
+ // 鑾峰彇杈撻�佺嚎plc绾跨▼
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
+ // 鍛戒护闆嗗悎
+ boolean reset = true;
+ for (Integer staNo : led.getStaArr()) {
+// System.out.println("staArr = " + staNo);
+
+ // 鑾峰彇鍙夎溅绔欑偣
+ StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (staProtocol == null) { continue; }
+ if (staProtocol.getWorkNo() != 0 || staProtocol.isErr()) {
+ reset = false;
+ break;
+ }
+ }
+ // 鑾峰彇led绾跨▼
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
+ // led鏄剧ず榛樿鍐呭
+ if (reset) {
+ if (ledThread == null) {
+ continue;
+ }
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
+ News.error("{}鍙稬ED鏄剧ず榛樿鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ }
+// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
+// News.error("{}鍙稬ED鏄剧ず榛樿鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+// }
+ }
+ }
+ }
+
/**
* 鍫嗗灈鏈�5鍒嗛挓鏃犱换鍔″垯鍥炲埌婧愮偣
*/
@@ -1169,7 +1433,7 @@
if (!WrkMastLogList.isEmpty()) {
boolean signT = false;
for (WrkMast wrkMast : WrkMastLogList){
- Date completeTime = wrkMast.getIoTime();
+ Date completeTime = wrkMast.getModiTime();
if (completeTime==null){
continue;
}
--
Gitblit v1.9.1