From a5990a214ba13119d617b4532e2b9eef2fe70cda Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期四, 12 九月 2024 14:09:01 +0800 Subject: [PATCH] mes接口对接 --- src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java index f19fa03..b3a8d55 100644 --- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java @@ -1210,6 +1210,8 @@ List<PdckqrParam.Material> materials = param.getMaterials(); boolean isFullyCancelled = compareAndCheckCancellation(wrkDetls, materials); + // todo 涓ょ鐩樹袱绠遍渶瑕佺‘瀹氫綅缃病閿� + if (isFullyCancelled) { // 鐩樼偣鐗╂枡纭垚鍔燂紝宸ヤ綔妗h浆鎹� 鐩樼偣鍑哄簱->鐩樼偣鍐嶅叆搴擄紝涓嬪彂鍥炲簱鍛戒护 // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� if (!wrkMastLogService.save(wrkMast.getWrkNo())) { @@ -1252,11 +1254,19 @@ return R.ok("鐩樼偣纭鎴愬姛"); } else { // 鐗╂枡涓嶄竴鑷� - // todo 涓嶄竴鑷寸殑澶勭悊澶勭悊鏂规硶寰呭畾 + // 涓嶄竴鑷寸殑澶勭悊澶勭悊鏂规硶锛氬脊鍑鸿皟鏁寸晫闈� +// 閲嶆柊鎵弿瀹炵墿涓婇潰鐨勭爜杩涜璋冩暣 +// 瀹炵墿鍦ㄥ簱瀛橀噷闈㈢殑鍦版柟娓呯┖锛屼换鍔℃墍鍦ㄥ簱瀛樻竻绌� +// 灏嗗疄鐗╁拰褰撳墠鎵樼洏浣嶇疆鍜屽簱浣嶇粦瀹� +// 涓�涓湪绠辨儏鍐电洿鎺ヨ皟鏁� +// 涓や釜鏈ㄧ鍑轰袱涓� 閮借皟鏁� +// 涓や釜鏈ㄧ鍑轰竴涓� 璋冩暣涓�涓� +// 宸ヤ綔妗f爣璁板紓甯�->鍥炲簱 + + return R.error("鐩樼偣纭寮傚父"); } - return R.error("鐩樼偣纭寮傚父"); } @Override @@ -1516,9 +1526,7 @@ boolean success = false; // 鑾峰彇璇锋眰澶� Map<String,Object> headers = new HashMap<>(); - headers.put("digi-type","sync "); - headers.put("digi-protocol","raw"); - headers.put("digi-datakey"," XCommon.ImportData"); + headers.put("Content-Type","application/json;charset=UTF-8"); // 鏋勯�犺姹備綋 JSONObject jsonObject = new JSONObject(); @@ -1528,22 +1536,23 @@ String response = ""; try { response = new HttpHandler.Builder() - .setUri(MesConstant.MES_IP_PORT) - .setPath(MesConstant.MES_DP_URL) + .setUri(MesConstant.MES_CC_IP_PORT) + .setPath(MesConstant.MES_CC_DP_URL) .setHeaders(headers) .setJson(body) .build() - .doPost(); + .doGet(); if (!Cools.isEmpty(response)) { JSONObject jsonObject1 = JSONObject.parseObject(response); int code = (int) jsonObject1.get("code"); - String msg = (String) jsonObject1.get("msg"); - if (code != 200) { - throw new CoolException(msg); + boolean state = jsonObject1.getBoolean("state"); + String msg = (String) jsonObject1.get("message"); + if (code == 200 && state) { + success = true; } - success = true; + throw new CoolException(msg); } else { - log.error("杩斾慨鍝佸叆搴撶粰mes鎺ㄩ�佸緟鍒ゅけ璐ワ紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.PAKIN_URL, body, response); + log.error("杩斾慨鍝佸叆搴撶粰mes鎺ㄩ�佸緟鍒ゅけ璐ワ紒锛侊紒url锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_IP_PORT, body, response); throw new CoolException("杩斾慨鍝佸叆搴撶粰mes鎺ㄩ�佸緟鍒ゅけ璐�"); } } catch (Exception e) { @@ -1553,7 +1562,7 @@ // 淇濆瓨鎺ュ彛鏃ュ織 apiLogService.save( "杩斾慨鍝佸叆搴撶粰mes鎺ㄩ�佸緟鍒�", - MesConstant.MES_IP_PORT + MesConstant.MES_DP_URL, + MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_IP_PORT, null, "127.0.0.1", body, -- Gitblit v1.9.1