From c53a461aef16902ca78cdb7bd0c62305e2fee809 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期二, 29 七月 2025 19:23:04 +0800 Subject: [PATCH] Update OQC search API functionality --- MES.Service/service/QC/MesOqcItemsDetect02Manager.cs | 78 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 77 insertions(+), 1 deletions(-) diff --git a/MES.Service/service/QC/MesOqcItemsDetect02Manager.cs b/MES.Service/service/QC/MesOqcItemsDetect02Manager.cs index 35830d6..881ee92 100644 --- a/MES.Service/service/QC/MesOqcItemsDetect02Manager.cs +++ b/MES.Service/service/QC/MesOqcItemsDetect02Manager.cs @@ -46,6 +46,12 @@ !"鏈畬鎴�".Equals(queryObj.result), (a, b, c, d, e) => a.FcheckResu != null && a.Fsubmit == 1) .WhereIF(id > 0, (a, b, c, d, e) => a.Id == id) + .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.createUser), + (a, b, c, d, e) => c.Fname.Contains(queryObj.createUser)) + .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.ItemNo), + (a, b, c, d, e) => b.ItemNo.Contains(queryObj.ItemNo)) + .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.ItemName), + (a, b, c, d, e) => b.ItemName.Contains(queryObj.ItemName)) .OrderByDescending((a, b, c, d, e) => a.Id) .Select((a, b, c, d, e) => new MesOqcItemsDetect02() { @@ -227,6 +233,47 @@ } return 0; + } + + public bool Regenerate(MesOqcItemsDetect02 from) + { + // 瀹氫箟杈撳嚭鍙傛暟 + var outputResult = new SugarParameter("PO_RESULT", null, + DbType.Int32, ParameterDirection.Output, 4000); + var outputMessage = new SugarParameter("PO_TEXT", null, + DbType.String, + ParameterDirection.Output, 4000); + + // 瀹氫箟杈撳叆鍙傛暟 + var parameters = new List<SugarParameter> + { + new("P_RELEASE_NO", from.ReleaseNo, DbType.String, + ParameterDirection.Input), + new("P_ITEM_ID", from.ItemId, DbType.Int32, + ParameterDirection.Input), + new("P_BILL_NO ", "", DbType.String, + ParameterDirection.Input), + outputResult, + outputMessage + }; + + var db = SqlSugarHelper.GetInstance(); + + // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ + db.Ado.ExecuteCommand( + "BEGIN PRC_OQC_ITEM_INSERT_BTN(:P_RELEASE_NO,:P_ITEM_ID,:P_BILL_NO,:PO_RESULT, :PO_TEXT); END;", + parameters.ToArray()); + + // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� + var resultValue = outputResult.Value?.ToString(); + var messageValue = outputMessage.Value?.ToString(); + + if ("1".Equals(resultValue)) + // 澶勭悊澶辫触鎯呭喌锛岃繑鍥為敊璇俊鎭� + throw new Exception($"鎿嶄綔澶辫触: {messageValue}"); + + // 褰� resultValue 涓� "0" 鏃惰繑鍥炴垚鍔熺姸鎬� + return true; } public OQCDto getXjDetail02ById(decimal? id) @@ -454,7 +501,7 @@ throw new Exception(ex.Message); } } - + public int saveRemarksGid(LLJDto dto) { return SqlSugarHelper.UseTransactionWithOracle(db => @@ -466,4 +513,33 @@ .ExecuteCommand(); }); } + + public int SetQSItemDetail(MesOqcItemsDetectDetail12 detail) + { + var oracle = SqlSugarHelper.UseTransactionWithOracle(db => + { + List<MesOqcItemsDetectDetail12> result = new(); + for (var i = 0; i < detail.count; i++) + { + var item = new MesOqcItemsDetectDetail12(); + item.MainId = detail.MainId; + item.ReleaseNo = detail.ReleaseNo; + item.Fstand = detail.Fstand; + item.FcheckResu = detail.FcheckResu; + item.CreateBy = detail.LastupdateBy; + item.CreateDate = DateTime.Now; + item.Factory = "1000"; + item.Company = "1000"; + result.Add(item); + } + + return db.Insertable(result).ExecuteCommand(); + }); + + detail.CreateBy = detail.LastupdateBy; + + autoResult(detail); + + return oracle; + } } \ No newline at end of file -- Gitblit v1.9.3