From 53f87c2ff10f7ab71d6b0340a5a4811089d7cd1e Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期五, 28 十一月 2025 17:17:48 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/entity/param/ArmAgvGratingParam.java | 16 ++
src/main/java/com/zy/asrs/controller/OpenController.java | 35 +++++
src/main/resources/mapper/BasArmMastMapper.xml | 1
src/main/java/com/zy/asrs/service/BasArmMastService.java | 2
src/main/java/com/zy/asrs/entity/param/AgvGoTheArnParam.java | 59 ++++++++
src/main/java/com/zy/asrs/mapper/BasArmMastMapper.java | 2
src/main/java/com/zy/common/constant/ArmConstant.java | 41 +++++
src/main/java/com/zy/asrs/service/OpenService.java | 1
src/main/java/com/zy/asrs/service/impl/BasArmMastServiceImpl.java | 4
src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java | 89 ++++++------
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 22 ++
src/main/java/com/zy/erp/kingdee/utils/PostMesDataUtils.java | 88 ++++++++++++
src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java | 11 +
13 files changed, 316 insertions(+), 55 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 68f380c..bcba859 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -403,6 +403,9 @@
} catch (Exception e){
return R.error("鍗曟嵁缂栧彿[order_id]浠� "+sign_arm_sku+" 涓� "+sign_arm_order+" 浣滀负鎷嗗垎鏍囪鎷嗗垎澶辫触锛侊紒锛�");
}
+ if (param.getArm_no()>4){
+ return R.ok().add(true);
+ }
boolean taskArmWorkOrderSign = openService.TaskArmWorkOrderSign(param);
return R.ok().add(taskArmWorkOrderSign);
@@ -511,4 +514,36 @@
return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
}
+ /**
+ * AGV鐢宠杩囧厜鏍�
+ */
+ @PostMapping("/agv/arm/grating/v1/agvCallback")
+ @AppAuth(memo = "AGV鐢宠杩囧厜鏍�")
+ public synchronized R agvGrating(@RequestHeader(required = false) String appkey,
+ @RequestBody AgvGoTheArnParam param,
+ HttpServletRequest request) {
+// auth(appkey, param, request);
+ if (Cools.isEmpty(param)) {
+ return R.parse(BaseRes.PARAM);
+ }
+ if (Cools.isEmpty(param.getCurrentPositionCode())) {
+ return R.error("浣嶇疆[currentPositionCode]涓嶈兘涓虹┖");
+ }
+ boolean bindCtnrAndBin = true;
+ List<ArmAgvGratingParam> armList = param.getArmNo();
+ if (armList.isEmpty()){
+ return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
+ }
+ for (ArmAgvGratingParam arm : armList){
+ if (bindCtnrAndBin){
+ bindCtnrAndBin = openService.agvApplicationPassedTheGrating(arm);
+// System.out.println("璇锋眰閫氳繃鍏夋爡"+armNo);
+ }
+ }
+ if (bindCtnrAndBin) {
+ return new R(0,"鎴愬姛");
+ }
+ return R.error("搴撲綅涓嶅瓨鍦ㄦ垨鏃犳槑缁�");
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/entity/param/AgvGoTheArnParam.java b/src/main/java/com/zy/asrs/entity/param/AgvGoTheArnParam.java
new file mode 100644
index 0000000..b382c8c
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/AgvGoTheArnParam.java
@@ -0,0 +1,59 @@
+package com.zy.asrs.entity.param;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class AgvGoTheArnParam {
+ String reqCode; //浠诲姟鍙�
+ String reqTime; //
+ String currentPositionCode; // 浣嶇疆
+ String method; //
+ String robotCode; //
+ String taskCode; //
+
+ public List<ArmAgvGratingParam> getArmNo() {
+ List<ArmAgvGratingParam> armList = new ArrayList<>();
+ if (this.currentPositionCode == null) return armList;
+ switch (this.currentPositionCode) {
+ case "028370CC015200":
+ case "029870CC015200":
+ case "3100101":
+ case "3100201":
+ ArmAgvGratingParam armAgvGratingParam1 = new ArmAgvGratingParam();
+ armAgvGratingParam1.setArmNo(5);
+ armAgvGratingParam1.setChannel("A1");
+ armList.add(armAgvGratingParam1);
+ return armList;
+ case "028440CC024257":
+ case "029940CC024257":
+ case "3000101":
+ case "3000201":
+ case "2900101":
+ case "2900201":
+ ArmAgvGratingParam armAgvGratingParam2 = new ArmAgvGratingParam();
+ armAgvGratingParam2.setArmNo(5);
+ armAgvGratingParam2.setChannel("A2");
+ armList.add(armAgvGratingParam2);
+ ArmAgvGratingParam armAgvGratingParam3 = new ArmAgvGratingParam();
+ armAgvGratingParam3.setArmNo(6);
+ armAgvGratingParam3.setChannel("A1");
+ armList.add(armAgvGratingParam3);
+ return armList;
+ case "028440CC031993":
+ case "029940CC031993":
+ case "2800101":
+ case "2800201":
+ ArmAgvGratingParam armAgvGratingParam4 = new ArmAgvGratingParam();
+ armAgvGratingParam4.setArmNo(6);
+ armAgvGratingParam4.setChannel("A2");
+ armList.add(armAgvGratingParam4);
+ return armList;
+ default:
+ return armList;
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/entity/param/ArmAgvGratingParam.java b/src/main/java/com/zy/asrs/entity/param/ArmAgvGratingParam.java
new file mode 100644
index 0000000..d9adf79
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/ArmAgvGratingParam.java
@@ -0,0 +1,16 @@
+package com.zy.asrs.entity.param;
+
+import com.core.common.DateUtils;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class ArmAgvGratingParam {
+ Integer armNo; //
+ String channel; //
+ String date_time = DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F); //
+
+}
diff --git a/src/main/java/com/zy/asrs/mapper/BasArmMastMapper.java b/src/main/java/com/zy/asrs/mapper/BasArmMastMapper.java
index 9ccbbfc..c84efe9 100644
--- a/src/main/java/com/zy/asrs/mapper/BasArmMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/BasArmMastMapper.java
@@ -9,6 +9,6 @@
@Mapper
@Repository
public interface BasArmMastMapper extends BaseMapper<BasArmMast> {
- boolean updateArmMastStatus(@Param("armNo")int armNo, @Param("sortingLine")int sortingLine, @Param("status")int status, @Param("endStatus")int endStatus);
+ boolean updateArmMastStatus(@Param("armNo")int armNo, @Param("sortingLine")int sortingLine, @Param("status")int status, @Param("endStatus")int endStatus, @Param("staNoEnd")int staNoEnd);
}
diff --git a/src/main/java/com/zy/asrs/service/BasArmMastService.java b/src/main/java/com/zy/asrs/service/BasArmMastService.java
index deb0247..f604574 100644
--- a/src/main/java/com/zy/asrs/service/BasArmMastService.java
+++ b/src/main/java/com/zy/asrs/service/BasArmMastService.java
@@ -4,6 +4,6 @@
import com.baomidou.mybatisplus.service.IService;
public interface BasArmMastService extends IService<BasArmMast> {
- boolean updateArmMastStatus(int armNo,int sortingLine,int status,int endStatus);
+ boolean updateArmMastStatus(int armNo,int sortingLine,int status,int endStatus,int staNoEnd);
}
diff --git a/src/main/java/com/zy/asrs/service/OpenService.java b/src/main/java/com/zy/asrs/service/OpenService.java
index a9d8ee9..e0a8758 100644
--- a/src/main/java/com/zy/asrs/service/OpenService.java
+++ b/src/main/java/com/zy/asrs/service/OpenService.java
@@ -53,4 +53,5 @@
boolean taskAgvCreate(TaskAgvCreateParam param);
List<AgvLocListDetlParam> getAgvLocList(AgvLocListParam param);
boolean bindCtnrAndBin(bindCtnrAndBinParam param);
+ boolean agvApplicationPassedTheGrating(ArmAgvGratingParam arm);
}
diff --git a/src/main/java/com/zy/asrs/service/impl/BasArmMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/BasArmMastServiceImpl.java
index 5cf042a..dfd6b2e 100644
--- a/src/main/java/com/zy/asrs/service/impl/BasArmMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/BasArmMastServiceImpl.java
@@ -9,7 +9,7 @@
@Service("basArmMastService")
public class BasArmMastServiceImpl extends ServiceImpl<BasArmMastMapper, BasArmMast> implements BasArmMastService {
@Override
- public boolean updateArmMastStatus(int armNo,int sortingLine,int status,int endStatus){
- return this.baseMapper.updateArmMastStatus(armNo,sortingLine,status,endStatus);
+ public boolean updateArmMastStatus(int armNo,int sortingLine,int status,int endStatus,int staNoEnd){
+ return this.baseMapper.updateArmMastStatus(armNo,sortingLine,status,endStatus,staNoEnd);
}
}
diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index adeadee..7b710b1 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -14,13 +14,16 @@
import com.zy.asrs.entity.result.StockVo;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
+import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.asrs.utils.Utils;
+import com.zy.common.constant.ArmConstant;
import com.zy.common.model.DetlDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.NodeUtils;
+import com.zy.erp.kingdee.utils.PostMesDataUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -663,7 +666,8 @@
.eq("status", 1)
);
if (Cools.isEmpty(basArm)){
- throw new CoolException("鏈烘鑷傞厤缃紓甯革紝鏌ヨ涓嶅埌鏈烘鑷傛暟鎹紒锛侊紒"+ JSON.toJSONString(param));
+ return;
+// throw new CoolException("鏈烘鑷傞厤缃紓甯革紝鏌ヨ涓嶅埌鏈烘鑷傛暟鎹紒锛侊紒"+ JSON.toJSONString(param));
}
try{
@@ -733,7 +737,8 @@
if (Cools.isEmpty(basArmMast)){
throw new CoolException("鏈煡璇㈠埌鐩稿叧鏈烘鑷傛媶鐮佸灈浠诲姟锛侊紒锛�"+ JSON.toJSONString(param));
}
- basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),2,3);
+ basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),1,3);
+ basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),2,3);
}
@Override
@@ -754,7 +759,7 @@
.eq("status", 5)
);
if (!Cools.isEmpty(basArmMast)){
- basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(), 5,6);
+ basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(), 5,6);
}
}
@@ -913,5 +918,16 @@
}
+ @Override
+ @Transactional
+ public boolean agvApplicationPassedTheGrating(ArmAgvGratingParam arm) {
+ ReturnT<String> result = new PostMesDataUtils().postMesDataArmGrating("鍏夋爡璇锋眰涓嬪彂锛�", ArmConstant.getArmUrl(arm.getArmNo()), ArmConstant.ARM_ADAPTOR_GRATING_AGVENTER, arm);
+ if (result.getCode()==200){
+ return true;
+ }
+ return false;
+ }
+
+
}
diff --git a/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java b/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
index ef0cf30..afc903f 100644
--- a/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/WrkMastAgvHandler.java
@@ -111,6 +111,16 @@
if (!locDetls2.isEmpty()) {
locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo()));
}
+
+ LocMast locMast2 = locMastService.selectById(basAgvMast.getLocNo());
+ // 淇敼搴撲綅鐘舵�� S ====>> F
+ if (locMast2.getLocSts().equals("S")) {
+ locMast2.setLocSts("F");
+ locMast2.setIoTime(now);
+ locMast2.setModiTime(now);
+ } else {
+ return FAIL.setMsg("搴撲綅鐘舵�佸紓甯�");
+ }
List<LocDetl> locDetlList1 = new ArrayList<>();
List<LocDetl> locDetlList2 = new ArrayList<>();
List<BasAgvLocDetl> basAgvLocDetlList = basAgvLocDetlService.selectList(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getSourceLocNo()));
@@ -123,59 +133,50 @@
}
} else if (!basAgvWrkDetlList.isEmpty()){
for (BasAgvWrkDetl wrkDetl : basAgvWrkDetlList){
+ LocDetl locDetl = new LocDetl();
+ locDetl.sync(wrkDetl);
+ locDetl.setLocNo(basAgvMast.getLocNo()); // 搴撲綅鍙�
+ locDetl.setAnfme(wrkDetl.getAnfme()); // 鏁伴噺
+ locDetl.setZpallet(wrkDetl.getZpallet()); // 鎵樼洏鏉$爜
+ locDetl.setModiTime(now);
+ locDetl.setAppeTime(now);
+ locDetl.setOrigin("鍦ㄥ簱");
+ locDetlList2.add(locDetl);
- LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand()
- ,wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3(),wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3());
+ }
+ } else {
+ locMast2.setLocSts("D");
+ }
+
+ if (!locMastService.updateById(locMast2)) {
+ return FAIL;
+ }
+ if (!locDetlList1.isEmpty()){
+ for (LocDetl locDetlold : locDetlList1) {
+ LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand()
+ ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3());
if (null != locDetl) {
- if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), basAgvMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getBrand(),wrkDetl.getStandby1(),wrkDetl.getStandby2(),wrkDetl.getStandby3()
- ,wrkDetl.getBoxType1(),wrkDetl.getBoxType2(),wrkDetl.getBoxType3())) {
-// exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 鏇存柊搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return FAIL.setMsg("鍏ㄦ澘鍏ュ簱 ===>> 鏇存柊搴撳瓨鏄庣粏澶辫触; [workNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
+ if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3()
+ ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) {
}
} else {
- locDetl = new LocDetl();
- locDetl.sync(wrkDetl);
- locDetl.setLocNo(basAgvMast.getLocNo()); // 搴撲綅鍙�
- locDetl.setAnfme(wrkDetl.getAnfme()); // 鏁伴噺
- locDetl.setZpallet(wrkDetl.getZpallet()); // 鎵樼洏鏉$爜
- locDetl.setModiTime(now);
- locDetl.setAppeTime(now);
- locDetl.setOrigin("鍦ㄥ簱");
- if (!locDetlService.insert(locDetl)) {
-// exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触锛沎workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return FAIL.setMsg("鍏ュ簱 ===>> 娣诲姞搴撳瓨鏄庣粏澶辫触; [workNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
+ if (!locDetlService.insert(locDetlold)) {
}
}
-
- }
- }
-
- LocMast locMast2 = locMastService.selectById(basAgvMast.getLocNo());
-
-
- // 淇敼搴撲綅鐘舵�� S ====>> F
- if (locMast2.getLocSts().equals("S")) {
- locMast2.setLocSts("F");
- locMast2.setIoTime(now);
- locMast2.setModiTime(now);
- if (!locMastService.updateById(locMast2)) {
-// exceptionHandle("鍏ㄦ澘鍏ュ簱 ===>> 淇敼搴撲綅鐘舵�佸け璐ワ紱[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo());
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return FAIL.setMsg("鍏ㄥ叆搴� ===>> 淇敼搴撲綅鐘舵�佸け璐�; [TaskNo=" + basAgvMast.getTaskNo() + "],[locNo=" + basAgvMast.getLocNo() + "]");
- }
- }
-
-
- if (!locDetlList1.isEmpty()){
- for (LocDetl locDetl : locDetlList1) {
- locDetlService.insert(locDetl);
}
}
if (!locDetlList2.isEmpty()){
- for (LocDetl locDetl : locDetlList2) {
- locDetlService.insert(locDetl);
+ for (LocDetl locDetlold : locDetlList2) {
+ LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand()
+ ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3());
+ if (null != locDetl) {
+ if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3()
+ ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) {
+ }
+ } else {
+ if (!locDetlService.insert(locDetlold)) {
+ }
+ }
}
}
diff --git a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
index eea2467..063b19d 100644
--- a/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
+++ b/src/main/java/com/zy/asrs/task/kingdee/handler/InboundOrderHandler.java
@@ -131,7 +131,7 @@
// jsonObject.put("start_biztime", latestUpdateTime);//涓氬姟璧峰鏃ユ湡
jsonObject.put("start_biztime", "2025-01-01 00:00:00");//涓氬姟璧峰鏃ユ湡
jsonObject.put("end_biztime", sdf1.format(now));//涓氬姟缁撴潫鏃ユ湡
- jsonObject.put("billno", "CGSL-251125-000001");
+ jsonObject.put("billno", "CGSL-251126-000001");
jsonObject.put("billstatus", Arrays.asList("C"));//鏁版嵁鐘舵�� [A:鏆傚瓨, B:宸叉彁浜�, C:宸插鏍竇
jsonObject.put("start_auditdate", "2025-11-25 00:00:00");
jsonObject.put("end_auditdate", sdf1.format(now));
@@ -203,6 +203,9 @@
Double length = jsonObjectNew.get("length") != null ? new BigDecimal(jsonObjectNew.get("eap7_decimalfield7").toString()).doubleValue() : 0.0;
Double netweight = jsonObjectNew.get("netweight") != null ? new BigDecimal(jsonObjectNew.get("eap7_decimalfield").toString()).doubleValue() : 0.0;
// 鐢熸垚鍟嗗搧妗f
+ height = height*10;
+ width = width*10;
+ length = length*10;
Mat mat = matService.selectByMatnr(matnr);
if (mat == null) {
mat = new Mat();
@@ -211,9 +214,9 @@
mat.setTagId(tag.getId());
mat.setWeight(grossweight);//鍑�閲�
mat.setUnits(netweight);//姣涢噸
- mat.setManLength(length*10);
- mat.setHeight(height*10);
- mat.setWidth(width*10);
+ mat.setManLength(length);
+ mat.setHeight(height);
+ mat.setWidth(width);
mat.setCreateTime(sdf1.parse(createTime));
mat.setUpdateTime(modifyTime);
mat.setStatus(1);
diff --git a/src/main/java/com/zy/common/constant/ArmConstant.java b/src/main/java/com/zy/common/constant/ArmConstant.java
new file mode 100644
index 0000000..4e2a7b6
--- /dev/null
+++ b/src/main/java/com/zy/common/constant/ArmConstant.java
@@ -0,0 +1,41 @@
+package com.zy.common.constant;
+
+/*
+ * Created by Monkey D. Luffy on 2025.09.09
+ * */
+public class ArmConstant {
+
+ public static final String ARM_URL = "http://10.10.10.171:7002";
+ public static final String ARM_URL1 = "http://10.10.10.171:7002";
+ public static final String ARM_URL2 = "http://10.10.10.174:7002";
+ public static final String ARM_URL3 = "http://10.10.10.177:7002";
+ public static final String ARM_URL4 = "http://10.10.10.180:7002";
+ public static final String ARM_URL5 = "http://10.10.10.183:7002";
+ public static final String ARM_URL6 = "http://10.10.10.186:7002";
+
+ public static final String ARM_ADAPTOR = "adaptor/api/wcs/order";//鍒涘缓璁㈠崟
+ public static final String ARM_ADAPTOR_GRATING_AGVLEAVE = "adaptor/api/wcs/agvleave";//鍒涘缓璁㈠崟
+ public static final String ARM_ADAPTOR_GRATING_AGVENTER = "adaptor/api/wcs/agventer";//鍒涘缓璁㈠崟
+
+ public static final String ARM_WORKSPACE = "adaptor/api/wcs/workspace/ready";//閫氱煡宸ヤ綔绌洪棿宸插氨缁�
+
+ public static String getArmUrl(int armNo) {
+ switch (armNo) {
+ case 1:
+ return ARM_URL1;
+ case 2:
+ return ARM_URL2;
+ case 3:
+ return ARM_URL3;
+ case 4:
+ return ARM_URL4;
+ case 5:
+ return ARM_URL5;
+ case 6:
+ return ARM_URL6;
+ default:
+ return ARM_URL;
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/erp/kingdee/utils/PostMesDataUtils.java b/src/main/java/com/zy/erp/kingdee/utils/PostMesDataUtils.java
index 1b89571..0881611 100644
--- a/src/main/java/com/zy/erp/kingdee/utils/PostMesDataUtils.java
+++ b/src/main/java/com/zy/erp/kingdee/utils/PostMesDataUtils.java
@@ -2,14 +2,18 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
+import com.zy.asrs.entity.ApiLog;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
+import java.util.Date;
import java.util.Map;
@Slf4j
@@ -116,4 +120,88 @@
}
return SUCCESS;
}
+
+ public ReturnT<String> postMesDataArmGrating(String name, String URL, String mesPath, Object combParam){
+// if (true){
+// System.out.println("name:"+name+",URL:"+URL+",mesPath:"+mesPath+",combParam:"+combParam);
+// return SUCCESS;
+// }
+ if(combParam != null){
+ String response = "";
+ boolean success = false;
+ try {
+// Map<String, Object> map = new HashMap<>()
+// map.put("appkey","ea1f0459efc02a79f046f982767939ae");
+ response = new HttpHandler.Builder()
+// .setHeaders(map)
+ .setUri(URL)
+ .setPath(mesPath)
+ .setJson(JSON.toJSONString(combParam))
+ .build()
+ .doPost();
+ System.out.println("response:"+response);
+ JSONObject jsonObject = JSON.parseObject(response);
+
+ if (jsonObject.getInteger("code").equals(0)) {
+ success = true;
+ } else {
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", URL+"/"+mesPath, JSON.toJSONString(combParam), response);
+ throw new CoolException(name);
+ }
+ } catch (Exception e) {
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", URL+"/"+mesPath, JSON.toJSONString(combParam), response);
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg(e.getMessage());
+ } finally {
+ try {
+ if (success){
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class);
+ apiLogService.save(
+ name,
+ URL +"/"+ mesPath,
+ null,
+ "127.0.0.1",
+ JSON.toJSONString(combParam),
+ response,
+ success
+ );
+ } else {
+ postMesDataCallApiLogSave(response,success,name, URL, mesPath, combParam);
+ }
+ } catch (Exception e) {
+ log.error("", e); }
+ }
+ }
+ return SUCCESS;
+ }
+
+ public void postMesDataCallApiLogSave(String response,boolean success,String name, String URL, String mesPath, Object combParam) {
+ ApiLogService apiLogService = SpringUtils.getBean(ApiLogService.class);
+
+ ApiLog apiLog = apiLogService.selectOne(new EntityWrapper<ApiLog>()
+ .eq("namespace", name)
+ .eq("response", response)
+ .eq("url", URL +"/"+ mesPath)
+ .eq("result", success? 1:0)
+ .orderBy("create_time", false)
+ );
+
+ if (!Cools.isEmpty(apiLog)){
+ long parseLong = Long.parseLong(apiLog.getTimestamp());
+ if (new Date().getTime()-parseLong<5*1000*60){
+ return;
+ }
+ }
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ apiLogService.save(
+ name,
+ URL +"/"+ mesPath,
+ null,
+ "127.0.0.1",
+ JSON.toJSONString(combParam),
+ response,
+ success
+ );
+ }
}
diff --git a/src/main/resources/mapper/BasArmMastMapper.xml b/src/main/resources/mapper/BasArmMastMapper.xml
index de5b6f0..9f715dc 100644
--- a/src/main/resources/mapper/BasArmMastMapper.xml
+++ b/src/main/resources/mapper/BasArmMastMapper.xml
@@ -32,6 +32,7 @@
where 1=1
and arm_no = #{armNo}
and sorting_line = #{sortingLine}
+ and sta_no = #{staNoEnd}
and status = #{status}
</update>
--
Gitblit v1.9.1