Browse Source

PTD003 作業查詢 優化

PTD
vick_wang419@hotmail.com.tw 1 year ago
parent
commit
42f93b6dd2
  1. 7
      AMESCoreStudio.Web/Controllers/PTDController.cs
  2. 2
      AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
  3. 17
      AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs
  4. 10
      AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs

7
AMESCoreStudio.Web/Controllers/PTDController.cs

@ -331,13 +331,14 @@ namespace AMESCoreStudio.Web.Controllers
} }
} }
List<string> RecordTypes = await _pcsApi.GetRecordTypes(); List<WebApi.Models.AMES.RecordTypeInfo> RecordTypes = await _pcsApi.GetRecordTypes();
var SelectListItem = new List<SelectListItem>(); var SelectListItem = new List<SelectListItem>();
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.RecordType = SelectListItem;
ViewBag.StartDate = System.DateTime.Now.AddDays(-7).ToString("yyyy/MM/dd"); ViewBag.StartDate = System.DateTime.Now.AddDays(-7).ToString("yyyy/MM/dd");

2
AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs

@ -1962,7 +1962,7 @@ namespace AMESCoreStudio.Web
#region "PTD003 作業查詢" #region "PTD003 作業查詢"
[WebApiClient.Attributes.HttpGet("api/WipInfos/GetRecordTypes")] [WebApiClient.Attributes.HttpGet("api/WipInfos/GetRecordTypes")]
ITask<List<string>> GetRecordTypes(); ITask<List<RecordTypeInfo>> GetRecordTypes();
[WebApiClient.Attributes.HttpGet("api/WipInfos/GetData4PTD003")] [WebApiClient.Attributes.HttpGet("api/WipInfos/GetData4PTD003")]
ITask<ResultModel<dynamic>> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd); ITask<ResultModel<dynamic>> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd);

17
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 作業查詢" #region "PTD003 作業查詢"
[Route("[action]")] [Route("[action]")]
[HttpGet] [HttpGet]
public async Task<List<string>> GetRecordTypes() public async Task<List<RecordTypeInfo>> GetRecordTypes()
{ {
try try
{ {
@ -3402,7 +3402,8 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no);
{ {
await connPTD.OpenAsync(); 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(); DataTable dtRecordTypes = new DataTable();
using (var cmd = connPTD.CreateCommand()) using (var cmd = connPTD.CreateCommand())
{ {
@ -3417,10 +3418,13 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no);
} }
} }
List<string> list = new List<string>(); List<RecordTypeInfo> list = new List<RecordTypeInfo>();
foreach (DataRow row in dtRecordTypes.Rows) 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; 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.SerialNumber 'SN',a.ProductID ,b.SoldCustomerID 'Customer',a.LocationID 'Location',
a.CreatorID ,a.CreateDate 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 "; 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}'"; 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}'"; strSQL += $" And a.CreateDate Between '{dateStart}' And '{dateEnd}'";
} }
//排序:ZProductTrans.CreateDate DESC
strSQL += " Order by a.CreateDate DESC";
DataTable dtZProductTrans = new DataTable(); DataTable dtZProductTrans = new DataTable();
using (var cmd = connPTD.CreateCommand()) using (var cmd = connPTD.CreateCommand())
{ {

10
AMESCoreStudio.WebApi/Models/AMES/PTD101AMESModel.cs

@ -89,12 +89,12 @@ namespace AMESCoreStudio.WebApi.Models.AMES
public class RecordTypeInfo public class RecordTypeInfo
{ {
public int Mode { get; set; } = 0; public int Mode { get; set; } = 0;
public string RBU { get; set; } public string? RBU { get; set; }
public string ID { get; set; } public string ID { get; set; }
public string TypeName { get; set; } public string? TypeName { get; set; }
public string TypeDesc { get; set; } public string? TypeDesc { get; set; }
public string Source { get; set; } public string? Source { get; set; }
public string PrefixCode { get; set; } public string? PrefixCode { get; set; }
public int? Length { get; set; } public int? Length { get; set; }
} }

Loading…
Cancel
Save