From aacf537c160d210beea3c37a18f43f3183414ac0 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 18 十一月 2025 13:14:29 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/controller/LocDetlController.java | 92 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 77 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index e25eb46..6e6ced4 100644
--- a/src/main/java/com/zy/asrs/controller/LocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -9,21 +9,15 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
-import com.core.common.BaseRes;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.R;
-import com.zy.asrs.entity.LocDetl;
-import com.zy.asrs.entity.ManLocDetl;
-import com.zy.asrs.entity.Mat;
+import com.core.common.*;
+import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.OrderInspectionRollParam;
+import com.zy.asrs.entity.param.OrderMesXGHYParam;
import com.zy.asrs.entity.param.QualityGroupListParam;
import com.zy.asrs.entity.result.OrderPakoutDetailVo;
import com.zy.asrs.mapper.LocDetlMapper;
-import com.zy.asrs.service.ApiLogService;
-import com.zy.asrs.service.LocDetlService;
-import com.zy.asrs.service.ManLocDetlService;
-import com.zy.asrs.service.MatService;
+import com.zy.asrs.service.*;
+import com.zy.asrs.service.impl.LocMastServiceImpl;
import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,18 +34,26 @@
@Autowired
private LocDetlService locDetlService;
-
@Autowired
private LocDetlMapper locDetlMapper;
@Autowired
private MatService matService;
@Autowired
private ApiLogService apiLogService;
+ @Autowired
+ private SnowflakeIdWorker snowflakeIdWorker;
@Value("${srXghyMes.qualityFinishedCheckoutUrl}")
private String qualityFinishedCheckoutUrl;
@Value("${srXghyMes.qualityFinishedCheckout}")
private String qualityFinishedCheckout;
+
+ @Value("${srXghyMes.productInventoryUrlSaveListDto}")
+ private String productInventoryUrlSaveListDto;
+ @Value("${srXghyMes.productInventorySaveListDto}")
+ private String productInventorySaveListDto;
+ @Autowired
+ private LocMastServiceImpl locMastService;
@RequestMapping(value = "/locDetl/update")
public R update1() {
@@ -330,10 +332,11 @@
return R.error("鐢ㄦ埛寮傚父").add("鐢ㄦ埛寮傚父");
}
List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("model", model));
- OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model);
+// OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model);
String response = "";
boolean success = false;
- Map<String, Object> params = JSON.parseObject(JSON.toJSONString(orderInspectionRollParam), Map.class);
+ Map<String, Object> params = new HashMap<>();
+ params.put("batchNo", model);
try {
response = new HttpHandler.Builder()
.setUri(qualityFinishedCheckoutUrl)
@@ -375,7 +378,7 @@
qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout,
null,
"127.0.0.1",
- JSON.toJSONString(orderInspectionRollParam),
+ JSON.toJSONString(params),
response,
success
);
@@ -384,4 +387,63 @@
return R.error("涓婃姤澶辫触").add("涓婃姤澶辫触");
}
+ @RequestMapping(value = "/synchronize/mes/locDetl/report/auth")
+ @ManagerAuth(memo = "鍚屾搴撳瓨鑷矼ES")
+ public R synchronizeLocDetlMes() {
+ try{
+ List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "F"));
+
+ List<OrderMesXGHYParam> orderMesXGHYParams = new ArrayList<>();
+ for (LocMast locMast : locMastList) {
+ List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no",locMast.getLocNo()));
+ if (locDetlList.isEmpty()) {
+ continue;
+ }
+ OrderMesXGHYParam orderMesXGHYParam = new OrderMesXGHYParam(locDetlList,"in","鎴愬搧鍏ュ簱");
+ orderMesXGHYParam.setBarcode(String.valueOf(snowflakeIdWorker.nextId()));
+ orderMesXGHYParam.setPalletizingNo(1);
+ orderMesXGHYParams.add(orderMesXGHYParam);
+ }
+
+ if (orderMesXGHYParams.isEmpty()) {
+ return R.error("搴撳瓨涓虹┖锛侊紒锛�");
+ }
+
+ String response = "";
+ boolean success = false;
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(productInventoryUrlSaveListDto)
+ .setPath(productInventorySaveListDto)
+ .setJson(JSON.toJSONString(orderMesXGHYParams))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getBoolean("state")) {
+ success = true;
+ } else {
+ return R.error("鍚屾搴撳瓨鑷矼ES");
+ }
+ } catch (Exception e) {
+ return R.error("鍚屾搴撳瓨鑷矼ES"+e.getMessage());
+ } finally {
+ try {
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ apiLogService.save(
+ "鍚屾搴撳瓨鑷矼ES",
+ productInventoryUrlSaveListDto+"/"+productInventorySaveListDto,
+ null,
+ "127.0.0.1",
+ JSON.toJSONString(orderMesXGHYParams),
+ response,
+ success
+ );
+ } catch (Exception e) { }
+ }
+ } catch (Exception e) {
+ return R.error("涓婃姤澶辫触"+e.getMessage()).add("涓婃姤澶辫触"+e.getMessage());
+ }
+ return R.error("涓婃姤澶辫触").add("涓婃姤澶辫触");
+ }
+
}
--
Gitblit v1.9.1