From 6a7374de6db9fb84439c2448238144a3fc2ea350 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 03 九月 2025 12:45:29 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 404 +++++++++++++++++++++++++++++----------------------------
1 files changed, 206 insertions(+), 198 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 6178177..44a69da 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -369,24 +369,25 @@
* 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
*/
public synchronized void stnToCrnStnPick(Integer mark) {
- for (DevpSlave devp : slaveProperties.getDevp()) {
- // 閬嶅巻鎷f枡鍏ュ簱鍙�
- for (DevpSlave.Sta pickSta : devp.getPickSta()) {
- // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
- if (staProtocol == null) {
- continue;
- } else {
- staProtocol = staProtocol.clone();
- }
+ try {
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 閬嶅巻鎷f枡鍏ュ簱鍙�
+ for (DevpSlave.Sta pickSta : devp.getPickSta()) {
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
- if (staProtocol.isAutoing()
- && staProtocol.isLoading()
- && staProtocol.isInEnable()
- && staProtocol.getWorkNo() > 0
- && staProtocol.isPakMk()) {
- News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
+ if (staProtocol.isAutoing()
+ && staProtocol.isLoading()
+ && staProtocol.isInEnable()
+ && staProtocol.getWorkNo() > 0
+ && staProtocol.isPakMk()) {
+ News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
// // 鑾峰彇鏉$爜鎵弿浠俊鎭�
// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
@@ -404,17 +405,17 @@
// }
// WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
- WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
- if (wrkMast == null) {
- // 鏃犳嫞鏂欐暟鎹�
- continue;
- }
- if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
- || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
- continue;
- }
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+ if (wrkMast == null) {
+ // 鏃犳嫞鏂欐暟鎹�
+ continue;
+ }
+ if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
+ || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
+ continue;
+ }
- // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
+ // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
// int stnNo = 0;
// if (wrkMast.getStaNo() == 109) {
// stnNo = 127;
@@ -423,87 +424,90 @@
// } else {
// log.error("{}鍙蜂换鍔℃暟鎹紓甯革紒", wrkMast.getWrkNo());
// }
- // 鑾峰彇鐩爣绔�
- Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
- .eq("type_no", wrkMast.getIoType() - 50)
- .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
- .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
- StaDesc staDesc = staDescService.selectOne(wrapper);
- if (Cools.isEmpty(staDesc)) {
+ // 鑾峰彇鐩爣绔�
+ Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+ .eq("type_no", wrkMast.getIoType() - 50)
+ .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+ .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
+ StaDesc staDesc = staDescService.selectOne(wrapper);
+ if (Cools.isEmpty(staDesc)) {
// News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
// staProtocol.setWorkNo((short) 9989);
// staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1));
// devpThread.setPakMk(staProtocol.getSiteId(), false);
// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- //LED
- LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
- // led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + pickSta.getBackSta().shortValue() + "绔欑偣";
- MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errorMsg));
- }
- continue;
- }
-
- try {
-// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
-// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
-// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
-// }
- // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
- if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ //LED
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + pickSta.getBackSta().shortValue() + "绔欑偣";
+ MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errorMsg));
+ }
+ continue;
}
- Date now = new Date();
- // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
- Integer staNo = staDesc.getCrnStn();
- // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
- wrkMast.setIoTime(now);
- wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
- wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
- wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
- wrkMast.setStaNo(staNo); // 鐩爣绔�
- wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
- wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
- wrkMast.setModiTime(now);
- wrkMast.setUpdMk("");//鍏佽鍐嶆绉诲簱
- if (wrkMastMapper.updateById(wrkMast) == 0) {
- throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ try {
+ // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
+ if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
+ throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+ }
+ // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+ if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+ throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ }
+
+ Date now = new Date();
+ // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
+ Integer staNo = staDesc.getCrnStn();
+ // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+ wrkMast.setIoTime(now);
+ wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+ wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+ wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
+ wrkMast.setStaNo(staNo); // 鐩爣绔�
+ wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+ wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
+ wrkMast.setModiTime(now);
+ wrkMast.setUpdMk("");//鍏佽鍐嶆绉诲簱
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ }
+ // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
+ wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
+ // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+ LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
+ locMast.setLocSts("Q");
+ locMast.setModiTime(new Date());
+ if (!locMastService.updateById(locMast)) {
+ throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ continue;
}
- // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
- wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
- // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+
LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocSts("Q");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+ staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
+ staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+ staProtocol.setPalletSize(locMast.getLocType2());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ News.error("" + mark + " - 3" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
}
- } catch (Exception e) {
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- continue;
+
+ } else {
+ News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
+ + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk());
}
- LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
- staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
- staProtocol.setPalletSize(locMast.getLocType2());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- News.error("" + mark + " - 3" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
-
- } else {
- News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
- + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk());
}
}
-
+ } catch (Exception e) {
+ e.printStackTrace();
}
News.infoNoLog("" + mark + " - 0" + " - 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱 ===銆嬫墽琛屽畬鎴�");
}
@@ -512,51 +516,52 @@
* 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱-鏉$爜
*/
public synchronized void stnToCrnStnPickBarcode(Integer mark) {
- for (DevpSlave devp : slaveProperties.getDevp()) {
- // 閬嶅巻鎷f枡鍏ュ簱鍙�
- for (DevpSlave.Sta insta : devp.getInSta()) {
- // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- StaProtocol staProtocol = devpThread.getStation().get(insta.getStaNo());
- if (staProtocol == null) {
- continue;
- } else {
- staProtocol = staProtocol.clone();
- }
-
- if (staProtocol.isAutoing()
- && staProtocol.isLoading()
- && staProtocol.isInEnable()
- && staProtocol.getWorkNo() > 0
- && staProtocol.isPakMk()) {
- News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
-
- // 鑾峰彇鏉$爜鎵弿浠俊鎭�
- BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, insta.getBarcode());
- if (barcodeThread == null) {
+ try {
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 閬嶅巻鎷f枡鍏ュ簱鍙�
+ for (DevpSlave.Sta insta : devp.getInSta()) {
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(insta.getStaNo());
+ if (staProtocol == null) {
continue;
+ } else {
+ staProtocol = staProtocol.clone();
}
- String barcode = barcodeThread.getBarcode();
- if (!Cools.isEmpty(barcode)) {
- News.info("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", insta.getBarcode(), barcode);
- if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+
+ if (staProtocol.isAutoing()
+ && staProtocol.isLoading()
+ && staProtocol.isInEnable()
+ && staProtocol.getWorkNo() > 0
+ && staProtocol.isPakMk()) {
+ News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
+
+ // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, insta.getBarcode());
+ if (barcodeThread == null) {
continue;
}
- } else {
- continue;
- }
+ String barcode = barcodeThread.getBarcode();
+ if (!Cools.isEmpty(barcode)) {
+ News.info("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", insta.getBarcode(), barcode);
+ if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+ continue;
+ }
+ } else {
+ continue;
+ }
- WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
- if (wrkMast == null) {
- // 鏃犳嫞鏂欐暟鎹�
- continue;
- }
- if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
- || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
- continue;
- }
+ WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
+ if (wrkMast == null) {
+ // 鏃犳嫞鏂欐暟鎹�
+ continue;
+ }
+ if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
+ || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
+ continue;
+ }
- // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
+ // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
// int stnNo = 0;
// if (wrkMast.getStaNo() == 109) {
// stnNo = 127;
@@ -565,87 +570,90 @@
// } else {
// log.error("{}鍙蜂换鍔℃暟鎹紓甯革紒", wrkMast.getWrkNo());
// }
- // 鑾峰彇鐩爣绔�
- Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
- .eq("type_no", wrkMast.getIoType() - 50)
- .eq("stn_no", insta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
- .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
- StaDesc staDesc = staDescService.selectOne(wrapper);
- if (Cools.isEmpty(staDesc)) {
+ // 鑾峰彇鐩爣绔�
+ Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+ .eq("type_no", wrkMast.getIoType() - 50)
+ .eq("stn_no", insta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+ .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
+ StaDesc staDesc = staDescService.selectOne(wrapper);
+ if (Cools.isEmpty(staDesc)) {
// News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
// staProtocol.setWorkNo((short) 9989);
// staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1));
// devpThread.setPakMk(staProtocol.getSiteId(), false);
// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- //LED
- LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, insta.getLed());
- // led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + insta.getBackSta().shortValue() + "绔欑偣";
- MessageQueue.offer(SlaveType.Led, insta.getLed(), new Task(5, errorMsg));
- }
- continue;
- }
-
- try {
-// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
-// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
-// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
-// }
- // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
- if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ //LED
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, insta.getLed());
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + insta.getBackSta().shortValue() + "绔欑偣";
+ MessageQueue.offer(SlaveType.Led, insta.getLed(), new Task(5, errorMsg));
+ }
+ continue;
}
- Date now = new Date();
- // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
- Integer staNo = staDesc.getCrnStn();
- // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
- wrkMast.setIoTime(now);
- wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
- wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
- wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
- wrkMast.setStaNo(staNo); // 鐩爣绔�
- wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
- wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
- wrkMast.setModiTime(now);
- wrkMast.setUpdMk("");//鍏佽鍐嶆绉诲簱
- if (wrkMastMapper.updateById(wrkMast) == 0) {
- throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ try {
+ // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
+ if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
+ throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+ }
+ // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+ if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+ throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ }
+
+ Date now = new Date();
+ // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
+ Integer staNo = staDesc.getCrnStn();
+ // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+ wrkMast.setIoTime(now);
+ wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+ wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+ wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
+ wrkMast.setStaNo(staNo); // 鐩爣绔�
+ wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+ wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
+ wrkMast.setModiTime(now);
+ wrkMast.setUpdMk("");//鍏佽鍐嶆绉诲簱
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ }
+ // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
+ wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
+ // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+ LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
+ locMast.setLocSts("Q");
+ locMast.setModiTime(new Date());
+ if (!locMastService.updateById(locMast)) {
+ throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ continue;
}
- // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
- wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
- // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+
LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocSts("Q");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+ staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
+ staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+ staProtocol.setPalletSize(locMast.getLocType2());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ News.error("" + mark + " - 3" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
}
- } catch (Exception e) {
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- continue;
+
+ } else {
+ News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
+ + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk());
}
- LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
- staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
- staProtocol.setPalletSize(locMast.getLocType2());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- News.error("" + mark + " - 3" + " - 鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
-
- } else {
- News.errorNoLog("" + mark + " - 6" + " - 绔欑偣淇℃伅涓嶇鍚堝叆搴撴潯浠讹紒锛侊紒" + " 鑷姩淇″彿锛�" + staProtocol.isLoading() + "銆佸彲鍏ヤ俊鍙凤細" + staProtocol.isInEnable()
- + "銆佺┖鏉夸俊鍙凤細" + staProtocol.isEmptyMk());
}
}
-
+ } catch (Exception e) {
+ e.printStackTrace();
}
News.infoNoLog("" + mark + " - 0" + " - 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱 ===銆嬫墽琛屽畬鎴�");
}
--
Gitblit v1.9.1