| | |
| | | using MES.Service.Dto.service; |
| | | 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; |
| | |
| | | |
| | | var totalCount = 0; |
| | | |
| | | var itemIds = GetQaItem(db, queryObj.createUser); |
| | | //var itemIds = GetQaItem(db, queryObj.createUser); |
| | | |
| | | var pageList = db.Queryable<LtsLlj>() |
| | | var pageList = db.Queryable<LtsLlj, IqcBefore, VMesQaItemsDetect01, SysUser, IqcBeforeFrom, SysUser>((a, b,d,e,f,g) => |
| | | new JoinQueryInfos(JoinType.Left, a.ItemId == b.ItemId, |
| | | |
| | | JoinType.Inner, a.Id == d.Id, |
| | | JoinType.Left, a.CreateBy == e.Fcode, |
| | | JoinType.Left,f.Id==b.PID, |
| | | JoinType.Left, f.Sid == g.Fid |
| | | )) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | a => a.FcheckResu == null) |
| | | (a, b, d) => a.FcheckResu == null ) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | a => a.FcheckResu != null) |
| | | .WhereIF( |
| | | itemIds is { Length: > 0 }, |
| | | a => itemIds.Contains(a.ItemId)) |
| | | .WhereIF(id > 0, a => a.Id == id) |
| | | .OrderByDescending(a => a.Id) |
| | | (a, b, d) => a.FcheckResu != null) |
| | | //.WhereIF( |
| | | // itemIds is { Length: > 0 }, |
| | | // (a, b, c) => itemIds.Contains(a.ItemId)) |
| | | .WhereIF(id > 0, (a, b, d) => a.Id == id ) |
| | | .WhereIF(true, (a, b,d, e,f,g) => (g.Fcode == queryObj.createUser || g.Fcode == null)) |
| | | //加筛选条件,根据供应商,物料编码,物料名称搜索 |
| | | //.WhereIF(queryObj.SearchValue!=null && queryObj.SearchValue!="", (a) => a.SuppName == queryObj.SearchValue|| a.ItemName == queryObj.SearchValue || a.ItemNo == queryObj.SearchValue ) |
| | | .WhereIF(queryObj.SearchValue != null && queryObj.SearchValue != "", |
| | | (a) => (a.SuppName.ToLower().Contains(queryObj.SearchValue.ToLower()) |
| | | || a.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()) |
| | | || a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower()))) |
| | | .OrderByDescending((a, b, d) => a.Id) |
| | | .Select((a, b, d,e,f,g) => new LtsLlj |
| | | { |
| | | UserName = g.Fname, |
| | | FIRST=d.First, |
| | | CreateUserName=e.Fname, |
| | | NewFngDesc=d.NewFngDesc |
| | | |
| | | }, true) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | |
| | | |
| | | return (pageList, totalCount); |
| | | } |
| | | |
| | |
| | | a.FspecRequ, |
| | | a.FreQty, |
| | | a.CheckQyt, |
| | | a.FcheckResu |
| | | a.FcheckResu, |
| | | a.FcheckItemDesc |
| | | }).Select((a, b) => new MesQaItemsDetectDetail5 |
| | | { |
| | | Id = a.Id, |
| | |
| | | Factory = "1000", |
| | | Company = "1000", |
| | | FenterQty = SqlFunc.AggregateCount(b.Id), |
| | | FcheckResu = a.FcheckResu |
| | | FcheckResu = a.FcheckResu, |
| | | FcheckItemDesc=a.FcheckItemDesc |
| | | }).ToList(); |
| | | } |
| | | |
| | |
| | | return SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | return db.Updateable<MesQaItemsDetect01>() |
| | | // .SetColumns(it => |
| | | // it.Remarks == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .SetColumns(it => |
| | | it.FngDesc == dto.Remarks) //SetColumns是可以叠加的 写2个就2个字段赋值 |
| | | .Where(it => it.ReleaseNo == dto.releaseNo) |
| | | .ExecuteCommand(); |
| | | }); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |