From 13a7ee010e75bab8030c7c0be736d0ca02d966d7 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 08 十二月 2023 10:04:11 +0800
Subject: [PATCH] #避让起始列
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 845 ++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 614 insertions(+), 231 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 f6b7da2..b655e3a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -36,6 +37,8 @@
import java.util.*;
import java.util.stream.Collectors;
+
+import static com.zy.asrs.utils.Utils.isJson;
/**
* 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔�
@@ -205,12 +208,12 @@
// 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());
- if (ledThread != null) {
- String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
- }
+// // 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;
}
@@ -272,6 +275,7 @@
String errorMsg = jsonObject.getString("msg");
if (!Cools.isEmpty(errorMsg)) {
MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ ledThread.setLedMk(false);
}
}
News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
@@ -285,6 +289,7 @@
if (ledThread != null) {
String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒";
MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ ledThread.setLedMk(false);
}
}
} catch (Exception e) {
@@ -396,13 +401,16 @@
}
/**
- * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
+ * 鎷f枡銆佸苟鏉垮啀鍏ュ簱
*/
@Transactional
public synchronized void stnToCrnStnPick(){
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鎷f枡鍏ュ簱鍙�
for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+ if (pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339) {
+ continue;
+ }
// 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -414,8 +422,8 @@
}
if (staProtocol.isAutoing()
&& staProtocol.isLoading()
-// && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
-// && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
+ && staProtocol.isInEnable()
+// && (staProtocol.getWorkNo() > 0)
&& staProtocol.isPakMk()){
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
@@ -424,58 +432,49 @@
continue;
}
String barcode = barcodeThread.getBarcode();
-
- WrkMast wrkMast = null;
- wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
- if (wrkMast == null) {
+ if(Cools.isEmpty(barcode)) {
continue;
}
-// if (staProtocol.getWorkNo() == 9996) {
-// String barcode = barcodeThread.getBarcode();
-// if(!Cools.isEmpty(barcode)) {
-// News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-// if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
-// staProtocol.setWorkNo((short) 32002);
-// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
-// 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());
-// if (ledThread != null) {
-// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
-// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
-// }
-// continue;
-// }
-// } else {
-// staProtocol.setWorkNo((short) 32002);
-// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
-// 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());
-// if (ledThread != null) {
-// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
-// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
-// }
-// continue;
-// }
-// wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
-// if (null == wrkMast) {
-// News.error("{}鏉$爜閿欒锛屾殏鏃犳嫞鏂欎换鍔★紒", barcode);
-// }
-// }
-
- if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
- || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+ if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
continue;
}
+
+ WrkMast wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+ if (wrkMast == null) {//鎵句笉鍒板伐浣滄。
+ continue;
+ }
+
+ if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104)
+ || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+ continue;
+ }
+
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+ boolean flag = false;
+ String th = "";
+ List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo());
+ for (String loc : innerLoc) {
+ LocMast locMast = locMastService.selectById(loc);
+ if (locMast == null) {
+ continue;
+ }
+
+ if (!locMast.getLocSts().equals("F")) {
+ flag = true;
+ th = loc + "搴撲綅瀛樺湪鏈洖搴撲换鍔�";
+ break;
+ }
+ }
+ if (flag) {
+ News.info(th);
+ continue;
+ }
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
// 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ News.info(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ continue;
}
String sourceLocNo = wrkMast.getSourceLocNo().trim();
@@ -487,7 +486,7 @@
// 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
- wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
+ wrkMast.setSourceStaNo(pickSta.getBackSta()); // 婧愮珯
// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
// wrkMast.setCrnNo(dto.getCrnNo());
wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
@@ -496,10 +495,8 @@
wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
wrkMast.setModiTime(new Date());
if (wrkMastMapper.updateById(wrkMast) == 0) {
- throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
- }
- if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
- throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ continue;
}
// 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
@@ -507,127 +504,472 @@
locMast.setLocSts("Q");
locMast.setModiTime(new Date());
if (!locMastService.updateById(locMast)) {
- throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ News.info("淇敼搴撲綅鐘舵�佸け璐�");
+ continue;
}
- barcodeThread.setBarcode("");//娓呯悊鏉$爜
-
-// try {
-// // 璁块棶 WMS 鑾峰彇鍏ュ簱搴撲綅
-// LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
-// SearchLocParam param = new SearchLocParam();
-// param.setWrkNo(wrkMast.getWrkNo());
-// param.setIoType(wrkMast.getIoType());
-// param.setSourceStaNo(pickSta.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);
-// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
-// Integer code = jsonObject.getInteger("code");
-// if (code.equals(200)) {
-// StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-//
-//// // 鑾峰彇鐩爣绔�
-//// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
-//// .eq("type_no", wrkMast.getIoType() - 50)
-//// .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
-//// .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿
-//// StaDesc staDesc = staDescService.selectOne(wrapper);
-//// if (Cools.isEmpty(staDesc)) {
-//// News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
-//// continue;
-//// }
-//// // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
-//// Integer staNo = staDesc.getCrnStn();
-//
-// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
-//// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
-//// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
-//// }
-// // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
-// if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
-// throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
-// }
-//
-// String sourceLocNo = wrkMast.getSourceLocNo().trim();
-// LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
-// if (liftStaProtocol == null) {
-// continue;
-// }
-//
-// // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
-// wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
-// wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
-// wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
-//// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
-//// wrkMast.setCrnNo(dto.getCrnNo());
-// wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
-// wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
-// wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
-// wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
-// wrkMast.setModiTime(new Date());
-// if (wrkMastMapper.updateById(wrkMast) == 0) {
-// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
-// }
-// if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
-// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
-// }
-//
-// // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
-// LocMast locMast = locMastService.selectById(sourceLocNo);
-// 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());
-//// devpThread.setPakMk(staProtocol.getSiteId(), false);
-//// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-//// if (!result) {
-//// News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
-//// }
-//
-// barcodeThread.setBarcode("");//娓呯悊鏉$爜
-//
-// } else if (code == 500){
-// if (ledThread != null) {
-// String errorMsg = jsonObject.getString("msg");
-// if (!Cools.isEmpty(errorMsg)) {
-// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
-// }
-// }
-// News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
-// } else {
-//// staProtocol.setWorkNo((short) 32002);
-//// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
-//// devpThread.setPakMk(staProtocol.getSiteId(), false);
-//// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-//
-// // led 寮傚父鏄剧ず
-// if (ledThread != null) {
-// String errorMsg = jsonObject.getString("msg");
-//// String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒";
-// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
-// }
-// }
-//
-// } catch (Exception e) {
-// e.printStackTrace();
-// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-// }
-
}
}
}
}
+
+ /**
+ * 鎷f枡銆佸苟鏉垮啀鍏ュ簱(325銆�331銆�333銆�339)
+ */
+ @Transactional
+ public synchronized void stnToCrnStnPick2(){
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 閬嶅巻鎷f枡鍏ュ簱鍙�
+ for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+ if (!(pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339)) {
+ continue;
+ }
+
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ DevpThread devpThread = (DevpThread) 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()){
+
+ WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
+ if (wrkMast == null) {//鎵句笉鍒板伐浣滄。
+ continue;
+ }
+
+ if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104)
+ || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+ continue;
+ }
+
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+ boolean flag = false;
+ String th = "";
+ List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo());
+ for (String loc : innerLoc) {
+ LocMast locMast = locMastService.selectById(loc);
+ if (locMast == null) {
+ continue;
+ }
+
+ if (!locMast.getLocSts().equals("F")) {
+ flag = true;
+ th = loc + "搴撲綅瀛樺湪鏈洖搴撲换鍔�";
+ break;
+ }
+ }
+ if (flag) {
+ News.info(th);
+ continue;
+ }
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+
+ // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+ if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+ News.info(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ continue;
+ }
+
+ String sourceLocNo = wrkMast.getSourceLocNo().trim();
+ LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+ if (liftStaProtocol == null) {
+ continue;
+ }
+
+ // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+ wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+ wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+ wrkMast.setSourceStaNo(pickSta.getBackSta()); // 婧愮珯
+// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
+// wrkMast.setCrnNo(dto.getCrnNo());
+ wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
+ wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+ wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
+ wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
+ wrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ continue;
+ }
+
+ // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+ LocMast locMast = locMastService.selectById(sourceLocNo);
+ locMast.setLocSts("Q");
+ locMast.setModiTime(new Date());
+ if (!locMastService.updateById(locMast)) {
+ News.info("淇敼搴撲綅鐘舵�佸け璐�");
+ continue;
+ }
+
+ staProtocol.setStaNo(pickSta.getBackSta().shortValue());//鍐欏叆鐩爣绔�
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ }
+ }
+
+ }
+ }
+
+ /**
+ * 鐩樼偣鍐嶅叆搴�
+ */
+ @Transactional
+ public synchronized void stnToCrnStnPlate(){
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 閬嶅巻鎷f枡鍏ュ簱鍙�
+ for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+// if (pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339) {
+// continue;
+// }
+
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ DevpThread devpThread = (DevpThread) 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()){
+
+ WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
+ if (wrkMast == null) {//鎵句笉鍒板伐浣滄。
+ continue;
+ }
+
+ if ((wrkMast.getIoType() != 107)
+ || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+ continue;
+ }
+
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+ boolean flag = false;
+ String th = "";
+ List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo());
+ for (String loc : innerLoc) {
+ LocMast locMast = locMastService.selectById(loc);
+ if (locMast == null) {
+ continue;
+ }
+
+ if (!locMast.getLocSts().equals("F")) {
+ flag = true;
+ th = loc + "搴撲綅瀛樺湪鏈洖搴撲换鍔�";
+ break;
+ }
+ }
+ if (flag) {
+ News.info(th);
+ continue;
+ }
+ //*********************鍚屽簱浣嶇粍鏍¢獙*********************
+
+ // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+ if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+ News.info(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ continue;
+ }
+
+ //鐩樼偣鎵炬柊搴撲綅
+ try {
+ LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());//婧愬簱浣�
+ SearchLocParam param = new SearchLocParam();
+ param.setWrkNo(wrkMast.getWrkNo());
+ param.setBarcode(wrkMast.getBarcode());
+ param.setIoType(107);//鐩樼偣
+ param.setSourceStaNo(wrkMast.getStaNo());
+ param.setLocType1(locMast.getLocType1());
+ String response = new HttpHandler.Builder()
+ .setUri(wmsUrl)
+ .setPath("/rpc/pakin/loc/v1")
+ .setJson(JSON.toJSONString(param))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
+ StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+
+ //鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+ LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(dto.getLocNo()));
+ if (liftStaProtocol == null) {
+ News.info(wrkMast.getWrkNo() + "鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯澶辫触");
+ continue;
+ }
+
+ // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+ wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 107->57
+ wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+ wrkMast.setSourceStaNo(dto.getSourceStaNo()); // 婧愮珯
+ wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
+ wrkMast.setLocNo(dto.getLocNo()); // 鐩爣搴撲綅
+ wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
+ wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
+ wrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+ continue;
+ }
+
+ staProtocol.setStaNo(dto.getSourceStaNo().shortValue());//鍐欏叆鐩爣绔�
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+
+ } else if (code == 500){
+ News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ }
+
+ }
+ }
+ }
+ }
+
+// /**
+// * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
+// */
+// @Transactional
+// public synchronized void stnToCrnStnPick(){
+// for (DevpSlave devp : slaveProperties.getDevp()) {
+// // 閬嶅巻鎷f枡鍏ュ簱鍙�
+// for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
+//
+// // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+// DevpThread devpThread = (DevpThread) 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.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
+//// && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
+// && staProtocol.isPakMk()){
+//
+// // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+// if (barcodeThread == null) {
+// continue;
+// }
+// String barcode = barcodeThread.getBarcode();
+//
+// WrkMast wrkMast = null;
+// wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+// if (wrkMast == null) {
+// continue;
+// }
+//// if (staProtocol.getWorkNo() == 9996) {
+//// String barcode = barcodeThread.getBarcode();
+//// if(!Cools.isEmpty(barcode)) {
+//// News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//// if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+//// staProtocol.setWorkNo((short) 32002);
+//// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+//// 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());
+//// if (ledThread != null) {
+//// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+//// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+//// }
+//// continue;
+//// }
+//// } else {
+//// staProtocol.setWorkNo((short) 32002);
+//// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+//// 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());
+//// if (ledThread != null) {
+//// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+//// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+//// }
+//// continue;
+//// }
+//// wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+//// if (null == wrkMast) {
+//// News.error("{}鏉$爜閿欒锛屾殏鏃犳嫞鏂欎换鍔★紒", barcode);
+//// }
+//// }
+//
+// if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
+// || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+// continue;
+// }
+//
+// // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+// if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+// throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+// }
+//
+// String sourceLocNo = wrkMast.getSourceLocNo().trim();
+// LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+// if (liftStaProtocol == null) {
+// continue;
+// }
+//
+// // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+// wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+// wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+// wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
+//// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
+//// wrkMast.setCrnNo(dto.getCrnNo());
+// wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
+// wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+// wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
+// wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
+// wrkMast.setModiTime(new Date());
+// if (wrkMastMapper.updateById(wrkMast) == 0) {
+// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+// }
+// if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
+// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+// }
+//
+// // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+// LocMast locMast = locMastService.selectById(sourceLocNo);
+// locMast.setLocSts("Q");
+// locMast.setModiTime(new Date());
+// if (!locMastService.updateById(locMast)) {
+// throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+// }
+// barcodeThread.setBarcode("");//娓呯悊鏉$爜
+//
+//// try {
+//// // 璁块棶 WMS 鑾峰彇鍏ュ簱搴撲綅
+//// LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
+//// SearchLocParam param = new SearchLocParam();
+//// param.setWrkNo(wrkMast.getWrkNo());
+//// param.setIoType(wrkMast.getIoType());
+//// param.setSourceStaNo(pickSta.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);
+//// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
+//// Integer code = jsonObject.getInteger("code");
+//// if (code.equals(200)) {
+//// StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+////
+////// // 鑾峰彇鐩爣绔�
+////// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+////// .eq("type_no", wrkMast.getIoType() - 50)
+////// .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+////// .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿
+////// StaDesc staDesc = staDescService.selectOne(wrapper);
+////// if (Cools.isEmpty(staDesc)) {
+////// News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+////// continue;
+////// }
+////// // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
+////// Integer staNo = staDesc.getCrnStn();
+////
+//// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
+////// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
+////// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+////// }
+//// // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+//// if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+//// throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+//// }
+////
+//// String sourceLocNo = wrkMast.getSourceLocNo().trim();
+//// LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+//// if (liftStaProtocol == null) {
+//// continue;
+//// }
+////
+//// // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+//// wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+//// wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+//// wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
+////// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
+////// wrkMast.setCrnNo(dto.getCrnNo());
+//// wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
+//// wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+//// wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
+//// wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌�
+//// wrkMast.setModiTime(new Date());
+//// if (wrkMastMapper.updateById(wrkMast) == 0) {
+//// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+//// }
+//// if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
+//// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+//// }
+////
+//// // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+//// LocMast locMast = locMastService.selectById(sourceLocNo);
+//// 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());
+////// devpThread.setPakMk(staProtocol.getSiteId(), false);
+////// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+////// if (!result) {
+////// News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+////// }
+////
+//// barcodeThread.setBarcode("");//娓呯悊鏉$爜
+////
+//// } else if (code == 500){
+//// if (ledThread != null) {
+//// String errorMsg = jsonObject.getString("msg");
+//// if (!Cools.isEmpty(errorMsg)) {
+//// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+//// }
+//// }
+//// News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+//// } else {
+////// staProtocol.setWorkNo((short) 32002);
+////// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+////// devpThread.setPakMk(staProtocol.getSiteId(), false);
+////// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+////
+//// // led 寮傚父鏄剧ず
+//// if (ledThread != null) {
+//// String errorMsg = jsonObject.getString("msg");
+////// String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒";
+//// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+//// }
+//// }
+////
+//// } catch (Exception e) {
+//// e.printStackTrace();
+//// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+//// }
+//
+// }
+// }
+//
+// }
+// }
/**
* 鍒濆鍖栧疄鏃跺湴鍥�
@@ -938,6 +1280,25 @@
}
if (wrkMast.getShuttleNo() == null) {//娌℃湁缁戝畾灏忚溅锛岃繘琛岃皟搴�
+ //寮哄埗棰勭暀涓�鍙板皬杞︾粰鍏ュ簱浠诲姟
+ int lev = Utils.getLev(wrkMast.getSourceLocNo());
+ //鑾峰彇褰撳墠妤煎眰鏈夊嚑鍙板彲鐢ㄥ皬杞�
+ int shuttleCount = shuttleDispatchUtils.getShuttleCountByLev(lev);
+ if (shuttleCount >= 2) {//鍙湁鍙敤灏忚溅鏁伴噺澶т簬2锛屾墠杩涜鍏ュ簱浠诲姟棰勭暀灏忚溅
+ int shuttleWrkInObligateCount = 1;//棰勭暀灏忚溅鏁伴噺
+ Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "shuttleWrkInObligateCount").eq("status", 1));
+ if (config != null) {
+ shuttleWrkInObligateCount = Integer.parseInt(config.getValue());
+ }
+ //鍙敤鍑哄簱灏忚溅鏁伴噺(缁欏叆搴撲换鍔¢鐣欎竴鍙拌溅)
+ int useShuttleCount = shuttleCount - shuttleWrkInObligateCount;
+ //鏌ヨ妤煎眰宸插垎閰嶈溅杈嗙殑鍑哄簱浠诲姟鏁伴噺
+ List<WrkMast> wrkMasts = wrkMastService.selectShuttleOutWrkByLev(lev);
+ if (wrkMasts.size() >= useShuttleCount) {
+ News.info("{}浠诲姟锛屽綋鍓嶆ゼ灞傚彲鐢ㄥ皬杞}鍙帮紝鍑哄簱浠诲姟宸插垎閰峽}鍙帮紝绯荤粺绛夊緟涓��", wrkMast.getWrkNo(), useShuttleCount, wrkMasts.size());
+ return false;
+ }
+ }
boolean result = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄥ簱浣嶈繘琛屽彇璐�
News.info("{}浠诲姟锛岃皟搴﹀皬杞}绯荤粺绛夊緟涓��", wrkMast.getWrkNo(), result ? "鎴愬姛" : "澶辫触");
return false;
@@ -1140,7 +1501,7 @@
//鎼滅储鏄惁鏈夊叾浠栦换鍔″崰鐢ㄤ簡鎻愬崌鏈猴紝濡傛灉鍗犵敤鎻愬崌鏈虹殑浠诲姟鍜屽綋鍓嶄换鍔$浉鍚岋紝鍒欒繍琛屾墽琛�
WrkMast wrkMast1 = wrkMastMapper.selectLiftWrkMast(liftProtocol.getLiftNo().intValue());
if (wrkMast1 != null && wrkMast1.getWrkNo().intValue() != wrkMast.getWrkNo().intValue()) {
- News.info("{0}鍙锋彁鍗囨満锛岃鍏朵粬浠诲姟{1}鍗犵敤涓斿拰褰撳墠浠诲姟{2}涓嶇浉鍚岋紝绂佹娲惧彂", liftSlave.getId(), wrkMast1.getWrkNo(), wrkMast.getWrkNo());
+ News.info("{}鍙锋彁鍗囨満锛岃鍏朵粬浠诲姟{}鍗犵敤涓斿拰褰撳墠浠诲姟{}涓嶇浉鍚岋紝绂佹娲惧彂", liftSlave.getId(), wrkMast1.getWrkNo(), wrkMast.getWrkNo());
continue;
}
@@ -1178,6 +1539,30 @@
if (!sourceBasDevp.getInEnable().equals("Y")) {
News.info("{}浠诲姟锛寋}婧愮珯锛屾病鏈夊彲鍏ヤ俊鍙�", wrkMast.getWrkNo(), sourceBasDevp.getDevNo());
return false;//绔欑偣涓嶅彲鍏�
+ }
+
+ Integer barcodeId = Utils.getBarcodeIdByStaNo(wrkMast.getSourceStaNo());
+ if (barcodeId == null) {
+ News.info("{}浠诲姟锛寋}婧愮珯锛屾壘涓嶅埌鍙敤鏉$爜鍣↖D", wrkMast.getWrkNo(), sourceBasDevp.getDevNo());
+ return false;//绔欑偣涓嶅彲鍏�
+ }
+
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId);
+ if (barcodeThread == null) {
+ News.info("{}浠诲姟锛寋}婧愮珯锛屾潯鐮佸櫒{}绾跨▼涓虹┖", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId);
+ return false;//绔欑偣涓嶅彲鍏�
+ }
+ String barcode = barcodeThread.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ if(!("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode))) {
+ //瀛樺湪鏉$爜鍊硷紝鍒ゆ柇鏄惁鍜屽綋鍓嶅伐浣滄。涓�鑷�
+ if (!barcode.equals(wrkMast.getBarcode())) {
+ News.info("{}浠诲姟,{}绔欑偣锛屾潯鐮佸櫒{}鍊納}涓庡伐浣滄。鏉$爜鍊納}涓嶄竴鑷达紝绯荤粺璺宠繃鎵ц", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId, barcode,wrkMast.getBarcode());
+ return false;//绔欑偣涓嶅彲鍏�
+ }
+ }
+ }else {
+ return false;
}
//鍒ゆ柇鎻愬崌鏈烘暣涓笁妤兼槸鍚﹂兘澶勪簬鍏ュ簱妯″紡
@@ -1477,11 +1862,11 @@
*/
public synchronized void locToLocExecute() {
//鑾峰彇鍑哄叆搴撳伐浣滄。
- List<WrkMast> wrkMasts = wrkMastMapper.selectInOutWrkMast();
- if (wrkMasts.size() > 0) {
- //鏈夊嚭鍏ュ簱浠诲姟锛屽繀椤荤瓑寰呬换鍔℃墽琛屽畬姣曞啀鎵ц搴撲綅绉昏浆
- return;
- }
+// List<WrkMast> wrkMasts = wrkMastMapper.selectInOutWrkMast();
+// if (wrkMasts.size() > 0) {
+// //鏈夊嚭鍏ュ簱浠诲姟锛屽繀椤荤瓑寰呬换鍔℃墽琛屽畬姣曞啀鎵ц搴撲綅绉昏浆
+// return;
+// }
//鏌ヨ搴撲綅绉昏浆宸ヤ綔妗�
List<WrkMast> wrkMasts1 = wrkMastMapper.selectLocToLocWrkMast();
@@ -2241,7 +2626,9 @@
RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303");
}
}
- }else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
+ }
+
+ if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
//璋冨害鏈烘鑷�
//鏌ヨ鏄惁鏈夊伐浣滄。
WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue());
@@ -2319,6 +2706,7 @@
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
+ News.info("鎮寕绾匡紝WMS杩斿洖缁撴灉锛�" + jsonObject);
Integer code = jsonObject.getInteger("code");
if (code.equals(200)) {//鍛煎彨AGV
return true;
@@ -2461,50 +2849,15 @@
ledCommand.setLocNo(wrkMast.getLocNo());
ledCommand.setStaNo(wrkMast.getStaNo());
if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
- //for (WrkDetl wrkDetl : wrkDetls) {
- // LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr()));
- //
- // locDetls.forEach(locDetl1 -> {
- // //宸ヤ綔妗d腑瀛樺湪璇ョ墿鏂欏垯璺宠繃
- // String suppCode = "";
- //
- // if (wrkDetl.getMatnr().equals(locDetl1.getMatnr())) {
- // Double anfme = 0D;
- // if (locDetl != null) {
- // anfme = locDetl.getAnfme();
- // }
- // if (wrkDetl.getSuppCode() != null) {
- // suppCode = wrkDetl.getSuppCode();
- // }
- // ledCommand.getMatDtos()
- // .add(new MatDto(wrkDetl.getMatnr()
- // , wrkDetl.getMaktx()
- // , wrkDetl.getAnfme()
- // , (wrkDetl.getAnfme()-anfme)
- // , wrkDetl.getSpecs()
- // , suppCode));
- // } else {
- // if (locDetl1.getSuppCode() != null) {
- // suppCode = locDetl1.getSuppCode();
- // }
- // ledCommand.getMatDtos()
- // .add(new MatDto(locDetl1.getMatnr()
- // , locDetl1.getMaktx()
- // , 0D
- // , locDetl1.getAnfme()
- // , locDetl1.getSpecs()
- // , suppCode));
- // }
- // });
- // //LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr()));
- //}
List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo()));
locDetls.forEach(locDetl -> {
- Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no",wrkMast.getWrkNo());
- Utils.wapperSetCondition(wrapper,"batch",locDetl.getBatch());
- Utils.wapperSetCondition(wrapper,"three_code",locDetl.getThreeCode());
- Utils.wapperSetCondition(wrapper,"dead_time",locDetl.getDeadTime());
+ Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no", wrkMast.getWrkNo());
+ Utils.wapperSetCondition(wrapper, "batch", locDetl.getBatch());
+ Utils.wapperSetCondition(wrapper, "three_code", locDetl.getThreeCode());
+ Utils.wapperSetCondition(wrapper, "dead_time", locDetl.getDeadTime());
+ Utils.wapperSetCondition(wrapper, "supp_code", locDetl.getSuppCode());//鏂欑鐮�
WrkDetl detl = wrkDetlService.selectOne(wrapper);
+
if (Cools.isEmpty(detl)) {
String suppCode = "";
if (locDetl.getSuppCode() != null) {
@@ -2513,13 +2866,32 @@
ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode));
} else {
String suppCode = "";
+ String orderNo = detl.getOrderNo();
if (detl.getSuppCode() != null) {
suppCode = detl.getSuppCode();
}
- ledCommand.getMatDtos().add(new MatDto(detl.getMatnr(), detl.getMaktx(), detl.getAnfme(), (locDetl.getAnfme() - detl.getAnfme()), detl.getSpecs(), suppCode));
+ if (isJson(orderNo)) {
+ JSONArray orders = JSON.parseArray(orderNo);
+ for (Object order : orders) {
+ JSONObject order1 = (JSONObject) order;
+ ledCommand.getMatDtos().add(new MatDto(detl.getMatnr(), detl.getMaktx(), (Double) order1.get("anfme"), (locDetl.getAnfme() - detl.getAnfme()), detl.getSpecs(), suppCode,(String) order1.get("orderNo")));
+ }
+ } else {
+ ledCommand.getMatDtos().add(new MatDto(detl.getMatnr(), detl.getMaktx(), detl.getAnfme(), (locDetl.getAnfme() - detl.getAnfme()), detl.getSpecs(), suppCode,detl.getOrderNo()));
+ }
+
+
}
});
+
+ if (locDetls.isEmpty()) {
+ List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
+ wrkDetls.forEach(wrkDetl -> {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), wrkDetl.getAnfme(), wrkDetl.getSpecs(), wrkDetl.getSuppCode()));
+ });
+ }
}
+
commands.add(ledCommand);
}
Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
@@ -2602,8 +2974,10 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
- if (staProtocol == null) { continue; }
- if (staProtocol.getWorkNo() != 0) {
+ if (staProtocol == null) {
+ continue;
+ }
+ if (staProtocol.isLoading()) {
reset = false;
break;
}
@@ -2612,13 +2986,9 @@
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
// led鏄剧ず榛樿鍐呭
if (reset && !ledThread.isLedMk()) {
- ledThread.setLedMk(false);
+ ledThread.setLedMk(true);
if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
- News.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- }else {
-// News.error("{}鍙稬ED鍛戒护涓嬪彂鎴愬姛锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()));
- ledThread.setLedMk(false);
+ log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
}
}
}
@@ -2769,6 +3139,19 @@
continue;
}
+ //***************鍒ゆ柇鏄惁婊″厖鏍″噯***************
+ EntityWrapper<Config> wrapper1 = new EntityWrapper<>();
+ wrapper.eq("code", "shuttleMaxPowerVerify");
+ Config config1 = configService.selectOne(wrapper1);
+ if (config1 != null) {
+ if (config1.getValue().equals("true")) {
+ if (shuttleProtocol.getVoltage() < 5630) {
+ continue;//鐢靛帇涓嶅缁х画鍏呯數
+ }
+ }
+ }
+ //***************鍒ゆ柇鏄惁婊″厖鏍″噯***************
+
//灏忚溅婊$數锛岀粨鏉熷厖鐢典换鍔�
NyShuttleHttpCommand chargeCommand = NyHttpUtils.getChargeCommand(shuttle.getId(), wrkCharge.getWrkNo(), false);
ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>();
--
Gitblit v1.9.1