From f59e58b28522b5e40057408bff1a584132cd3503 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Mon, 21 Jul 2025 10:02:07 +0800 Subject: [PATCH] =?UTF-8?q?ifs\wcs=E5=85=AC=E5=85=B1=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gaotao/common/utils/AgvClientUtil.java | 192 +++++++ .../gaotao/common/utils/HttpClientUtil.java | 151 +++++- .../gaotao/common/utils/IfsClientUtil.java | 510 ++++++++++++++++++ .../po/service/impl/PoServiceImpl.java | 17 +- src/main/resources/application.yml | 2 +- 5 files changed, 859 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/gaotao/common/utils/AgvClientUtil.java create mode 100644 src/main/java/com/gaotao/common/utils/IfsClientUtil.java diff --git a/src/main/java/com/gaotao/common/utils/AgvClientUtil.java b/src/main/java/com/gaotao/common/utils/AgvClientUtil.java new file mode 100644 index 0000000..afac4da --- /dev/null +++ b/src/main/java/com/gaotao/common/utils/AgvClientUtil.java @@ -0,0 +1,192 @@ +package com.gaotao.common.utils; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * AGV接口调用工具类 + * 基于Lothar V4.13接口文档实现 + */ +@Setter +@Getter +@Component +public class AgvClientUtil { + + /** + * -- GETTER -- + * 获取WCS基础URL + * -- SETTER -- + * 设置WCS基础URL + */ + @Value("${custom.wcs-url}") + private String wcsUrl; + + /** + *1. 发送任务 - 创建APR搬运任务 + * @param taskId 任务唯一标识 + * @param targets 任务目标点名称集合 + * @param configId 任务配置名称(可选) + * @param priority 任务优先级1-9(可选) + * @return 响应结果 + */ + public ResponseData createTask(String taskId, List targets, String configId, Integer priority) { + String url = wcsUrl + "/rpc/createTask"; + Map request = new HashMap<>(); + request.put("taskId", taskId); + request.put("targets", targets); + if (configId != null) { + request.put("configId", configId); + } + if (priority != null) { + request.put("priority", priority); + } + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + * 2 继续任务 - 继续执行等待中的任务 + * @param taskId 任务唯一编号 + * @return 响应结果 + */ + public ResponseData continueTask(String taskId) { + String url = wcsUrl + "/rpc/continueTask"; + Map request = new HashMap<>(); + request.put("taskId", taskId); + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + *3. 取消任务 - 取消APR搬运任务 + * @param taskId 任务唯一标识 + * @return 响应结果 + */ + public ResponseData cancelTask(String taskId) { + String url = wcsUrl + "/rpc/cancelTask"; + Map request = new HashMap<>(); + request.put("taskId", taskId); + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + *4. 任务回调 - 任务执行到关键节点上报 + * @param taskId 任务唯一标识 + * @param deviceId APR编号 + * @param targetPoint APR到达的目标点 + * @return 响应结果 + */ + public ResponseData feedbackTask(String taskId, String deviceId, String targetPoint) { + String url = wcsUrl + "/feedbackTask"; + Map request = new HashMap<>(); + request.put("taskId", taskId); + request.put("deviceId", deviceId); + request.put("targetPoint", targetPoint); + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + *5. APR查询 - 获取在线小车状态 + * @return 响应结果 + */ + public ResponseData getOnlineRobot() { + String url = wcsUrl + "/rpc/getOnlineRobot"; + Map params = new HashMap<>(); + return HttpClientUtil.doGet(url, params); + } + + /** + * 6地图信息 + * @param mapName 地图名称(可选) + * @return 响应结果 + */ + public ResponseData getMapInfo(String mapName) { + String url = wcsUrl + "/rpc/getMapInfo"; + Map params = new HashMap<>(); + if (mapName != null) { + params.put("mapName", mapName); + } + return HttpClientUtil.doGet(url, params); + } + + /** + *7. APR故障信息查询 + * @return 响应结果 + */ + public ResponseData getAlarms() { + String url = wcsUrl + "/rpc/getAlarms"; + Map params = new HashMap<>(); + return HttpClientUtil.doGet(url, params); + } + + /** + * 8 APR申请进出交管区 + * @param areaName 交管区编号 + * @param type 1进入申请,2-离开告知 + * @param agvNo APR编号 + * @return 响应结果 + */ + public ResponseData applyTrafficCtlArea(String areaName, Integer type, String agvNo) { + String url = wcsUrl + "/applyTrafficCtlArea"; + Map request = new HashMap<>(); + request.put("areaName", areaName); + request.put("type", type); + if (agvNo != null) { + request.put("agvNo", agvNo); + } + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + * 9. APR申请进出设备区域 + * @param deviceName 设备编号 + * @param type 1进入申请,2-离开告知 + * @param taskId APR正在执行的任务编号(可选) + * @param action APR将要在此设备区域执行的动作,get-取货,put-放货(可选) + * @param agvNo APR编号(可选) + * @return 响应结果 + */ + public ResponseData applyDeviceArea(String deviceName, Integer type, String taskId, String action, String agvNo) { + String url = wcsUrl + "/applyDeviceArea"; + Map request = new HashMap<>(); + request.put("deviceName", deviceName); + request.put("type", type); + if (taskId != null) { + request.put("taskId", taskId); + } + if (action != null) { + request.put("action", action); + } + if (agvNo != null) { + request.put("agvNo", agvNo); + } + return HttpClientUtil.doPostByRaw(url, request); + } + + /** + *10储位信息 + * @param storageNames 目标储位名称列表(可选) + * @param areaNames 目标区域名称列表(可选) + * @param mapNames 目标地图名称列表(可选) + * @return 响应结果 + */ + public ResponseData getMapStorage(List storageNames, List areaNames, List mapNames) { + String url = wcsUrl + "/getMapStorage"; + Map request = new HashMap<>(); + if (storageNames != null) { + request.put("storageNames", storageNames); + } + if (areaNames != null) { + request.put("areaNames", areaNames); + } + if (mapNames != null) { + request.put("mapNames", mapNames); + } + return HttpClientUtil.doPostByRaw(url, request); + } + +} diff --git a/src/main/java/com/gaotao/common/utils/HttpClientUtil.java b/src/main/java/com/gaotao/common/utils/HttpClientUtil.java index 31871f3..0d34d4f 100644 --- a/src/main/java/com/gaotao/common/utils/HttpClientUtil.java +++ b/src/main/java/com/gaotao/common/utils/HttpClientUtil.java @@ -3,6 +3,7 @@ package com.gaotao.common.utils; import com.alibaba.fastjson2.JSON; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.*; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; @@ -16,11 +17,14 @@ import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -159,4 +163,143 @@ public class HttpClientUtil { } return responseData; } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param params 请求的参数集合 + * @return 远程资源的响应结果 + */ + public static String sendPost(String url, Map params) { + OutputStreamWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + URL realUrl = new URL(url); + HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection(); + //发送POST请求必须设置如下两行 + conn.setDoOutput(true); + conn.setDoInput(true); + //POST方法 + conn.setRequestMethod("POST"); + //设置通用的请求属性 + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.connect(); + //获取URLConnection对象对应的输出流 + out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8"); + //发送请求参数 + if (params != null) { + StringBuilder param = new StringBuilder(); + for (Map.Entry entry : params.entrySet()) { + if (!param.isEmpty()) { + param.append("&"); + } + param.append(entry.getKey()); + param.append("="); + param.append(entry.getValue()==null ? null : URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); + } + out.write(param.toString()); + } + // flush输出流的缓冲 + out.flush(); + // 定义BufferedReader输入流来读取URL的响应 + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + //使用finally块来关闭输出流、输入流 + finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return result.toString(); + /* String resp = UrlUtil.sendPost(url, new HashMap<>()); + List> vmiMap = JSONObject.parseObject(JSONObject.parseObject(resp).toJavaObject(AjaxResponse.class).getData().toString() + , new TypeReference>>() { + }); + for (Map map : vmiMap) { + String memCode = String.valueOf(map.get("mem_code")); + }*/ + } + + public static String sendGet(String url, Map requestProperty) { + HttpURLConnection conn = null; + InputStream is = null; + BufferedReader br = null; + String result = null; + try { + // 创建远程url连接对象 + URL realUrl = new URL(url); + // 通过远程url连接对象打开一个连接,强转成httpURLConnection类 + conn = (HttpURLConnection) realUrl.openConnection(); + // 设置连接方式:get + conn.setRequestMethod("GET"); + + //设置通用的请求属性 + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + //特殊请求,需要设置cooker等 + if (requestProperty != null) { + for (String key : requestProperty.keySet()) { + conn.setRequestProperty(key, requestProperty.get(key)); + } + } + conn.connect(); + // 发送请求 + conn.connect(); + // 通过connection连接,获取输入流 + if (conn.getResponseCode() == 200) { + is = conn.getInputStream(); + // 封装输入流is,并指定字符集 + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + // 存放数据 + StringBuffer sbf = new StringBuffer(); + String temp = null; + while ((temp = br.readLine()) != null) { + sbf.append(temp); + sbf.append("\r\n"); + } + result = sbf.toString(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + // 关闭资源 + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + conn.disconnect();// 关闭远程连接 + } + return result; + } } diff --git a/src/main/java/com/gaotao/common/utils/IfsClientUtil.java b/src/main/java/com/gaotao/common/utils/IfsClientUtil.java new file mode 100644 index 0000000..6126199 --- /dev/null +++ b/src/main/java/com/gaotao/common/utils/IfsClientUtil.java @@ -0,0 +1,510 @@ +package com.gaotao.common.utils; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * IFS接口调用工具类 + * 基于IFS接口清单实现 + */ +@Setter +@Getter +@Component +public class IfsClientUtil { + /** + * -- GETTER -- + * 获取IFS基础URL + * -- SETTER -- + * 设置IFS基础URL + + */ + @Value("${custom.ifs-url}") + private String ifsUrl; + + // ==================== View接口 (IFSV-xxx) ==================== + + /** + * IFSV-01: Inventory Part - 物料信息查询 + */ + public ResponseData getInventoryPart(String partNo) { + String url = ifsUrl + "/api/inventory/part"; + Map params = new HashMap<>(); + if (partNo != null) { + params.put("partNo", partNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-02: Purchase Part - 采购物料信息查询 + */ + public ResponseData getPurchasePart(String partNo) { + String url = ifsUrl + "/api/purchase/part"; + Map params = new HashMap<>(); + if (partNo != null) { + params.put("partNo", partNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-3ailability Control ID - 可用性控制ID查询 + */ + public ResponseData getAvailabilityControlId(String controlId) { + String url = ifsUrl + "/api/availability/control"; + Map params = new HashMap<>(); + if (controlId != null) { + params.put("controlId", controlId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-4: 供应商信息查询 + */ + public ResponseData getSupplierInfo(String supplierId) { + String url = ifsUrl + "/api/supplier/info"; + Map params = new HashMap<>(); + if (supplierId != null) { + params.put("supplierId", supplierId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-005客户信息查询 + */ + public ResponseData getCustomerInfo(String customerId) { + String url = ifsUrl + "/api/customer/info"; + Map params = new HashMap<>(); + if (customerId != null) { + params.put("customerId", customerId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-6 客户地址信息查询 + */ + public ResponseData getCustomerAddress(String customerId, String addressId) { + String url = ifsUrl + "/api/customer/address"; + Map params = new HashMap<>(); + if (customerId != null) { + params.put("customerId", customerId); + } + if (addressId != null) { + params.put("addressId", addressId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-007采购订单查询 + */ + public ResponseData getPurchaseOrder(String poNo) { + String url = ifsUrl + "/api/purchase/order"; + Map params = new HashMap<>(); + if (poNo != null) { + params.put("poNo", poNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-8: 采购订单行查询 + */ + public ResponseData getPurchaseOrderLine(String poNo, String lineNo) { + String url = ifsUrl + "/api/purchase/order/line"; + Map params = new HashMap<>(); + if (poNo != null) { + params.put("poNo", poNo); + } + if (lineNo != null) { + params.put("lineNo", lineNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-9 检验结果记录查询 + */ + public ResponseData getInspectionResult(String inspectionNo) { + String url = ifsUrl + "/api/inspection/result"; + Map params = new HashMap<>(); + if (inspectionNo != null) { + params.put("inspectionNo", inspectionNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-010生产订单查询 + */ + public ResponseData getProductionOrder(String woNo) { + String url = ifsUrl + "/api/production/order"; + Map params = new HashMap<>(); + if (woNo != null) { + params.put("woNo", woNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-11 生产订单物料查询 + */ + public ResponseData getProductionOrderMaterial(String woNo) { + String url = ifsUrl + "/api/production/order/material"; + Map params = new HashMap<>(); + if (woNo != null) { + params.put("woNo", woNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-014采购订单行物料查询 + */ + public ResponseData getPurchaseOrderLineMaterial(String poNo, String lineNo) { + String url = ifsUrl + "/api/purchase/order/line/material"; + Map params = new HashMap<>(); + if (poNo != null) { + params.put("poNo", poNo); + } + if (lineNo != null) { + params.put("lineNo", lineNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-15terial Requisition查询 + */ + public ResponseData getMaterialRequisition(String mrNo) { + String url = ifsUrl + "/api/material/requisition"; + Map params = new HashMap<>(); + if (mrNo != null) { + params.put("mrNo", mrNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-16terial Requisition Material Line查询 + */ + public ResponseData getMaterialRequisitionLine(String mrNo) { + String url = ifsUrl + "/api/material/requisition/line"; + Map params = new HashMap<>(); + if (mrNo != null) { + params.put("mrNo", mrNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-017hipment查询 + */ + public ResponseData getShipment(String shipmentNo) { + String url = ifsUrl + "/api/shipment"; + Map params = new HashMap<>(); + if (shipmentNo != null) { + params.put("shipmentNo", shipmentNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-18: Shipment Line查询 + */ + public ResponseData getShipmentLine(String shipmentNo) { + String url = ifsUrl + "/api/shipment/line"; + Map params = new HashMap<>(); + if (shipmentNo != null) { + params.put("shipmentNo", shipmentNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-019: Customer Order查询 + */ + public ResponseData getCustomerOrder(String coNo) { + String url = ifsUrl + "/api/customer/order"; + Map params = new HashMap<>(); + if (coNo != null) { + params.put("coNo", coNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-020ustomer Order Line查询 + */ + public ResponseData getCustomerOrderLine(String coNo) { + String url = ifsUrl + "/api/customer/order/line"; + Map params = new HashMap<>(); + if (coNo != null) { + params.put("coNo", coNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-021 RMA查询 + */ + public ResponseData getRma(String rmaNo) { + String url = ifsUrl + "/api/rma"; + Map params = new HashMap<>(); + if (rmaNo != null) { + params.put("rmaNo", rmaNo); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSV-022MA Line查询 + */ + public ResponseData getRmaLine(String rmaNo) { + String url = ifsUrl + "/api/rma/line"; + Map params = new HashMap<>(); + if (rmaNo != null) { + params.put("rmaNo", rmaNo); + } + return HttpClientUtil.doGet(url, params); + } + + // ==================== API接口 (IFSA-xxx) ==================== + + /** + * IFSA-1: 库位信息API + */ + public ResponseData getLocationInfo(String locationId) { + String url = ifsUrl + "/api/location/info"; + Map params = new HashMap<>(); + if (locationId != null) { + params.put("locationId", locationId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSA-2: 仓库信息API + */ + public ResponseData getWarehouseInfo(String warehouseId) { + String url = ifsUrl + "/api/warehouse/info"; + Map params = new HashMap<>(); + if (warehouseId != null) { + params.put("warehouseId", warehouseId); + } + return HttpClientUtil.doGet(url, params); + } + + /** + * IFSA-003采购订单接收 + */ + public ResponseData receivePurchaseOrder(Object receiveData) { + String url = ifsUrl + "/api/purchase/order/receive"; + return HttpClientUtil.doPostByRaw(url, receiveData); + } + + /** + * IFSA-04采购订单接收单取消 + */ + public ResponseData cancelPurchaseOrderReceive(Object cancelData) { + String url = ifsUrl + "/api/purchase/order/receive/cancel"; + return HttpClientUtil.doPostByRaw(url, cancelData); + } + + /** + * IFSA-005购订单检验合格入库 + */ + public ResponseData qualifiedInbound(Object inboundData) { + String url = ifsUrl + "/api/purchase/order/qualified/inbound"; + return HttpClientUtil.doPostByRaw(url, inboundData); + } + + /** + * IFSA-006生产订单发料 + */ + public ResponseData issueProductionOrder(Object issueData) { + String url = ifsUrl + "/api/production/order/issue"; + return HttpClientUtil.doPostByRaw(url, issueData); + } + + /** + * IFSA-007生产订单退料 + */ + public ResponseData returnProductionOrder(Object returnData) { + String url = ifsUrl + "/api/production/order/return"; + return HttpClientUtil.doPostByRaw(url, returnData); + } + + /** + * IFSA-008生产订单入库 + */ + public ResponseData inboundProductionOrder(Object inboundData) { + String url = ifsUrl + "/api/production/order/inbound"; + return HttpClientUtil.doPostByRaw(url, inboundData); + } + + /** + * IFSA-009生产订单退库 + */ + public ResponseData returnProductionInbound(Object returnData) { + String url = ifsUrl + "/api/production/order/inbound/return"; + return HttpClientUtil.doPostByRaw(url, returnData); + } + + /** + * IFSA-10 委外PO发料(包含预留) + */ + public ResponseData issueOutsourcePO(Object issueData) { + String url = ifsUrl + "/api/outsource/po/issue"; + return HttpClientUtil.doPostByRaw(url, issueData); + } + + /** + * IFSA-011委外PO退料 + */ + public ResponseData returnOutsourcePO(Object returnData) { + String url = ifsUrl + "/api/outsource/po/return"; + return HttpClientUtil.doPostByRaw(url, returnData); + } + + /** + * IFSA-12terial Requisition发料(包含预留) + */ + public ResponseData issueMaterialRequisition(Object issueData) { + String url = ifsUrl + "/api/material/requisition/issue"; + return HttpClientUtil.doPostByRaw(url, issueData); + } + + /** + * IFSA-13terial Requisition退料 + */ + public ResponseData returnMaterialRequisition(Object returnData) { + String url = ifsUrl + "/api/material/requisition/return"; + return HttpClientUtil.doPostByRaw(url, returnData); + } + + /** + * IFSA-014基于Shipment的Reserve/Create Pick List/Report Picking + */ + public ResponseData processShipmentPicking(Object pickingData) { + String url = ifsUrl + "/api/shipment/picking"; + return HttpClientUtil.doPostByRaw(url, pickingData); + } + + /** + * IFSA-016销售订单发货 + */ + public ResponseData deliverSalesOrder(Object deliveryData) { + String url = ifsUrl + "/api/sales/order/deliver"; + return HttpClientUtil.doPostByRaw(url, deliveryData); + } + + /** + * IFSA-019MA处理 - 入库 + */ + public ResponseData processRmaInbound(Object rmaData) { + String url = ifsUrl + "/api/rma/inbound"; + return HttpClientUtil.doPostByRaw(url, rmaData); + } + + /** + * IFSA-020MA处理 - 报废 + */ + public ResponseData processRmaScrap(Object rmaData) { + String url = ifsUrl + "/api/rma/scrap"; + return HttpClientUtil.doPostByRaw(url, rmaData); + } + + /** + * IFSA-21: Execute + */ + public ResponseData executeTask(Object executeData) { + String url = ifsUrl + "/api/execute"; + return HttpClientUtil.doPostByRaw(url, executeData); + } + + /** + * IFSA-022 */ + public ResponseData moveInventory(Object moveData) { + String url = ifsUrl + "/api/inventory/move"; + return HttpClientUtil.doPostByRaw(url, moveData); + } + + /** + * IFSA-23ceive from Transit + */ + public ResponseData receiveFromTransit(Object receiveData) { + String url = ifsUrl + "/api/transit/receive"; + return HttpClientUtil.doPostByRaw(url, receiveData); + } + + /** + * IFSA-024 */ + public ResponseData scrapInventory(Object scrapData) { + String url = ifsUrl + "/api/inventory/scrap"; + return HttpClientUtil.doPostByRaw(url, scrapData); + } + + /** + * IFSA-25: 其他入库 + */ + public ResponseData otherInbound(Object inboundData) { + String url = ifsUrl + "/api/inventory/other/inbound"; + return HttpClientUtil.doPostByRaw(url, inboundData); + } + + /** + * IFSA-26: 其他出库 + */ + public ResponseData otherOutbound(Object outboundData) { + String url = ifsUrl + "/api/inventory/other/outbound"; + return HttpClientUtil.doPostByRaw(url, outboundData); + } + + /** + * IFSA-027 */ + public ResponseData inventoryGain(Object gainData) { + String url = ifsUrl + "/api/inventory/gain"; + return HttpClientUtil.doPostByRaw(url, gainData); + } + + /** + * IFSA-028 */ + public ResponseData inventoryLoss(Object lossData) { + String url = ifsUrl + "/api/inventory/loss"; + return HttpClientUtil.doPostByRaw(url, lossData); + } + + /** + * IFSA-029hange WDR + */ + public ResponseData changeWdr(Object wdrData) { + String url = ifsUrl + "/api/wdr/change"; + return HttpClientUtil.doPostByRaw(url, wdrData); + } + + /** + * IFSA-030: Change Availability Control ID + */ + public ResponseData changeAvailabilityControlId(Object controlData) { + String url = ifsUrl + "/api/availability/control/change"; + return HttpClientUtil.doPostByRaw(url, controlData); + } + + /** + * IFSA-031: Change Expiration Date + */ + public ResponseData changeExpirationDate(Object expirationData) { + String url = ifsUrl + "/api/expiration/date/change"; + return HttpClientUtil.doPostByRaw(url, expirationData); + } + +} diff --git a/src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java b/src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java index b9ef6a2..b539a28 100644 --- a/src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java +++ b/src/main/java/com/gaotao/modules/po/service/impl/PoServiceImpl.java @@ -3,7 +3,9 @@ package com.gaotao.modules.po.service.impl; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gaotao.common.exception.XJException; +import com.gaotao.common.utils.AgvClientUtil; import com.gaotao.common.utils.HttpClientUtil; +import com.gaotao.common.utils.IfsClientUtil; import com.gaotao.common.utils.ResponseData; import com.gaotao.modules.handlingunit.entity.HandlingUnit; import com.gaotao.modules.handlingunit.entity.HandlingUnitDetail; @@ -49,11 +51,10 @@ public class PoServiceImpl extends ServiceImpl implemen private HandlingUnitService handlingUnitService; @Autowired private HandlingUnitDetailService handlingUnitDetailService; - - @Value("${custom.ifs-url}") - private String ifsUrl; - @Value("${custom.wcs-url}") - private String wcsUrl; + @Autowired + private AgvClientUtil agvClientUtil; + @Autowired + private IfsClientUtil ifsClientUtil; @Override public List getPoList(PurchaseOrderDto purchaseOrder) { @@ -240,13 +241,13 @@ public class PoServiceImpl extends ServiceImpl implemen .update(); } // 业务处理成功后,调用IFS和WCS接口 - JSONObject jsonObject = new JSONObject(); + /*JSONObject jsonObject = new JSONObject(); jsonObject.put("ifsDBName", "IFSTEST"); jsonObject.put("domainUserID", "CCL_WMS"); jsonObject.put("ifsSiteID", "55"); - ResponseData ifsData = HttpClientUtil.doPostByRaw(ifsUrl+"MoveInventoryPart", jsonObject); + ResponseData ifsData = ifsClientUtil.receivePurchaseOrder(jsonObject);*/ // 直接入库,此时如果是立库,需call AGV小车 - ResponseData wcsData = HttpClientUtil.doPostByRaw(wcsUrl, inData); + //ResponseData wcsData = agvClientUtil.createTask("", null, null, null); } catch (Exception e) { throw new XJException("采购入库失败: " + e.getMessage()); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index be2c985..dd41231 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -87,5 +87,5 @@ query: maxNums: 1000 custom: - ifs-url: 'https://cclifswebservice.ccldesign.com/api/' + ifs-url: 'https://cclifswebservice.ccldesign.com' wcs-url: 'http://wcs-server/api/receive'