| | |
| | | using System.Text; |
| | | using GS.QC.Models; |
| | | using Gs.Toolbox; |
| | | using Gs.Toolbox; |
| | | using Gs.Toolbox.ApiCore.Abstract.Mvc; |
| | | using Gs.Toolbox.ApiCore.Common.Mvc; |
| | | using Gs.Toolbox.ApiCore.Group; |
| | | using GS.QC.Models; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json.Linq; |
| | | using System.Linq; |
| | | using System.Text; |
| | | |
| | | namespace GS.QC.Service; |
| | | |
| | |
| | | |
| | | private readonly MesQmAql2Manager _mesQmAql2Manager; |
| | | private readonly MesQmAql3Manager _mesQmAql3Manager; |
| | | private readonly MesQmAql4Manager _mesQmAql4Manager; |
| | | |
| | | private readonly string _userCode, _userGuid, _orgFids; |
| | | public MesQmAql1Manager(IHttpContextAccessor httpContextAccessor) |
| | |
| | | |
| | | _mesQmAql2Manager = new MesQmAql2Manager(); |
| | | _mesQmAql3Manager = new MesQmAql3Manager(); |
| | | _mesQmAql4Manager = new MesQmAql4Manager(); |
| | | |
| | | (_userCode, _userGuid, _orgFids) = |
| | | UtilityHelper.GetUserGuidAndOrgGuid(_http); |
| | |
| | | return ReturnDto<PageList<MesQmAql1>>.QuickReturn(pageList, |
| | | ReturnCode.Success, "读取成功"); |
| | | } |
| | | // 定义 AQL 标准顺序 |
| | | private static readonly Dictionary<decimal, int> _aqlOrder = new Dictionary<decimal, int> |
| | | { |
| | | { 0.0100m, 1 }, { 0.0150m, 2 }, { 0.0250m, 3 }, { 0.0400m, 4 }, { 0.0650m, 5 }, |
| | | { 0.1000m, 6 }, { 0.1500m, 7 }, { 0.2500m, 8 }, { 0.4000m, 9 }, { 0.6500m, 10 }, |
| | | { 1.0000m, 11 }, { 1.5000m, 12 }, { 2.5000m, 13 }, { 4.0000m, 14 }, { 6.5000m, 15 }, |
| | | { 10.0000m, 16 } |
| | | }; |
| | | |
| | | /// <summary> |
| | | /// 根据主表id读取主表和子表 |
| | |
| | | .Where(a => a.Aql1Id == m.Guid) |
| | | .OrderBy(a => a.SampleSizeWord) |
| | | .ToList(); |
| | | m.MesQmAql4s = Db.Queryable<MesQmAql4>() |
| | | .Where(a => a.Aql1Id == m.Guid) |
| | | .ToList() |
| | | .OrderBy(a => a.FacLevel) |
| | | .ToList(); |
| | | |
| | | if (m != null) |
| | | return ReturnDto<MesQmAql1>.QuickReturn(m, |
| | | ReturnCode.Success, "读取成功!"); |
| | |
| | | .ExecuteCommand(); |
| | | } |
| | | |
| | | if (model.MesQmAql4s is { Count: > 0 }) |
| | | { |
| | | var _upLst = new List<MesQmAql4>(); |
| | | var _addLst = new List<MesQmAql4>(); |
| | | foreach (var m in model.MesQmAql4s) |
| | | if (UtilityHelper.CheckGuid(m.Guid)) |
| | | { |
| | | m.Aql1Id = model.Guid; |
| | | _upLst.Add(m); |
| | | } |
| | | else |
| | | { |
| | | m.Guid = Guid.NewGuid(); |
| | | m.Aql1Id = model.Guid; |
| | | _addLst.Add(m); |
| | | } |
| | | |
| | | if (_upLst is { Count: > 0 }) |
| | | { |
| | | var guids = _upLst.Select(t => t.Guid).ToArray(); |
| | | Db.Deleteable<MesQmAql4>().In(guids).ExecuteCommand(); |
| | | _addLst.AddRange(_upLst); |
| | | } |
| | | |
| | | Db.Insertable(_addLst).PageSize(1).IgnoreColumnsNull() |
| | | .ExecuteCommand(); |
| | | } |
| | | |
| | | Db.Ado.CommitTran(); |
| | | } |
| | | catch (Exception ex) |