From 54c1905b39297c65b39b54be69118f8a06294879 Mon Sep 17 00:00:00 2001 From: Sai Date: Sun, 4 Feb 2024 21:21:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=A2=9D=E7=A2=BC=E6=AD=B7=E7=A8=8B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=8C=85=E8=A3=9D=E7=A7=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 26 ++++++++- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 25 ++++----- .../ViewModels/PCS/PCS009RViewModel.cs | 39 ++++++++++++++ AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml | 54 +++++++++++++++++++ .../Controllers/BLL/TestLogController.cs | 43 ++++++++------- 5 files changed, 155 insertions(+), 32 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index b7ebb498..b3c98d2f 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -4735,7 +4735,7 @@ namespace AMESCoreStudio.Web.Controllers } // TestLog - var testLogResult = await _pcsApi.GetTestLogByMSSql(result.BarCodeNo); + var testLogResult = await _pcsApi.GetTestLog(result.BarCodeNo); foreach (var item in testLogResult) { var FileName = (string)item.filename; @@ -4754,12 +4754,34 @@ namespace AMESCoreStudio.Web.Controllers FilePath = $"{(string)item.workOrder}\{FileName}" }); } + + // 包裝秤重 + try + { + var packingWeighResult = await _pcsApi.GetPackingWeigh(result.ExtraBarCodeNo); + foreach (var item in packingWeighResult) + { + var RecordTime = ((DateTime)item.record_Time).ToString("yyyy/MM/dd HH:mm:ss"); + result.packingWeighs.Add(new PackingWeigh + { + Weight = item.weight, + Result = item.result, + Record_Time = RecordTime, + FileName = item.filename + }); + } + } + catch + { + + } + return View(result); } public async Task PCS009T(string sn, string id) { - var query = await _pcsApi.GetTestLogByMSSql(sn); + var query = await _pcsApi.GetTestLog(sn); var result = new List(); if (query.Any()) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 5246f8ae..708a57eb 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -16,7 +16,7 @@ namespace AMESCoreStudio.Web [JsonReturn] public interface IPCS : IHttpApi { - + ////////////////////////////////////// [WebApiClient.Attributes.HttpPost("api/BarCodeCheck/PassIngByCheck")] @@ -93,7 +93,7 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/WipInfos/GetWipInfoSelectParameter")] //ITask> GetWipInfoSelectParameter(string unitno = null, string wipno = null); ITask> GetWipInfoSelectParameter(string unitno = null, string wipno = null, int lineid = 0 - , string itemno = null, DateTime? date_str = null, DateTime? date_end = null, string wipType = null, string factoryno = null, int page = 0, int limit = 10 , string statusNo = null); + , string itemno = null, DateTime? date_str = null, DateTime? date_end = null, string wipType = null, string factoryno = null, int page = 0, int limit = 10, string statusNo = null); /// /// 查詢工單基本資料+是否已過站 @@ -1109,7 +1109,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/WipInfos/GetWipInfo4QRS011")] - ITask> GetWipInfo4QRS011(string unitNo, string itemNO, string wipNO , string wipStatus); + ITask> GetWipInfo4QRS011(string unitNo, string itemNO, string wipNO, string wipStatus); #endregion @@ -1171,7 +1171,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/FqcResultMaster/GetFQCHeaderData4QRS016")] - ITask> GetFQCHeaderData4QRS016(string wipNO, string itemNO, string modelNO, string dateStart, string dateEnd ,string factoryID); + ITask> GetFQCHeaderData4QRS016(string wipNO, string itemNO, string modelNO, string dateStart, string dateEnd, string factoryID); /// /// FQC查詢報表 細項統計 @@ -1414,7 +1414,7 @@ namespace AMESCoreStudio.Web /// WIPID /// [WebApiClient.Attributes.HttpGet("api/FqcInhouseDetail/GetCheckFqcOnGoIng")] - ITask> GetCheckFqcOnGoIng(string boxNo , int wipId); + ITask> GetCheckFqcOnGoIng(string boxNo, int wipId); #endregion #region 取出貨序號 @@ -1549,7 +1549,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/WipClears")] - ITask> GetWipClears(string wipNo,string itemNo,string dateStart,string dateEnd,int page, int limit); + ITask> GetWipClears(string wipNo, string itemNo, string dateStart, string dateEnd, int page, int limit); /// /// 新增清線資料 @@ -1701,7 +1701,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpPost("http://192.168.4.109:5088/api/WareHouseing")] - ITask> PostWareHouseing_EVER([FromBody, RawJsonContent] string model); + ITask> PostWareHouseing_EVER([FromBody, RawJsonContent] string model); /// /// FQC抽驗資料 /// @@ -1808,7 +1808,7 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/SerialRuleDetails/SerialRuleDetailbyPCS040/{id}")] ITask> GetSerialRuleDetailbyPCS040(int id); - + /// /// 查詢SerialRuleDetail /// @@ -1935,11 +1935,12 @@ namespace AMESCoreStudio.Web ITask> GetTestLog(string id); /// - /// Test Log 查詢 + /// 包裝秤重 查詢 /// + /// 出貨序號 /// - [WebApiClient.Attributes.HttpGet("api/TestLog/ByMSSql/{id}")] - ITask> GetTestLogByMSSql(string id); + [WebApiClient.Attributes.HttpGet("api/TestLog/PackingWeigh/{id}")] + ITask> GetPackingWeigh(string id); #endregion @@ -1966,7 +1967,7 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/WipInfos/GetData4PTD003")] ITask> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd); - + [WebApiClient.Attributes.HttpGet("api/WipInfos/GetCustomer/{recordNumber}")] ITask GetCustomer(string recordNumber); #endregion diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs index d206db3c..bda4eead 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs @@ -21,6 +21,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS Outfits = new List(); nGInfoDtos = new List(); testLogs = new List(); + packingWeighs = new List(); } /// @@ -101,6 +102,13 @@ namespace AMESCoreStudio.Web.ViewModels.PCS get; set; } + /// + /// 包裝秤重 + /// + public List packingWeighs + { + get; set; + } } /// @@ -319,4 +327,35 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// public string FilePath { get; set; } } + + /// + /// 包裝秤重 + /// + public class PackingWeigh + { + /// + /// 重量 + /// + public string Weight { get; set; } + + /// + /// 結果 + /// + public string Result { get; set; } + + /// + /// 測試時間 RECORD_TIME + /// + public string Record_Time { get; set; } + + /// + /// 檔案名稱 + /// + public string FileName { get; set; } + + /// + /// 檔案路徑 + /// + public string FilePath { get; set; } + } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index 052d4858..cbb14c86 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -280,6 +280,60 @@ } + @if (Model.packingWeighs.Count != 0) + { +
+
+ 包裝秤重 +
+ + + + + + + + + + + @foreach (var index in Model.packingWeighs) + { + + + + + + + } + +
+ 結果 + + 秤重時間 + + 秤重值 + + 檔案名稱 +
+ @if (index.Result == "FAIL") + { + @index.Result + } + else + { + @index.Result + } + + @index.Record_Time + + @index.Weight + + @index.FileName + @*檔案下載*@ +
+
+ } +
組件清單 diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/TestLogController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/TestLogController.cs index 788fce0f..67d051d4 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/TestLogController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/TestLogController.cs @@ -41,30 +41,13 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL _context = context; } - /// /// 查詢 TestLog /// /// 條碼 /// [HttpGet("{id}")] - public List GetTestLog(string id) - { - var query = @$" SELECT * FROM JHAMES.TEST_FUNCTION_TABLE WHERE SN=:id"; - - DynamicParameters p = new DynamicParameters(); - p.Add("id", id, DbType.String); - var q = _context.Database.DapperQuery(query, p); - return q.ToList(); - } - - /// - /// 查詢 TestLog ByMSSql - /// - /// 條碼 - /// - [HttpGet("ByMSSql/{id}")] - public async Task> GetTestLogByMSSql(string id) + public async Task> GetTestLog(string id) { var context = _config.GetConnectionString("TestLogConnection"); using (IDbConnection _TestLog_context = new SqlConnection(context)) @@ -103,5 +86,29 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL return q.ToList(); } } + + /// + /// 查詢 是否有包裝秤重 + /// + /// 出貨序號 + /// + [HttpGet("PackingWeigh/{id}")] + public async Task> GetPackingWeighing(string id) + { + var context = _config.GetConnectionString("TestLogConnection"); + using (IDbConnection _TestLog_context = new SqlConnection(context)) + { + if (_TestLog_context.State != ConnectionState.Open) + { + _TestLog_context.Open(); + } + var query = @$" SELECT * FROM TestAutomate.dbo.Packing_Weighing_View + WHERE SN =@Sn "; + DynamicParameters p = new DynamicParameters(); + p.Add("Sn", id, DbType.String); + var q = await _TestLog_context.QueryAsync(query, p); + return q.ToList(); + } + } } }