From 4cec3f902ac1fac2d599a37dc401594e4e932cf8 Mon Sep 17 00:00:00 2001
From: L <L@132>
Date: 星期五, 18 七月 2025 18:25:14 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 276 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 175 insertions(+), 101 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 531fab4..39702ae 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -93,9 +93,9 @@
@Autowired
private WrkMastStaMapper wrkMastStaMapper;
@Autowired
- private BasRgvMapMapper basRgvMapMapper;
- @Autowired
private RgvOneSignMapper rgvOneSignMapper;
+ @Autowired
+ private BasRgvMapService basRgvMapService;
@Value("${wms.url}")
private String wmsUrl;
@@ -1310,7 +1310,11 @@
log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+// if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+// && staDetl.getCanining() != null && staDetl.getCanining().equals("Y") && staDetl.getWrkNo().equals(wrkMast.getWrkNo())) {
+// flag = true;
+// }
+ if (staProtocol.isAutoing() && staProtocol.getWorkNo() > 0
&& staDetl.getCanining() != null && staDetl.getCanining().equals("Y") && staDetl.getWrkNo().equals(wrkMast.getWrkNo())) {
flag = true;
}
@@ -2484,11 +2488,12 @@
if (Cools.isEmpty(wrkDetls)){
continue;
}
- Integer count1 = wrkDetlService.count1();
- Integer count11 = wrkDetlService.count11();
+// Integer count1 = wrkDetlService.count1();
+ Integer count111 = wrkDetlService.count111();
+// Integer count11 = wrkDetlService.count11();
Integer count2 = wrkDetlService.count2(wrkDetls.get(0).getOrderNo());
Integer count3 = wrkDetlService.count3();
- wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count1+count11,count2,count3)));
+ wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count111,count2,count3)));
}
commands.add(ledCommand);
}
@@ -2556,7 +2561,7 @@
if (staProtocol == null) {
continue;
}
- if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) {
+ if (staProtocol.getWorkNo() != 0 || staProtocol.isLoading()) {
reset = false;
break;
}
@@ -2565,21 +2570,21 @@
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
// led鏄剧ず榛樿鍐呭
if (reset && !ledThread.isLedMk()) {
- if (led.getId() == 7) {
- ledThread.setLedMk(true);
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
- log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- } else {
-
- }
- } else {
+// if (led.getId() == 7) {
+// ledThread.setLedMk(true);
+// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
+// log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+// } else {
+//
+// }
+// } else {
ledThread.setLedMk(true);
if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
} else {
}
- }
+// }
}
}
}
@@ -3552,7 +3557,13 @@
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
}
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
break;
@@ -3569,7 +3580,7 @@
// log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
// break;
// }
- rgvAvoidanceXYWrkMast(rgvProtocol.getRgvNo());
+ rgvAvoidanceXYWrkMast(rgvProtocol.getRgvNo(),wrkMastSta.getWrkNo().shortValue());
continue;
}
if (wrkMastSta.getWrkType()==6){
@@ -3630,7 +3641,13 @@
}
wrkMastSta.setWrkSts(3);
wrkMastStaMapper.updateById(wrkMastSta);
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}else if (rgvProtocol.getTaskNo2()!=0 && (rgvProtocol.getStatusType2()==RgvStatusType.WAITING || rgvProtocol.getStatusType2()==RgvStatusType.FETCHWAITING)){
@@ -3639,7 +3656,13 @@
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
}
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
break;
@@ -3688,7 +3711,13 @@
}
wrkMastSta.setWrkSts(3);
wrkMastStaMapper.updateById(wrkMastSta);
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}else {
@@ -3840,7 +3869,13 @@
&& rgvProtocol.getLoaded1()==0
&& rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(basRgv.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -3955,7 +3990,13 @@
&& rgvProtocol.getLoaded1()==0
&& rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(basRgv.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4037,7 +4078,13 @@
&& rgvProtocol.getLoaded1()==1
&& rgvProtocol.getTaskNo1()!=0 && rgvProtocol.getTaskNo2()==0
) {// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏈夌墿 鏈夊伐浣滃彿//rgv鍙敤
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(basRgv.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4124,7 +4171,13 @@
&& rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==3 || rgvProtocol.getLoaded2()==1 || rgvProtocol.getLoaded2()==4)////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛堝彧鑳芥媶鍙狅級 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗�() 锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4232,7 +4285,13 @@
&& rgvProtocol.getLoaded1()==1
&& rgvProtocol.getTaskNo1()!=0 && rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4345,7 +4404,13 @@
&& rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==2 || rgvProtocol.getLoaded2()==3 ) ////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4453,7 +4518,13 @@
&& rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==0 || rgvProtocol.getLoaded2()==1 ) //鐜板満淇敼锛氬彔鐩樻満锛�////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗╋紙鍙兘鎷嗗彔锛� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4549,7 +4620,13 @@
&& rgvProtocol.getLoaded1() == 0
&& rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4638,7 +4715,13 @@
&& rgvProtocol.getTaskNo2()==0
&& rgvProtocol.getLoaded2()==0 //鐜板満淇敼锛氬彔鐩樻満锛�////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗╋紙鍙兘鎷嗗彔锛� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4732,7 +4815,13 @@
|| (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
&& rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4925,7 +5014,13 @@
|| (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
&& rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvSlave.getId());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvSlave.getId(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}
@@ -4940,9 +5035,11 @@
* 灏忚溅XY绉诲姩 閬胯
* */
public synchronized boolean rgvAvoidanceXY(Integer rgvId){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
if (rgvId==1){
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -4965,7 +5062,6 @@
}
}else {
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -4991,14 +5087,16 @@
/*
* 灏忚溅XY绉诲姩 閬胯
* */
- public synchronized boolean rgvAvoidanceXYWrkMast(Integer rgvId){
+ public synchronized boolean rgvAvoidanceXYWrkMast(Integer rgvId,short wrkNo1){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
if (rgvId==2){
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
- rgvCommand.setTaskNo1((short) 0); // 宸ヤ綔鍙�
+ rgvCommand.setTaskNo1(wrkNo1); // 宸ヤ綔鍙�
rgvCommand.setAckFinish1((short) 1); // 浠诲姟瀹屾垚纭浣�
rgvCommand.setTaskMode1(RgvTaskModeType.NONE); // 浠诲姟妯″紡
rgvCommand.setSourceStaNo1((short)0); // 婧愮珯
@@ -5008,7 +5106,7 @@
rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
rgvCommand.setSourceStaNo2((short)121);
rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
- if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(5, rgvCommand))) {
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(10, rgvCommand))) {
//step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
return false;
@@ -5021,11 +5119,10 @@
}
}else {
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
- rgvCommand.setTaskNo1((short) 0); // 宸ヤ綔鍙�
+ rgvCommand.setTaskNo1(wrkNo1); // 宸ヤ綔鍙�
rgvCommand.setAckFinish1((short) 1); // 浠诲姟瀹屾垚纭浣�
rgvCommand.setTaskMode1(RgvTaskModeType.NONE); // 浠诲姟妯″紡
rgvCommand.setSourceStaNo1((short)0); // 婧愮珯
@@ -5035,7 +5132,7 @@
rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
rgvCommand.setSourceStaNo2((short)118);
rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
- if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(5, rgvCommand))) {
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(10, rgvCommand))) {
//step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
return false;
@@ -5053,9 +5150,11 @@
* 灏忚溅XY绉诲姩 閬胯
* */
public synchronized boolean rgvAvoidanceXY(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
if (rgvId==1){
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -5078,7 +5177,6 @@
}
}else {
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -5106,6 +5204,9 @@
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFullAll(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5128,64 +5229,13 @@
}
}
-
- /*
- * 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
- * */
- public synchronized boolean rgvTakeFullPut(Integer rgvId,WrkMastSta wrkMastSta){
- try{
- // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
- RgvCommand rgvCommand = new RgvCommand();
- rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
- rgvCommand.setAckFinish1((short) 0); // 宸ヤ綅1浠诲姟瀹屾垚纭浣�
- rgvCommand.setTaskNo1(wrkMastSta.getWrkNo().shortValue()); // 宸ヤ綅1宸ヤ綔鍙�
- rgvCommand.setTaskMode1(RgvTaskModeType.FETCH); // 宸ヤ綅1浠诲姟妯″紡: 鍗曞彇
- rgvCommand.setSourceStaNo1(wrkMastSta.getStaStart().shortValue()); //宸ヤ綅1璧风偣
- rgvCommand.setDestinationStaNo1(wrkMastSta.getStaEnd().shortValue()); //宸ヤ綅1鐩爣绔欑偣
- rgvCommand.setCommand((short) 1); //宸ヤ綅1浠诲姟纭
- if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(4, rgvCommand))) {
- //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔�
- log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
- return false;
- } else {
- return true;
- }
- }catch (Exception e){
- return false;
- }
- }
-
-
- /*
- * 灏忚溅鏀捐揣鑷冲伐浣嶄换鍔�
- * */
- public synchronized boolean rgvTakeFullTake(Integer rgvId,WrkMastSta wrkMastSta){
- try{
- // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
- RgvCommand rgvCommand = new RgvCommand();
- rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
- rgvCommand.setAckFinish1((short) 0); // 宸ヤ綅1浠诲姟瀹屾垚纭浣�
- rgvCommand.setTaskNo1(wrkMastSta.getWrkNo().shortValue()); // 宸ヤ綅1宸ヤ綔鍙�
- rgvCommand.setTaskMode1(RgvTaskModeType.PUT); // 宸ヤ綅1浠诲姟妯″紡: 鍗曟斁
- rgvCommand.setSourceStaNo1(wrkMastSta.getStaStart().shortValue()); //宸ヤ綅1璧风偣
- rgvCommand.setDestinationStaNo1(wrkMastSta.getStaEnd().shortValue()); //宸ヤ綅1鐩爣绔欑偣
- rgvCommand.setCommand((short) 1); //宸ヤ綅1浠诲姟纭
- if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(4, rgvCommand))) {
- //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔�
- log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
- return false;
- } else {
- return true;
- }
- }catch (Exception e){
- return false;
- }
- }
-
/*
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5211,6 +5261,9 @@
* 灏忚溅鏀捐揣鑷宠緭閫佺嚎浠诲姟
* */
public synchronized boolean rgvPutFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5236,6 +5289,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 鍙犵洏
* */
public synchronized boolean rgvTakeEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5261,6 +5317,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //鎷嗙洏
* */
public synchronized boolean rgvPutEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5286,6 +5345,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 婊″彇
* */
public synchronized boolean rgvTakeEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5311,6 +5373,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //婊℃斁
* */
public synchronized boolean rgvPutEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -5336,6 +5401,9 @@
* 灏忚溅澶嶄綅
* */
public synchronized boolean rgvComplete(Integer rgvId){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(3, new RgvCommand()))) {
@@ -5356,6 +5424,9 @@
* 灏忚溅澶嶄綅
* */
public synchronized boolean rgvComplete(Integer rgvId,Short taskNo1){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setTaskNo1(taskNo1);
@@ -5381,7 +5452,9 @@
if (rgvOpen){
return true;
}
-
+ if (basRgvMapCurrent.getRgvNo()>2){
+ return true;
+ }
// List<Integer> integers = RouteUtils.RouteMapCurrentFar(basRgvMapCurrent.getNowRoute(),staStart,staEnd, basRgvMapCurrent.getLockStartRoute());
//鏇存柊褰撳墠灏忚溅閿�
try{
@@ -5389,16 +5462,17 @@
// Integer farCurrentStaNo = RouteUtils.RouteIndexFarMas(staEnd, staStart, staEnd, basRgvMapCurrent.getLockStartRoute());//鑾峰彇鏈�杩滅珯鐐�
Integer fallMerge = RouteUtils.RouteIndexFarMas(basRgvMapCurrent.getRgvNo(), farCurrentStaNo); //鑾峰彇鍚堝苟骞叉秹椤�
basRgvMapCurrent.setLockEndRoute(fallMerge);
- basRgvMapMapper.updateById(basRgvMapCurrent);
+
+ basRgvMapService.updateById(basRgvMapCurrent);
//鏇存柊鍙︿竴鍙板皬杞﹀湴鍥�
Integer rgvNoOther = basRgvMapCurrent.getRgvNoOther();
- BasRgvMap basRgvMapOther = basRgvMapMapper.selectById(rgvNoOther);
+ BasRgvMap basRgvMapOther = basRgvMapService.selectById(rgvNoOther);
List<Integer> integers = RouteUtils.RouteMapCurrentFar(fallMerge, basRgvMapCurrent.getLockStartRoute());
Integer lockEndRoute = RouteUtils.RouteMapOtherFarStnNo(integers, basRgvMapCurrent.getLockStartRoute());//鍙︿竴鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�
Integer lockEndRouteL = RouteUtils.RouteIndexFarMasL(rgvNoOther, lockEndRoute);//鍙︿竴鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�
basRgvMapOther.setEndRoute(lockEndRouteL);
- basRgvMapMapper.updateById(basRgvMapOther);
+ basRgvMapService.updateById(basRgvMapOther);
return true;
}catch (Exception e){
log.error("灏忚溅鍦板浘鏇存柊鍑洪敊锛�");
--
Gitblit v1.9.1