diff --git a/AMESCoreStudio.Web/Views/QRS/QRS013.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS013.cshtml index 3d28e8dc..32361899 100644 --- a/AMESCoreStudio.Web/Views/QRS/QRS013.cshtml +++ b/AMESCoreStudio.Web/Views/QRS/QRS013.cshtml @@ -42,7 +42,7 @@ table && table.reload(data); }); - var tableCols = [[ + var tableCols1 = [[ { field: 'wipNO', title: '工單號碼', @@ -97,6 +97,59 @@ }] ]; + var tableCols = [[ + { + field: 'wipno', + title: '工單號碼', + width: 120, + sort: true + }, + { + field: 'barcodeno', + width: 150, + title: '條碼' + }, + { + field: 'extrabarcodeno', + width: 150, + title: '出貨條碼' + }, + { + field: 'modelno', + width: 120, + title: '機種' + }, + { + field: 'itemno', + width: 120, + title: '料號' + }, + { + field: 'kP_01', + title: '組件01' + }, + { + field: 'kP_02', + title: '組件02' + }, + { + field: 'kP_03', + title: '組件03' + }, + { + field: 'kP_04', + title: '組件04' + }, + { + field: 'kP_95', + title: '組件95' + }, + { + field: 'kP_98', + title: '組件98' + }] + ]; + //基本数据表格 var table = hg.table.datatable('test', '工單KeyParts資料', '/QRS/QRS013A', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); diff --git a/AMESCoreStudio.Web/Views/REP/REP012.cshtml b/AMESCoreStudio.Web/Views/REP/REP012.cshtml index 58779e7f..64577c6f 100644 --- a/AMESCoreStudio.Web/Views/REP/REP012.cshtml +++ b/AMESCoreStudio.Web/Views/REP/REP012.cshtml @@ -264,10 +264,11 @@ 'oldPartNo', 'newPartNo', 'ngNo', - 'reasonDesc', + 'ngReasonDesc', 'locationNo', 'changeMaterial', - 'repairReason', + 'repairNo', + 'rmaReasonDesc', 'repairType2', 'memo', 'repairDesc', @@ -295,7 +296,7 @@ data.unshift({ unitNO: "製程單位", lineDesc: "線別", createDate: "維修時間", month: "月份", weekOfYearISO: "第幾週", stationName: "站別", wipNO: "工單號碼", planQTY: "數量", barcodeNo: "條碼", modelNO: "機種", itemNO: "料號", semiItemNo: "半成品料號", oldPartNo: "舊料號", newPartNo: "新料號", - ngNo: "不良代碼", reasonDesc: "不良描述", locationNo: "維修位置", changeMaterial: "更換零件", repairReason: "維修原因", repairType2: "維修類別", memo: "維修備註", repairDesc: "維修描述", + ngNo: "不良代碼", ngReasonDesc: "不良描述", locationNo: "維修位置", changeMaterial: "更換零件", repairNo: "維修原因", rmaReasonDesc: "維修原因描述", repairType2: "維修類別", memo: "維修備註", repairDesc: "維修描述", ngType2: "不良類別", rrDesc: "不良責任類別", userNo: "維修工號", userName: "維修人員", replyDate: "回覆時間", testDate: "測試時間", testUserNo: "測試工號", testUserName: "測試人員" , testTypeName: "測試類別", qaTypeName: "QA類別", ngReasonDescEn: "英文不良描述", partNo: "零件料號", pinNo: "腳位", reelNo: "料卷號" , dateCode: "日期碼", vendorCode: "供應商代碼", replyReason: "回覆原因" @@ -440,12 +441,24 @@ width: 120, sort: true }, + { + field: 'ngReasonDesc', + title: '不良原因描述', + width: 120, + sort: true + }, { field: 'repairNo', title: '維修代碼', width: 120, sort: true }, + { + field: 'rmaReasonDesc', + title: '維修原因描述', + width: 120, + sort: true + }, { field: 'locationNo', title: '維修位置', diff --git a/AMESCoreStudio.Web/Views/SYS/SYS001.cshtml b/AMESCoreStudio.Web/Views/SYS/SYS001.cshtml index fba6557d..4aae18e0 100644 --- a/AMESCoreStudio.Web/Views/SYS/SYS001.cshtml +++ b/AMESCoreStudio.Web/Views/SYS/SYS001.cshtml @@ -51,6 +51,7 @@ field: 'sortSeq', title: '排序', width: 160, + //totalRow: true, sort: true }, { @@ -105,6 +106,10 @@ } }]; //基本数据表格 + + //最后一个参数true表示产生合计行 + //var table = hg.table.datatable('test', '系統資料管理', '/SYS/GetSystemInfoes', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports'], true); + var table = hg.table.datatable('test', '系統資料管理', '/SYS/GetSystemInfoes', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); } \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs index cf2392bc..ae1581e6 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/NgRepairsController.cs @@ -272,7 +272,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q2.TypeNo, q2.StationId, q1.RepairNo, - q2.ReasonNo + q2.ReasonNo, + qa.NGReasonDesc, + qg.RMAReasonDesc }; if (productType != "*") diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index b9bb2f0e..211ac5b7 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -8,6 +8,9 @@ using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.WebApi.DTO.AMES; using AMESCoreStudio.CommonTools.Result; +using System.Data.Common; +using System.Data; +using System.Dynamic; namespace AMESCoreStudio.WebApi.Controllers.AMES { @@ -221,6 +224,42 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// + /// + /// + /// + public static DataTable DataReaderToDataTable(DbDataReader reader) + { + try + { + DataTable dt = new DataTable(); + int fieldCount = reader.FieldCount; + for (int fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex) + { + dt.Columns.Add(reader.GetName(fieldIndex), reader.GetFieldType(fieldIndex)); + } + + dt.BeginLoadData(); + + object[] rowValues = new object[fieldCount]; + while (reader.Read()) + { + reader.GetValues(rowValues); + dt.LoadDataRow(rowValues, true); + } + reader.Close(); + dt.EndLoadData(); + + return dt; + + } + catch (Exception ex) + { + throw new Exception("DataReader Convert DataTable Error!", ex); + } + } + /// /// 查詢工單KeyParts資料QRS013 /// @@ -236,6 +275,94 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES ResultModel result = new ResultModel(); Helper helper = new Helper(_context); + var wip_kp = await _context.WipKps.FromSqlRaw("SELECT * FROM JHAMES.WIP_KP WHERE WIP_NO = '" + wipNO + "' ORDER BY KP_NO").ToListAsync(); + + string sql = @" select c.wip_no as WipNo,b.barcode_no as BarcodeNo,b.extra_barcode_no as ExtraBarcodeNo,d.model_no as ModelNO,d.item_no as ItemNO"; + string sql1 = "", sql2 = "", sql3 = ""; + if (wip_kp.Count > 0) + { + for (int i = 0; i < wip_kp.Count; i++) + { + sql1 = sql1 + ",k" + (i + 1).ToString() + ".part_no as KP_" + wip_kp[i].KpNo; + sql2 = sql2 + ",(select barcode_id,part_no from jhames.barcode_item where item_no = '" + wip_kp[i].KpNo + "') k" + (i + 1).ToString(); + sql3 = sql3 + " and b.barcode_id = k" + (i + 1).ToString() + ".barcode_id"; + } + } + + sql = sql + sql1; + sql = sql + " from jhames.barcode_info b,jhames.wip_info c,jhames.wip_att d"; + sql = sql + sql2; + + sql = sql + " where b.wip_id = c.wip_id and c.wip_no = d.wip_no"; + + sql = sql + sql3; + + sql = sql + " and c.wip_no = '" + wipNO + "'"; + + string tempName = string.Empty; + DbConnection conn = _context.Database.GetDbConnection(); + if (conn.State != System.Data.ConnectionState.Open) + { + await conn.OpenAsync(); + } + + using (var cmd = conn.CreateCommand()) + { + cmd.CommandText = sql; + + using (var reader = await cmd.ExecuteReaderAsync()) + { + if (reader.HasRows) + { + List list = new List(); + DataTable table = new DataTable(); + + table = DataReaderToDataTable(reader); + + foreach (DataRow row in table.Rows) + { + dynamic dyn = new ExpandoObject(); + list.Add(dyn); + foreach (DataColumn column in table.Columns) + { + var dic = (IDictionary)dyn; + dic[column.ColumnName] = row[column]; + } + } + + 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; + } + + /// + /// 查詢工單KeyParts資料QRS013 + /// + /// + /// + /// + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetWipInfo4QRS013Old(string wipNO, string factoryNo, int page, int limit) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + var q = from q1 in _context.WipInfos join q2 in _context.BarcodeInfoes on q1.WipID equals q2.WipID join q3 in _context.BarcodeItems on q2.BarcodeID equals q3.BarcodeID into item_data