| | |
| | | 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; |
| | |
| | | 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> |
| | | /// 从U9获取料号图纸列表 |
| | | /// </summary> |
| | | /// <param name="Type">u9No:u9物料编号</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(); // 检查HTTP状态码 |
| | | 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); |
| | | } |
| | | } |
| | | } |