From 3885879e740b34868b7927a6b801e070843f2124 Mon Sep 17 00:00:00 2001 From: zhangchao <zc857179121@qq.com> Date: 星期三, 20 十一月 2024 11:37:42 +0800 Subject: [PATCH] mes对接 --- src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java | 40 ++++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 18 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..84951b7 100644 --- a/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java +++ b/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java @@ -48,7 +48,7 @@ add(101); add(12); add(53); - add(101); + add(103); add(108); add(111); add(112); @@ -59,6 +59,8 @@ @Value("${agvBasDev.maxWorkNum}") private int maxWrokNum; + @Value("${mes.report}") + private Boolean flag; @Value("${mes.url}") private String url; @Value("${mes.getTokenUrl}") @@ -353,11 +355,7 @@ } //TODO //鏆傛椂鍔犱笂trycatch - try { - reportMes(agvWrkMast, agvWrkDetlListOld); - } catch (Exception e) { - e.printStackTrace(); - } + reportMes(agvWrkMast, agvWrkDetlListOld); return SUCCESS; } @@ -517,7 +515,7 @@ log.error("" + e.getMessage()); } //TODO 寮犺秴 - //reportMes(agvWrkMast, agvWrkDetlListOld); + reportMes(agvWrkMast, agvWrkDetlListOld); return SUCCESS; } @@ -542,7 +540,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 +690,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 +746,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"); @@ -870,7 +874,7 @@ 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