From e1b5026d8ebdc365beb30de96d809c4fde35c42c Mon Sep 17 00:00:00 2001 From: zhangc <zc@123> Date: 星期二, 25 二月 2025 14:14:08 +0800 Subject: [PATCH] 1 --- src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java | 148 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 97 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java b/src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java index d8d63ba..07c0a8c 100644 --- a/src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java +++ b/src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java @@ -16,6 +16,8 @@ import com.zy.asrs.service.*; import com.zy.common.service.AgvCommonService; import com.zy.common.utils.HttpHandler; +import com.zy.system.entity.Config; +import com.zy.system.service.ConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -28,6 +30,9 @@ @Service @Slf4j public class AgvWrkMastServiceImp extends ServiceImpl<AgvWrkMastMapper, AgvWrkMast> implements AgvWrkMastService { + + @Value("${agv.flag}") + private boolean flag; @Value("${agv.url}") private String url; @@ -61,15 +66,17 @@ private AgvCommonService agvCommonService; @Autowired private AgvWrkMastService agvWrkMastService; + @Autowired + private ConfigService configService; - public void updateWrkStsByWrkNo(int wrkNo, long wrkSts) { + public Boolean updateWrkStsByWrkNo(int wrkNo, long wrkSts) { AgvWrkMast agvWrkMast = this.selectById(wrkNo); //鍒ゆ柇瑕佷慨鏀圭殑宸ヤ綔妗g姸鎬佹槸鍚﹀悎鐞嗭紝濡傛灉涓嶅悎鐞嗗垯鎶涘嚭寮傚父 checkWrkSts(agvWrkMast, wrkSts); agvWrkMast.setWrkSts(wrkSts); agvWrkMast.setModiTime(new Date()); - this.updateById(agvWrkMast); + return this.updateById(agvWrkMast); } public void updateWrkStsByWrkNo(int wrkNo, long wrkSts, String manuType, long userId) { @@ -224,55 +231,93 @@ agvWrkMast.setWrkNo(-agvWrkMast.getWrkNo()); } agvTaskCreateParam.setTaskCode(agvWrkMast.getWrkNo().toString()); - switch (agvWrkMast.getIoType()) { - case 114: - case 108: - case 12: - agvTaskCreateParam.setTaskTyp("F06"); - break; - case 109: - if (agvWrkMast.getWrkSts() == 201) { + Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "FOUR")); + if (config != null && config.getStatus() == 1 && config.getValue().equals("1") && processUseTiShengJi(agvWrkMast.getSourceLocNo(), agvWrkMast.getLocNo())) { + // TODO 鍥涙湡 + } else { + switch (agvWrkMast.getIoType()) { + case 114: + case 108: + case 12: agvTaskCreateParam.setTaskTyp("F06"); - } else { + break; + case 109: + if (agvWrkMast.getWrkSts() == 201) { + agvTaskCreateParam.setTaskTyp("F06"); + } else { + agvTaskCreateParam.setTaskTyp("F01"); + } + break; + case 1: + case 57: + // 鍏ュ簱浠诲姟鏄彧鏈� 鎺ラ┏浣� -- > 搴撲綅 + AgvLocMast loc = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvWrkMast.getLocNo())); + String locSub = loc.getLocNo().substring(loc.getLocNo().length() - 4).substring(0, 2).substring(0, 2); + AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo()); + if ("02".equals(locSub)) { + if (agvBasDevp.getFloor() == 4) { + agvTaskCreateParam.setTaskTyp("F01"); + } else { + agvTaskCreateParam.setTaskTyp("F06"); + } + + } else { + // 鐩爣妤煎眰浣�1妤� 浣嗘簮搴撲綅锛堟帴椹充綅锛夊湪鍚稿浜屾ゼ + if (agvBasDevp.getFloor() == 4) { + agvTaskCreateParam.setTaskTyp("F06"); + } else { + agvTaskCreateParam.setTaskTyp("F01"); + } + + + } + break; + default: agvTaskCreateParam.setTaskTyp("F01"); - } - break; - case 1: - case 57: - // 鍏ュ簱浠诲姟鏄彧鏈� 鎺ラ┏浣� -- > 搴撲綅 - AgvLocMast loc = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvWrkMast.getLocNo())); - String locSub = loc.getLocNo().substring(loc.getLocNo().length() - 4).substring(0, 2).substring(0, 2); - AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo()); - if ("02".equals(locSub)) { - if (agvBasDevp.getFloor() == 4) { - agvTaskCreateParam.setTaskTyp("F01"); - } else { - agvTaskCreateParam.setTaskTyp("F06"); - } - - } else { - // 鐩爣妤煎眰浣�1妤� 浣嗘簮搴撲綅锛堟帴椹充綅锛夊湪鍚稿浜屾ゼ - if (agvBasDevp.getFloor() == 4) { - agvTaskCreateParam.setTaskTyp("F06"); - } else { - agvTaskCreateParam.setTaskTyp("F01"); - } - - - } - break; - default: - agvTaskCreateParam.setTaskTyp("F01"); - break; + break; + } } agvTaskCreateParam.setPositionCodePath(agvTaskParamList); } + // TODO 鍥涙湡 + private boolean processUseTiShengJi(String sourceLocNo, String locNo) { + // 鍒ゆ柇鏄惁鏄彁鍗囨満 + if (sourceLocNo.startsWith("YZ")) { + if (sourceLocNo.endsWith("01F2") && !locNo.startsWith("YZ") && locNo.endsWith("F4") ) { + // 浠庣敓浜т簩鍘傜殑搴撲綅鍒板惛濉戜簩鍘傜殑鐐逛綅涓� + return true; + } else if (sourceLocNo.endsWith("01F2") && locNo.startsWith("YZ") && locNo.endsWith("02F1")) { + // 浠庣敓浜т簩鍘傜殑搴撲綅鍒板惛濉戜簩鍘傜殑搴撲綅 + return true; + } else if (sourceLocNo.endsWith("02F1") && locNo.startsWith("YZ") && locNo.endsWith("01F2")) { + // 鍚稿浜屾ゼ鐨勫簱浣嶅埌鐢熶骇浜屽巶鐨勫簱浣� + return true; + } else if (sourceLocNo.endsWith("02F1") && !locNo.startsWith("YZ") && locNo.endsWith("F2")) { + // 鍚稿浜屾ゼ鐨勫簱浣嶅埌鐢熶骇浜屽巶鐨勭偣浣� + return true; + } + } else { + if (sourceLocNo.endsWith("F4") && locNo.startsWith("YZ") && locNo.endsWith("01F2")) { + // 浠庡惛濉戜簩妤肩殑鐐逛綅鍒扮敓浜т簩鍘傜殑搴撲綅 + return true; + } else if (sourceLocNo.endsWith("F2") && locNo.startsWith("YZ") && locNo.endsWith("02F1")) { + // 浠庣敓浜т簩鍘傜殑鐐逛綅鍒板惛濉戜簩妤肩殑搴撲綅 + return true; + } + } + return false; + } + private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip) { + if (!flag) { + return 1; + } String response = ""; boolean success = false; + int code = 0; try { response = new HttpHandler.Builder() .setUri(url) @@ -283,7 +328,7 @@ .doPost(); JSONObject jsonObject = JSON.parseObject(response); - int code = Integer.parseInt(jsonObject.get("code").toString()); + code = Integer.parseInt(jsonObject.get("code").toString()); if (code != 0) { if (code == 6) { log.info("AGV浠诲姟鍗曞彿宸蹭笂鎶�:{}", response); @@ -300,19 +345,20 @@ return code; } catch (Exception e) { log.error(e.getMessage()); - //TODO 寮犺秴 throw new CoolException("璋冪敤AGV鍝嶅簲閿欒"); //return 1; } finally { - apiLogService.save( - namespace, - url + path, - appkey, - ip, - JSON.toJSONString(JSONObject.toJSONString(requestParam)), - response, - success - ); + if (code != 6) { + apiLogService.save( + namespace, + url + path, + appkey, + ip, + JSON.toJSONString(JSONObject.toJSONString(requestParam)), + response, + success + ); + } } } -- Gitblit v1.9.1