| | |
| | | // result = "未检测" |
| | | // }).ToList(); |
| | | // } |
| | | public List<QsItemIpiItem> SetQSItems(string itemNo) |
| | | public List<QsItemIpiItem> SetQSItems(string itemNo, decimal? workQty = null) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | |
| | | |
| | | if (count <= 0) return []; |
| | | |
| | | return db |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "1" && b.ItemNo == itemNo).Select( |
| | | b => new QsItemIpiItem |
| | | // 如果没有传递工单数量,尝试从工单表中获取 |
| | | if (workQty == null || workQty <= 0) |
| | | { |
| | | System.Diagnostics.Debug.WriteLine($"SJService.SetQSItems - itemNo: {itemNo}, workQty: {workQty}"); |
| | | |
| | | // 通过物料编码(Daa002)匹配工单 |
| | | var workOrder = db.Queryable<Womdaa>() |
| | | .Where(w => w.Daa002 == itemNo) |
| | | .OrderByDescending(w => w.Id) |
| | | .First(); |
| | | |
| | | if (workOrder != null) |
| | | { |
| | | workQty = workOrder.Daa008; // 工单数量 |
| | | System.Diagnostics.Debug.WriteLine($"Found work order by Daa002 (物料编码): {workOrder.Daa001}, Daa002: {workOrder.Daa002}, Daa003: {workOrder.Daa003}, workQty: {workQty}"); |
| | | } |
| | | else |
| | | { |
| | | System.Diagnostics.Debug.WriteLine($"No work order found for itemNo (物料编码): {itemNo}"); |
| | | |
| | | // 如果通过物料编码找不到,尝试通过产品名称匹配 |
| | | var workOrderByName = db.Queryable<Womdaa>() |
| | | .Where(w => w.Daa003.Contains(itemNo) || itemNo.Contains(w.Daa003)) |
| | | .OrderByDescending(w => w.Id) |
| | | .First(); |
| | | |
| | | if (workOrderByName != null) |
| | | { |
| | | ProjName = b.ProjName, |
| | | ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = SqlFunc.IsNull( |
| | | SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1), |
| | | b.InspectionLevel), |
| | | MaxValue = b.MaxValue, |
| | | StandardValue = b.StandardValue, |
| | | MinValue = b.MinValue, |
| | | Notes = b.Notes, |
| | | FcheckLevel = b.FcheckLevel, |
| | | FacLevel = b.FacLevel, |
| | | QsCode = b.QsCode, |
| | | QsName = b.QsName, |
| | | Picture = b.Picture, |
| | | Picturename = b.Picturename, |
| | | result = "未检测", |
| | | isCheck = 0 |
| | | }).ToList(); |
| | | workQty = workOrderByName.Daa008; // 工单数量 |
| | | System.Diagnostics.Debug.WriteLine($"Found work order by name: {workOrderByName.Daa001}, Daa002: {workOrderByName.Daa002}, Daa003: {workOrderByName.Daa003}, workQty: {workQty}"); |
| | | } |
| | | else |
| | | { |
| | | System.Diagnostics.Debug.WriteLine($"No work order found by name for itemNo: {itemNo}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 先获取基础数据 |
| | | var qualityStandards = db |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "1" && b.ItemNo == itemNo) |
| | | .ToList(); |
| | | |
| | | // 在内存中计算检验数量 |
| | | return qualityStandards.Select(b => new QsItemIpiItem |
| | | { |
| | | ProjName = b.ProjName, |
| | | ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = CalculateInspectionQuantity(b.LevelNum, b.InspectionLevel, workQty), |
| | | MaxValue = b.MaxValue, |
| | | StandardValue = b.StandardValue, |
| | | MinValue = b.MinValue, |
| | | Notes = b.Notes, |
| | | FcheckLevel = b.FcheckLevel, |
| | | FacLevel = b.FacLevel, |
| | | QsCode = b.QsCode, |
| | | QsName = b.QsName, |
| | | Picture = b.Picture, |
| | | Picturename = b.Picturename, |
| | | result = "未检测", |
| | | isCheck = 0 |
| | | }).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 计算检验数量:如果工单数量小于抽验数量,则检验数量为工单数量,否则为抽检数量 |
| | | /// </summary> |
| | | /// <param name="levelNum">每模多少个</param> |
| | | /// <param name="inspectionLevel">模数</param> |
| | | /// <param name="workQty">工单数量</param> |
| | | /// <returns>检验数量</returns> |
| | | private decimal? CalculateInspectionQuantity(decimal? levelNum, decimal? inspectionLevel, decimal? workQty) |
| | | { |
| | | System.Diagnostics.Debug.WriteLine($"SJService.CalculateInspectionQuantity - INPUT: levelNum={levelNum}, inspectionLevel={inspectionLevel}, workQty={workQty}"); |
| | | |
| | | // 直接使用levelNum作为抽检数量,不再计算 |
| | | var samplingQuantity = levelNum ?? 1; |
| | | |
| | | System.Diagnostics.Debug.WriteLine($"SJService.CalculateInspectionQuantity - samplingQuantity (from levelNum): {samplingQuantity}"); |
| | | |
| | | // 如果没有工单数量,使用抽检数量 |
| | | if (workQty == null || workQty <= 0) |
| | | {return samplingQuantity; |
| | | } |
| | | |
| | | // 如果工单数量小于抽检数量,则检验数量为工单数量 |
| | | // 如果工单数量大于等于抽检数量,则检验数量为抽检数量 |
| | | var result = workQty < samplingQuantity ? workQty : samplingQuantity; |
| | | |
| | | System.Diagnostics.Debug.WriteLine($"SJService.CalculateInspectionQuantity - FINAL: workQty={workQty}, samplingQuantity={samplingQuantity}, result={result}"); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public List<QsQaItemXj01> setJYItem(string itemNo) |
| | | public List<QsQaItemXj01> setJYItem(string itemNo, decimal? workQty = null) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | |
| | | |
| | | if (count <= 0) return new List<QsQaItemXj01>(); |
| | | |
| | | return db |
| | | // 如果没有传递工单数量,尝试从工单表中获取 |
| | | if (workQty == null || workQty <= 0) |
| | | { |
| | | // 通过物料编码(Daa002)匹配工单 |
| | | var workOrder = db.Queryable<Womdaa>() |
| | | .Where(w => w.Daa002 == itemNo) |
| | | .OrderByDescending(w => w.Id) |
| | | .First(); |
| | | |
| | | if (workOrder != null) |
| | | { |
| | | workQty = workOrder.Daa008; // 工单数量 |
| | | } |
| | | } |
| | | |
| | | // 先获取基础数据 |
| | | var qualityStandards = db |
| | | .Queryable<MesQualityStandard>() |
| | | .Where(b => b.QsType == "2" |
| | | && b.ItemNo == itemNo).Select( |
| | | b => new QsQaItemXj01 |
| | | { |
| | | ProjName = b.ProjName, |
| | | ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = SqlFunc.IsNull( |
| | | SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1), |
| | | b.InspectionLevel), |
| | | MaxValue = b.MaxValue, |
| | | StandardValue = b.StandardValue, |
| | | MinValue = b.MinValue, |
| | | Notes = b.Notes, |
| | | FcheckLevel = b.FcheckLevel, |
| | | FacLevel = b.FacLevel, |
| | | QsCode = b.QsCode, |
| | | QsName = b.QsName, |
| | | result = "未检测", |
| | | isCheck = 0, |
| | | Picture = b.Picture, |
| | | Picturename = b.Picturename |
| | | }).ToList(); |
| | | .Where(b => b.QsType == "2" && b.ItemNo == itemNo) |
| | | .ToList(); |
| | | |
| | | // 在内存中计算检验数量 |
| | | return qualityStandards.Select(b => { |
| | | var calculatedLevelNum = CalculateInspectionQuantity(b.InspectionLevel, workQty); |
| | | |
| | | return new QsQaItemXj01 |
| | | { |
| | | ProjName = b.ProjName, |
| | | ItemMod = b.ItemMod, |
| | | InspectionMethod = b.InspectionMethod, |
| | | UsingInstruments = b.UsingInstruments, |
| | | LevelNum = calculatedLevelNum, |
| | | MaxValue = b.MaxValue, |
| | | StandardValue = b.StandardValue, |
| | | MinValue = b.MinValue, |
| | | Notes = b.Notes, |
| | | FcheckLevel = b.FcheckLevel, |
| | | FacLevel = b.FacLevel, |
| | | QsCode = b.QsCode, |
| | | QsName = b.QsName, |
| | | result = "未检测", |
| | | isCheck = 0, |
| | | Picture = b.Picture, |
| | | Picturename = b.Picturename |
| | | }; |
| | | }).ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 计算检验数量:如果抽检数量大于工单数量,则检验数量为工单数量,否则为抽检数量 |
| | | /// </summary> |
| | | /// <param name="samplingQuantity">抽检数量</param> |
| | | /// <param name="workQty">工单数量</param> |
| | | /// <returns>检验数量</returns> |
| | | private decimal? CalculateInspectionQuantity(decimal? samplingQuantity, decimal? workQty) |
| | | { |
| | | // 如果没有工单数量,使用抽检数量 |
| | | if (workQty == null || workQty <= 0) |
| | | { |
| | | return samplingQuantity; |
| | | } |
| | | |
| | | // 如果抽检数量大于工单数量,则检验数量为工单数量,否则为抽检数量 |
| | | return samplingQuantity > workQty ? workQty : samplingQuantity; |
| | | } |
| | | |
| | | public List<QsQaItemXj01> getJYItem(decimal? pid, decimal? id) |
| | |
| | | try |
| | | { |
| | | HttpClient client = new(); |
| | | var requestUrl = $"http://192.168.1.223:10054/UpgradeInformation.json"; |
| | | var requestUrl = $"http://192.168.1.223:8085/UpgradeInformation.json"; |
| | | var response = await client.GetAsync(requestUrl); |
| | | response.EnsureSuccessStatusCode(); // 检查HTTP状态码 |
| | | var responseContent = await response.Content.ReadAsStringAsync(); |
| | |
| | | public ResponseResult SetQSItems([FromBody] JObject data) |
| | | { |
| | | var itemNo = data["itemNo"].ToString(); |
| | | decimal? workQty = null; |
| | | |
| | | // 尝试获取工单数量参数 |
| | | if (data["workQty"] != null) |
| | | { |
| | | if (decimal.TryParse(data["workQty"].ToString(), out decimal parsedWorkQty)) |
| | | { |
| | | workQty = parsedWorkQty; |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var tbBillList = new SJService(); |
| | | var detail021 = tbBillList.SetQSItems(itemNo); |
| | | var detail021 = tbBillList.SetQSItems(itemNo, workQty); |
| | | resultInfos.tbBillList = detail021; |
| | | return new ResponseResult |
| | | { |
| | |
| | | public ResponseResult setJYItem([FromBody] JObject data) |
| | | { |
| | | var itemNo = data["itemNo"].ToString(); |
| | | decimal? workQty = null; |
| | | |
| | | // 尝试获取工单数量参数 |
| | | if (data["workQty"] != null) |
| | | { |
| | | if (decimal.TryParse(data["workQty"].ToString(), out decimal parsedWorkQty)) |
| | | { |
| | | workQty = parsedWorkQty; |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var tbBillList = |
| | | new XJService().setJYItem(itemNo); |
| | | new XJService().setJYItem(itemNo, workQty); |
| | | resultInfos.tbBillList = tbBillList; |
| | | return new ResponseResult |
| | | { |
| | |
| | | <Project> |
| | | <PropertyGroup> |
| | | <_PublishTargetUrl>E:\Desktop\接口\RD\RD_MES_Api\MESApplication\bin\Release\net8.0\publish\</_PublishTargetUrl> |
| | | <History>True|2025-09-25T01:36:17.3207590Z||;True|2025-09-24T17:48:11.4770370+08:00||;True|2025-09-24T10:00:27.2652137+08:00||;True|2025-09-22T17:09:16.2235067+08:00||;True|2025-09-07T15:57:42.6492991+08:00||;True|2025-09-02T14:07:59.4933772+08:00||;True|2025-08-22T10:11:31.0216372+08:00||;True|2025-08-18T08:28:20.1447738+08:00||;True|2025-08-12T09:51:50.2822756+08:00||;True|2025-08-10T16:28:17.3559399+08:00||;True|2025-08-06T09:47:19.1451217+08:00||;True|2025-08-06T09:46:51.2621129+08:00||;True|2025-08-03T18:48:37.3295098+08:00||;True|2025-08-01T17:29:02.4576952+08:00||;True|2025-03-27T23:22:42.3501020+08:00||;True|2025-03-10T16:49:08.3476948+08:00||;True|2024-12-24T15:39:58.5366570+08:00||;True|2024-11-26T18:32:03.9568766+08:00||;True|2024-11-21T02:11:35.8050745+08:00||;True|2024-09-21T16:35:22.6651659+08:00||;True|2024-09-21T16:14:11.3450387+08:00||;True|2024-09-19T17:16:11.7338751+08:00||;True|2024-09-19T17:11:21.0116707+08:00||;True|2024-09-19T13:54:25.7455472+08:00||;True|2024-09-15T13:55:51.7095153+08:00||;True|2024-09-12T17:10:20.4734556+08:00||;True|2024-09-10T15:54:07.7463519+08:00||;True|2024-09-06T14:40:56.3762241+08:00||;True|2024-08-20T17:12:00.2924570+08:00||;True|2024-08-17T10:57:05.6670396+08:00||;True|2024-08-17T10:56:46.8068041+08:00||;True|2024-08-16T14:09:17.0526491+08:00||;True|2024-08-15T08:40:32.8134665+08:00||;True|2024-08-14T10:00:27.7017207+08:00||;True|2024-08-14T08:54:44.8284031+08:00||;True|2024-08-07T10:32:10.3689256+08:00||;True|2024-08-05T15:45:03.0864530+08:00||;True|2024-08-03T09:59:13.7916520+08:00||;True|2024-07-31T17:27:28.1965929+08:00||;True|2024-07-31T15:27:34.7943845+08:00||;True|2024-07-30T15:04:50.5849235+08:00||;True|2024-07-30T14:09:06.2877325+08:00||;True|2024-07-29T16:11:30.4493940+08:00||;True|2024-07-23T14:30:34.4591002+08:00||;True|2024-07-22T14:17:39.8186158+08:00||;True|2024-04-10T12:55:31.3963752+08:00||;True|2024-04-08T13:59:25.5487203+08:00||;True|2024-04-06T09:30:09.5350539+08:00||;True|2024-04-06T08:46:05.8814658+08:00||;True|2024-04-05T14:06:52.0448024+08:00||;True|2024-04-05T12:47:46.0561601+08:00||;True|2024-02-26T08:46:22.0988887+08:00||;True|2024-02-24T19:17:13.6770376+08:00||;True|2024-02-24T14:32:37.4450337+08:00||;True|2024-02-23T10:22:06.5150173+08:00||;True|2024-02-22T13:19:56.6997993+08:00||;True|2024-02-22T10:53:17.7929585+08:00||;True|2024-02-21T17:08:06.5553444+08:00||;True|2024-02-19T16:24:37.4912012+08:00||;True|2024-02-02T10:07:23.2726075+08:00||;True|2024-02-02T08:36:49.2904460+08:00||;True|2024-01-29T17:44:43.6800769+08:00||;True|2024-01-23T09:47:26.7811926+08:00||;True|2024-01-18T16:23:30.3373836+08:00||;True|2024-01-17T14:22:04.2552286+08:00||;True|2024-01-16T16:54:42.2316892+08:00||;True|2024-01-16T16:37:23.8028858+08:00||;True|2024-01-16T09:25:24.4007775+08:00||;True|2024-01-15T10:18:57.3362616+08:00||;True|2024-01-15T10:07:14.2044763+08:00||;True|2024-01-10T14:03:36.4451130+08:00||;True|2024-01-09T16:45:32.9601815+08:00||;True|2024-01-06T14:16:34.2732220+08:00||;True|2024-01-06T14:11:45.2134717+08:00||;True|2024-01-06T11:30:58.9198887+08:00||;</History> |
| | | <History>True|2025-09-28T06:01:09.8976598Z||;True|2025-09-27T18:21:38.6643161+08:00||;True|2025-09-25T09:36:17.3207590+08:00||;True|2025-09-24T17:48:11.4770370+08:00||;True|2025-09-24T10:00:27.2652137+08:00||;True|2025-09-22T17:09:16.2235067+08:00||;True|2025-09-07T15:57:42.6492991+08:00||;True|2025-09-02T14:07:59.4933772+08:00||;True|2025-08-22T10:11:31.0216372+08:00||;True|2025-08-18T08:28:20.1447738+08:00||;True|2025-08-12T09:51:50.2822756+08:00||;True|2025-08-10T16:28:17.3559399+08:00||;True|2025-08-06T09:47:19.1451217+08:00||;True|2025-08-06T09:46:51.2621129+08:00||;True|2025-08-03T18:48:37.3295098+08:00||;True|2025-08-01T17:29:02.4576952+08:00||;True|2025-03-27T23:22:42.3501020+08:00||;True|2025-03-10T16:49:08.3476948+08:00||;True|2024-12-24T15:39:58.5366570+08:00||;True|2024-11-26T18:32:03.9568766+08:00||;True|2024-11-21T02:11:35.8050745+08:00||;True|2024-09-21T16:35:22.6651659+08:00||;True|2024-09-21T16:14:11.3450387+08:00||;True|2024-09-19T17:16:11.7338751+08:00||;True|2024-09-19T17:11:21.0116707+08:00||;True|2024-09-19T13:54:25.7455472+08:00||;True|2024-09-15T13:55:51.7095153+08:00||;True|2024-09-12T17:10:20.4734556+08:00||;True|2024-09-10T15:54:07.7463519+08:00||;True|2024-09-06T14:40:56.3762241+08:00||;True|2024-08-20T17:12:00.2924570+08:00||;True|2024-08-17T10:57:05.6670396+08:00||;True|2024-08-17T10:56:46.8068041+08:00||;True|2024-08-16T14:09:17.0526491+08:00||;True|2024-08-15T08:40:32.8134665+08:00||;True|2024-08-14T10:00:27.7017207+08:00||;True|2024-08-14T08:54:44.8284031+08:00||;True|2024-08-07T10:32:10.3689256+08:00||;True|2024-08-05T15:45:03.0864530+08:00||;True|2024-08-03T09:59:13.7916520+08:00||;True|2024-07-31T17:27:28.1965929+08:00||;True|2024-07-31T15:27:34.7943845+08:00||;True|2024-07-30T15:04:50.5849235+08:00||;True|2024-07-30T14:09:06.2877325+08:00||;True|2024-07-29T16:11:30.4493940+08:00||;True|2024-07-23T14:30:34.4591002+08:00||;True|2024-07-22T14:17:39.8186158+08:00||;True|2024-04-10T12:55:31.3963752+08:00||;True|2024-04-08T13:59:25.5487203+08:00||;True|2024-04-06T09:30:09.5350539+08:00||;True|2024-04-06T08:46:05.8814658+08:00||;True|2024-04-05T14:06:52.0448024+08:00||;True|2024-04-05T12:47:46.0561601+08:00||;True|2024-02-26T08:46:22.0988887+08:00||;True|2024-02-24T19:17:13.6770376+08:00||;True|2024-02-24T14:32:37.4450337+08:00||;True|2024-02-23T10:22:06.5150173+08:00||;True|2024-02-22T13:19:56.6997993+08:00||;True|2024-02-22T10:53:17.7929585+08:00||;True|2024-02-21T17:08:06.5553444+08:00||;True|2024-02-19T16:24:37.4912012+08:00||;True|2024-02-02T10:07:23.2726075+08:00||;True|2024-02-02T08:36:49.2904460+08:00||;True|2024-01-29T17:44:43.6800769+08:00||;True|2024-01-23T09:47:26.7811926+08:00||;True|2024-01-18T16:23:30.3373836+08:00||;True|2024-01-17T14:22:04.2552286+08:00||;True|2024-01-16T16:54:42.2316892+08:00||;True|2024-01-16T16:37:23.8028858+08:00||;True|2024-01-16T09:25:24.4007775+08:00||;True|2024-01-15T10:18:57.3362616+08:00||;True|2024-01-15T10:07:14.2044763+08:00||;True|2024-01-10T14:03:36.4451130+08:00||;True|2024-01-09T16:45:32.9601815+08:00||;True|2024-01-06T14:16:34.2732220+08:00||;True|2024-01-06T14:11:45.2134717+08:00||;True|2024-01-06T11:30:58.9198887+08:00||;</History> |
| | | <LastFailureDetails /> |
| | | </PropertyGroup> |
| | | </Project> |