From 55129aa7f1f5910e88f7c615502c27a18e427815 Mon Sep 17 00:00:00 2001 From: zhangc <zc@123> Date: 星期四, 05 十二月 2024 15:14:12 +0800 Subject: [PATCH] 优化界面显示 --- src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java | 56 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java index adfe4fc..69403df 100644 --- a/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java +++ b/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Slf4j @@ -48,7 +49,7 @@ add(101); add(12); add(53); - add(101); + add(103); add(108); add(111); add(112); @@ -59,6 +60,8 @@ @Value("${agvBasDev.maxWorkNum}") private int maxWrokNum; + @Value("${mes.report}") + private Boolean flag; @Value("${mes.url}") private String url; @Value("${mes.getTokenUrl}") @@ -353,11 +356,7 @@ } //TODO //鏆傛椂鍔犱笂trycatch - try { - reportMes(agvWrkMast, agvWrkDetlListOld); - } catch (Exception e) { - e.printStackTrace(); - } + reportMes(agvWrkMast, agvWrkDetlListOld); return SUCCESS; } @@ -517,7 +516,7 @@ log.error("" + e.getMessage()); } //TODO 寮犺秴 - //reportMes(agvWrkMast, agvWrkDetlListOld); + reportMes(agvWrkMast, agvWrkDetlListOld); return SUCCESS; } @@ -532,9 +531,16 @@ throw new CoolException("浠诲姟涓嬪彂澶辫触"); } - agvWrkMast.setWrkSts(202L); - agvWrkMast.setModiTime(new Date()); - agvWrkMastService.updateById(agvWrkMast); + //agvWrkMast.setWrkSts(202L); + //agvWrkMast.setModiTime(new Date()); + //boolean b = agvWrkMastService.updateById(agvWrkMast); + boolean b = agvWrkMastService.updateWrkStsByWrkNo(Math.abs(agvWrkMast.getWrkNo()), 202L); + if (!b) { + log.info("鏇存柊浠诲姟鐘舵�佸け璐�,{}", agvWrkMast.getWrkNo()); + throw new CoolException("鏇存柊浠诲姟鐘舵�佸け璐�"); + } else { + log.info("鏇存柊浠诲姟鐘舵�佹垚鍔�,{}", agvWrkMast.getWrkNo()); + } if (agvWrkMast.getIoType() == 1) { //淇敼AGV鍏ュ簱閫氱煡妗g姸鎬佸叆鍑虹姸鎬佷负Y agvWaitPakinService.updateIoStatus(agvWrkMast.getWrkNo(), "Y"); @@ -542,7 +548,7 @@ return SUCCESS; } catch (Exception e) { //TODO - //log.error("淇敼AGV鍏ュ簱閫氱煡妗g姸鎬佸叆鍑虹姸鎬佷负Y" + e.getMessage()); + log.error("淇敼AGV鍏ュ簱閫氱煡妗g姸鎬佸叆鍑虹姸鎬佷负Y,{}", e.getMessage()); } return FAIL; } @@ -692,20 +698,26 @@ } private void reportMes(AgvWrkMast agvWrkMast, List<AgvWrkDetl> agvWrkDetls) { + if (!flag) { + return; + } if (Cools.isEmpty(agvWrkDetls)) { return; } //鍖哄垎涓嶅悓浠诲姟绫诲瀷鐨勪笂鎶ユ柟寮� if (IN_TYPE_LIST.contains(agvWrkMast.getIoType())) { - reportMesPakinOrder(agvWrkMast, agvWrkDetls); + String barcode = agvWrkMast.getBarcode(); + if (barcode.startsWith("20") || barcode.startsWith("21") || barcode.startsWith("40")) { + reportMesPakinOrder(agvWrkMast, agvWrkDetls); + } } - if (OUT_TYPE_List.contains(agvWrkMast.getIoType())) { - reportMesPakoutOrder(agvWrkMast, agvWrkDetls); - } - if (MOVE_TYPE_List.contains(agvWrkMast.getIoType())) { - generateMesParam(agvWrkMast, agvWrkDetls); - } +// if (OUT_TYPE_List.contains(agvWrkMast.getIoType())) { +// reportMesPakoutOrder(agvWrkMast, agvWrkDetls); +// } +// if (MOVE_TYPE_List.contains(agvWrkMast.getIoType())) { +// generateMesParam(agvWrkMast, agvWrkDetls); +// } } private void reportMesPakinOrder(AgvWrkMast agvWrkMast, List<AgvWrkDetl> agvWrkDetls) { @@ -742,9 +754,9 @@ } else { MesPakinReportParam mesPakinReportParam = new MesPakinReportParam(); - mesPakinReportParam.setInboundOrderCode(agvWrkDetl.getOrderNo()); + //mesPakinReportParam.setInboundOrderCode(agvWrkDetl.getOrderNo()); mesPakinReportParam.setBizType("0"); - mesPakinReportParam.setInventoryAttr(new MesPakinReportParam.InventoryAttr(agvWrkDetl.getThreeCode().trim(), agvWrkDetl.getMatnr(), agvWrkMast.getLocNo())); + mesPakinReportParam.setInventoryAttr(new MesPakinReportParam.InventoryAttr(null, agvWrkDetl.getMatnr(), agvWrkMast.getLocNo())); mesPakinReportParam.setNoQrCodeExecAmount(new MesPakinReportParam.NoQrCodeExecAmount(agvWrkDetl.getAnfme(), agvWrkDetl.getUnit(), null)); doHttpRequest(mesPakinReportParam, getMesTokenInfo(), "涓婃姤mes鍏ュ簱淇℃伅", url, pakinReportPath, null, "127.0.0.1"); @@ -864,13 +876,13 @@ boolean success = false; try { - response = new HttpHandler.Builder().setUri(url).setPath(path).setHeaders(headParam).setJson(JSONObject.toJSONString(requestParam)).setHttps(true).build().doPost(); + response = new HttpHandler.Builder().setUri(url).setPath(path).setTimeout(30, TimeUnit.SECONDS).setHeaders(headParam).setJson(JSONObject.toJSONString(requestParam)).setHttps(true).build().doPost(); JSONObject jsonObject = JSON.parseObject(response); if (Cools.isEmpty(jsonObject.get("code")) || Integer.parseInt(jsonObject.get("code").toString()) != 200) { log.info("mes鎺ュ彛璋冪敤澶辫触锛岃繑鍥炰俊鎭細" + jsonObject); //TODO 寮犺秴 - //throw new CoolException("mes鎺ュ彛璋冪敤澶辫触锛岃繑鍥炰俊鎭�:" + jsonObject); + throw new CoolException("mes鎺ュ彛璋冪敤澶辫触锛岃繑鍥炰俊鎭�:" + jsonObject); } success = true; return jsonObject; -- Gitblit v1.9.1