From 42f93b6dd2af09af8d71809593469b6e277ea030 Mon Sep 17 00:00:00 2001 From: "vick_wang419@hotmail.com.tw" Date: Sat, 20 Jan 2024 23:57:28 +0800 Subject: [PATCH] =?UTF-8?q?PTD003=20=E4=BD=9C=E6=A5=AD=E6=9F=A5=E8=A9=A2?= =?UTF-8?q?=20=E5=84=AA=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Controllers/PTDController.cs | 7 ++++--- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 2 +- .../Controllers/AMES/WipInfosController.cs | 17 ++++++++++++----- .../Models/AMES/PTD101AMESModel.cs | 10 +++++----- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PTDController.cs b/AMESCoreStudio.Web/Controllers/PTDController.cs index 7b321f13..f0710944 100644 --- a/AMESCoreStudio.Web/Controllers/PTDController.cs +++ b/AMESCoreStudio.Web/Controllers/PTDController.cs @@ -331,13 +331,14 @@ namespace AMESCoreStudio.Web.Controllers } } - List RecordTypes = await _pcsApi.GetRecordTypes(); + List RecordTypes = await _pcsApi.GetRecordTypes(); var SelectListItem = new List(); - foreach (String RecordTypeID in RecordTypes) + SelectListItem.Add(new SelectListItem("全部", "全部")); + foreach (WebApi.Models.AMES.RecordTypeInfo RecordType in RecordTypes) { - SelectListItem.Add(new SelectListItem(RecordTypeID, RecordTypeID)); + SelectListItem.Add(new SelectListItem(RecordType.ID.ToString() + "-" + RecordType.TypeName, RecordType.ID.ToString())); } ViewBag.RecordType = SelectListItem; ViewBag.StartDate = System.DateTime.Now.AddDays(-7).ToString("yyyy/MM/dd"); diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index a61658cf..5246f8ae 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1962,7 +1962,7 @@ namespace AMESCoreStudio.Web #region "PTD003 作業查詢" [WebApiClient.Attributes.HttpGet("api/WipInfos/GetRecordTypes")] - ITask> GetRecordTypes(); + ITask> GetRecordTypes(); [WebApiClient.Attributes.HttpGet("api/WipInfos/GetData4PTD003")] ITask> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd); diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index 9174d081..734daea2 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -3391,7 +3391,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); #region "PTD003 作業查詢" [Route("[action]")] [HttpGet] - public async Task> GetRecordTypes() + public async Task> GetRecordTypes() { try { @@ -3402,7 +3402,8 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); { await connPTD.OpenAsync(); } - string strSQL = $@"select RecordTypeID from SFIS_PTD.dbo.ZProductTrans group by RecordTypeID"; + string strSQL = $@"select a.RecordTypeID,(select TypeName from SFIS_PTD.dbo.RecordTypeInfo where ID = a.RecordTypeID ) as TypeName + from SFIS_PTD.dbo.ZProductTrans a group by a.RecordTypeID"; DataTable dtRecordTypes = new DataTable(); using (var cmd = connPTD.CreateCommand()) { @@ -3417,10 +3418,13 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } } - List list = new List(); + List list = new List(); foreach (DataRow row in dtRecordTypes.Rows) { - list.Add(row["RecordTypeID"].ToString()); + list.Add(new RecordTypeInfo + { ID = Convert.ToString(row["RecordTypeID"]), + TypeName = Convert.ToString(row["TypeName"]) + }); } return list; @@ -3449,7 +3453,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); a.SerialNumber 'SN',a.ProductID ,b.SoldCustomerID 'Customer',a.LocationID 'Location', a.CreatorID ,a.CreateDate FROM SFIS_PTD.dbo.ZProductTrans a join SFIS_PTD.dbo.ZDNDetail b on (a.RecordNumber = b.DNNO and a.RCLineNO = b.DNLineNO) where 1=1 "; - if (recordType != null && recordType != "") + if (recordType != null && recordType != "" && recordType != "全部") { strSQL += $" And a.RecordTypeID ='{recordType}'"; } @@ -3485,6 +3489,9 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); strSQL += $" And a.CreateDate Between '{dateStart}' And '{dateEnd}'"; } + //排序:ZProductTrans.CreateDate DESC + strSQL += " Order by a.CreateDate DESC"; + DataTable dtZProductTrans = new DataTable(); using (var cmd = connPTD.CreateCommand()) { diff --git a/AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs b/AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs index 41153c3e..c0bae964 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs @@ -89,12 +89,12 @@ namespace AMESCoreStudio.WebApi.Models.AMES public class RecordTypeInfo { public int Mode { get; set; } = 0; - public string RBU { get; set; } + public string? RBU { get; set; } public string ID { get; set; } - public string TypeName { get; set; } - public string TypeDesc { get; set; } - public string Source { get; set; } - public string PrefixCode { get; set; } + public string? TypeName { get; set; } + public string? TypeDesc { get; set; } + public string? Source { get; set; } + public string? PrefixCode { get; set; } public int? Length { get; set; } }