From 97a73035e8391fb60cdb26c00f7ff8b05296c68c Mon Sep 17 00:00:00 2001 From: zjh <2207896513@qq.com> Date: 星期五, 07 三月 2025 15:12:22 +0800 Subject: [PATCH] 获取料号图纸接口代码完整提交 --- StandardPda/MES.Service/service/QC/LljService.cs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/StandardPda/MES.Service/service/QC/LljService.cs b/StandardPda/MES.Service/service/QC/LljService.cs index 4137734..34826a8 100644 --- a/StandardPda/MES.Service/service/QC/LljService.cs +++ b/StandardPda/MES.Service/service/QC/LljService.cs @@ -5,8 +5,12 @@ using MES.Service.Modes; using MES.Service.util; using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Newtonsoft.Json; using SqlSugar; using DbType = System.Data.DbType; +using System.Net.Http; +using System.Threading.Tasks; + namespace MES.Service.service.QC; @@ -651,4 +655,51 @@ throw new Exception(ex.Message); } } + /// <summary> + /// 鏂欏彿鍥剧焊鎺ュ彛杩斿洖瀵硅薄 + /// </summary> + public class ApiResponse + { + [JsonProperty("status")] + public int Status { get; set; } + [JsonProperty("message")] + public string Message { get; set; } + [JsonProperty("data")] + public string[] Data { get; set; } + [JsonProperty("totalCount")] + public int TotalCount { get; set; } + } + private static readonly HttpClient client = new HttpClient(); + /// <summary> + /// 浠嶶9鑾峰彇鏂欏彿鍥剧焊鍒楄〃 + /// </summary> + /// <param name="Type">u9No锛歶9鐗╂枡缂栧彿</param> + /// <param name="U9No">type锛�1锛氬浘绾歌鏍间功 2锛氳繘鏂欐楠屾枃浠� </param> + /// <returns></returns> + /// <exception cref="Exception"></exception> + public async Task<string[]> GetFileUrlByU9List(string Type,string U9No) + { + try + { + var requestUrl = $"https://erp.dream-maker.com/api/public/getFileUrlByU9No?u9No={Uri.EscapeDataString(U9No)}&type={Type}"; + var response = await client.GetAsync(requestUrl); + response.EnsureSuccessStatusCode(); // 妫�鏌TTP鐘舵�佺爜 + var responseContent = await response.Content.ReadAsStringAsync(); + var result = JsonConvert.DeserializeObject<ApiResponse>(responseContent); + + if (result.Status == 0 && result.Data != null) + { + return result.Data; + } + else + { + return null; + } + + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + } } \ No newline at end of file -- Gitblit v1.9.3