From 77a863a3517cab99c64729dfe05a9c5bcf6d5661 Mon Sep 17 00:00:00 2001 From: Sai Date: Sun, 19 May 2024 21:18:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=81=8E=E7=AB=99=E5=8E=BB=E5=89=8D?= =?UTF-8?q?=E5=BE=8C=E7=A9=BA=E7=99=BD=202.=20=E9=81=8E=E7=AB=99=E5=88=A4?= =?UTF-8?q?=E6=96=B7=E6=B5=81=E7=A8=8B=EF=BC=8C=E9=83=A8=E5=88=86=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=B7=A5=E5=96=AE=E8=99=9F=E7=A2=BC=203.=20PTD=20?= =?UTF-8?q?=E6=89=A3=E5=B8=B3=E4=BD=9C=E6=A5=AD=E5=8F=8A=E4=B8=80=E6=AE=B5?= =?UTF-8?q?=E5=BC=8F=20RecordDate=20=E6=94=B9=E5=8A=A0=E5=85=A5=E6=99=82?= =?UTF-8?q?=E9=96=93=20=20=20=20=20=20=20=20=E6=9F=A5=E8=A9=A2=E4=BD=9C?= =?UTF-8?q?=E6=A5=AD=E5=8A=A0=E5=85=A5=E5=B8=B3=E8=99=9F=E5=88=A4=E6=96=B7?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA=E6=99=82=E5=8D=80=EF=BC=8C=E6=9F=A5=E8=A9=A2?= =?UTF-8?q?=E6=AC=84=E4=BD=8D=E5=A4=9A=E9=A1=AF=E7=A4=BA=E6=99=82=E9=96=93?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=E6=9F=A5=E8=A9=A2=E9=A0=81=E6=95=B8?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=204.=20=E5=B7=A5=E5=96=AE=E6=95=88=E7=8E=87?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA=20=E4=B8=AD=E5=8D=88=E4=BC=91=E6=81=AF?= =?UTF-8?q?=E6=99=82=E9=96=93=E6=94=B9=E6=89=A350=E5=88=86=E9=90=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 23 +- .../Controllers/PTDController.cs | 10 +- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 2 +- AMESCoreStudio.Web/Views/PTD/PTD002Old.cshtml | 665 +++++++++++++++++ AMESCoreStudio.Web/Views/PTD/PTD003.cshtml | 8 +- AMESCoreStudio.Web/Views/PTD/PTD006.cshtml | 8 +- AMESCoreStudio.Web/Views/PTD/PTD006Old.cshtml | 690 ++++++++++++++++++ .../Controllers/AMES/WipInfosController.cs | 193 ++++- .../BLL/BarCodeCheckNewController.cs | 2 +- .../Controllers/BLL/RPTController.cs | 8 +- 10 files changed, 1542 insertions(+), 67 deletions(-) create mode 100644 AMESCoreStudio.Web/Views/PTD/PTD002Old.cshtml create mode 100644 AMESCoreStudio.Web/Views/PTD/PTD006Old.cshtml diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c4f4a77e..8f85e6d7 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -6316,11 +6316,12 @@ namespace AMESCoreStudio.Web.Controllers // ResultModel string Msg = string.Empty; bool Success = true; + var input = model.Input.Trim().ToUpper(); + string Data = input; - if (string.IsNullOrWhiteSpace(model.Input)) + if (string.IsNullOrWhiteSpace(input)) return Json(new Result1() { success = Success, msg = Msg, data = "", data1 = "" }); - string Data = model.Input.ToUpper(); // 刷入條碼+異常欄位 if (!string.IsNullOrWhiteSpace(model.InputNo)) Data += "@" + model.InputNo; @@ -6340,7 +6341,7 @@ namespace AMESCoreStudio.Web.Controllers Msg += "請選擇作業站
"; } - if (string.IsNullOrWhiteSpace(model.Input)) + if (string.IsNullOrWhiteSpace(input)) { Msg += "請刷讀條碼
"; } @@ -6352,7 +6353,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - var q = await _pcsApi.CheckBarCodeByWipNo(model.Input, model.WipNO.Trim().ToUpper()); + var q = await _pcsApi.CheckBarCodeByWipNo(input, model.WipNO.Trim().ToUpper()); // 判斷是否序號與工單號碼是否對應條碼區間值,沒對應到視為組件或不良代碼 if (q.Success) { @@ -6395,7 +6396,7 @@ namespace AMESCoreStudio.Web.Controllers var keyParts = new List(); // 先查詢已綁定組件數量 By WipID - var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCode(model.Input); + var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCode(input); BarCodeItems = BarCodeItems.Where(w => w.S.UnitNo == stationUnit && w.WipID == model.WipID).ToList(); // WipKps - BarCodeItem 剩下未綁定的KpNo @@ -6497,7 +6498,7 @@ namespace AMESCoreStudio.Web.Controllers var x = new BarCodeCheckDto { wipNo = model.WipNO, - barcode = model.Input, + barcode = input, barcodeType = "M", stationID = model.Station, line = model.LineID, @@ -6509,7 +6510,7 @@ namespace AMESCoreStudio.Web.Controllers var barcode_result = await _pcsApi.PassIngByCheck(JsonConvert.SerializeObject(x)); if (!barcode_result.Success) - return Json(new Result() { success = barcode_result.Success, msg = barcode_result.Msg, data = Data }); + return Json(new Result() { success = barcode_result.Success, msg = barcode_result.Msg, data = input }); // 過站判斷成功 else { @@ -6524,20 +6525,20 @@ namespace AMESCoreStudio.Web.Controllers var items = await _pcsApi.GetItems(); items = items.Where(w => model.WipKps.Any(wi => wi.KpNo.Trim().ToUpper() == w.ItemNo.Trim().ToUpper())).ToList(); // 判斷Input為指定KeyParts順序 - if (items.Any(a => a.ItemName.ToUpper() == Data.ToUpper())) + if (items.Any(a => a.ItemName.ToUpper() == input)) { if (model.KpItemName != null) { // 取得目前Input指定KP代碼的綁定數量 - var KpItemNameByCount = model.KpItemName.Split(",").Where(w => w.ToUpper() == Data.ToUpper()).Count(); + var KpItemNameByCount = model.KpItemName.Split(",").Where(w => w.ToUpper() == input).Count(); // WipKp的ByKpNo數量 - var WipKpByCount = model.WipKps.Where(w1 => w1.KpNo == items.Where(w => w.ItemName.ToUpper() == Data.ToUpper()) + var WipKpByCount = model.WipKps.Where(w1 => w1.KpNo == items.Where(w => w.ItemName.ToUpper() == input) .Select(s => s.ItemNo).FirstOrDefault()).Count(); // 目前綁定KpNo 等於 WipKp ByKpNo 數量 if (KpItemNameByCount == WipKpByCount) { Success = false; - Msg = $"指定KeyParts:{Data} 已超過資料設定數量
"; + Msg = $"指定KeyParts:{input} 已超過資料設定數量
"; return Json(new Result() { success = Success, msg = Msg, data = Data }); } } diff --git a/AMESCoreStudio.Web/Controllers/PTDController.cs b/AMESCoreStudio.Web/Controllers/PTDController.cs index f5a02db0..25939bdb 100644 --- a/AMESCoreStudio.Web/Controllers/PTDController.cs +++ b/AMESCoreStudio.Web/Controllers/PTDController.cs @@ -264,7 +264,7 @@ namespace AMESCoreStudio.Web.Controllers } List RecordTypes = await _pcsApi.GetRecordTypeInfo(); - var allRecordType = new[] { "653", "632", "261", "101R", "201", "202", "291", "292", "601", "601DB", "657" }; + var allRecordType = new[] { "653", "632", "261", "262", "101R", "201", "202", "291", "292", "601", "601DB", "657", "952", "634" }; var filtered = from o in RecordTypes where allRecordType.Contains(o.ID) select o; @@ -353,14 +353,14 @@ namespace AMESCoreStudio.Web.Controllers return View(); } - public async Task PTD003QueryAsync(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, int autoLoad = 0) + public async Task PTD003QueryAsync(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, int autoLoad = 0 , string RBU = null) { //if (recordNumber == null || recordNumber == "") // return Json(new Table() { count = 0, data = null }); if (autoLoad == 0) return Json(new Table() { count = 0, data = null }); - var result = await _pcsApi.GetData4PTD003(recordType, recordNumber, lineNo, materialNo, shippingSN, dateStart, dateEnd); + var result = await _pcsApi.GetData4PTD003(recordType, recordNumber, lineNo, materialNo, shippingSN, dateStart, dateEnd, RBU); if (result.DataTotal > 0) { return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); @@ -591,12 +591,12 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.RecordDate = System.DateTime.Now.ToString("yyyy/MM/dd"); return View(); } - public async Task PTD006QueryAsync(string recordNumber, string? LineNO) + public async Task PTD006QueryAsync(string recordNumber, string lineNo = null) { if (recordNumber == null || recordNumber == "") return Json(new Table() { count = 0, data = null }); - var result = await _pcsApi.GetZWHPickListDetail(recordNumber, LineNO); + var result = await _pcsApi.GetZWHPickListDetail(recordNumber, lineNo); if (result.DataTotal > 0) { return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 4585fcf3..ece2aaf0 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -1993,7 +1993,7 @@ namespace AMESCoreStudio.Web ITask> GetRecordTypes(); [WebApiClient.Attributes.HttpGet("api/WipInfos/GetData4PTD003")] - ITask> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd); + ITask> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd ,string RBU); [WebApiClient.Attributes.HttpGet("api/WipInfos/GetCustomer/{recordNumber}")] ITask GetCustomer(string recordNumber); diff --git a/AMESCoreStudio.Web/Views/PTD/PTD002Old.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD002Old.cshtml new file mode 100644 index 00000000..83ffe1cb --- /dev/null +++ b/AMESCoreStudio.Web/Views/PTD/PTD002Old.cshtml @@ -0,0 +1,665 @@ +@{ + ViewData["Title"] = "一段式入出庫作業"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+ + + +
+ +
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+ +
+ + +
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +@section Scripts{ + + + +} diff --git a/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml index d81e4b50..361979bd 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml @@ -231,13 +231,11 @@ var tableCols = [[ { field: 'recordTypeID', - width: 120, title: 'RecordType', sort: true }, { field: 'recordNumber', - width: 160, title: 'RecordNumber', sort: true }, @@ -249,7 +247,6 @@ }, { field: 'sn', - width: 160, title: 'SN', sort: true }, @@ -280,15 +277,14 @@ { field: 'recordDate', title: 'RecordDate', - width: 120, - templet: '
{{ layui.util.toDateString(d.recordDate, "yyyy/MM/dd") }}
' + templet: '
{{ layui.util.toDateString(d.recordDate, "yyyy/MM/dd HH:mm:ss") }}
' }] ]; //var param = productTypeNo.value + '_' + testTypeNo.value + '_' + unitNo.value + '_' + lineID.value + '_' + stationID.value + '_' + wipNO.value + '_' + itemNO.value + '_' + dateStart.value + '_' + dateEnd.value; //基本数据表格 - var table = hg.table.datatable('query', '作業查詢', '/PTD/PTD003Query', { recordType: $("#recordType").val() }, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + var table = hg.table.datatable('query', '作業查詢', '/PTD/PTD003Query', { recordType: $("#recordType").val() }, tableCols, toolbar, false, 'full-100', ['filter', 'print', 'exports']); } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml index 30ab94c3..0f88bbab 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml @@ -64,11 +64,11 @@
- +
- +
@@ -535,7 +535,7 @@ if (res.success) { // 重新加载表格数据 layui.table.reload('query', { - data: tableData, + data: rowData, page: false, limit: 2000 }); @@ -543,7 +543,7 @@ calculateRowCount(tableData); } else { - hg.msg('備貨失敗,原因:' + result.data.msg); + hg.msg('備貨失敗,原因:' + res.msg); } } , diff --git a/AMESCoreStudio.Web/Views/PTD/PTD006Old.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD006Old.cshtml new file mode 100644 index 00000000..30ab94c3 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PTD/PTD006Old.cshtml @@ -0,0 +1,690 @@ +@{ + ViewData["Title"] = "備貨作業"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+ + + +
+ +
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+ +
+ + +
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+ +@section Scripts{ + + + +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index a1383484..303ff7e1 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -182,7 +182,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// [Route("[action]")] [HttpGet] - public async Task> GetWipInfo4QRS011(string unitNo, string itemNO, string wipNO , string wipStatus = "A") + public async Task> GetWipInfo4QRS011(string unitNo, string itemNO, string wipNO, string wipStatus = "A") { ResultModel result = new ResultModel(); var q = from q1 in _context.WipInfos @@ -205,7 +205,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q4.UnitName }; - + q = q.Where(w => w.StatusNO == wipStatus); if (unitNo != "*") { @@ -514,7 +514,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); bool createMacCol = true; - + //part_no = "91000237320038"; string mac_sql = string.Format(@"select distinct a.工單編號 as mo_id,e.客戶工單編號 as customer_moid,a.工單序號 as product_sn, @@ -594,7 +594,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } } - catch(Exception e1) + catch (Exception e1) { string err = e1.Message; } @@ -976,7 +976,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S if (!findFlag) { string mac_sql2 = string.Format("select a.part_no from jhames.barcode_item a,jhames.barcode_info b where a.barcode_id = b.barcode_id and b.barcode_no = '{0}' and item_no like 'MAC%'", part_no); - + using (var esun_cmd = conn.CreateCommand()) { esun_cmd.CommandText = mac_sql2; @@ -1825,7 +1825,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S q = q.Where(w => w.CompleteQTY > 0); q = q.Where(w => w.UnitNO == "B" && w.CustomerMedical == "N"); - + if (werksNo != "*") { q = q.Where(w => w.WerksNO == werksNo); @@ -2316,7 +2316,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S // 委外廠編號抓WERKS廠別代碼 var q = _context.FactoryInfos.Where(w => w.FactoryID.ToString() == WipInfo.Werks).ToList(); - if (q.Count() !=0) + if (q.Count() != 0) { WipInfo.WerksNO = q.FirstOrDefault().FactoryNo; } @@ -2454,7 +2454,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S ResultModel result = new ResultModel(); var wipinfos = await _context.WipInfos.Where(w => w.WipID == id).FirstOrDefaultAsync(); - var WiwipinfoByWipNo= await _context.WipInfos.Where(w => w.WipNO == wipinfos.WipNO).ToListAsync(); + var WiwipinfoByWipNo = await _context.WipInfos.Where(w => w.WipNO == wipinfos.WipNO).ToListAsync(); _context.WipInfos.RemoveRange(wipinfos); var wipBarcode = await _context.WipBarcodes.Where(w => w.WipNO == wipinfos.WipNO && w.UnitNO == wipinfos.UnitNO).ToListAsync(); @@ -2590,7 +2590,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S /// [Route("[action]")] [HttpGet] - public async Task> GetDNInfo4PTD001(string dnNo,string lineNo) + public async Task> GetDNInfo4PTD001(string dnNo, string lineNo) { ResultModel result = new ResultModel(); @@ -2670,7 +2670,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S } } } - catch (Exception e) + catch (Exception e) { Console.WriteLine(e.Message); } @@ -2678,7 +2678,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S string strbarcode_id = "''"; foreach (DataRow drbarcode in dtBarcode.Rows) { - if (!string.IsNullOrEmpty(drbarcode["BARCODE_ID"].ToString())) + if (!string.IsNullOrEmpty(drbarcode["BARCODE_ID"].ToString())) strbarcode_id += $",{drbarcode["BARCODE_ID"]}"; } @@ -2686,7 +2686,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S string kp_sql = @"select kp_no, max(kp_qty) kp_qty from( select item_no as kp_no,count(item_no) kp_qty,barcode_id from jhames.barcode_item where barcode_id in (" + strbarcode_id + ") group by item_no,barcode_id) a group by kp_no order by kp_no"; - + using (var cmd = conn.CreateCommand()) { cmd.CommandText = kp_sql; @@ -2965,9 +2965,9 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); //dtBarcode.Columns["ExtraBarcodeNo"].ColumnName = "出貨料號"; //dtBarcode.Columns["BarcodeNo"].ColumnName = "生產序號"; dtBarcode.AcceptChanges(); - } + } - List list = new List(); + List list = new List(); foreach (DataRow row in dtBarcode.Rows) { dynamic dyn = new ExpandoObject(); @@ -3014,6 +3014,9 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); try { + // RecordDate 加入目前時間 + Data.RecordDate += $" {DateTime.Now:HH:mm:ss}"; + string strSQL = ""; string strRecordType = Data.RecordType; string strRmaNo = Data.RmaNo; @@ -3022,7 +3025,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); string strRecordDate = TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse(Data.RecordDate)).ToString("yyyy-MM-dd HH:mm:ss"); string strLocation = Data.Location; string strCustomer = Data.Customer; - string strCreateDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); + string strCreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string strMaterial = ""; string strMailBodyHtml = ""; @@ -3268,7 +3271,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); { cmd.CommandText = strSQL; - using (var reader = cmd.ExecuteReader()) + using (var reader = cmd.ExecuteReader()) { if (reader.HasRows) { @@ -3283,7 +3286,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); using (var cmd = connPTD.CreateCommand()) { cmd.CommandText = strSQL; - using (var reader = cmd.ExecuteReader()) + using (var reader = cmd.ExecuteReader()) { if (reader.Read()) { @@ -3448,7 +3451,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); { await connPTD.OpenAsync(); } - try + try { 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"; @@ -3470,16 +3473,17 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); foreach (DataRow row in dtRecordTypes.Rows) { list.Add(new RecordTypeInfo - { ID = Convert.ToString(row["RecordTypeID"]), + { + ID = Convert.ToString(row["RecordTypeID"]), TypeName = Convert.ToString(row["TypeName"]) }); } return list; } - catch (Exception e) - { - throw e; + catch (Exception e) + { + throw e; } finally { @@ -3493,7 +3497,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); [Route("[action]")] [HttpGet] - public async Task> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd) + public async Task> GetData4PTD003_Old(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd) { ResultModel result = new ResultModel(); //安勤連線 @@ -3546,7 +3550,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); result.Success = false; return result; } - strSQL += $" And a.RecordDate Between '{dateStart.Replace("/","-") + " 00:00:00"}' And '{dateEnd.Replace("/", "-") + " 23:59:59"}'"; + strSQL += $" And a.RecordDate Between '{dateStart.Replace("/", "-") + " 00:00:00"}' And '{dateEnd.Replace("/", "-") + " 23:59:59"}'"; } //排序:ZProductTrans.CreateDate DESC @@ -3606,6 +3610,122 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } } + [Route("[action]")] + [HttpGet] + public async Task> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, string RBU) + { + ResultModel result = new ResultModel(); + //安勤連線 + PTDContext _ptd_context = new PTDContext(); + DbConnection connPTD = _ptd_context.Database.GetDbConnection(); + if (connPTD.State != ConnectionState.Open) + { + await connPTD.OpenAsync(); + } + + try + { + string strSQL = $@"SELECT a.RecordTypeID ,a.RecordNumber ,a.RCLineNO 'LineNo', + a.SerialNumber 'SN',a.ProductID ,a.EmplID 'Customer',a.LocationID 'Location', + a.CreatorID , a.RecordDate + FROM SFIS_PTD.dbo.ZProductTrans a where 1=1 "; + if (recordType != null && recordType != "" && recordType != "全部") + { + strSQL += $" And a.RecordTypeID ='{recordType}'"; + } + + if (recordNumber != null && recordNumber != "") + { + strSQL += $" And a.RecordNumber ='{recordNumber}'"; + } + + if (lineNo != null && lineNo != "") + { + strSQL += $" And a.RCLineNO ='{lineNo}'"; + } + + if (materialNo != null && materialNo != "") + { + strSQL += $" And a.ProductID like '{materialNo}%'"; + } + + if (shippingSN != null && shippingSN != "") + { + strSQL += $" And a.SerialNumber like '{shippingSN}%'"; + } + + if (dateStart != null && dateEnd != null) + { + if (DateTime.Parse(dateStart) > DateTime.Parse(dateEnd)) + { + result.Msg = "起 不可大於 迄!"; + result.Success = false; + return result; + } + strSQL += $" And a.RecordDate Between '{dateStart.Replace("/", "-") + " 00:00:00"}' And '{dateEnd.Replace("/", "-") + " 23:59:59"}'"; + } + + //排序:ZProductTrans.CreateDate DESC + strSQL += " Order by a.RecordDate DESC"; + + DataTable dtZProductTrans = new DataTable(); + using (var cmd = connPTD.CreateCommand()) + { + cmd.CommandText = strSQL; + + using (var reader = await cmd.ExecuteReaderAsync()) + { + if (reader.HasRows) + { + dtZProductTrans = DataReaderToDataTable(reader); + } + } + } + + List list = new List(); + foreach (DataRow row in dtZProductTrans.Rows) + { + dynamic dyn = new ExpandoObject(); + list.Add(dyn); + foreach (DataColumn column in dtZProductTrans.Columns) + { + var dic = (IDictionary)dyn; + dic[column.ColumnName] = row[column]; + } + } + + // EV01 RecordDate 要改成GMT時區(台灣+8小時) + if (RBU == "EV01") + list.ToList().ForEach(s => s.RecordDate = DateTime.Parse(s.RecordDate).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss")); + + result.DataTotal = list.Count(); + result.Data = list; + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + catch (Exception e) + { + throw e; + } + finally + { + if (connPTD.State == ConnectionState.Open) + { + connPTD.Close(); + connPTD.Dispose(); + } + } + } + [HttpGet("GetCustomer/{recordNumber}")] public async Task GetCustomer(string recordNumber) { @@ -3666,7 +3786,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } try { - string strSQL = $@"select * from SFIS_PTD.dbo.RecordTypeInfo"; + string strSQL = $@"select * from SFIS_PTD.dbo.RecordTypeInfo"; DataTable dtRecordTypeInfo = new DataTable(); using (var cmd = connPTD.CreateCommand()) @@ -3792,8 +3912,8 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); using (var cmd = connPTD.CreateCommand()) { cmd.CommandText = strSQL; - cmd.ExecuteNonQuery(); - } + cmd.ExecuteNonQuery(); + } result.Success = true; result.Msg = "OK"; } @@ -3979,7 +4099,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } try { - + string strSQL = $@"select * from SFIS_PTD.dbo.CustomerItemMailGroup Where 1=1"; if (id != null && id != "") { @@ -4169,10 +4289,10 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); #region "PTD006 備貨作業" [Route("[action]")] [HttpGet] - public async Task> GetZWHPickListDetail(string recordNumber,string? LineNO) + public async Task> GetZWHPickListDetail(string recordNumber, string? LineNO) { ResultModel result = new ResultModel(); - + //安勤連線 PTDContext _ptd_context = new PTDContext(); DbConnection connPTD = _ptd_context.Database.GetDbConnection(); @@ -4492,12 +4612,15 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); } try { + // RecordDate 加入目前時間 + Data.RecordDate += $" {DateTime.Now:HH:mm:ss}"; + string strSQL = ""; string strRecordType = Data.RecordType; string strRbu = Data.Rbu; string strWorkCenter = Data.WorkCenter; - string strRecordDate = TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse(Data.RecordDate)).ToString("yyyy-MM-dd HH:mm:ss"); ; - string strCreateDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); + string strRecordDate = TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse(Data.RecordDate)).ToString("yyyy-MM-dd HH:mm:ss"); + string strCreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (PTD007TableDataModel SNData in Data.TableData) { @@ -4532,7 +4655,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); int seed = Convert.ToInt32(reader["Seed"]); int nIdx = seed + 1; strLatest = row["ShipmentSN"].ToString() + nIdx.ToString().PadLeft(4, '0');//組成HistoryID - //HistoryKeyDefine + //HistoryKeyDefine strSQL = @$"UPDATE [SFIS_PTD].[dbo].[ZHistoryKeyDefine] SET [Seed] = {nIdx} where [SerialNumber]='{row["ShipmentSN"]}'"; colSQL.Add(strSQL); @@ -4545,7 +4668,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); else { strLatest = row["ShipmentSN"].ToString() + 1.ToString().PadLeft(4, '0');//組成HistoryID - //ZHistoryKeyDefine + //ZHistoryKeyDefine strSQL = @$"INSERT INTO [SFIS_PTD].[dbo].[ZHistoryKeyDefine] ([SerialNumber],[Seed]) VALUES ('{row["ShipmentSN"]}',1)"; colSQL.Add(strSQL); @@ -4634,7 +4757,7 @@ and b.item_no = '{0}' and a.barcode_no = '{1}'", kp_no, barcode_no); #region "PTD008 還原作業" [Route("[action]")] [HttpGet] - public async Task> GetData4PTD008( string recordNumber, string lineNo, string materialNo, string shippingSN) + public async Task> GetData4PTD008(string recordNumber, string lineNo, string materialNo, string shippingSN) { //安勤連線 PTDContext _ptd_context = new PTDContext(); diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs index 530f4ce1..0d7b5cbe 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs @@ -1514,7 +1514,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES #region 判斷作業站順序 // 判斷序號目前是否有重複過站 - var BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BarcodeID == barCode && w.StationID == stationID).FirstOrDefaultAsync(); + var BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BarcodeID == barCode && w.StationID == stationID && w.WipID == wipId).FirstOrDefaultAsync(); if (BarcodeInfo != null) { resultModel.Msg = $"該內部序號【{barCodeNo}】已刷過此站"; diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs index 4698973c..74c3f74a 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs @@ -2172,9 +2172,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL item.station_Id == "1099" ? "包裝" : ""; - // 中午休息時間 12:00 ~ 13:00 + // 中午休息時間 12:00 ~ 12:50 if (str.TimeOfDay < TimeSpan.Parse("12:10:00") && TimeSpan.Parse("12:20:00") < end.TimeOfDay) - item.restTime += 60; + item.restTime += 50; // 早上休息時間 10:00 ~ 10:10 if (str.TimeOfDay < TimeSpan.Parse("10:02:00") && TimeSpan.Parse("10:04:00") < end.TimeOfDay) @@ -2196,9 +2196,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL TimeSpan exceptionTs = exceptionEnd.Subtract(exceptionStr); item.abnormalTime = (double)Math.Abs(Math.Round(exceptionTs.TotalMinutes, 2)); - // 中午休息時間 12:00 ~ 13:00 + // 中午休息時間 12:00 ~ 12:50 if (exceptionStr.TimeOfDay < TimeSpan.Parse("12:10:00") && TimeSpan.Parse("12:20:00") < exceptionEnd.TimeOfDay) - item.abnormalTime += 60; + item.abnormalTime += 50; // 早上休息時間 10:00 ~ 10:10 if (exceptionStr.TimeOfDay < TimeSpan.Parse("10:02:00") && TimeSpan.Parse("10:04:00") < exceptionEnd.TimeOfDay)