From 34503a2e9a29418346a4ac8f84170ab8f4321d6e Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期四, 19 三月 2026 15:19:05 +0800
Subject: [PATCH] lsh#行号适配
---
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java | 161 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 110 insertions(+), 51 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java
index d2f59c7..31dd316 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java
@@ -18,8 +18,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -41,7 +41,6 @@
@Autowired(required = false)
private WmsServerFeignClient wmsServerFeignClient;
-
@ApiOperation("浠撳簱淇℃伅鍚屾")
@PostMapping("/wareHouse/sync")
public CommonResponse syncWareHouse(@RequestBody Object objParams) {
@@ -56,7 +55,11 @@
JSONArray params = paramsFormat(objParams);
List<Warehouse> warehouseList = JSON.parseArray(params.toJSONString(), Warehouse.class);
// 鏁版嵁澶勭悊锛岃浆鍙憇erver
- return CommonResponse.ok();
+ String resultMsg = erpReportService.syncWareHouse(warehouseList);
+ if ("200".equals(resultMsg)){
+ return CommonResponse.ok(resultMsg);
+ }
+ return CommonResponse.error(resultMsg);
}
@ApiOperation("鐗╂枡淇℃伅鍚屾")
@@ -73,7 +76,11 @@
JSONArray params = paramsFormat(objParams);
List<Material> materialList = JSON.parseArray(params.toJSONString(), Material.class);
// 鏁版嵁澶勭悊锛岃浆鍙憇erver
- return CommonResponse.ok();
+ String resultMsg = erpReportService.syncMaterial(materialList);
+ if ("200".equals(resultMsg)){
+ return CommonResponse.ok(resultMsg);
+ }
+ return CommonResponse.error(resultMsg);
}
@ApiOperation("瀹㈡埛淇℃伅鍚屾")
@@ -90,7 +97,11 @@
JSONArray params = paramsFormat(objParams);
List<Customer> customerList = JSON.parseArray(params.toJSONString(), Customer.class);
// 鏁版嵁澶勭悊锛岃浆鍙憇erver
- return CommonResponse.ok();
+ String resultMsg = erpReportService.syncCustomer(customerList);
+ if ("200".equals(resultMsg)){
+ return CommonResponse.ok(resultMsg);
+ }
+ return CommonResponse.error(resultMsg);
}
@ApiOperation("渚涘簲鍟嗕俊鎭悓姝�")
@@ -107,7 +118,11 @@
JSONArray params = paramsFormat(objParams);
List<Supplier> supplierList = JSON.parseArray(params.toJSONString(), Supplier.class);
// 鏁版嵁澶勭悊锛岃浆鍙憇erver
- return CommonResponse.ok();
+ String resultMsg = erpReportService.syncSupplier(supplierList);
+ if ("200".equals(resultMsg)){
+ return CommonResponse.ok(resultMsg);
+ }
+ return CommonResponse.error(resultMsg);
}
@ApiOperation("鍏�/鍑哄簱浠诲姟閫氱煡鍗�")
@@ -129,11 +144,55 @@
String i = erpReportService.addOrderToServer(order);
if (i.equals("200")){
errorMsg.append(order.getOrderNo()+"涓嬪彂鎴愬姛;");
+ if (orderList.size()==1){
+ return CommonResponse.ok(errorMsg.toString());
+ }
} else {
errorMsg.append(order.getOrderNo()+"涓嬪彂澶辫触,鍘熷洜锛�"+i+";");
+ if (orderList.size()==1){
+ return CommonResponse.error(errorMsg.toString());
+ }
}
}
return CommonResponse.ok(errorMsg.toString());
+ }
+
+ @ApiOperation("鍏�/鍑哄簱浠诲姟閫氱煡鍗曪紙鏂伴摼璺級")
+ @PostMapping("/order/add/new")
+ public CommonResponse addOrderNew(@RequestBody Object objParams) {
+ if (Objects.isNull(objParams)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ if (SIMULATED_DATA_ENABLE.equals("1")) {
+ return CommonResponse.ok();
+ }
+
+ JSONArray params = paramsFormat(objParams);
+ List<Order> orderList = JSON.parseArray(params.toJSONString(), Order.class);
+ StringBuffer msg = new StringBuffer();
+ boolean allSuccess = true;
+ for (Order order : orderList) {
+ String result = erpReportService.addOrderToServerNew(order);
+ if ("200".equals(result)) {
+ msg.append(order.getOrderNo()).append("涓嬪彂鎴愬姛;");
+ } else {
+ allSuccess = false;
+ msg.append(order.getOrderNo()).append("涓嬪彂澶辫触,鍘熷洜锛�").append(result).append(";");
+ }
+ }
+ return allSuccess ? CommonResponse.ok(msg.toString()) : CommonResponse.error(msg.toString());
+ }
+
+ @ApiOperation("璁㈠崟淇℃伅涓婃姤锛堟柊閾捐矾锛�")
+ @PostMapping("/report/order/new")
+ public CommonResponse reportOrderNew(@RequestBody Object objParams) {
+ if (Objects.isNull(objParams)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ if (SIMULATED_DATA_ENABLE.equals("1")) {
+ return CommonResponse.ok();
+ }
+ return erpReportService.reportOrderNew(objParams);
}
@ApiOperation("鍏�/鍑哄簱浠诲姟閫氱煡鍗曞彇娑�")
@@ -170,50 +229,50 @@
condition = new InventoryQueryCondition();
}
- if (SIMULATED_DATA_ENABLE.equals("1")) {
- String x = "[\n" +
- " {\n" +
- " \"locId\": \"LOC-A-01-01\",\n" +
- " \"wareHouseId\": \"WH001\",\n" +
- " \"wareHouseName\": \"鍘熸枡浠撳簱\",\n" +
- " \"palletId\": \"PALLET001\",\n" +
- " \"matNr\": \"MAT10001\",\n" +
- " \"makTx\": \"閽㈡潗Q235\",\n" +
- " \"spec\": \"鍥芥爣GB/T700-2006\",\n" +
- " \"anfme\": 10.5,\n" +
- " \"unit\": \"鍚╘",\n" +
- " \"status\": \"鍙敤\",\n" +
- " \"orderType\": 1,\n" +
- " \"orderNo\": \"Order202698921\",\n" +
- " \"prepareType\": 1,\n" +
- " \"planNo\": \"PLAN202601060001\",\n" +
- " \"batch\": \"BATCH20260106001\",\n" +
- " \"stockOrgId\": \"ORG001\"\n" +
- " },\n" +
- " {\n" +
- " \"locId\": \"LOC-B-02-03\",\n" +
- " \"wareHouseId\": \"WH002\",\n" +
- " \"wareHouseName\": \"鎴愬搧浠撳簱\",\n" +
- " \"palletId\": \"PALLET002\",\n" +
- " \"matNr\": \"MAT20001\",\n" +
- " \"makTx\": \"鐢垫満缁勪欢\",\n" +
- " \"spec\": \"380V 50Hz\",\n" +
- " \"anfme\": 50,\n" +
- " \"unit\": \"鍙癨",\n" +
- " \"status\": \"鍙敤\",\n" +
- " \"orderType\": \"1\",\n" +
- " \"orderNo\": \"SO202601060001\",\n" +
- " \"prepareType\": 1,\n" +
- " \"planNo\": \"PLAN202601060002\",\n" +
- " \"batch\": \"BATCH20260106002\",\n" +
- " \"stockOrgId\": \"ORG001\"\n" +
- " }\n" +
- "]";
- if (map == null || map.isEmpty()) {
- map = JSON.parseArray(x);
- }
- return CommonResponse.ok(JSONArray.parseArray(map.toJSONString(), InventoryDetails.class));
- }
+// if (SIMULATED_DATA_ENABLE.equals("1")) {
+// String x = "[\n" +
+// " {\n" +
+// " \"locId\": \"LOC-A-01-01\",\n" +
+// " \"wareHouseId\": \"WH001\",\n" +
+// " \"wareHouseName\": \"鍘熸枡浠撳簱\",\n" +
+// " \"palletId\": \"PALLET001\",\n" +
+// " \"matNr\": \"MAT10001\",\n" +
+// " \"makTx\": \"閽㈡潗Q235\",\n" +
+// " \"spec\": \"鍥芥爣GB/T700-2006\",\n" +
+// " \"anfme\": 10.5,\n" +
+// " \"unit\": \"鍚╘",\n" +
+// " \"status\": \"鍙敤\",\n" +
+// " \"orderType\": 1,\n" +
+// " \"orderNo\": \"Order202698921\",\n" +
+// " \"prepareType\": 1,\n" +
+// " \"planNo\": \"PLAN202601060001\",\n" +
+// " \"batch\": \"BATCH20260106001\",\n" +
+// " \"stockOrgId\": \"ORG001\"\n" +
+// " },\n" +
+// " {\n" +
+// " \"locId\": \"LOC-B-02-03\",\n" +
+// " \"wareHouseId\": \"WH002\",\n" +
+// " \"wareHouseName\": \"鎴愬搧浠撳簱\",\n" +
+// " \"palletId\": \"PALLET002\",\n" +
+// " \"matNr\": \"MAT20001\",\n" +
+// " \"makTx\": \"鐢垫満缁勪欢\",\n" +
+// " \"spec\": \"380V 50Hz\",\n" +
+// " \"anfme\": 50,\n" +
+// " \"unit\": \"鍙癨",\n" +
+// " \"status\": \"鍙敤\",\n" +
+// " \"orderType\": \"1\",\n" +
+// " \"orderNo\": \"SO202601060001\",\n" +
+// " \"prepareType\": 1,\n" +
+// " \"planNo\": \"PLAN202601060002\",\n" +
+// " \"batch\": \"BATCH20260106002\",\n" +
+// " \"stockOrgId\": \"ORG001\"\n" +
+// " }\n" +
+// "]";
+// if (map == null || map.isEmpty()) {
+// map = JSON.parseArray(x);
+// }
+// return CommonResponse.ok(JSONArray.parseArray(map.toJSONString(), InventoryDetails.class));
+// }
try {
if (wmsServerFeignClient == null) {
--
Gitblit v1.9.1