From d2d40f1b4e2b740043f09b70efd8d5c9742ccc2e Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期日, 30 十一月 2025 10:19:19 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 496 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 417 insertions(+), 79 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 412410d..3e22f86 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -7,10 +7,7 @@
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
-import com.zy.asrs.entity.param.AgvTaskAssignmentParam;
-import com.zy.asrs.entity.param.ArmOrderAssignmentParam;
-import com.zy.asrs.entity.param.ArmTaskAssignmentParam;
-import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.OrderDetlValueResultUtil;
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
@@ -111,6 +108,10 @@
private BasArmMastService basArmMastService;
@Autowired
private ApiLogService apiLogService;
+ @Autowired
+ private BasDevpOptService basDevpOptService;
+ @Autowired
+ private MatService matService;
@Value("${wms.url}")
private String wmsUrl;
@@ -201,6 +202,7 @@
MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
}
staProtocol.setWorkNo(wrkNo);
+ staProtocol.setErrCode(errMsg);
News.info("寮傚父鍒ゆ柇{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
wrkNo++;
staProtocol.setStaNo(inSta.getBackSta().shortValue());
@@ -220,6 +222,7 @@
&& staProtocol.isPakMk()
&& staProtocol.getWorkNo() == 0
) {
+
if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
// News.error(JSON.toJSONString(staProtocol));
News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
@@ -229,6 +232,7 @@
MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
}
staProtocol.setWorkNo(wrkNo);
+ staProtocol.setErrCode(errMsg);
News.info("鏉$爜鍒ゆ柇{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg,wrkNo);
wrkNo++;
staProtocol.setStaNo(inSta.getBackSta().shortValue());
@@ -236,6 +240,9 @@
devpThread.setPakMk(staProtocol.getSiteId(), false);
MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
log.error("杈撻�佺嚎涓嬪彂1锛�"+wrkNo+","+inSta.getBackSta());
+ continue;
+ }
+ if(barcode.equals("0")){
continue;
}
// if (staProtocol.getSiteId()!= 159){
@@ -299,7 +306,6 @@
}
try {
LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
-
SearchLocParam param = new SearchLocParam();
param.setBarcode(barcode);
param.setIoType(1);
@@ -320,7 +326,15 @@
devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
log.error("杈撻�佺嚎涓嬪彂2锛�"+dto.getWorkNo()+","+dto.getStaNo());
-
+ if(staProtocol.getSiteId() == 1036){ //1036
+ BasAgvMast basAgvMast = basAgvMastService.selectOne(new EntityWrapper<BasAgvMast>().eq("sta_no", 1037));
+ AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam(basAgvMast);
+ agvBindCtnrAndBinParam.setCtnrCode(barcode);
+ ReturnT<String> resultBind = new PostMesDataUtils().postMesDataAgv("AGV瀹瑰櫒缁戝畾瑙g粦", AgvConstant.AGV_URL, AgvConstant.AGV_CTNRANDBING, agvBindCtnrAndBinParam);
+ if (resultBind.getCode()!=200){
+ agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV瀹瑰櫒缁戝畾瑙g粦", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ }
+ }
ledThread.errorReset();
log.error("缁勬墭璇锋眰鍚嶭ED閿欒娓呴櫎");
@@ -334,6 +348,10 @@
staProtocol.setWorkNo(wrkNo);
staProtocol.setStaNo(inSta.getBackSta().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
+ switch (jsonObject.getInteger("code")){
+ case 700: staProtocol.setErrCode("鏈粍鎵�");break;
+ case 500: staProtocol.setErrCode("宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�");break;
+ }
MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
News.info("浠诲姟涓嬪彂鍒ゆ柇{}鍏ュ簱鍥為��锛歿}锛岄敊璇紪鍙穥},浠诲姟鍙凤細{}", inSta.getStaNo(), errMsg,jsonObject.getInteger("code"),wrkNo);
wrkNo++;
@@ -2029,7 +2047,7 @@
BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
String errName = crnError == null ? String.valueOf(crnProtocol.getAlarm()) : crnError.getErrName();
BasErrLog basErrLog = new BasErrLog(
- null, // 缂栧彿
+ crnProtocol.getUuid(), // 缂栧彿
wrkMast.getWrkNo(), // 宸ヤ綔鍙�
now, // 鍙戠敓鏃堕棿
null, // 缁撴潫鏃堕棿
@@ -2077,7 +2095,7 @@
BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
String errName = crnError == null ? String.valueOf(crnProtocol.getAlarm()) : crnError.getErrName();
BasErrLog basErrLog = new BasErrLog(
- null, // 缂栧彿
+ crnProtocol.getUuid(), // 缂栧彿
null, // 宸ヤ綔鍙�
now, // 鍙戠敓鏃堕棿
null, // 缁撴潫鏃堕棿
@@ -2259,7 +2277,8 @@
WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
if (null == wrkMast) {
if(staProtocol.getWorkNo() > 9999){ //寮傚父閫�鍑�
- MessageQueue.offer(SlaveType.Led, 2, new Task(3, "寮傚父閫�鍑�"));
+ String err = basDevpOptService.getErr(staProtocol.getWorkNo());
+ MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, err));
}
continue;
}
@@ -2390,6 +2409,8 @@
// 鍛戒护闆嗗悎
boolean reset = true;
for (Integer staNo : led.getStaArr()) {
+// System.out.println("staArr = " + staNo);
+
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
if (staProtocol == null) { continue; }
@@ -2856,7 +2877,7 @@
for (Integer site:list){
Integer emptyCount = wrkMastMapper.countPakOutEmpty(site);
StaProtocol staProtocol = null;
- if(emptyCount >= 1 && site == 1108){
+ if(emptyCount >= 2 && site == 1108){
continue;
}else if(emptyCount == 1 && site == 2031){
continue;
@@ -3302,6 +3323,9 @@
// 鑾峰彇RGV淇℃伅
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ continue;
+ }
if (rgvProtocol.getStatusType1() != RgvStatusType.IDLE && rgvProtocol.getModeType() != RgvModeType.AUTO) {
continue;
}
@@ -3518,6 +3542,7 @@
basRgv.setPakAll("1");
basRgvService.updateById(basRgv);
rgvThread.setPakMk(true);
+
}
// List<WrkMastSta> wrkMastStaPakingNum = wrkMastStaService.selectPakingWrkNum(basRgv.getRgvNo());
// if(wrkMastStaPakingNum.size() <1){
@@ -3537,6 +3562,7 @@
// 鑾峰彇鍫嗗灈鏈轰俊鎭�
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+
if (rgvProtocol == null) {
continue;
}
@@ -3549,6 +3575,9 @@
if(rgvProtocol.getStatusType1() == RgvStatusType.WORKING){
rgvThread.setPaking(true);
}
+// if(rgvProtocol.getTaskNo1() == 0 && rgvProtocol.getTaskNo2() == 0 && rgvProtocol.getStatusType1() == RgvStatusType.IDLE){
+// rgvThread.setPaking(true);
+// }
if(rgvProtocol.isLoaded1ing() && rgvProtocol.isLoaded2ing()){
basRgv.setPakAll("1");
basRgvService.updateById(basRgv);
@@ -3704,7 +3733,7 @@
if(wrkMastSta3 != null ){
List<WrkMastSta> wrkMastStaPaking = wrkMastStaService.selectPakingWrk(wrkMastSta3.getStaStart());
- if(wrkMastStaPaking.size() < 1 ){//宸叉湁鏍囪涓嶅啀鏍囪
+ if(wrkMastStaPaking.size() < 1 && !wrkMastSta3.getWrkNo().equals(wrkMastSta.getWrkNo())){//宸叉湁鏍囪涓嶅啀鏍囪
wrkMastSta3.setMk(1);
basRgv.setPakAll("0");
basRgvService.updateById(basRgv);
@@ -3836,8 +3865,13 @@
wrkMastSta.setWorkSta(wrkMastSta1 !=null ? 2 : 1);//鑻�1鍙峰伐浣嶆湁浠诲姟缁�2鍙峰伐浣�
wrkMastSta.setRgvNo((int) rgvProtocol.getRgvNo());
boolean sign = false;
+
sign = rgvTakeFullAll(basRgvMap.getRgvNo(), wrkMastSta); //鍛戒护涓嬪彂
if (sign){
+ if(wrkMastSta.getMk() == 1){//鑻ュ凡鎵ц
+ basRgv.setPakAll("1");
+ basRgvService.updateById(basRgv);
+ }
if(LEFT_POSITION.contains(wrkMastSta.getStaEnd())){
basRgv.setPakToCrn("0");
basRgvService.updateById(basRgv);
@@ -3847,7 +3881,7 @@
}
}
}
- if(wrkMastSta3 != null ){
+ if(wrkMastSta3 != null && !wrkMastSta3.getWrkNo().equals(wrkMastSta.getWrkNo())){
List<WrkMastSta> wrkMastStaPaking = wrkMastStaService.selectPakingWrk(wrkMastSta3.getStaStart());
if(wrkMastStaPaking.size() < 1){
wrkMastSta3.setMk(1);
@@ -3855,7 +3889,7 @@
basRgvService.updateById(basRgv);
try{
wrkMastStaMapper.updateById(wrkMastSta3);
- log.error("閿佸畾鐩搁殧绔欑偣浠诲姟");
+ log.error("閿佸畾鐩搁殧绔欑偣浠诲姟:"+ wrkMastSta3.getWrkNo());
}catch (Exception e){
log.error("閿佸畾鐩搁殧绔欑偣浠诲姟澶辫触");
}
@@ -4305,8 +4339,6 @@
}
}
-
-
/*
* arm浠诲姟瀹屾垚鑷姩缁勬墭
* */
@@ -4356,7 +4388,7 @@
//arm浠诲姟瀹屾垚鑷姩缁勬墭
ReturnT<String> result = new PostMesDataUtils().postMesData("arm浠诲姟瀹屾垚鑷姩缁勬墭",wmsUrl, wmsComb, combParam);
if (result.getCode()==200){
- basArmMastService.updateArmMastStatus(basArm.getArmNo(),basArm.getSortingLineSou(),3,4);
+ basArmMastService.updateArmMastStatus(basArm.getArmNo(),basArm.getSortingLineSou(),3,5);
} else {
armTaskAssignmentCallApiLogSave(staProtocol, "鑷姩缁勬墭澶辫触", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛�===銆嬭嚜鍔ㄧ粍鎵樺け璐ワ紝绛夊緟閲嶈瘯", false);
// log.error("鏈烘鑷傛姄鍙栦换鍔″畬鎴愶細"+JSON.toJSON(basArmMastList)+"===銆嬭嚜鍔ㄧ粍鎵樺け璐ワ紝绛夊緟閲嶈瘯");
@@ -4368,6 +4400,52 @@
break;
}
}
+ }
+ } catch (Exception e){
+ log.error("鏈烘鑷傛姄鍙栦换鍔″畬鎴愮粍鎵樺け璐�"+e.getMessage());
+ }
+ }
+
+ /*
+ * arm浠诲姟瀹屾垚鑷姩缁勬墭
+ * */
+ public synchronized void armMissionAccomplished2() {
+ try{
+ List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<BasArm>().gt("arm_no",4));
+ for (BasArm basArm : basArmList) {
+ if (basArm.getStatus()!=1){
+ continue;
+ }
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", basArm.getStaNoSou()));
+ if (Cools.isEmpty(locMast)){
+ continue;
+ }
+ try{
+ List<BasArmMast> basArmMastList = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("arm_no", basArm.getArmNo())
+ .eq("sorting_line", basArm.getSortingLineSou())
+ .eq("status", 3)
+ );
+ if (basArmMastList.isEmpty()){
+ continue;
+ }
+ CombParam combParam = new CombParam(basArmMastList);
+ //arm浠诲姟瀹屾垚鑷姩缁勬墭
+ ReturnT<String> result = new PostMesDataUtils().postMesData("arm浠诲姟瀹屾垚鑷姩缁勬墭",wmsUrl, wmsComb, combParam);
+ if (result.getCode()==200){
+ basArmMastService.updateArmMastStatus(basArm.getArmNo(),basArm.getSortingLineSou(),3,5);
+ locMast.setLocSts("R");
+ locMastService.updateById(locMast);
+ } else {
+ armTaskAssignmentCallApiLogSave(locMast, "鑷姩缁勬墭澶辫触", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛�===銆嬭嚜鍔ㄧ粍鎵樺け璐ワ紝绛夊緟閲嶈瘯", false);
+// log.error("鏈烘鑷傛姄鍙栦换鍔″畬鎴愶細"+JSON.toJSON(basArmMastList)+"===銆嬭嚜鍔ㄧ粍鎵樺け璐ワ紝绛夊緟閲嶈瘯");
+ }
+ } catch (Exception e){
+ armTaskAssignmentCallApiLogSave(locMast, "鑷姩缁勬墭澶辫触", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛�===銆嬭嚜鍔ㄧ粍鎵樺け璐ワ紝绛夊緟閲嶈瘯", false);
+// log.error("arm缂栧彿锛�"+basArm.getArmNo()+"====銆嬫満姊拌噦鎶撳彇浠诲姟瀹屾垚"+e.getMessage());
+ }
+ break;
}
} catch (Exception e){
log.error("鏈烘鑷傛姄鍙栦换鍔″畬鎴愮粍鎵樺け璐�"+e.getMessage());
@@ -4422,9 +4500,9 @@
* */
public synchronized void armTaskAssignment() {
try{
- List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<>());
+ List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<BasArm>().lt("arm_no",5));
for (BasArm basArm : basArmList) {
- if (basArm.getStatus()!=1){
+ if (basArm.getStatus()!=1 || basArm.getArmNo()>4){
continue;
}
try{
@@ -4441,31 +4519,23 @@
if(!Cools.isEmpty(barcode)) {
if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
armTaskAssignmentCallApiLogSave(staProtocol, "鎵樼洏鏉$爜涓虹┖", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�", false);
-// log.error(staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�");
continue;
}
} else {
armTaskAssignmentCallApiLogSave(staProtocol, "鎵樼洏鏉$爜涓虹┖", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�", false);
-
-// log.error(staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�");
continue;
}
if(barcode.length()!=6){
armTaskAssignmentCallApiLogSave(staProtocol, "鏉$爜闀垮害涓嶆槸6浣�", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛屾潯鐮侀暱搴︿笉鏄�6浣�===>>" + barcode, false);
-// log.error(staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛屾潯鐮侀暱搴︿笉鏄�6浣�===>>" + barcode);
continue;
-// throw new CoolException(staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛屾潯鐮侀暱搴︿笉鏄�6浣�===>>" + barcode);
}
int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",barcode));
int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",barcode));
int countwait = waitPakinMapper.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",barcode));
if (countLoc > 0 || countWrk > 0 || countwait > 0) {
-// throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + barcode);
armTaskAssignmentCallApiLogSave(staProtocol, "鏉$爜鏁版嵁宸插瓨鍦�", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛岀粍鎵樻。/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + barcode, false);
-
-// log.error(staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛岀粍鎵樻。/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + barcode);
continue;
}
@@ -4486,8 +4556,6 @@
);
if (!basArmMastListError.isEmpty()){
armTaskAssignmentCallApiLogSave(staProtocol, "瀛樺湪寮傚父鏈烘鑷備换鍔�", basArm.getArmNo()+"鍙锋満姊拌噦瀛樺湪寮傚父鏁版嵁闇�瑕佺淮鎶わ紒锛侊紒", false);
-
-// log.error(basArm.getArmNo()+"鍙锋満姊拌噦瀛樺湪寮傚父鏁版嵁闇�瑕佺淮鎶わ紒锛侊紒");
continue;
}
List<BasArmMast> basArmMastListRuning = basArmMastService.selectList(
@@ -4499,9 +4567,7 @@
List<BasArmMast> basArmMastListRuning3 = basArmMastService.selectList(
new EntityWrapper<BasArmMast>()
.eq("arm_no", basArm.getArmNo())
- .eq(
-
- "sorting_line", basArm.getSortingLineSou())
+ .eq("sorting_line", basArm.getSortingLineSou())
.eq("status", 3)
);
if (basArmMastListRuning.isEmpty() && basArmMastListRuning3.isEmpty()){
@@ -4516,8 +4582,6 @@
}
if (basArmMastList.size()>1){
armTaskAssignmentCallApiLogSave(staProtocol, "浠诲姟寰呮墽琛屾暟閲忓ぇ浜�1,鏃犳硶鍒嗚鲸寰呮墽琛屼换鍔�", "arm缂栧彿锛�"+basArm.getArmNo()+"====銆嬫媶鐮佸灈浠诲姟寮傚父绂佹涓嬪彂锛侊紒锛佷换鍔″緟鎵ц鏁伴噺澶т簬1锛侊紒锛�", false);
-
-// log.error("arm缂栧彿锛�"+basArm.getArmNo()+"====銆嬫媶鐮佸灈浠诲姟寮傚父绂佹涓嬪彂锛侊紒锛佷换鍔″緟鎵ц鏁伴噺澶т簬1锛侊紒锛�");
continue;
}
BasArmMast basArmMast = basArmMastList.get(0);
@@ -4525,33 +4589,27 @@
new EntityWrapper<BasArmMast>()
.eq("arm_no", basArm.getArmNo())
.eq("sorting_line", basArm.getSortingLineSou())
- .eq("sku", basArmMast.getSku())
+ .eq("matnr", basArmMast.getMatnr())
.eq("order_no", basArmMast.getOrderNo())
.eq("binding_tags", basArmMast.getBindingTags())
);
if (basArmMastListOrder.size()==1){
Thread.sleep(100);
-
List<BasArmMast> basArmMastListRuningBarCode2 = basArmMastService.selectList(
- new EntityWrapper<BasArmMast>()
- .eq("barcode", barcode)
+ new EntityWrapper<BasArmMast>().eq("barcode", barcode)
);
if (!basArmMastListRuningBarCode2.isEmpty()){
int binding_tags = basArmMastService.selectCount(
new EntityWrapper<BasArmMast>()
.eq("status", 2)
- .eq("binding_tags", basArmMast.getBindingTags())
- );
-
+ .eq("binding_tags", basArmMast.getBindingTags()));
if (binding_tags<2){
BasArmMast basArmMastOne = basArmMastService.selectOne(
new EntityWrapper<BasArmMast>()
.eq("status", 2)
- .eq("binding_tags", basArmMast.getBindingTags())
- );
- Double anfmeSignOne = basArmMastService.selectBasArmMastSignValue(basArmMastOne.getOrderNo(), basArmMastOne.getSku(),basArmMastOne.getBindingTags());
-
+ .eq("binding_tags", basArmMast.getBindingTags()));
+ Double anfmeSignOne = basArmMastService.selectBasArmMastSignValue(basArmMastOne.getOrderNo(), basArmMastOne.getMatnr(),basArmMastOne.getBindingTags());
if (anfmeSignOne>1D){
armTaskAssignmentCallApiLogSave(staProtocol, "鏉$爜鏁版嵁宸插瓨鍦紒锛侊紒", staProtocol.getSiteId()+"鐮佸灈浣嶇疆锛屾潯鐮佹暟鎹鍦ㄨ嚜鍔ㄧ粍鎵�===>>" + barcode, false);
continue;
@@ -4559,30 +4617,24 @@
}
}
- OrderDetlValueResultUtil orderDetlValueResultUtil = basArmMastService.selectOrderDetlValue(basArmMast.getOrderNo(), basArmMast.getSku());
+ OrderDetlValueResultUtil orderDetlValueResultUtil = basArmMastService.selectOrderDetlValue(basArmMast.getOrderNo(), basArmMast.getMatnr());
if (Cools.isEmpty(orderDetlValueResultUtil)){
continue;
}
- Double anfmeSign = basArmMastService.selectBasArmMastSignValue(basArmMast.getOrderNo(), basArmMast.getSku(),basArmMast.getBindingTags());
+ Double anfmeSign = basArmMastService.selectBasArmMastSignValue(basArmMast.getOrderNo(), basArmMast.getMatnr(),basArmMast.getBindingTags());
orderDetlValueResultUtil.setAnfme(anfmeSign);
//璁㈠崟涓嬪彂
try{
ArmOrderAssignmentParam armOrderAssignmentParam = new ArmOrderAssignmentParam(basArmMast,orderDetlValueResultUtil);
// 璁㈠崟涓嬪彂(SKU+璁㈠崟)
ReturnT<String> result = new PostMesDataUtils().postMesData("鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙戯細",ArmConstant.getArmUrl(basArmMast.getArmNo()), ArmConstant.ARM_ADAPTOR, armOrderAssignmentParam);
- if (result.getCode()==200){
-// basArmMast.setStatus(1);
-// basArmMast.setBarcode(barcode);
-// basArmMastService.updateById(basArmMast);
- } else {
+ if (result.getCode()!=200){
armTaskAssignmentCallApiLogSave(staProtocol, "鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙�", "arm缂栧彿锛�"+basArm.getArmNo()+"璁㈠崟涓嬪彂璁㈠崟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
-
-// log.error("arm缂栧彿锛�"+basArm.getArmNo()+"鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙戯細"+JSON.toJSON(basArmMast)+"===銆嬭鍗曚俊鎭笅鍙戝け璐�");
+ continue;
}
} catch (Exception e){
armTaskAssignmentCallApiLogSave(staProtocol, "鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙�", "arm缂栧彿锛�"+basArm.getArmNo()+"璁㈠崟涓嬪彂璁㈠崟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
-// log.error("arm缂栧彿锛�"+basArm.getArmNo()+"鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙戯細"+JSON.toJSON(basArmMast)+"===銆嬭鍗曚笅鍙戣鍗曚俊鎭笅鍙戝け璐�");
continue;
}
}
@@ -4595,7 +4647,150 @@
basArmMastService.updateById(basArmMast);
} else {
armTaskAssignmentCallApiLogSave(staProtocol, "鏈烘鑷傛姄鍙栦换鍔′俊鎭笅鍙戝け璐�", "arm缂栧彿锛�"+basArm.getArmNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
-// log.error("鏈烘鑷傛姄鍙栦换鍔★細"+JSON.toJSON(basArmMast)+"===銆嬩换鍔′俊鎭笅鍙戝け璐�");
+ }
+ }
+ } catch (Exception e){
+ log.error("arm缂栧彿锛�"+basArm.getArmNo()+"====銆嬫媶鐮佸灈浠诲姟涓嬪彂澶辫触"+e.getMessage());
+ }
+ }
+ }catch (Exception e){
+ log.error("arm浠诲姟涓嬪彂澶辫触"+e.getMessage());
+ }
+ }
+
+ /*
+ * arm浠诲姟涓嬪彂
+ * */
+ public synchronized void armTaskAssignment2() {
+ try{
+ List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<BasArm>().gt("arm_no",4));
+ for (BasArm basArm : basArmList) {
+ if (basArm.getStatus()!=1 || basArm.getArmNo()<5){
+ continue;
+ }
+ try{
+ LocMast locMastEnd = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", basArm.getStaNoSou()));
+ if(!locMastEnd.getLocSts().equals("D")){
+ continue;
+ }
+
+ String barcode = locMastEnd.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "0".equals(barcode)) {
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鎵樼洏鏉$爜涓虹┖", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�", false);
+ continue;
+ }
+ } else {
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鎵樼洏鏉$爜涓虹┖", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛�===銆嬫墭鐩樻潯鐮佷负绌�", false);
+ continue;
+ }
+
+ if(barcode.length()!=6){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏉$爜闀垮害涓嶆槸6浣�", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛屾潯鐮侀暱搴︿笉鏄�6浣�===>>" + barcode, false);
+ continue;
+ }
+
+ int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",barcode));
+ int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",barcode));
+ int countwait = waitPakinMapper.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",barcode));
+ if (countLoc > 0 || countWrk > 0 || countwait > 0) {
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏉$爜鏁版嵁宸插瓨鍦�", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛岀粍鎵樻。/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + barcode, false);
+ continue;
+ }
+
+ List<BasArmMast> basArmMastListRuningBarCode = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("barcode", barcode)
+ .eq("status", 3)
+ );
+ if (!basArmMastListRuningBarCode.isEmpty()){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏉$爜鏁版嵁宸插瓨鍦�,姝e湪鑷姩缁勬墭锛侊紒锛�", basArm.getStaNoSou()+"鐮佸灈浣嶇疆锛屾潯鐮佹暟鎹鍦ㄨ嚜鍔ㄧ粍鎵�===>>" + barcode, false);
+ continue;
+ }
+ List<BasArmMast> basArmMastListError = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("arm_no", basArm.getArmNo())
+ .eq("sorting_line", basArm.getSortingLineSou())
+ .eq("status", 9)
+ );
+ if (!basArmMastListError.isEmpty()){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "瀛樺湪寮傚父鏈烘鑷備换鍔�", basArm.getArmNo()+"鍙锋満姊拌噦瀛樺湪寮傚父鏁版嵁闇�瑕佺淮鎶わ紒锛侊紒", false);
+ continue;
+ }
+ List<BasArmMast> basArmMastListRuning = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("arm_no", basArm.getArmNo())
+ .eq("sorting_line", basArm.getSortingLineSou())
+ .eq("status", 1)
+ );
+ List<BasArmMast> basArmMastListRuning3 = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("arm_no", basArm.getArmNo())
+ .eq("sorting_line", basArm.getSortingLineSou())
+ .eq("status", 3)
+ );
+ if (basArmMastListRuning.isEmpty() && basArmMastListRuning3.isEmpty()){
+ List<BasArmMast> basArmMastList = basArmMastService.selectList(
+ new EntityWrapper<BasArmMast>()
+ .eq("arm_no", basArm.getArmNo())
+ .eq("sorting_line", basArm.getSortingLineSou())
+ .eq("sta_no", basArm.getStaNoSou())
+ .eq("status", 0)
+ );
+ if (basArmMastList.isEmpty()){
+ continue;
+ }
+ if (basArmMastList.size()>1){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "浠诲姟寰呮墽琛屾暟閲忓ぇ浜�1,鏃犳硶鍒嗚鲸寰呮墽琛屼换鍔�", "arm缂栧彿锛�"+basArm.getArmNo()+"====銆嬫媶鐮佸灈浠诲姟寮傚父绂佹涓嬪彂锛侊紒锛佷换鍔″緟鎵ц鏁伴噺澶т簬1锛侊紒锛�", false);
+ continue;
+ }
+ BasArmMast basArmMast = basArmMastList.get(0);
+// List<BasArmMast> basArmMastListOrder = basArmMastService.selectList(
+// new EntityWrapper<BasArmMast>()
+// .eq("arm_no", basArm.getArmNo())
+// .eq("sorting_line", basArm.getSortingLineSou())
+// .eq("matnr", basArmMast.getMatnr())
+// .eq("order_no", basArmMast.getOrderNo())
+// .eq("binding_tags", basArmMast.getBindingTags())
+// );
+// if (basArmMastListOrder.size()==1){
+// OrderDetlValueResultUtil orderDetlValueResultUtil = basArmMastService.selectOrderDetlValue(basArmMast.getOrderNo(), basArmMast.getMatnr());
+//
+// if (Cools.isEmpty(orderDetlValueResultUtil)){
+// continue;
+// }
+
+ OrderDetlValueResultUtil orderDetlValueResultUtil = new OrderDetlValueResultUtil();
+ Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", basArmMast.getMatnr()));
+// Double anfmeSign = basArmMastService.selectBasArmMastSignValue(basArmMast.getOrderNo(), basArmMast.getMatnr(),basArmMast.getBindingTags());
+ orderDetlValueResultUtil.setAnfme(1D);
+ orderDetlValueResultUtil.setHeight(mat.getHeight());
+ orderDetlValueResultUtil.setWeight(mat.getWeight());
+ orderDetlValueResultUtil.setLength(mat.getManLength());
+ orderDetlValueResultUtil.setWidth(mat.getWidth());
+ //璁㈠崟涓嬪彂
+ try{
+ ArmOrderAssignmentParam armOrderAssignmentParam = new ArmOrderAssignmentParam(basArmMast,orderDetlValueResultUtil);
+// 璁㈠崟涓嬪彂(SKU+璁㈠崟)
+ ReturnT<String> result = new PostMesDataUtils().postMesData("鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙戯細",ArmConstant.getArmUrl(basArmMast.getArmNo()), ArmConstant.ARM_ADAPTOR, armOrderAssignmentParam);
+ if (result.getCode()!=200){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙�", "arm缂栧彿锛�"+basArm.getArmNo()+"璁㈠崟涓嬪彂璁㈠崟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ continue;
+ }
+ } catch (Exception e){
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏈烘鑷傛姄鍙栬鍗曪紙SKU锛変笅鍙�", "arm缂栧彿锛�"+basArm.getArmNo()+"璁㈠崟涓嬪彂璁㈠崟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ continue;
+ }
+// }
+ ArmTaskAssignmentParam armTaskAssignmentParam = new ArmTaskAssignmentParam(basArm.getSortingLine());
+ //璁剧疆宸ヤ綔绌洪棿灏辩华
+ ReturnT<String> result = new PostMesDataUtils().postMesData("鏈烘鑷傛姄鍙栦换鍔′笅鍙戯細閫氱煡宸ヤ綔绌洪棿宸插氨缁�",ArmConstant.getArmUrl(basArmMast.getArmNo()), ArmConstant.ARM_WORKSPACE, armTaskAssignmentParam);
+ if (result.getCode()==200){
+ basArmMast.setStatus(1);
+ basArmMast.setBarcode(barcode);
+ basArmMastService.updateById(basArmMast);
+ } else {
+ armTaskAssignmentCallApiLogSave(locMastEnd, "鏈烘鑷傛姄鍙栦换鍔′俊鎭笅鍙戝け璐�", "arm缂栧彿锛�"+basArm.getArmNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
}
}
} catch (Exception e){
@@ -4631,6 +4826,33 @@
// 濡傛灉娌℃湁绗﹀悎鏉′欢鐨勮褰曪紝鎴栬�呮墍鏈夎褰曟椂闂村樊澶т簬 5 鍒嗛挓锛屼繚瀛樻柊鐨勬棩蹇�
apiLogService.save("鏈烘鑷備换鍔$浉鍏�", tableName, "null", staProtocol.getBarcode(),
"绔欑偣鍙�:" + staProtocol.getSiteId(),
+ response, bool);
+ }
+
+ public void armTaskAssignmentCallApiLogSave(LocMast locMast, String tableName, String response, Boolean bool) {
+ // 鏌ヨ绗﹀悎鏉′欢鐨勬墍鏈� ApiLog
+ List<ApiLog> apiLogs = apiLogService.selectList(new EntityWrapper<ApiLog>()
+ .eq("namespace", "鏈烘鑷備换鍔$浉鍏�")
+ .eq("request", "绔欑偣鍙�:" + locMast.getLocNo())
+ .eq("response", response)
+ .eq("url", tableName)
+ .eq("client_ip", locMast.getBarcode())
+ .eq("result", 0)
+ .orderBy("create_time", false)
+ );
+
+ // 閬嶅巻缁撴灉闆嗭紝妫�鏌ユ椂闂存埑宸�兼槸鍚﹀皬浜� 5 鍒嗛挓
+ for (ApiLog apiLog : apiLogs) {
+ long parseLong = Long.parseLong(apiLog.getTimestamp());
+ if (new Date().getTime() - parseLong < 5 * 1000 * 60) {
+ // 濡傛灉鎵惧埌绗﹀悎鏉′欢鐨勮褰曚笖鏃堕棿宸皬浜� 5 鍒嗛挓锛屽垯涓嶄繚瀛樻柊璁板綍锛岀洿鎺ヨ繑鍥�
+ return;
+ }
+ }
+
+ // 濡傛灉娌℃湁绗﹀悎鏉′欢鐨勮褰曪紝鎴栬�呮墍鏈夎褰曟椂闂村樊澶т簬 5 鍒嗛挓锛屼繚瀛樻柊鐨勬棩蹇�
+ apiLogService.save("鏈烘鑷備换鍔$浉鍏�", tableName, "null", locMast.getBarcode(),
+ "绔欑偣鍙�:" + locMast.getLocNo(),
response, bool);
}
@@ -4691,7 +4913,13 @@
JSONObject jsonObject = JSON.parseObject(response);
if (jsonObject.getInteger("code").equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-
+ if(wrkMast.getStaNo()<2000){
+ basAgvMast.setFloorNo(1);
+ }else if(wrkMast.getStaNo()<4000){
+ basAgvMast.setFloorNo(2);
+ }else{
+ basAgvMast.setFloorNo(3);
+ }
basAgvMast.setTaskNo(wrkMast.getWrkNo());
basAgvMast.setSourceStaNo(outStaAgv.getStaNo());
basAgvMast.setLocNo(dto.getLocNo());
@@ -4700,6 +4928,7 @@
basAgvMast.setIoType(2);
basAgvMastService.insert(basAgvMast);
+
wrkMast.setTakeNone("2");
@@ -4739,8 +4968,8 @@
String barcode = staProtocol.getBarcode();
if(!Cools.isEmpty(barcode)) {
- if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
- News.info("{}鍙风珯鐐规壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", outStaAgv.getStaNo(), barcode);
+ if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "0".equals(barcode)) {
+// News.info("{}鍙风珯鐐规壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", outStaAgv.getStaNo(), barcode);
continue;
}
} else {
@@ -4755,7 +4984,9 @@
// News.info("{}鍙风珯鐐瑰瓨鍦ㄤ换鍔℃墽琛屼腑锛岃绛夊緟浠诲姟鎵ц瀹屾瘯锛歿}", outStaAgv.getStaNo(), barcode);
continue;
}
-
+ if(barcode.equals("0")){
+ continue;
+ }
List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>().eq("barcode", barcode));
if (!locMastList.isEmpty()) {
News.info("{}鍙风珯鐐规潯鐮佷俊鎭噸澶嶏細{}", outStaAgv.getStaNo(), barcode);
@@ -4783,12 +5014,12 @@
JSONObject jsonObject = JSON.parseObject(response);
if (jsonObject.getInteger("code").equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-
basAgvMast.setTaskNo(outStaAgv.getStaNo());
basAgvMast.setSourceStaNo(outStaAgv.getStaNo());
basAgvMast.setLocNo(dto.getLocNo());
basAgvMast.setDevpId(devp.getId());
basAgvMast.setIoType(2);
+ basAgvMast.setFloorNo(2);
basAgvMastService.insert(basAgvMast);
} else {
@@ -4836,18 +5067,37 @@
BasAgvMast basAgvMast = new BasAgvMast();
try {
- List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>()
- .eq("loc_sts", "R")
- .ge("row1", 23)
- .le("row1", 32)
- .orderBy("io_time",true)
- );
+ List<LocMast> locMastList = null;
+ Integer floorNo = 1;
+ if(inStaAgv.getStaNo() < 2000){
+ locMastList = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("loc_sts", "R")
+ .ge("row1", 21)
+ .le("row1", 26)
+ .orderBy("io_time",true)
+ );
+ }else if(inStaAgv.getStaNo() < 4000){
+ locMastList = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("loc_sts", "R")
+ .ge("row1", 28)
+ .le("row1", 31)
+ .orderBy("io_time",true));
+ floorNo = 2;
+ }else{
+ locMastList = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("loc_sts", "R")
+ .ge("row1", 32)
+ .le("row1", 38)
+ .orderBy("io_time",true));
+ floorNo = 3;
+ }
for (LocMast locMast : locMastList){
basAgvMast.setTaskNo(inStaAgv.getStaNo());
basAgvMast.setSourceLocNo(locMast.getLocNo());
basAgvMast.setStaNo(inStaAgv.getStaNo());
basAgvMast.setDevpId(devp.getId());
+ basAgvMast.setFloorNo(floorNo);
basAgvMast.setIoType(0);//AGV搴撲綅==銆嬭緭閫佺嚎绔欑偣 0
basAgvMastService.insert(basAgvMast);
break;
@@ -4856,6 +5106,52 @@
} catch (Exception e) {
News.error(JSON.toJSONString(e.getMessage()));
}
+ }
+ }
+ }
+ }
+
+ /*
+ * agv浠诲姟鐢熸垚 寮傚父閫佸埌鍏ュ簱鍙�
+ * */
+ public synchronized void agvTaskCreateException() {
+ // 鏍规嵁杈撻�佺嚎plc閬嶅巻
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ Integer outStaAgv = 1041;
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(outStaAgv);
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
+ if (!staProtocol.isLoading()){
+ continue;
+ }
+
+ if (staProtocol.isAutoing() && staProtocol.getWorkNo() > 10000) {
+
+ // 鍒ゆ柇閲嶅宸ヤ綔妗�
+ List<BasAgvMast> basAgvMastList = basAgvMastService.selectList(new EntityWrapper<BasAgvMast>().eq("sta_no", 1037));
+ if (!basAgvMastList.isEmpty()) {
+ News.info("{}鍙风珯鐐瑰瓨鍦ㄤ换鍔℃墽琛屼腑锛岀瓑寰呬换鍔℃墽琛屽畬姣�!!!", outStaAgv);
+ continue;
+ }
+ // 浠诲姟鐢熸垚鍖� --------------------------------------------------------------------------
+
+ BasAgvMast basAgvMast = new BasAgvMast();
+ try {
+ basAgvMast.setTaskNo(staProtocol.getWorkNo());
+ basAgvMast.setSourceStaNo(1041);
+ basAgvMast.setStaNo(1037);
+ basAgvMast.setDevpId(devp.getId());
+ basAgvMast.setIoType(3);//杈撻��==銆嬭緭閫佺嚎绔欑偣 3
+ basAgvMastService.insert(basAgvMast);
+ break;
+ } catch (Exception e) {
+ News.error(JSON.toJSONString(e.getMessage()));
}
}
}
@@ -4874,7 +5170,7 @@
}
try{
// 鑾峰彇绔欑偣淇℃伅
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getDevpId());
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getFloorNo() !=1?2:1);
StaProtocol staProtocol = devpThread.getStation().get(basAgvMast.getStaNo());
if (staProtocol == null) {
continue;
@@ -4883,9 +5179,14 @@
}
if (staProtocol.isAutoing()){
+ AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam(basAgvMast);
+ agvBindCtnrAndBinParam.setCtnrCode(basAgvMast.getTimestamp().toString());
+ ReturnT<String> resultBind = new PostMesDataUtils().postMesDataAgv("AGV瀹瑰櫒缁戝畾", AgvConstant.AGV_URL, AgvConstant.AGV_CTNRANDBING, agvBindCtnrAndBinParam);
+ if (resultBind.getCode()!=200){
+ agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV瀹瑰櫒缁戝畾", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ }
AgvTaskAssignmentParam agvTaskAssignmentParam = new AgvTaskAssignmentParam(basAgvMast);
-
//浠诲姟涓嬪彂
ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
if (result.getCode()==200){
@@ -4903,6 +5204,8 @@
log.error("AGV浠诲姟涓嬪彂澶辫触"+e.getMessage());
}
}
+
+
/*
* agv浠诲姟涓嬪彂:AGV搴撲綅==銆婣GV搴撲綅
@@ -4947,7 +5250,7 @@
}
try{
// 鑾峰彇绔欑偣淇℃伅
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getDevpId());
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getFloorNo() !=1?2:1);
StaProtocol staProtocol = devpThread.getStation().get(basAgvMast.getSourceStaNo());
if (staProtocol == null || !staProtocol.isLoading()) {
continue;
@@ -4960,15 +5263,35 @@
(basAgvMast.getSourceStaNo().equals(2033))){
AgvTaskAssignmentParam agvTaskAssignmentParam = new AgvTaskAssignmentParam(basAgvMast);
-
- //浠诲姟涓嬪彂
- ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
- if (result.getCode()==200){
- basAgvMast.setStatus(1);
- basAgvMastService.updateById(basAgvMast);
- } else {
- agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV浠诲姟涓嬪彂澶辫触", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ if(basAgvMast.getFloorNo()==1 || basAgvMast.getStaNo().equals(2034)) {
+ WrkMast wrkMast = wrkMastService.selectByWrkNo(staProtocol.getWorkNo());
+ AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam(basAgvMast);
+ agvBindCtnrAndBinParam.setCtnrCode(wrkMast.getBarcode());
+ agvBindCtnrAndBinParam.setCtnrTyp("1");
+ ReturnT<String> resultBind = new PostMesDataUtils().postMesDataAgv("AGV瀹瑰櫒缁戝畾瑙g粦", AgvConstant.AGV_URL, AgvConstant.AGV_CTNRANDBING, agvBindCtnrAndBinParam);
+ if (resultBind.getCode()==200){
+ //浠诲姟涓嬪彂
+ ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
+ if (result.getCode()==200){
+ basAgvMast.setStatus(1);
+ basAgvMastService.updateById(basAgvMast);
+ } else {
+ agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV浠诲姟涓嬪彂澶辫触", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ }
+ } else {
+ agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV瀹瑰櫒缁戝畾瑙g粦", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ }
+ }else{
+ //浠诲姟涓嬪彂
+ ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
+ if (result.getCode()==200){
+ basAgvMast.setStatus(1);
+ basAgvMastService.updateById(basAgvMast);
+ } else {
+ agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV浠诲姟涓嬪彂澶辫触", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+ }
}
+//
}
} catch (Exception e){
log.error("浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"====銆婣GV浠诲姟涓嬪彂澶辫触"+e.getMessage());
@@ -4991,7 +5314,7 @@
}
try{
// 鑾峰彇绔欑偣淇℃伅
- SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getDevpId());
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, basAgvMast.getFloorNo() !=1?2:1);
StaProtocol staProtocol = devpThread.getStation().get(basAgvMast.getSourceStaNo());
if (staProtocol == null || !staProtocol.isLoading()) {
continue;
@@ -5009,7 +5332,21 @@
if (!Cools.isEmpty(staProtocol.getWorkNo()) && staProtocol.getWorkNo().equals(basAgvMast.getTaskNo())){
AgvTaskAssignmentParam agvTaskAssignmentParam = new AgvTaskAssignmentParam(basAgvMast);
-
+// AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam(basAgvMast);
+//
+// ReturnT<String> resultBind = new PostMesDataUtils().postMesDataAgv("AGV瀹瑰櫒缁戝畾瑙g粦", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvBindCtnrAndBinParam);
+// if (resultBind.getCode()==200){
+// //浠诲姟涓嬪彂
+// ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
+// if (result.getCode()==200){
+// basAgvMast.setStatus(1);
+// basAgvMastService.updateById(basAgvMast);
+// } else {
+// agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV浠诲姟涓嬪彂澶辫触", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+// }
+// } else {
+// agvTaskAssignmentCallApiLogSave(basAgvMast, "AGV瀹瑰櫒缁戝畾瑙g粦", "浠诲姟鍙凤細"+basAgvMast.getTaskNo()+"浠诲姟淇℃伅涓嬪彂澶辫触锛侊紒锛�", false);
+// }
//浠诲姟涓嬪彂
ReturnT<String> result = new PostMesDataUtils().postMesDataAgv("AGV浠诲姟涓嬪彂", AgvConstant.AGV_URL, AgvConstant.AGV_ADAPTOR, agvTaskAssignmentParam);
if (result.getCode()==200){
@@ -5028,6 +5365,7 @@
}
}
+
public void agvTaskAssignmentCallApiLogSave(BasAgvMast basAgvMast ,String tableName, String response, Boolean bool) {
ApiLog apiLog = apiLogService.selectOne(new EntityWrapper<ApiLog>()
.eq("namespace", "Agv浠诲姟涓嬪彂")
--
Gitblit v1.9.1