From 3d2a161ca245484a3162b439cadf348b2f3a75fa Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期三, 23 四月 2025 15:06:37 +0800
Subject: [PATCH] 初始化
---
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java | 4
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 675 +++++---------------------------
src/main/resources/mapper/LocMastMapper.xml | 2
src/main/resources/mapper/WrkDetlMapper.xml | 2
src/main/java/com/zy/core/thread/SiemensCrnThread.java | 63 +-
src/main/java/com/zy/asrs/entity/TestMast.java | 4
src/main/java/com/zy/asrs/utils/Utils.java | 17
src/main/java/com/zy/asrs/mapper/LocMastMapper.java | 2
src/main/java/com/zy/core/MainProcess.java | 6
src/main/java/com/zy/asrs/entity/LocMast.java | 4
src/main/java/com/zy/asrs/service/LocMastService.java | 3
src/main/java/com/zy/core/thread/SiemensDevpThread.java | 353 +++++++----------
src/main/resources/application.yml | 52 -
13 files changed, 335 insertions(+), 852 deletions(-)
diff --git a/src/main/java/com/zy/asrs/entity/LocMast.java b/src/main/java/com/zy/asrs/entity/LocMast.java
index 0d4f47a..68917a5 100644
--- a/src/main/java/com/zy/asrs/entity/LocMast.java
+++ b/src/main/java/com/zy/asrs/entity/LocMast.java
@@ -189,9 +189,9 @@
private Integer fireStatus=0;
/**
- * 浜у搧鐘舵�亄0:鏃�,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;5.闈欑疆涓�;6:闈欑疆瀹屾垚;7:鏆傚仠娴嬭瘯;8:绱ф�ュ嚭搴�;}
+ * 浜у搧鐘舵�亄0:绌洪棽,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;}
*/
- @ApiModelProperty(value= "浜у搧鐘舵�亄0:鏃�,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;5.闈欑疆涓�;6:闈欑疆瀹屾垚;7:鏆傚仠娴嬭瘯;8:绱ф�ュ嚭搴�;}")
+ @ApiModelProperty(value= "浜у搧鐘舵�亄0:绌洪棽,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;}")
@TableField("pack_status")
private Integer packStatus;
diff --git a/src/main/java/com/zy/asrs/entity/TestMast.java b/src/main/java/com/zy/asrs/entity/TestMast.java
index 6b98808..3eadd4f 100644
--- a/src/main/java/com/zy/asrs/entity/TestMast.java
+++ b/src/main/java/com/zy/asrs/entity/TestMast.java
@@ -56,9 +56,9 @@
private String userId;
/**
- * 鐘舵�� 0: 寰呯敵璇� 1: 鐢宠涓� 2: 宸插鏍�;3.娴嬭瘯涓�;4
+ * 鐘舵�� 0: 鏃犺揣 1: 绛夊緟娴嬭瘯 2:娴嬭瘯涓� 3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;
*/
- @ApiModelProperty(value= "鐘舵�� 0: 寰呯敵璇� 1: 鐢宠涓� 2: 宸插鏍� 3:娴嬭瘯涓� 4:瀹屾垚")
+ @ApiModelProperty(value= "鐘舵�� 0: 鏃犺揣 1: 绛夊緟娴嬭瘯 2:娴嬭瘯涓� 3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触; ")
private Integer status;
/**
diff --git a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
index aeba308..a17e694 100644
--- a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -35,6 +35,6 @@
@Select("select count(*) as count from asr_loc_mast where 1=1 and loc_sts = 'O' and loc_type1 = #{locType1} and crn_no = #{crnNo}")
Integer selectEmptyLocCount(@Param("locType1") Short locType1, @Param("crnNo") Integer crnNo);
- LocMast selectztgx(@Param("sts1") String sts1,@Param("sts2") String sts2,@Param("count") Integer count);
+ LocMast selectztgx(@Param("sts1") String sts1,@Param("count") Integer count);
}
diff --git a/src/main/java/com/zy/asrs/service/LocMastService.java b/src/main/java/com/zy/asrs/service/LocMastService.java
index 9b88ca4..f48088d 100644
--- a/src/main/java/com/zy/asrs/service/LocMastService.java
+++ b/src/main/java/com/zy/asrs/service/LocMastService.java
@@ -49,9 +49,8 @@
/**
* 鏌ヨ鍦ㄥ簱鍜岄绾﹀嚭搴撶殑娴嬭瘯搴撲綅
* @param sts1 F
- * @param sts2 R
* @param count i
* @return
*/
- LocMast selectztgx(String sts1,String sts2,Integer count);
+ LocMast selectztgx(String sts1,Integer count);
}
diff --git a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
index e11951b..5a75681 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -53,7 +53,7 @@
return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1;
}
@Override
- public LocMast selectztgx(String sts1,String sts2,Integer count){
- return this.baseMapper.selectztgx(sts1,sts2,count);
+ public LocMast selectztgx(String sts1,Integer count){
+ return this.baseMapper.selectztgx(sts1,count);
}
}
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 e5d2421..936b175 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -48,10 +48,7 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import springfox.documentation.spring.web.json.Json;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
@@ -152,59 +149,32 @@
errMsg = errMsg + "鎵爜澶辫触";
back = true;
}
- // 閫�鍥�
- if (back) {
- // led 寮傚父鏄剧ず
- LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
- if (ledThread != null) {
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
- }
- continue;
- }
String barcode = barcodeThread.getBarcode();
- if (!Cools.isEmpty(barcode) && !barcode.equals("00000000")) {
- log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
- if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
- continue;
- }
- } else {
- // led 寮傚父鏄剧ず
-// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-// if (ledThread != null) {
-// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
-// MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
-// }
- continue;
- }
-
if (staProtocol.isAutoing() && staProtocol.isLoading()
&& staProtocol.isInEnable()
- && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() >= 9992 && staProtocol.getWorkNo() <= 9999)
+ && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999)
&& staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
-// if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-// //鏉$爜涓虹┖鎴栬�呬笉绗﹀悎锛岄��搴撳埌172绔欑偣
-// staProtocol.setWorkNo((short)9999);
-// staProtocol.setStaNo((short)172);
-// devpThread.setPakMk(staProtocol.getSiteId(), false);
-// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-// if (!result) {
-// throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-// }
-// continue;
-// }
+
+ // 閫�鍥�
+ if (back ||(!Cools.isEmpty(barcode) && barcode.equals("00000000"))) {
+ staProtocol.setWorkNo((short) 9999);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+
+ // led 寮傚父鏄剧ず
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ if (ledThread != null) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
+ }
+ continue;
+ }
// 鍒ゆ柇閲嶅宸ヤ綔妗�
WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
if (wrkMast != null) {
News.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
- continue;
- }
- // 鑾峰彇鍏ュ簱閫氱煡妗�
- List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N"));
- if (waitPakins.isEmpty()) {
- log.error("鏃犳鍏ュ簱鏉$爜鏁版嵁銆傛潯鐮佸彿={}", barcode);
continue;
}
@@ -216,7 +186,6 @@
param.setIoType(1);
param.setSourceStaNo(inSta.getStaNo());
param.setLocType1(locTypeDto.getLocType1());
-// param.setPackNo(pack);
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/loc/v1")
@@ -809,9 +778,6 @@
staProtocol = staProtocol.clone();
}
-// // 鍏ュ嚭搴撴ā寮忓垽鏂�
-// if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; }
-
// 鏌ヨ绔欑偣璇︾粏淇℃伅
BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
if (staDetl == null) {
@@ -831,11 +797,6 @@
// 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
&& staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
- //娴嬭瘯搴撲綅鍑哄簱蹇呴』瑕佹寜鍚姩鎸夐挳鎵嶈兘鍑哄簱
- if ((wrkMast.getStaNo() == 206 || wrkMast.getStaNo() == 1000) && locMast.getCtnKind() == 0) {
- News.error("鍑哄簱 ===>> 绛夊緟鍚姩鍑哄簱鎸夐挳", wrkMast);
- continue;
- }
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
// 鍫嗗灈鏈烘帶鍒惰繃婊�
@@ -1051,30 +1012,22 @@
WrkMast wrkMast = null;
if (Cools.isEmpty(wrkMasts)) {
return;
+ }else {
+ wrkMast = wrkMasts.get(0);
}
- //鍏堟煡娴嬭瘯搴撲綅杞琌K鎴栬�匩G搴撲綅鎸変簡鎸夐挳鐨�
- for (WrkMast wm : wrkMasts) {
- LocMast sourceSta1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wm.getSourceLocNo()));
- if (!Cools.isEmpty(sourceSta1.getCtnKind())) {
- if (sourceSta1.getCtnKind() == 1) {
- wrkMast = wm;
- break;
- }
- }
- }
- //鍚庢煡绛夊緟搴撲綅杞祴璇曞簱浣�
- if (Cools.isEmpty(wrkMast)) {
- for (WrkMast wm : wrkMasts) {
- LocMast sourceSta1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wm.getSourceLocNo()));
- if (sourceSta1.getLocType1() == 3) {
- wrkMast = wm;
- }
- }
- }
- //閮芥病鏈夋弧瓒虫潯浠剁殑锛岃烦杩囩Щ搴�
- if (Cools.isEmpty(wrkMast)) {
- return;
- }
+// //鍚庢煡绛夊緟搴撲綅杞祴璇曞簱浣�
+// if (Cools.isEmpty(wrkMast)) {
+// for (WrkMast wm : wrkMasts) {
+// LocMast sourceSta1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wm.getSourceLocNo()));
+// if (sourceSta1.getLocType1() == 3) {
+// wrkMast = wm;
+// }
+// }
+// }
+// //閮芥病鏈夋弧瓒虫潯浠剁殑锛岃烦杩囩Щ搴�
+// if (Cools.isEmpty(wrkMast)) {
+// return;
+// }
// 鑾峰彇婧愬簱浣嶄俊鎭�
LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
@@ -1430,7 +1383,8 @@
* 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
*/
@Async
- public synchronized void ledExecute() {
+ public synchronized void ledExecute(Integer mark) {
+
for (LedSlave led : slaveProperties.getLed()) {
// 鑾峰彇杈撻�佺嚎plc绾跨▼
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
@@ -1441,16 +1395,18 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
- if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo()) {
+ 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 || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
if (null == wrkMast) {
continue;
}
+ log.info(""+mark+" - 0"+" - 寮�濮嬫墽琛�:鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�");
wrkMasts.add(wrkMast);
// 缁勮鍛戒护
LedCommand ledCommand = new LedCommand();
@@ -1481,39 +1437,18 @@
ledCommand.setEmptyMk(true);
break;
default:
- News.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
+ News.error(""+mark+" - 1"+" - 浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
break;
}
ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
+ ledCommand.setLocNo(wrkMast.getLocNo());
ledCommand.setStaNo(wrkMast.getStaNo());
- ledCommand.setBarcode(wrkMast.getBarcode());
+// ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
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.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
- }
- if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) {
- ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
- }
- if (wrkMast.getIoType() == 107 || wrkMast.getIoType() == 104) {
- ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(), total));
- }
- });
+ wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getSpecs())));
}
commands.add(ledCommand);
- }
- if (Cools.isEmpty(wrkMasts)) {
- continue;
}
Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
// 鑾峰彇LED绾跨▼
@@ -1522,11 +1457,32 @@
if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
continue;
}
+// 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
+// if (!commands.isEmpty()) {
+// if (led.getId() < 7) {
+// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
+// News.error(""+mark+" - 2"+" - {}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+// continue;
+// } else {
+// ledThread.setLedMk(false);
+// }
+// } else {
+// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
+// News.error(""+mark+" - 3"+" - {}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+// continue;
+// } else {
+// ledThread.setLedMk(false);
+// }
+// }
+//
+// }
// 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
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());
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
+ News.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
continue;
+ }else {
+ ledThread.setLedMk(false);
}
}
@@ -1536,6 +1492,7 @@
wrkMast.setOveMk("Y");
wrkMast.setModiTime(new Date());
if (wrkMastMapper.updateById(wrkMast) == 0) {
+ log.error(""+mark+" - 4"+" - 鏇存柊宸ヤ綔妗eけ璐�");
throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
}
}
@@ -1549,6 +1506,7 @@
}
}
+ log.info(""+mark+" - 0"+" - 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣ㄦ墽琛屽畬鎴�");
}
/**
@@ -1958,38 +1916,6 @@
}
}
- /**
- * 鍏ュ嚭搴撴ā寮忓垏鎹㈠嚱鏁�
- */
- public void ioConvert() {
- try {
- // 鏍规嵁杈撻�佺嚎plc閬嶅巻
- for (DevpSlave devp : slaveProperties.getDevp()) {
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-
- WrkMast pakout = wrkMastMapper.selectWorkingPakout();
- if (pakout != null) {
- if (devpThread.ioMode != IoModeType.PAKOUT_MODE) {
- // 鍑哄簱鍒囨崲涓�
- devpThread.ioMode = IoModeType.PAKOUT_BOOTING;
-
- WrkMast pakin = wrkMastMapper.selectWorkingPakin();
- if (pakin == null) {
- // 鍑哄簱妯″紡
- devpThread.ioMode = IoModeType.PAKOUT_MODE;
- }
- }
- } else {
- // 鍏ュ簱妯″紡
- devpThread.ioMode = IoModeType.PAKIN_MODE;
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
public void outOfDevp() {
List<WrkMast> wrkMasts = wrkMastMapper.selectPick();
for (WrkMast wrkMast : wrkMasts) {
@@ -2076,232 +2002,6 @@
}
}
- /**
- * 鏍规嵁PLC鎸夐挳娴嬭瘯銆佸畬鎴愩�佹殏鍋滀俊鍙凤紝鏇存柊testMast琛ㄤ腑status鍊硷紝浜ょ敱WMS绯荤粺澶勭悊
- */
- @Transactional
- public void packTest() {
- try {
- // 鏍规嵁杈撻�佺嚎plc閬嶅巻
- for (DevpSlave devp : slaveProperties.getDevp()) {
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- if (null != devpThread) {
- for (int i = 0; i < 48; i++) {
- int olsStatus = 0;//testMast琛ㄥ師鏉tatus鏁版嵁鐘舵��
- int newStatus = 0;//testMast琛ㄥ緟淇敼鐨剆tatus鏁版嵁鐘舵��
- short newSingle = 0; //PLC鍦板潃寰呬慨鏀圭殑鏂板��
- switch (devpThread.startSignal[i][0]) {//鏍规嵁淇″彿鏌ユ壘testMast琛ㄤ腑瀵瑰簲鐘舵�佹潯浠�,olsStatus锛宯ewStatus鏍规嵁瀹為檯娴佺▼璋冩暣
- case 0://鍒濆鐘舵�侊紝鍏ュ簱
- olsStatus = 1;//寰呮祴
- newStatus = 1;//寰呮祴
- newSingle = 1;//搴撳瓨鏈夎祫鏂欙紝瀵勫瓨鍣ㄥ湴鍧�锛�0===>>1
- break;
- case 2://鍚姩澶嶆牳淇″彿
- olsStatus = 1;//寰呮祴
- newStatus = 2;//澶嶆牳涓�
- newSingle = 3;//娴嬭瘯澶嶆牳锛屽瘎瀛樺櫒鍦板潃锛�2===>>3
- break;
- case 3://娴嬭瘯瀹屾垚
- olsStatus = 4;//娴嬭瘯瀹屾垚
- newStatus = 4;//娴嬭瘯瀹屾垚
- newSingle = 4;//锛圢G:4\OK:41锛夋祴璇曞畬鎴愶紝瀵勫瓨鍣ㄥ湴鍧�锛�3===>>4\41
- break;
- case 5://NG娴嬭瘯淇″彿
- case 6://瀹屾垚娴嬭瘯淇″彿
- case 22://瀹屾垚娴嬭瘯淇″彿
- olsStatus = 4;//娴嬭瘯瀹屾垚
- newStatus = 5;//宸茬Щ搴�
- newSingle = 0;//鍚姩绉诲簱锛屽瘎瀛樺櫒鍦板潃娓呴浂锛�5/6===>>0
- break;
- case 7://鏆傚仠淇″彿
- olsStatus = 99;//plc缁欏嚭鏆傚仠淇″彿
- newStatus = 0;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast
- newSingle = 8;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�7===>>8
- break;
- case 9://绱ф�ュ嚭搴撶‘璁ゅ厖鐢电嚎宸茬粡鎷斿嚭
- olsStatus = 99;//plc缁欏嚭鏆傚仠淇″彿
- newStatus = 0;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast
- newSingle = 8;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�9===>>8
- break;
- case 10://瑙i櫎鏆傚仠淇″彿
- olsStatus = 0;//plc缁欏嚭鏆傚仠淇″彿
- newStatus = 1;//WCS鏀跺埌鏆傚仠淇″彿鍚庯紝鏇存柊testMast
- newSingle = 0;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�10===>>0/11
- break;
- case 12://绱ф�ュ嚭搴撶‘璁ゅ厖鐢电嚎宸茬粡鎷斿嚭
- newSingle = 11;//鏆傚仠娴嬭瘯锛屽瘎瀛樺櫒鍦板潃锛�12===>>11
- break;
- case 13://鍏ュ簱鍓嶅垽鏂厖鐢电嚎鏄惁鏀惧ソ
- newSingle = 14;//绂佺敤搴撲綅锛屽瘎瀛樺櫒鍦板潃锛�13===>>14
- break;
- case 15://鍏呯數绾挎斁濂�
- newSingle = 0;//澶嶄綅锛屽瘎瀛樺櫒鍦板潃锛�12===>>0
- break;
- default:
- log.info("璇诲彇閫氶亾" + (i + 1) + "娴嬭瘯搴撲綅鎸夐挳淇″彿:涓�" + devpThread.startSignal[i][0]);
- continue;
- }
-
- TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
- .eq("channel", (i + 1)).eq("status", olsStatus));//鏌ユ壘鍘熸潵鐨勭姸鎬�
- LocMast locMast = null;
- boolean sign = false;
- switch (devpThread.startSignal[i][0]) {
- case 0:
- if (!Cools.isEmpty(testMast)) {
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("F")) {
- sign = true;
- }
- }
- break;
- case 3:
- if (!Cools.isEmpty(testMast)) {
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("F")) {
- sign = true;
- if (locMast.getPackStatus() == 3) {//娴嬭瘯瀹屾垚
- newSingle = 41;
- } else if (locMast.getPackStatus() == 4) {//娴嬭瘯澶辫触
- newSingle = 4;
- } else {
- log.info("璇诲彇閫氶亾" + (i + 1) + "娴嬭瘯搴撲綅鎸夐挳淇″彿:涓�" + devpThread.startSignal[i][0] + "閫氶亾搴撲綅pack鐘舵�佷俊鎭紓甯�" + locMast.getPackStatus());
- sign = false;
- }
- }
- }
- break;
- case 5:
- case 6:
- if (!Cools.isEmpty(testMast)) {
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("F")) {
- if (devpThread.startSignal[i][0] == 5 && locMast.getPackStatus() == 4) {
- sign = true;
- } else if (devpThread.startSignal[i][0] == 6 && locMast.getPackStatus() == 3) {
- sign = true;
- } else {
- log.error("娴嬭瘯瀹屾垚绉诲簱鏃舵寜涓嬪畬鎴愭寜閽笌娴嬭瘯缁撴灉涓嶄竴鑷�===>>[channel:{}", i + 1);
- }
- } else {
- log.error("娴嬭瘯瀹屾垚绉诲簱鏃舵湭鏌ヨ鍒版祴璇曟。妗�===>>[channel:{}", i + 1);
- }
- }
- break;
- case 2:
- if (!Cools.isEmpty(testMast)) {
- testMast.setStatus(newStatus);
- testMast.setModiTime(new Date());
- if (!testMastService.update(testMast, new EntityWrapper<TestMast>().eq("channel", (i + 1)).eq("barcode", testMast.getBarcode()))) {
- throw new CoolException("鏇存柊浜у搧娴嬭瘯鐘舵�佸け璐�");
- } else {
- sign = true;
- }
- } else {
- log.error("鍚姩娴嬭瘯鏃舵湭鏌ヨ鍒版祴璇曟。妗�===>>[channel:{}", i + 1);
- }
- break;
- case 7:
- SearchLocParam param = new SearchLocParam();
- param.setBarcode(i + 1 + "");
- String response = new HttpHandler.Builder()
- .setUri(wmsUrl)
- .setPath("/mobile/test/suspend/auth")
- .setJson(JSON.toJSONString(param))
- .build()
- .doPost();
- JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
- testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("channel", (i + 1)));
- testMast.setStatus(newStatus);
- testMast.setModiTime(new Date());
- if (!testMastService.update(testMast, new EntityWrapper<TestMast>().eq("channel", (i + 1)).eq("barcode", testMast.getBarcode()))) {
- log.error("鏇存柊浜у搧娴嬭瘯鐘舵�佸け璐�");
- }
- sign = true;
- } else {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/mobile/test/suspend/auth", JSON.toJSONString(param), response);
- }
- break;
- case 9:
- case 12:
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) {
- locMast.setPackStatus(8); //8.绱ф�ュ嚭搴�
- if (locMastService.update(locMast, new EntityWrapper<LocMast>().eq("channel", (i + 1)))) {
- log.info("搴撲綅锛歿}锛岀揣鎬ュ嚭搴擄紒", locMast.getLocNo());
- }
- } else {
- log.error("搴撲綅涓嶆槸鍦ㄥ簱鐘舵�侊紝鏃犻渶绱ф�ュ嚭搴擄紒");
- }
- sign = true;
- break;
- case 10:
- if (!Cools.isEmpty(testMast)) {
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("F")) {
- if (locMast.getFireStatus().equals(1)) {
- newSingle = 11;
- } else {
- testMast.setStatus(newStatus);
- testMast.setModiTime(new Date());
- if (!testMastService.update(testMast, new EntityWrapper<TestMast>().eq("channel", (i + 1)).eq("barcode", testMast.getBarcode()))) {
- throw new CoolException("鏇存柊浜у搧娴嬭瘯鐘舵�佸け璐�");
- } else {
- sign = true;
- }
- }
- }
- }
- sign = true;
- break;
- case 13:
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (locMast.getLocSts().equals("O")) {
- locMast.setLocSts("X");
- locMastService.update(locMast, new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- }
- sign = true;
- break;
- case 15:
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (locMast.getLocSts().equals("X")) {
- locMast.setLocSts("O");
- locMastService.update(locMast, new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- }
- sign = true;
- break;
- default:
- log.info("璇诲彇閫氶亾" + (i + 1) + "娴嬭瘯搴撲綅鎸夐挳淇″彿:涓�" + devpThread.startSignal[i][0]);
- continue;
- }
- if (sign) {
- boolean result = messageQueueOffer(i, newSingle, SlaveType.Devp, devp.getId());
- if (!result) {
- log.error("鏇存柊娴嬭瘯淇″彿澶辫触===>>[channel:{},locNo:{},barcode:{}]", i + 1, testMast.getLocNo(), testMast.getBarcode());
- } else {
- devpThread.startSignal[i][0] = newSingle;
- }
- }
- try {
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", (i + 1)));
- if (devpThread.startSignal[i][1] != locMast.getFireStatus()) {
- messageQueueOffer2(i + 1, (short) ((int) locMast.getFireStatus()), SlaveType.Devp, devp.getId());
- }
- } catch (Exception e) {
- log.error("鐏 ===>> 缁欒緭閫佺嚎鍙戦�佽鎶ュけ璐�,閫氶亾鍙凤細", i + 1);
- }
- }
-
- }
-
- }
- } catch (Exception e) {
- log.error("鍚姩娴嬭瘯 ===>> 鍚姩娴嬭瘯澶辫触", e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- }
- }
public boolean messageQueueOffer(int i, short newSingle, SlaveType devp, Integer id) {
//澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被
@@ -2320,216 +2020,73 @@
}
/**
- * 灏嗙伀璀︽姤璀︿俊鍙峰啓鍏ュ埌鍫嗗灈鏈篜LC涓�
- */
- @Transactional
- public void fierCrn() {
- try {
- for (CrnSlave crn : slaveProperties.getCrn()) {
- if (crn.getId() != 1) {
- continue;
- }
- // 鑾峰彇鍫嗗灈鏈轰俊鎭�
- CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
- CrnProtocol crnProtocol = crnThread.getCrnProtocol();
- LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("fire_status", 1));
- if (!Cools.isEmpty(locMast)) {
- //鎶ヨ淇″彿鍐欏叆1
- if (!MessageQueue.offer(SlaveType.Crn, 1, new Task(4, 1))) {
- News.error("鐏 ===>> 缁欏爢鍨涙満鍙戦�佹姤璀︿俊鍙峰け璐�");
- }
- News.error("鐏!!!!!!! ===>> 缁欏爢鍨涙満鍙戦�佹姤璀︿俊鍙锋垚鍔�");
- } else {
- //鎶ヨ淇″彿娌℃湁鍚庯紝澶嶄綅鍦板潃
- if (!MessageQueue.offer(SlaveType.Crn, 1, new Task(4, 0))) {
- News.error("鐏 ===>> 缁欏爢鍨涙満娓呴浂澶嶄綅鎶ヨ淇″彿澶辫触");
- }
- }
- }
- } catch (Exception e) {
- News.error("鐏 ===>> 缁欏爢鍨涙満鍙戦�佽鎶ュけ璐�", e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- }
- }
-
- /**
- * 103绔欑偣鏈夌墿涓嬪彂pack鐮�
- */
- @Transactional
- public void packDevp() {
- try {
- // 鏍规嵁杈撻�佺嚎plc閬嶅巻
- for (DevpSlave devp : slaveProperties.getDevp()) {
- BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 103));
- if (Cools.isEmpty(basDevp)) {
- News.error("103绔欑偣鏌ヨ澶辫触-MainServiceImpl.java-2255琛�");
- }
- if (basDevp.getAutoing().equals("Y") && basDevp.getWrkNo() > 0 && basDevp.getLoading().equals("Y")) {
- WrkDetl wrkDetl = wrkDetlService.devpPackNo(basDevp.getWrkNo());
- if (Cools.isEmpty(wrkDetl)) {
- News.error("103绔欑偣鏌ヨ澶辫触-MainServiceImpl.java-2255琛�");
- }
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, wrkDetl.getMatnr()));
- }
- }
- } catch (Exception e) {
- News.error("103 ===>> 缁欒緭閫佺嚎鍙戦�丳ack鐮佸け璐�", e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- }
- }
-
- /**
- * 鏍规嵁PLC鎸夐挳娴嬭瘯銆佸畬鎴愩�佹殏鍋滀俊鍙凤紝鏇存柊testMast琛ㄤ腑status鍊硷紝浜ょ敱WMS绯荤粺澶勭悊
+ * 鏇存柊PLC搴撲綅鐘舵�併�佹洿鏂板簱浣嶅惎鍔ㄧ姸鎬�
*/
@Transactional
public void packTest1() {
try {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
- log.info("2363琛岀▼搴忓紑濮嬭繍琛�");
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- if (null != devpThread) {
- for (int i = 0; i < 48; i++) {
-// log.info("2367琛岀▼搴忓紑濮嬭繍琛岋紝绗�"+i+"娆�");
- boolean fig = false;
+ if(null != devpThread){
+ //devpThread.startSignal[i][0]
+ //0:绌洪棽,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;
+
+ //locMast.setPackStatus
+ // "浜у搧鐘舵�亄0:绌洪棽,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;}"
+
+ //testMast.setStatus
+ //"鐘舵�� 0: 鏃犺揣 1: 绛夊緟娴嬭瘯 2:娴嬭瘯涓� 3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触; "
+ for (int i = 0; i < 24; i++){
//鏌ヨ鍦ㄥ簱鍜岄绾﹀嚭搴�
- LocMast locMast = locMastService.selectztgx("F", "R", i);
- if (!Cools.isEmpty(locMast)) {
-// log.info("2372琛岀▼搴忓紑濮嬭繍琛岋紝鏌ヨ娴嬭瘯妗�");
- TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
- .eq("loc_no", locMast.getLocNo())
- .eq("user_id", locMast.getBarcode()));
- if (Cools.isEmpty(testMast)) {
+ LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel",i+1));
+ if(!Cools.isEmpty(locMast)){
+ if (locMast.getLocSts().equals("F")){
+ TestMast testMast=testMastService.selectOne(new EntityWrapper<TestMast>()
+ .eq("loc_no",locMast.getLocNo())
+ .eq("user_id",locMast.getBarcode()));
+ if(Cools.isEmpty(testMast)){
// log.info("2377琛岀▼搴忓紑濮嬭繍琛岋紝娴嬭瘯妗d负绌猴紝璺宠繃");
- continue;
- }
-// log.info("2380琛岀▼搴忓紑濮嬭繍琛岋紝娴嬭瘯妗d笉涓虹┖锛屼笅涓�姝�");
- //devpThread.startSignal[i][0]
- //0:绌�,1:鍚姩涓�,2:宸ヤ綔涓�,3:鑷姩鏆傚仠,4:姝e父瀹屾垚(OK),5:寮傚父鍋滄(NG),6:鍦ㄧ嚎,7:绂荤嚎,8:绌洪棽
-
- //locMast.setPackStatus
- // "浜у搧鐘舵�亄0:鏃�,1:寰呮祴,2:娴嬭瘯涓�;3.娴嬭瘯瀹屾垚;4.娴嬭瘯澶辫触;5.闈欑疆涓�;6:闈欑疆瀹屾垚;7:鏆傚仠娴嬭瘯;8:绱ф�ュ嚭搴�;9:鍦ㄧ嚎;10:绂荤嚎;11:绌洪棽;}"
-
- //testMast.setStatus
- //"鐘舵�� 0: 寰呯敵璇� 1: 鐢宠涓� 2: 宸插鏍� 3:娴嬭瘯涓� 4:瀹屾垚 5:绉诲簱 6:鐏"
- if (devpThread.startSignal[i][0] == 8) {
- News.info("2390琛岀▼搴忓紑濮嬭繍琛岋紝淇敼娴嬭瘯妗g姸鎬佷负 1銆佺敵璇蜂腑锛屽紑濮嬩慨鏀瑰墠锛�" + JSON.toJSONString(testMast));
- testMast.setStatus(1);
- locMast.setPackStatus(1);
- testMast.setModiTime(new Date());
- log.info("2394琛岀▼搴忓紑濮嬭繍琛岋紝淇敼娴嬭瘯妗g姸鎬佷负 1銆佺敵璇蜂腑,淇敼鏁版嵁鍚庛�佹湭鏇存柊" + JSON.toJSONString(testMast));
- } else if (devpThread.startSignal[i][0] == 2 && locMast.getPackStatus() != 2) {
- News.info("2396琛岀▼搴忓紑濮嬭繍琛岋紝淇敼娴嬭瘯妗g姸鎬佷负 3銆佹祴璇曚腑锛屽紑濮嬩慨鏀瑰墠锛�" + JSON.toJSONString(testMast));
- testMast.setStatus(3);
- locMast.setPackStatus(2);
- testMast.setModiTime(new Date());
- log.info("2400锛屼慨鏀规祴璇曟。鐘舵�佷负 3銆佹祴璇曚腑,淇敼鏁版嵁鍚庛�佹湭鏇存柊" + JSON.toJSONString(testMast));
- //NG杞琌K闇�瑕佽繕鍘熸簮搴撲綅鍜岀洰鏍囧簱浣嶇姸鎬侊紝OK杞琋G 鍒犻櫎浠诲姟妗�
- WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
- .eq("source_loc_no", locMast.getLocNo())
- .eq("wrk_sts", 11));
- News.info("2405锛屾煡璇㈢姸鎬佷负鐢熸垚鍑哄簱id鐨勬祴璇曞畬鎴愶紙NG鎴朞K锛変换鍔℃。锛�" + JSON.toJSONString(wrkMast));
- if (!Cools.isEmpty(wrkMast)) {
- if (wrkMast.getWrkSts() == 11) {
- if (wrkMast.getIoType() == 11) {
- log.info("2409锛屽垹闄や换鍔℃。涓虹Щ搴撶殑锛�" + JSON.toJSONString(wrkMast));
- LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getLocNo()));
- locMast1.setLocSts("O");
- locMastService.update(locMast1, new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getLocNo()));
- }
- wrkMastMapper.deleteById(wrkMast);
- log.info("2415锛屽垹闄ゅ伐浣滄。" + JSON.toJSONString(wrkMast) + JSON.toJSONString(locMast));
- locMast.setLocSts("F");
- log.info("2417锛屽垹闄ゅ伐浣滄。" + JSON.toJSONString(wrkMast) + JSON.toJSONString(locMast));
- wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
- log.info("2419锛屽垹闄ゅ伐浣滄槑缁�" + wrkMast.getWrkNo());
- if (!locMastService.update(locMast, new EntityWrapper<LocMast>()
- .eq("channel", i + 1))) {
- log.error("2422淇敼娴嬭瘯搴撲綅鐘舵�佸け璐�" + locMast.getLocNo() + JSON.toJSONString(locMast));
- } else {
- log.error("2424淇敼娴嬭瘯搴撲綅鐘舵�佹垚鍔�" + locMast.getLocNo() + JSON.toJSONString(locMast));
- fig = true;
- }
- }
- }
- } else if (devpThread.startSignal[i][0] == 3) {
- locMast.setPackStatus(7);
- testMast.setModiTime(new Date());
- } else if (devpThread.startSignal[i][0] == 4 && testMast.getStatus() != 4 && locMast.getFireStatus() != 1 && testMast.getStatus() != 6) {
- locMast.setPackStatus(3);
- testMast.setStatus(4);
- testMast.setModiTime(new Date());
- testMastService.insertPackQualified(true, new Date(), testMast.getBarcode());
- } else if (devpThread.startSignal[i][0] == 5 && testMast.getStatus() != 4 && locMast.getFireStatus() != 1 && testMast.getStatus() != 6) {
- locMast.setPackStatus(4);
- testMast.setStatus(4);
- testMast.setModiTime(new Date());
- testMastService.insertPackQualified(false, new Date(), testMast.getBarcode());
- }
-// else if(devpThread.startSignal[i][0]==6||devpThread.startSignal[i][0]==7||devpThread.startSignal[i][0]==8){
-// locMast.setPackStatus(devpThread.startSignal[i][0]+3);
-// }
- //閫氶亾鍚姩鎸夐挳鐘舵�侊紝1:鍙互鍚姩鍑哄簱鎴栬�呯Щ搴擄紝0:涓嶈兘鍚姩鍑哄簱鎴栬�呯Щ搴�
- locMast.setCtnKind(devpThread.startSignal[i][2]);
- if (devpThread.startSignal[i][2] == 1) {
- if (!locMastService.update(locMast, new EntityWrapper<LocMast>()
- .eq("loc_sts", "R")
- .eq("channel", i + 1))) {
- News.error("淇敼鍚姩鎸夐挳鐘舵�侊紝娴嬭瘯搴撲綅鐘舵�佸け璐�" + locMast.getLocNo(), locMast);
- }
- } else if (!locMast.getLocSts().equals("R")) {
- if (!fig) {
- if (!locMastService.update(locMast, new EntityWrapper<LocMast>()
- .eq("loc_sts", "F")
- .eq("channel", i + 1))) {
- News.error("淇敼娴嬭瘯搴撲綅鐘舵�佸け璐�" + locMast.getLocNo(), locMast);
- }
- }
- if (!testMastService.update(testMast, new EntityWrapper<TestMast>()
- .eq("loc_no", locMast.getLocNo())
- .eq("user_id", locMast.getBarcode()))) {
- News.error("淇敼娴嬭瘯妗g姸鎬佸け璐�" + locMast.getLocNo(), locMast);
- }
- }
- }
- }
- //褰撳厖鏀剧數搴撲綅涓篛绌哄簱浣嶆椂
- //搴撲綅鐘舵�佹敼涓�8绌洪棽
- //缁橮LC鍐欐秷闃蹭俊鍙�
- for (int i = 0; i < 48; i++) {
- LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel", i + 1));
- TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
- .eq("loc_no", locMast.getLocNo())
- .eq("user_id", locMast.getBarcode()));
- if ((locMast.getLocSts().equals("O") || locMast.getLocSts().equals("S")) && devpThread.startSignal[i][0] != 8) {
- Thread.sleep(1000);
- MessageQueue.offer(SlaveType.Devp, 1, new Task(6, locMast.getChannel() - 1));
- }
- try {
- if (locMast.getFireStatus() != devpThread.startSignal[i][1]) {
- messageQueueOffer2(i, (short) ((int) locMast.getFireStatus()), SlaveType.Devp, devp.getId());
- if (Cools.isEmpty(testMast)) {
continue;
}
- if (locMast.getFireStatus() == 1) {
- testMast.setStatus(6);//鐏
- if (!testMastService.update(testMast, new EntityWrapper<TestMast>()
- .eq("loc_no", locMast.getLocNo())
- .eq("user_id", locMast.getBarcode()))) {
- News.error("淇敼娴嬭瘯妗g姸鎬佸け璐�" + locMast.getLocNo(), locMast);
+ HashMap<String,Short> hashMap=new HashMap<>();
+ if(devpThread.startSignal[i][0]!=locMast.getPackStatus()){
+ hashMap.put("locSts",locMast.getPackStatus().shortValue());
+ hashMap.put("channel",(short)(i*2));
+ MessageQueue.offer(SlaveType.Devp, 1, new Task(6,hashMap));
+ }
+ //鍚屾璁惧鐘舵��
+ if(locMast.getPackStatus()!=testMast.getStatus()){
+ testMast.setStatus(locMast.getPackStatus());
+ testMastService.updateById(testMast);
+ }
+ if(devpThread.startSignal[i][1]!=locMast.getCtnKind()){
+ locMast.setCtnKind(devpThread.startSignal[i][1]);
+ locMastService.updateById(locMast);
+ }
+ }else if(locMast.getLocSts().equals("O")){
+ //褰撳厖鏀剧數搴撲綅涓篛绌哄簱浣嶆椂
+ //搴撲綅鐘舵�佹敼涓�0绌洪棽
+ locMast=locMastService.selectztgx("O",i);
+ if(!Cools.isEmpty(locMast)){
+ HashMap<String,Short> hashMap=new HashMap<>();
+ if(devpThread.startSignal[i][0]!=locMast.getPackStatus()){
+ hashMap.put("locSts",(short)0);
+ hashMap.put("channel",(short)(i*2));
+ MessageQueue.offer(SlaveType.Devp, 1, new Task(6,hashMap));
+ locMast.setPackStatus(0);
+ locMastService.updateById(locMast);
+ }
+
+ if(devpThread.startSignal[i][1]!=locMast.getChannel()){
+ locMast.setCtnKind(devpThread.startSignal[i][1]);
+ locMastService.updateById(locMast);
}
}
}
- } catch (Exception e) {
- News.error("鐏 ===>> 缁欒緭閫佺嚎鍙戦�佽鎶ュけ璐�,閫氶亾鍙凤細", i + 1);
}
}
-
-
}
-
}
} catch (Exception e) {
News.error("鑾峰緱娴嬭瘯搴撲綅鐘舵�佸け璐�", e);
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 36a0324..1b98680 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -4,9 +4,12 @@
import com.core.common.Cools;
import com.zy.core.properties.SlaveProperties;
+import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* Created by vincent on 2020/8/27
@@ -161,6 +164,20 @@
}
+ public static Map<String, Object> objectToMap(Object obj) {
+ Map<String, Object> map = new HashMap<>();
+ Field[] fields = obj.getClass().getDeclaredFields();
+ for (Field field : fields) {
+ field.setAccessible(true); // 璁剧疆绉佹湁瀛楁鍙闂�
+ try {
+ map.put(field.getName(), field.get(obj));
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ return map;
+ }
+
public static void main(String[] args) {
SlaveProperties slaveProperties = new SlaveProperties();
slaveProperties.setDoubleDeep(true);
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 595c5ec..4f1c8b1 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -59,15 +59,15 @@
// 鍫嗗灈鏈哄紓甯镐俊鎭褰�
mainService.recCrnErr();
// 鍏ュ簱 ===>> 绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�
-// mainService.storeEmptyPlt();
+ mainService.storeEmptyPlt();
// 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
- mainService.ledExecute();
+// mainService.ledExecute(1);
// 鍏朵粬 ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅
mainService.ledReset();
// mainService.outOfDevp();
//鍚姩銆佸畬鎴愩�佹殏鍋滄祴璇曠郴缁熸祴璇�
-// mainService.packTest1();
+ mainService.packTest1();
// //鐏锛岀粰鍫嗗灈鏈哄彂閫佺伀璀﹁鎶�
// mainService.fierCrn();
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index 7aadcbd..5ecdf33 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -5,6 +5,7 @@
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.alibaba.fastjson.JSON;
+import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasCrnOpt;
@@ -39,6 +40,11 @@
private CrnProtocol crnProtocol;
private boolean resetFlag = false;
+ public Long sign = System.currentTimeMillis();
+
+ public boolean isRunning = true;
+
+
/**
* 鍫嗗灈鏈烘槸鍚﹀湪鍥炲師鐐硅繍鍔ㄤ腑鏍囪
*/
@@ -52,7 +58,7 @@
@SuppressWarnings("InfiniteLoopStatement")
public void run() {
this.connect();
- while (true) {
+ while (isRunning) {
try {
int step = 1;
Task task = MessageQueue.poll(SlaveType.Crn, slave.getId());
@@ -86,10 +92,6 @@
command.setDestinationPosZ((short)0); // 鐩爣搴撲綅灞�
write(command);
break;
- case 4:
- Integer data = (Integer) task.getData();
- siemensNet.Write("DB100.276", data.shortValue());
- break;
default:
break;
}
@@ -97,7 +99,7 @@
} catch (Exception e) {
// e.printStackTrace();
}
-
+ sign = System.currentTimeMillis();
}
}
@@ -137,10 +139,10 @@
if(connect.IsSuccess){
result = true;
OutputQueue.CRN.offer(MessageFormat.format( "銆恵0}銆戝爢鍨涙満plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
- log.info("鍫嗗灈鏈簆lc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+ News.info("SiemensCrn"+" - 1"+" - 鍫嗗灈鏈簆lc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
} else {
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝爢鍨涙満plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
- log.error("鍫嗗灈鏈簆lc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+ News.error("SiemensCrn"+" - 2"+" - 鍫嗗灈鏈簆lc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
initCrn();
}
// siemensNet.ConnectClose();
@@ -152,10 +154,11 @@
*/
private void readStatus(){
try {
- OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 65);
+ OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56);
if (result.IsSuccess) {
if (null == crnProtocol) {
crnProtocol = new CrnProtocol();
+ crnProtocol.setCrnNo(slave.getId());
}
crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0));
crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2));
@@ -178,13 +181,11 @@
crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44));
crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48));
crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52));
- crnProtocol.setBarcodeResult(siemensNet.getByteTransform().TransBool(result.Content, 56));
- crnProtocol.setBarcode(siemensNet.getByteTransform().TransString(result.Content, 58,6,"UTF-8"));
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
// 澶嶄綅淇″彿
- if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+ if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
if (resetFlag) {
if(crnProtocol.getTaskNo()==9999){
backHpFlag = false;
@@ -204,19 +205,19 @@
basCrnp.setCrnNo(slave.getId());
basCrnp.setCrnSts((int)crnProtocol.getMode());
if (!basCrnpService.updateById(crnProtocol.toSqlModel(basCrnp))){
- log.error("鍫嗗灈鏈簆lc鏁版嵁搴撴洿鏂板け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+ News.error("SiemensCrn"+" - 3"+" - 鍫嗗灈鏈簆lc鏁版嵁搴撴洿鏂板け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
}
} catch (Exception ignore){}
} else {
initCrn();
- OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐�1 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
- log.error("璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐�1 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+ News.error("SiemensCrn"+" - 4"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
}
} catch (Exception e) {
- log.error("fail", e);
- OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐�2 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
- log.error("璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐�2 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ e.printStackTrace();
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ News.error("SiemensCrn"+" - 5"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
initCrn();
}
}
@@ -235,12 +236,12 @@
*/
private boolean write(CrnCommand command) throws InterruptedException {
if (null == command) {
- log.error("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
+ News.error("SiemensCrn"+" - 6"+" - 鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
return false;
}
- //convertRow(command);
+// convertRow(command);
command.setCrnNo(slave.getId());
- short[] array = new short[12];
+ short[] array = new short[10];
array[0] = command.getAckFinish();
array[1] = command.getTaskNo();
array[2] = command.getTaskMode();
@@ -250,15 +251,14 @@
array[6] = command.getDestinationPosX();
array[7] = command.getDestinationPosY();
array[8] = command.getDestinationPosZ();
- array[9] = command.getSourceStaNo();
- array[10] = command.getDestinationStaNo();
- array[11] = command.getCommand();
+// array[9] = command.getSourceStaNo();
+// array[10] = command.getDestinationStaNo();
+ array[9] = command.getCommand();
OperateResult result = siemensNet.Write("DB100.0", array);
- if (command.getAckFinish() == 0){
- OperateResult result2 = siemensNet.Write("DB100.20", command.getBarcode());
- }
+
if (command.getAckFinish() == 0) {
short commandFinish = 1;
+ Thread.sleep(100L);
result = siemensNet.Write("DB100.18", commandFinish);
}
@@ -288,12 +288,12 @@
if (result != null && result.IsSuccess) {
Thread.sleep(200);
this.readStatus();
- log.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
+ News.info("SiemensCrn"+" - 7"+" - 鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
return true;
} else {
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ爢鍨涙満plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
- log.error("鍐欏叆鍫嗗灈鏈簆lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ News.error("SiemensCrn"+" - 8"+" - 鍐欏叆鍫嗗灈鏈簆lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
return false;
}
}
@@ -419,4 +419,9 @@
}
+ // 鎻愪緵涓�涓柟娉曟潵鍋滄绾跨▼
+ public void requestStop() {
+ isRunning = false;
+ }
+
}
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 317f6dc..d395753 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -5,11 +5,14 @@
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
+import com.core.exception.CoolException;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.service.BasDevpService;
+import com.zy.asrs.utils.Utils;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -22,11 +25,9 @@
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
+import java.lang.reflect.Field;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
@@ -41,29 +42,43 @@
private SiemensS7Net siemensS7Net;
private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
private short heartBeatVal = 1;
- public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{
- add(101);
- add(102);
- add(103);
- add(104);
- add(201);
- add(202);
- add(203);
- add(204);
- add(205);
- add(206);
+
+ public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
+ add(100);add(101);add(102);add(103);add(104);add(105);add(106);
}};
+
+
+ private Integer count=0;
+
+ public int[][] startSignal = new int[24][2];
/**
* 鏉$爜鏁伴噺
*/
private int barcodeSize = 1;
- public IoModeType ioMode = IoModeType.NONE;
- public int[][] startSignal = new int[48][3];
+ /**
+ * 鍏ュ嚭搴撴ā寮�
+ * 0锛氭湭鐭�
+ * 1锛氬叆搴撳惎鍔ㄤ腑
+ * 2.鍏ュ簱妯″紡
+ * 3.鍑哄簱鍚姩涓� 锛堜笉鑳界敓鎴愬叆搴撳伐浣滄。锛�
+ * 4.鍑哄簱妯″紡
+ */
+
+// public IoModeType ioMode = IoModeType.NONE;
public SiemensDevpThread(DevpSlave slave) {
this.slave = slave;
+ }
+
+ private ArrayList<Integer> getStaNo() {
+ switch (slave.getId()) {
+ case 1:
+ return staNos1;
+ default:
+ throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
+ }
}
@Override
@@ -84,28 +99,14 @@
break;
// 鍐欐暟鎹� ID+鐩爣绔�
case 2:
- write((StaProtocol) task.getData());
+ write((StaProtocol)task.getData());
break;
- // 鍐欐暟鎹� 103绔欑偣鍐欏叆PACK鐮�
-// case 4:
-// write103((String)task.getData());
-// break;
- // 鐏淇″彿
-// case 5:
-// StaProtocol staProtocol2 = (StaProtocol)task.getData();
-// siemensS7Net.Write("DB108.0" + staProtocol2.getSiteId(), staProtocol2.getStaNo()==1);
-// break;
- //娴嬭瘯搴撳嚭搴擄紝搴撲綅鐘舵�佹敼涓�8
-// case 6:
-// String data = task.getData()+"";
-// Byte coun=8;
-// siemensS7Net.Write("DB38.0" + data, coun);
-// break;
- //澶嶄綅娴嬭瘯淇″彿
-// case 3:
-// StaProtocol staProtocol = (StaProtocol) task.getData();
-// siemensS7Net.Write("DB102.0" + staProtocol.getSiteId(), staProtocol.getStaNo());
-// break;
+ //淇敼娴嬭瘯鐘舵��
+
+ case 6:
+ Map<String, Short> map = (Map<String, Short>) task.getData();
+ siemensS7Net.Write("DB102.0" + map.get("channel"),map.get("locSts"));
+ break;
default:
break;
}
@@ -119,6 +120,37 @@
}
}
+ /**
+ * 鍒濆鍖栫珯鐐圭姸鎬�
+ */
+ private void initSite() {
+ count ++;
+ ArrayList<Integer> staNos = getStaNo();
+ if(count > 10) {
+ // 绔欑偣缂栧彿
+ for (Integer siteId : staNos) {
+ StaProtocol staProtocol = station.get(siteId);
+ if (null == staProtocol) {
+ staProtocol = new StaProtocol();
+ staProtocol.setSiteId(siteId);
+ station.put(siteId, staProtocol);
+ }
+ staProtocol.setWorkNo((short) 0); // ID
+ staProtocol.setAutoing(false); // 鑷姩
+ staProtocol.setLoading(false); // 鏈夌墿
+ staProtocol.setInEnable(false); // 鍙叆
+ staProtocol.setOutEnable(false); // 鍙嚭
+ staProtocol.setEmptyMk(false); // 绌烘澘淇″彿
+ staProtocol.setStaNo((short) 0); // 鐩爣绔�
+
+ if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+ staProtocol.setPakMk(true);
+ }
+ }
+ count = 0;
+ }
+ }
+
@Override
public boolean connect() {
boolean result = false;
@@ -126,13 +158,14 @@
siemensS7Net.setRack(slave.getRack().byteValue());
siemensS7Net.setSlot(slave.getSlot().byteValue());
OperateResult connect = siemensS7Net.ConnectServer();
- if (connect.IsSuccess) {
+ if(connect.IsSuccess){
result = true;
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣緭閫佺嚎plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+ OutputQueue.DEVP.offer(MessageFormat.format( "銆恵0}銆戣緭閫佺嚎plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
log.info("杈撻�佺嚎plc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
} else {
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣緭閫佺嚎plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+ OutputQueue.DEVP.offer(MessageFormat.format( "銆恵0}銆戣緭閫佺嚎plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
log.error("杈撻�佺嚎plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ initSite();
}
siemensS7Net.ConnectClose();
return result;
@@ -142,10 +175,10 @@
* 璇诲彇鐘舵�� ====> 鏁村潡plc
*/
private void read() throws InterruptedException {
-// // 鏇存柊鍏ュ嚭搴撴ā寮�
-// updateIoMode();
+
+ ArrayList<Integer> staNos = getStaNo();
int staNoSize = staNos.size();
- OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize * 4));
+ OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
if (result.IsSuccess) {
for (int i = 0; i < staNoSize; i++) {
Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
@@ -155,32 +188,11 @@
staProtocol.setSiteId(siteId);
station.put(siteId, staProtocol);
}
- staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4)); // 宸ヤ綔鍙�
+ staProtocol.setWorkNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, i*8)); // 宸ヤ綔鍙�
- staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4 + 2)); // 鐩爣绔�
- }
- }
-// Thread.sleep(200);
-// OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186);
-// if (result0.IsSuccess) {
-// for (int i = 0; i < 93; i++) {
-// Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
-// StaProtocol staProtocol = station.get(siteId);
-// if (null == staProtocol) {
-// staProtocol = new StaProtocol();
-// staProtocol.setSiteId(siteId);
-// station.put(siteId, staProtocol);
-// }
-// staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 鐩爣绔�
-// }
-// }
- Thread.sleep(200);
- OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.0", (short) (staNoSize * 2));
- if (result1.IsSuccess) {
- for (int i = 0; i < staNoSize; i++) {
- Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
- boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i * 2, 1);
- StaProtocol staProtocol = station.get(siteId);
+ staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4)); // 鐩爣绔�
+
+ boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i*8 + 6, 2);
staProtocol.setAutoing(status[0]); // 鑷姩
staProtocol.setLoading(status[1]); // 鏈夌墿
staProtocol.setInEnable(status[2]); // 鍙叆
@@ -196,61 +208,50 @@
}
}
- Thread.sleep(200);
- OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.190", (short) 8);
-// OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB100.216",(short)(6));
- if (result2.IsSuccess) {
- String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, 0, 8, "UTF-8");
-// String barcode=new String(result2.Content,i*12,12);
- BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 1);
- if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
- barcodeThread.setBarcode(barcode);
- }
+ //澶栧舰妫�娴�
+ OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.702.0", (short) (barcodeSize*1));
+ StaProtocol staProtocol1 = station.get(101);
+ if(resultErr1.IsSuccess){
+ boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1);
+ staProtocol1.setFrontErr(status1[0]);
+ staProtocol1.setBackErr(status1[1]);
+ staProtocol1.setHighErr(status1[2]);
+ staProtocol1.setLeftErr(status1[3]);
+ staProtocol1.setRightErr(status1[4]);
+ staProtocol1.setWeightErr(status1[5]);
+ staProtocol1.setBarcodeErr(status1[6]);
}
-// if (result5.IsSuccess) {
-// String barcode =siemensS7Net.getByteTransform().TransString(result5.Content,0,6, "UTF-8");
-//// String barcode=new String(result2.Content,i*12,12);
-// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 2);
-// if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
-// barcodeThread.setBarcode(barcode);
-// }
-// }
+
Thread.sleep(200);
- //娴嬭瘯鏌滅姸鎬佽幏鍙�
- OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB38.0", (short) 48);
- //鍚姩绉诲簱鎸夐挳
- OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB102.0", (short) 96);
- //娑堥槻鎶ヨ
- OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB108.0", (short) 48);
- if (result3.IsSuccess) {
- for (int i = 0; i < 48; i++) {
- startSignal[i][0] = siemensS7Net.getByteTransform().TransByte(result3.Content, i);//娴嬭瘯鏌滅姸鎬�
- startSignal[i][1] = siemensS7Net.getByteTransform().TransBool(result4.Content, i) ? 1 : 0;//娑堥槻鐘舵��
- startSignal[i][2] = siemensS7Net.getByteTransform().TransInt16(result6.Content, i * 2);//鍚姩鎸夐挳鐘舵��
+ if(slave.getId()==1) {
+ OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.602.0", (short) (barcodeSize * 8));
+ if (result2.IsSuccess) {
+ for (int i = 0; i < barcodeSize; i++) {
+ String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
+ if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+ barcodeThread.setBarcode(barcode);
+ }
+ }
+
}
}
-// OperateResultExOne<Short> result2 = siemensS7Net.ReadInt16("DB200.0");
-// if (result2.IsSuccess) {
-// this.ioMode = IoModeType.get(result2.Content);
-// }
- OperateResultExOne<byte[]> result202 = siemensS7Net.Read("DB101.806", (short) 8);
- if (result202.IsSuccess) {
- //鍑哄叆搴撴ā寮�
- boolean[] status = siemensS7Net.getByteTransform().TransBool(result202.Content, 0, 1);
- StaProtocol staProtocol = station.get(202);
- staProtocol.setFrontErr(status[0]);
- staProtocol.setBackErr(status[1]);
- staProtocol.setHighErr(status[2]);
- staProtocol.setLeftErr(status[3]);
- staProtocol.setRightErr(status[4]);
- staProtocol.setWeightErr(status[5]);
- staProtocol.setBarcodeErr(status[6]);
+
+ //鍏呮斁鐢靛簱浣嶇姸鎬佽鍙�
+ OperateResultExOne<byte[]> resultLocSts = siemensS7Net.Read("DB102.0", (short) 48);
+ //鍏呮斁鐢靛惎鍔ㄦ寜閽鍙�
+ OperateResultExOne<byte[]> resultLocOpen = siemensS7Net.Read("DB103.0", (short) 48);
+
+ if(resultLocSts.IsSuccess&&resultLocOpen.IsSuccess) {
+ for(int i=0; i<24; i++){
+ startSignal[i][0] = siemensS7Net.getByteTransform().TransInt16(resultLocSts.Content, i*2);//娴嬭瘯鏌滅姸鎬�
+ startSignal[i][1] = siemensS7Net.getByteTransform().TransInt16(resultLocOpen.Content, i*2);//鍚姩鎸夐挳鐘舵��
+ }
}
- if (result.IsSuccess && result1.IsSuccess) {
-
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛", DateUtils.convert(new Date()), slave.getId()));
+ if (result.IsSuccess) {
+ OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
// 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴�
try {
@@ -271,27 +272,9 @@
}
} else {
+ initSite();
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
// log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
- }
- }
-
- /**
- * 鍐欏叆 pack鐮� =====> 鍗曠珯鐐瑰啓鍏�
- */
- private void write103(String packNo) {
- try {
-
- OperateResult write = siemensS7Net.Write("DB109.0", packNo);
- if (!write.IsSuccess) {
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), JSON.toJSON(packNo)));
- log.error("鍐欏叆杈撻�佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), JSON.toJSON(packNo));
- } else {
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 杈撻�佺嚎鍛戒护涓嬪彂 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(packNo)));
- log.info("杈撻�佺嚎鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}", slave.getId(), JSON.toJSON(packNo));
- }
- } catch (Exception e) {
- log.error("103绔欑偣鍐欏叆鏁版嵁澶辫触锛岃緭閫佺嚎绾跨▼write103");
}
}
@@ -302,90 +285,34 @@
if (null == staProtocol) {
return;
}
- int staNoSize = staNos.size();
+ ArrayList<Integer> staNos = getStaNo();
int index = staNos.indexOf(staProtocol.getSiteId());
short[] array = new short[2];
- array[0] = staProtocol.getWorkNo();
- array[1] = staProtocol.getStaNo();
+ OperateResult writeResult1 = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo().intValue()); // 宸ヤ綔鍙�
+ OperateResult writeResult2 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo()); // 鐩爣绔�
- //浠诲姟ID涓嬪彂娆℃暟
- int idCount = 0;
- boolean idFlag = false;
- OperateResult write;
- while (idCount < 5) {
+// OperateResult write = siemensS7Net.Write("DB100.0" + index*4, staProtocol.getWorkNo()); // 宸ヤ綔鍙�
+// Thread.sleep(500);
+// OperateResult write1 = siemensS7Net.Write("DB100.2" + index*4+2, staProtocol.getStaNo()); // 鐩爣绔�
- write = siemensS7Net.Write("DB100." + index * 4, array); // 鍐�
- if (write.IsSuccess) {
- Thread.sleep(200);
- OperateResultExOne<byte[]> readId = siemensS7Net.Read("DB100." + index * 4, (short) (staNoSize * 2));
- if (readId.IsSuccess) {
- if (staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() != 9999) {
- if (!staProtocol.isInEnable() && (staProtocol.getSiteId() == 201 || staProtocol.getSiteId() == 206)) {
- break;
- }
- }
- short workNo = siemensS7Net.getByteTransform().TransInt16(readId.Content, 0);
- if (staProtocol.getWorkNo().equals(workNo)) {
- //宸ヤ綔鍙峰啓鍏ユ垚鍔�
- idFlag = true;
- break;
- } else {//杩斿洖缁撴灉鏄垚鍔熶簡锛屼絾鏄湡瀹炲�间笉鐩稿悓
- idCount++;
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎宸ヤ綔鍙峰悗杩斿洖鎴愬姛锛屼絾鏄鍙栧伐浣滃彿鍊间笉涓�鑷淬�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2},鍐欏叆娆℃暟={3}",
- slave.getId(), JSON.toJSON(staProtocol), idCount));
- log.error("鍐欏叆杈撻�佺嚎宸ヤ綔鍙峰悗杩斿洖鎴愬姛锛屼絾鏄鍙栧伐浣滃彿鍊间笉涓�鑷淬�傝緭閫佺嚎plc缂栧彿={}锛寋}锛屽啓鍏ユ鏁�={}", slave.getId(), JSON.toJSON(staProtocol), idCount);
- }
- } else {
- idCount++;
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎宸ヤ綔鍙峰悗璇诲彇宸ヤ綔鍙峰け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2},鍐欏叆娆℃暟={3}",
- slave.getId(), JSON.toJSON(staProtocol), idCount));
- log.error("鍐欏叆杈撻�佺嚎宸ヤ綔鍙峰悗璇诲彇宸ヤ綔鍙峰け璐ャ�傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), idCount);
- }
- } else {
- idCount++;
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎宸ヤ綔鍙峰け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2},鍐欏叆娆℃暟={3}",
- slave.getId(), JSON.toJSON(staProtocol), idCount));
- log.error("鍐欏叆杈撻�佺嚎宸ヤ綔鍙峰け璐ャ�傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), idCount);
- }
- Thread.sleep(200);
- }
- //鍐橧D灏濊瘯浜�5娆¤繕鏄け璐ヤ簡
- if (!idFlag) {
+ if (!writeResult1.IsSuccess&&!writeResult2.IsSuccess) {
staProtocol = station.get(staProtocol.getSiteId());
- if (staProtocol.getWorkNo() == 9999 && staProtocol.getStaNo() == 0) {
+ if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) {
staProtocol.setPakMk(true);
}
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎宸ヤ綔鍙峰皾璇�5娆″け璐ャ�傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), JSON.toJSON(staProtocol)));
- log.error("鍐欏叆杈撻�佺嚎宸ヤ綔鍙峰皾璇�5娆″け璐ャ�傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), JSON.toJSON(staProtocol));
-
- //閲嶆柊娣诲姞鏁版嵁鍒颁换鍔¢槦鍒�
- boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol));
- read();//璇诲彇1娆¤澶囩姸鎬�
- return;
- }
-
-// OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 宸ヤ綔鍙�
-// Thread.sleep(500);
-// OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo()); // 鐩爣绔�
-
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 杈撻�佺嚎鍛戒护涓嬪彂鎴愬姛 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol)));
- log.info("杈撻�佺嚎鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂鎴愬姛锛� {}", slave.getId(), JSON.toJSON(staProtocol));
- }
-
- // 鏇存柊鍏ュ嚭搴撴ā寮�
- private void updateIoMode() throws InterruptedException {
- if (this.ioMode != IoModeType.NONE) {
- if (!siemensS7Net.Write("DB200", this.ioMode.id).IsSuccess) {
- OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎1F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId()));
- log.error("鍐欏叆杈撻�佺嚎1F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId());
- }
+ OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), JSON.toJSON(staProtocol)));
+ log.error("鍐欏叆杈撻�佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), JSON.toJSON(staProtocol));
+ } else {
+ OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 杈撻�佺嚎鍛戒护涓嬪彂 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol)));
+ log.info("杈撻�佺嚎鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}", slave.getId(), JSON.toJSON(staProtocol));
}
}
+
/**
* 蹇冭烦
*/
- private void heartbeat() {
+ private void heartbeat(){
if (heartBeatVal == 1) {
heartBeatVal = 2;
} else {
@@ -414,16 +341,16 @@
}
public static void main(String[] args) {
- System.out.println(staNos.indexOf(129));
- System.out.println(staNos.size());
- for (int i = 0; i < staNos.size(); i++) {
+ System.out.println(staNos1.indexOf(129));
+ System.out.println(staNos1.size());
+ for (int i = 0; i< staNos1.size(); i++) {
// System.out.println(i*2);
// System.out.println(i*2 + 200);
// System.out.println(i);
}
- int index = staNos.indexOf(128);
- System.out.println(index * 2);
- System.out.println(index * 2 + 200);
+ int index = staNos1.indexOf(128);
+ System.out.println(index*2);
+ System.out.println(index*2 + 200);
}
// public static void main(String[] args) throws Exception {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 53644be..f19ef97 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -35,20 +35,20 @@
enable: false
wms:
- url: 10.12.55.200:8080/fnwms
+ url: 127.0.0.1:8081/tlfwms
# 涓嬩綅鏈洪厤缃�
wcs-slave:
# 鍙屾繁
doubleDeep: false
# 鍙屾繁搴撲綅鎺掑彿
- doubleLocs:
+ doubleLocs: 3
# 涓�涓爢鍨涙満璐熻矗鐨勮揣鏋舵帓鏁�
- groupCount: 2
+ groupCount: 3
# 鍫嗗灈鏈�1
crn[0]:
id: 1
- ip: 10.12.55.70
+ ip: 178.18.1.150
port: 8888
rack: 0
slot: 0
@@ -58,29 +58,21 @@
# 鍫嗗灈鏈哄叆搴撶珯鐐�
crnInStn[0]:
devpPlcId: ${wcs-slave.devp[0].id}
- staNo: 202
- row: 1
- bay: 0
+ staNo: 100
+ row: 2
+ bay: 1
lev: 1
# 鍫嗗灈鏈哄嚭搴撶珯鐐�
crnOutStn[0]:
devpPlcId: ${wcs-slave.devp[0].id}
- staNo: 1000
+ staNo: 106
row: 1
- bay: 25
+ bay: 1
lev: 1
- # 鍫嗗灈鏈哄嚭搴撶珯鐐�
- crnOutStn[1]:
- devpPlcId: ${wcs-slave.devp[0].id}
- staNo: 203
- row: 2
- bay: 0
- lev: 1
-
# 杈撻�佺嚎
devp[0]:
id: 1
- ip: 10.12.55.90
+ ip: 178.18.1.160
port: 102
rack: 0
slot: 0
@@ -88,36 +80,22 @@
inSta[0]:
staNo: 101
barcode: ${wcs-slave.barcode[0].id}
- backSta: 100
+ backSta: 102
led: ${wcs-slave.led[0].id}
# 绌烘澘鍏ュ簱鍙�1
emptyInSta[0]:
- staNo: 201
- # 绌烘澘鍏ュ簱鍙�2
- emptyInSta[1]:
- staNo: 206
+ staNo: 101
# 鍑哄簱鍙�1
outSta[0]:
- staNo: 204
+ staNo: 104
# 鍑哄簱鍙�2
outSta[1]:
- staNo: 103
- # 鍑哄簱鍙�3
- outSta[2]:
- staNo: 205
- # 鍑哄簱鍙�4
- outSta[3]:
- staNo: 1000
+ staNo: 102
# 鏉$爜鎵弿浠�1
barcode[0]:
id: 1
ip: 172.28.15.235
port: 51236
-# # 鏉$爜鎵弿浠�2
-# barcode[1]:
-# id: 2
-# ip: 172.28.15.235
-# port: 51236
# LED1
led[0]:
id: 1
@@ -131,7 +109,7 @@
ip: 10.10.10.60
port: 5005
devpPlcId: ${wcs-slave.devp[0].id}
- staArr: 110
+ staArr: 104
#
# #socket
# socket[0]:
diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index b577fe8..03bb74a 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -64,7 +64,7 @@
</select>
<select id="selectztgx" resultMap="BaseResultMap">
- select top 1 * from asr_loc_mast where loc_sts in (#{sts1},#{sts2}) and channel=#{count}+1
+ select top 1 * from asr_loc_mast where loc_sts in (#{sts1}) and channel=#{count}+1
</select>
</mapper>
diff --git a/src/main/resources/mapper/WrkDetlMapper.xml b/src/main/resources/mapper/WrkDetlMapper.xml
index df633fa..4a57552 100644
--- a/src/main/resources/mapper/WrkDetlMapper.xml
+++ b/src/main/resources/mapper/WrkDetlMapper.xml
@@ -48,7 +48,7 @@
</resultMap>
<select id="findByWorkNo" resultMap="BaseResultMap">
- select wrk_no, mat_no, mat_name, qty from asr_wrk_detl where 1=1 and wrk_no = #{workNo}
+ select wrk_no, mat_name, qty from asr_wrk_detl where 1=1 and wrk_no = #{workNo}
</select>
<select id="devpPackNo" resultMap="BaseResultMap">
select top 1 * from asr_wrk_detl_log where 1=1 and wrk_no = #{workNo} order by io_time desc
--
Gitblit v1.9.1