From 29204b9c5c5b29201dbf55344524e51f654e931c Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 25 三月 2026 11:06:20 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/timer/WmsDataTimer.java | 84 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/asrs/timer/WmsDataTimer.java b/src/main/java/com/zy/asrs/timer/WmsDataTimer.java
index 4dc9bc0..f8148c7 100644
--- a/src/main/java/com/zy/asrs/timer/WmsDataTimer.java
+++ b/src/main/java/com/zy/asrs/timer/WmsDataTimer.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
import com.zy.asrs.entity.BasStation;
import com.zy.asrs.entity.dto.*;
import com.zy.asrs.enums.RedisKeyType;
@@ -21,6 +22,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Component
@@ -55,6 +57,9 @@
if (wcsStationDto == null) {
continue;
}
+ if(Cools.isEmpty(wcsStationDto.getTaskNo())){
+ continue;
+ }
if (wcsStationDto.getAuto() != 1
|| wcsStationDto.getLoading() != 1
@@ -78,13 +83,14 @@
for (Object o : data.getJSONArray("wrkDetls")) {
JSONObject wrkDetl = (JSONObject) o;
TvWrkDetlDto tvWrkDetlDto = new TvWrkDetlDto();
- list.add(tvWrkDetlDto);
+// list.add(tvWrkDetlDto);
tvWrkDetlDto.setMatnr(wrkDetl.getString("matnr"));
tvWrkDetlDto.setMaktx(wrkDetl.getString("maktx"));
tvWrkDetlDto.setSpecs(wrkDetl.getString("specs"));
tvWrkDetlDto.setBatch(wrkDetl.getString("batch"));
tvWrkDetlDto.setAnfme(wrkDetl.getDouble("anfme"));
+ list.add(tvWrkDetlDto);
}
wcsStationDto.setIoType(data.getInteger("ioType"));
@@ -97,6 +103,82 @@
}
}
+ //WMS鍏ュ簱浠诲姟鏌ヨ鎺ュ彛
+ @Scheduled(cron = "0/3 * * * * ? ")
+ public synchronized void inTaskQuery() {
+ Config wmsCombQueryUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsCombQueryUrl"));
+ if (wmsCombQueryUrlConfig == null) {
+ return;
+ }
+
+ String wmsCombQueryUrl = wmsCombQueryUrlConfig.getValue();
+
+ String response = null;
+ try {
+ HashMap<String, Object> requestParam = new HashMap<>();
+
+ List<BasStation> basStations = basStationService.selectList(new EntityWrapper<BasStation>().eq("in_enable", "Y"));
+ for (BasStation basStation : basStations) {
+ WcsStationDto wcsStationDto = stationUtils.stationMap.get(basStation.getStationId());
+ if (wcsStationDto == null) {
+ continue;
+ }
+
+ if (wcsStationDto.getAuto() != 1
+ || wcsStationDto.getLoading() != 1
+ ) {
+ continue;
+ }
+
+ if (Cools.isEmpty(wcsStationDto.getBarcode())) {
+ continue;
+ }
+ String[] split = wcsStationDto.getBarcode().split(",");
+ String barcode = split[0];
+ if(Objects.equals(barcode, "NoRead")){
+ continue;
+ }
+ requestParam.put("barcode", barcode);
+ response = new HttpHandler.Builder()
+ .setUri(wmsCombQueryUrl)
+ .setJson(JSON.toJSONString(requestParam))
+ .setTimeout(30, TimeUnit.SECONDS)
+ .build()
+ .doPost();
+ if (response != null) {
+ JSONObject jsonObject = JSON.parseObject(response);
+ JSONObject data = jsonObject.getJSONObject("data");
+ if(data == null){
+ continue;
+ }
+ List<TvWrkDetlDto> list = new ArrayList<>();
+ for (Object o : data.getJSONArray("waitPakins")) {
+ JSONObject wrkDetl = (JSONObject) o;
+ TvWrkDetlDto tvWrkDetlDto = new TvWrkDetlDto();
+// list.add(tvWrkDetlDto);
+
+ tvWrkDetlDto.setMatnr(wrkDetl.getString("matnr"));
+ tvWrkDetlDto.setMaktx(wrkDetl.getString("maktx"));
+ tvWrkDetlDto.setSpecs(wrkDetl.getString("specs"));
+ tvWrkDetlDto.setBatch(wrkDetl.getString("batch"));
+ tvWrkDetlDto.setAnfme(wrkDetl.getDouble("anfme"));
+ tvWrkDetlDto.setBarcode(barcode);
+ tvWrkDetlDto.setLocNo(wrkDetl.getString("zpallet"));
+
+ list.add(tvWrkDetlDto);
+ }
+ wcsStationDto.setIoType(1);
+ wcsStationDto.setBarcode(barcode);
+ wcsStationDto.setWrkDetls(list);
+ System.out.println(wcsStationDto);
+ stationUtils.stationMap.put(wcsStationDto.getStationId(), wcsStationDto);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
//WMS搴撳瓨鏁版嵁鏌ヨ
@Synchronized
@Scheduled(cron = "0/3 * * * * ? ")
--
Gitblit v1.9.1