From 076e48718ae6c9232fbb51168d198af5c1481f6c Mon Sep 17 00:00:00 2001 From: CP <513960435@qq.com> Date: 星期一, 23 十二月 2024 17:47:01 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 122 ++++++++++++++++++++++------------------ 1 files changed, 68 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index 45bf0dc..1a45968 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -198,68 +198,82 @@ .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); - if (!Cools.isEmpty(response)&&!Cools.isEmpty(jsonObject.get("ReturnStatus"))&&jsonObject.get("ReturnStatus").equals(0) && !Cools.isEmpty(jsonObject.get("Result").toString())) { - Result result = JSON.parseObject(jsonObject.get("Result").toString(), Result.class); - // 鍒涙柊涓�涓叆搴撳伐浣滄。 - TaskWrk taskWrk = taskWrkService.selectByTaskNo(result.getTaskNo()); - if (Cools.isEmpty(taskWrk)) { - taskWrk = createTask1(result, BoxNo); + if(back){ + if(staProtocol.getWorkNo()>=9801&&staProtocol.getWorkNo()<=9825){ + staProtocol.setStaNo((short)105); + } else if (staProtocol.getWorkNo()>=9826&&staProtocol.getWorkNo()<=9850) { + staProtocol.setStaNo((short)107); + }else if (staProtocol.getWorkNo()>=9851&&staProtocol.getWorkNo()<=9875) { + staProtocol.setStaNo((short)109); + }else{ + staProtocol.setStaNo((short)110); + } + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + }else{ + if (!Cools.isEmpty(response)&&!Cools.isEmpty(jsonObject.get("ReturnStatus"))&&jsonObject.get("ReturnStatus").equals(0) && !Cools.isEmpty(jsonObject.get("Result").toString())) { + Result result = JSON.parseObject(jsonObject.get("Result").toString(), Result.class); + // 鍒涙柊涓�涓叆搴撳伐浣滄。 + TaskWrk taskWrk = taskWrkService.selectByTaskNo(result.getTaskNo()); if (Cools.isEmpty(taskWrk)) { - log.error("搴撲綅寮傚父锛屽簱浣嶅彿锛�={}", taskWrk.getOriginTargetPoint()); - } else { - taskWrkService.insert(taskWrk); - StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() - .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); - staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); - staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); - HashMap<String, Object> hashMap = new HashMap<>(); - hashMap.put("TaskNo",taskWrk.getTaskNo()); - try { - //寮�濮嬩笂鎶�,浠诲姟寮�濮嬫椂锛學CS鍥炶皟WMS - response = new HttpHandler.Builder() - .setUri(wmsUrl) - .setPath(taskStatusFeedbackPath) - .setJson(JSON.toJSONString(hashMap)) - .build() - .doPost(); - JSONObject jsonObject1 = JSON.parseObject(response); - Boolean bool = false; - if(jsonObject1.get("ReturnStatus").equals(0)){ - bool = true; - } - apiLogService.save("wcs寮�濮嬪叆搴撲换鍔′笂鎶ms" - , wmsUrl + TaskExecCallback - , null - , "127.0.0.1" - , JSON.toJSONString(hashMap) - , response - , bool - ); - } catch (Exception e) { + taskWrk = createTask1(result, BoxNo); + if (Cools.isEmpty(taskWrk)) { + log.error("搴撲綅寮傚父锛屽簱浣嶅彿锛�={}", taskWrk.getOriginTargetPoint()); + } else { + taskWrkService.insert(taskWrk); + StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() + .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); + staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); + staProtocol.setStaNo(staDesc.getCrnStn().shortValue()); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + HashMap<String, Object> hashMap = new HashMap<>(); + hashMap.put("TaskNo",taskWrk.getTaskNo()); + try { + //寮�濮嬩笂鎶�,浠诲姟寮�濮嬫椂锛學CS鍥炶皟WMS + response = new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath(taskStatusFeedbackPath) + .setJson(JSON.toJSONString(hashMap)) + .build() + .doPost(); + JSONObject jsonObject1 = JSON.parseObject(response); + Boolean bool = false; + if(jsonObject1.get("ReturnStatus").equals(0)){ + bool = true; + } + apiLogService.save("wcs寮�濮嬪叆搴撲换鍔′笂鎶ms" + , wmsUrl + TaskExecCallback + , null + , "127.0.0.1" + , JSON.toJSONString(hashMap) + , response + , bool + ); + } catch (Exception e) { + } } - } - } else { + } else { // staProtocol.setWorkNo((short) 9991); - if(staProtocol.getWorkNo()>=9801&&staProtocol.getWorkNo()<=9825){ - staProtocol.setStaNo((short)105); - } else if (staProtocol.getWorkNo()>=9826&&staProtocol.getWorkNo()<=9850) { - staProtocol.setStaNo((short)107); - }else if (staProtocol.getWorkNo()>=9851&&staProtocol.getWorkNo()<=9875) { - staProtocol.setStaNo((short)109); - }else{ - staProtocol.setStaNo((short)110); + if(staProtocol.getWorkNo()>=9801&&staProtocol.getWorkNo()<=9825){ + staProtocol.setStaNo((short)105); + } else if (staProtocol.getWorkNo()>=9826&&staProtocol.getWorkNo()<=9850) { + staProtocol.setStaNo((short)107); + }else if (staProtocol.getWorkNo()>=9851&&staProtocol.getWorkNo()<=9875) { + staProtocol.setStaNo((short)109); + }else{ + staProtocol.setStaNo((short)110); + } + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); } + + } else { +// staProtocol.setWorkNo((short) 9991); + staProtocol.setStaNo(inSta.getBackSta().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); } - - } else { -// staProtocol.setWorkNo((short) 9991); - staProtocol.setStaNo(inSta.getBackSta().shortValue()); - devpThread.setPakMk(staProtocol.getSiteId(), false); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); } } catch (Exception e) { log.error("璇锋眰鍏ュ簱璋冪敤鎺ュ彛澶辫触"); -- Gitblit v1.9.1