zjh
2025-03-07 97a73035e8391fb60cdb26c00f7ff8b05296c68c
获取料号图纸接口代码完整提交
已修改2个文件
91 ■■■■ 文件已修改
StandardPda/MES.Service/service/QC/LljService.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardPda/MESApplication/Controllers/QC/LljController.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
    /// 从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);
        }
    }
}
StandardPda/MESApplication/Controllers/QC/LljController.cs
@@ -273,27 +273,37 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    //IqcQaSubmit
    [HttpPost("GetFileUrlByU9List")]
    public ResponseResult GetFileUrlByU9List(LLJDto rkjDto)
    public async Task<ResponseResult> GetFileUrlByU9List([FromBody] JObject data)
    {
        try
        {
            //dynamic resultInfos = new ExpandoObject();
            //var tbBillList =
            //    new LljService().IqcQaSubmit(rkjDto);
            //resultInfos.tbBillList = tbBillList;
            string[] fileUrls =
 {
    "https://new-service.oss-cn-hangzhou.aliyuncs.com/sheet-attachment/1728624575152_ty5VSi9R.png",
    "https://new-service.oss-cn-hangzhou.aliyuncs.com/sheet-attachment/1728624610583_EwIN55BL.pdf"
};
            return new ResponseResult
            var type = data["type"]?.ToString();
            var itemID = data["u9No"]?.ToString();
            dynamic resultInfos = new ExpandoObject();
            var lljService = new LljService();
            var tbBillList = await lljService.GetFileUrlByU9List(type, itemID);
            if (tbBillList!=null)
            {
                status = 0,
                message = "OK",
                data = fileUrls
            };
                return new ResponseResult
                {
                    status = 0,
                    message = "OK",
                    data = tbBillList
                };
            }
            else
            {
                return new ResponseResult
                {
                    status = 0,
                    message = "OK",
                    data = ""
                };
            }
        }
        catch (Exception ex)
        {