From 9568a74e3c5fc6bfbf2fa0a4e0a9e8585eaa0ff7 Mon Sep 17 00:00:00 2001 From: Marvin Date: Mon, 1 Jul 2024 16:34:04 +0800 Subject: [PATCH 01/23] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3=E7=9B=B4=E9=80=9A?= =?UTF-8?q?=E7=8E=87=E6=98=8E=E7=BB=86=E6=8E=92=E5=BA=8F&=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=9B=B4=E9=80=9A=E7=8E=87=E4=BF=9D=E7=95=992?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Controllers/QRSController.cs | 16 +++++++++++++--- .../Controllers/AMES/WipInfosController.cs | 8 ++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index d26b7135..43a219df 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -1119,13 +1119,14 @@ namespace AMESCoreStudio.Web.Controllers //2024-03-26 BB.Wang Modify 修正良率(代小平) //double sum_rate = 100.0; //int sum_idx = 1; - double sum_rate = 0.0; + double sum_rate = 100.0; int sum_idx = 0; for (int i = 0; i < ft_stations.Count; i++) { int station_id = ft_stations[i].StationID; - var wip_station = await _pcsApi.GetWipStation4QRS009Group(wip_id, station_id); + //var wip_station = await _pcsApi.GetWipStation4QRS009Group(wip_id, station_id); + var wip_station = await _pcsApi.GetBarcodeStation4QRS009Group(wip_id, station_id, param[3], param[4]); int okQty = 0, ngQty = 0, inputQty = 0; @@ -1151,6 +1152,11 @@ namespace AMESCoreStudio.Web.Controllers rate = (okQty * 1.0 / inputQty) * 100; } + if (rate > 0) + { + sum_rate = double.Parse((sum_rate * (rate / 100.0)).ToString("0.00")); + } + /* if (rate > 0) { @@ -1158,18 +1164,22 @@ namespace AMESCoreStudio.Web.Controllers } */ + /* if (rate > 0) { sum_idx = sum_idx + 1; sum_rate = sum_rate + rate; } + */ } query.SumYieldDatas.Add(new SumYieldData { WipID = int.Parse(jo["wipID"].ToString()), WipNO = jo["wipNO"].ToString(), - Yield = sum_rate / sum_idx + //Yield = sum_rate / sum_idx + //Yield = double.Parse((sum_rate / sum_idx).ToString("0.00")) + Yield = sum_rate }); } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index cf32d224..e1518347 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -1772,7 +1772,7 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S { q = q.Where(w => w.UnitNO == unitNo); } - if (werksNo != "*") + if (werksNo != "*" && werksNo != null) { q = q.Where(w => w.WerksNO == werksNo); } @@ -1807,7 +1807,11 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S //紀錄筆數 result.DataTotal = q.Distinct().ToList().Count(); - result.Data = await q.Distinct().ToListAsync(); + var data1 = await q.Distinct().ToListAsync(); + var data2 = data1.OrderByDescending(x => x.WipNO).ToList(); + + //result.Data = await q.Distinct().ToListAsync(); + result.Data = data2; if (result == null) { From 2cb64060b437478120f99cac77cd1bc712210e7b Mon Sep 17 00:00:00 2001 From: Marvin Date: Mon, 1 Jul 2024 17:37:06 +0800 Subject: [PATCH 02/23] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E7=9B=B4=E9=80=9A?= =?UTF-8?q?=E7=8E=87=EF=BC=8C=E4=BF=AE=E6=AD=A3wip=5Fstation=E6=9F=A5?= =?UTF-8?q?=E6=97=A0=E8=B5=84=E6=96=99=E7=9A=84=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AMES/WipInfosController.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs index e1518347..e1fe16c2 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipInfosController.cs @@ -1741,8 +1741,10 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S join q2 in _context.WipAtts on q1.WipNO equals q2.WipNO join q3 in _context.LineInfoes on q1.LineID equals q3.LineID join q4 in _context.FactoryUnits on q1.UnitNO equals q4.UnitNo - join q5 in _context.WipStations.Where(y => slist.Contains(y.StationID) && y.CreateDate >= DateTime.Parse(dateStart) && y.CreateDate <= DateTime.Parse(dateEnd).AddDays(1)).GroupBy(x => new { x.WipID }).Select(x => new { WipID = x.Key.WipID, CreateDate = x.Min(o => o.CreateDate) }) on q1.WipID equals q5.WipID into wip_data - from x1 in wip_data.DefaultIfEmpty() + join q5 in _context.WipStations.Where(y => slist.Contains(y.StationID) && y.CreateDate >= DateTime.Parse(dateStart) && y.CreateDate <= DateTime.Parse(dateEnd).AddDays(1)).GroupBy(x => new { x.WipID }).Select(x => new { WipID = x.Key.WipID, CreateDate = x.Min(o => o.CreateDate) }) on q1.WipID equals q5.WipID + //join q5 in _context.WipStations.Where(y => slist.Contains(y.StationID) && y.CreateDate >= DateTime.Parse(dateStart) && y.CreateDate <= DateTime.Parse(dateEnd).AddDays(1)).GroupBy(x => new { x.WipID }).Select(x => new { WipID = x.Key.WipID, CreateDate = x.Min(o => o.CreateDate) }) on q1.WipID equals q5.WipID into wip_data + //from x1 in wip_data.DefaultIfEmpty() + //join q6 in _context.FqcResultMasters.GroupBy(x => new { x.WipNo }).Select(x => new { WipNo = x.Key.WipNo, FqcDate = x.Max(o => o.EndTime) }) on q2.WipNO equals q6.WipNo join q6 in _context.FqcResultMasters.GroupBy(x => new { x.WipNo }).Select(x => new { WipNo = x.Key.WipNo, FqcDate = x.Max(o => o.EndTime) }) on q2.WipNO equals q6.WipNo into fqc_data from x2 in fqc_data.DefaultIfEmpty() select new @@ -1758,7 +1760,8 @@ FROM [SFIS].[dbo].[ZPDKeyPart] B WHERE B.[IsActive] = 1 AND B.[ProductSN] = (S q1.FlowRuleID, q1.StatusNO, q1.WipScheduleDate, - CreateDate = (x1.CreateDate == null ? DateTime.Now : x1.CreateDate), + //CreateDate = (x1.CreateDate == null ? DateTime.Now : x1.CreateDate), + q5.CreateDate, q2.ItemNO, q2.ModelNO, q3.LineDesc, From 246217a77b9c1235582888dba67365d27e707458 Mon Sep 17 00:00:00 2001 From: Yiru Date: Mon, 1 Jul 2024 21:10:25 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E7=95=B0=E5=B8=B8=E5=B7=A5=E6=99=82=20?= =?UTF-8?q?=E8=B2=AC=E4=BB=BB=E4=BA=BAID=E5=8F=96=E6=B6=88=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Views/WHS/WHS009C.cshtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AMESCoreStudio.Web/Views/WHS/WHS009C.cshtml b/AMESCoreStudio.Web/Views/WHS/WHS009C.cshtml index 9b2e9916..20c7c6e0 100644 --- a/AMESCoreStudio.Web/Views/WHS/WHS009C.cshtml +++ b/AMESCoreStudio.Web/Views/WHS/WHS009C.cshtml @@ -447,7 +447,7 @@ success: function (result) { if (result.data) { $("#DutyUserID").empty(); - $('#DutyUserID').append(new Option("請選擇", "")); + $('#DutyUserID').append(new Option("請選擇", "-1")); var count = 0; $.each(result.data, function (index, item) { if (item.deptID == data) { @@ -457,12 +457,12 @@ }); if (count == 0) { $("#DutyUserID").empty(); - $('#DutyUserID').append(new Option("無選項", "")); + $('#DutyUserID').append(new Option("無選項", "-1")); } } else { $("#DutyUserID").empty(); - $('#DutyUserID').append(new Option("無選項", "")); + $('#DutyUserID').append(new Option("無選項", "-1")); } layui.form.render("select"); } From a0bc62bc545096fac8e3022ac4fdac664fb7ccae Mon Sep 17 00:00:00 2001 From: Sai Date: Mon, 1 Jul 2024 23:13:00 +0800 Subject: [PATCH 04/23] =?UTF-8?q?1.=20PTD=E8=AA=BF=E6=95=B4=E4=B8=8A?= =?UTF-8?q?=E9=80=B1=E5=BE=85=E4=BF=AE=E6=AD=A3=EF=BC=9ALineNo=20=E5=8D=A1?= =?UTF-8?q?6=E7=A2=BC=E5=8F=8A=E7=A7=BB=E9=99=A4=E4=BE=8B=E5=A4=96?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E5=A1=ABLineNo=E5=88=A4=E6=96=B7=EF=BC=8C?= =?UTF-8?q?=E4=B8=80=E6=AE=B5=E5=BC=8F=E9=A1=AF=E7=A4=BA=E9=8C=AF=E8=AA=A4?= =?UTF-8?q?=E8=AA=BF=E6=95=B4=EF=BC=8C=E4=BA=8C=E6=AE=B5=E5=BC=8F=E5=8F=8A?= =?UTF-8?q?=E4=B8=80=E6=AE=B5=E5=BC=8F=E8=AA=BF=E6=95=B4=E5=BA=8F=E8=99=9F?= =?UTF-8?q?=E8=BC=B8=E5=85=A5=E8=B7=9FExcel=E5=8C=AF=E5=85=A5=E5=8F=96?= =?UTF-8?q?=E5=85=B6=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PTDController.cs | 159 +++++++++++------- AMESCoreStudio.Web/Views/PTD/PTD002.cshtml | 76 ++++----- AMESCoreStudio.Web/Views/PTD/PTD006.cshtml | 78 +++++---- 3 files changed, 173 insertions(+), 140 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PTDController.cs b/AMESCoreStudio.Web/Controllers/PTDController.cs index 97209bd9..baa61221 100644 --- a/AMESCoreStudio.Web/Controllers/PTDController.cs +++ b/AMESCoreStudio.Web/Controllers/PTDController.cs @@ -316,10 +316,14 @@ namespace AMESCoreStudio.Web.Controllers if (!string.IsNullOrWhiteSpace(inputCheck)) return Json(new Result() { success = false, msg = inputCheck }); - // + // 取RecordType var recordType = await _ptdApi.GetRecordTypeInfo(); var recordTypeFirst = recordType.Where(w => w.ID == model.RecordType).FirstOrDefault(); + // 資料收集 + var sn = new List(); + var addInput = new List(); + var msgInput = new List(); var zsnInfo = new List(); // 序號區間 @@ -328,6 +332,11 @@ namespace AMESCoreStudio.Web.Controllers // PCS if (model.StockUnit == "0") { + var sequential = model.Sequential; + var frontLength = model.FrontSN.Length; + // 前綴 + var title = model.FrontSN.Substring(0, frontLength - sequential); + // Begin=End if (model.PcsUnit == "Y") model.EndSN = model.FrontSN; @@ -336,16 +345,20 @@ namespace AMESCoreStudio.Web.Controllers // EndSn 空白 計算備貨量 if (string.IsNullOrWhiteSpace(model.EndSN)) { - var sequential = model.Sequential; - var frontLength = model.FrontSN.Length; - // 前綴 - var title = model.FrontSN.Substring(0, frontLength - sequential); // 開始流水號 var frontSequential = int.Parse(model.FrontSN.Substring(frontLength - sequential, sequential)); model.EndSN = $"{title}{(frontSequential + model.StockQty - 1).ToString().PadLeft(sequential, '0')}"; } } - zsnInfo = await _ptdApi.GetZSNInfoByIntervalNumber(model.FrontSN, model.EndSN); + + int startNumber = int.Parse(model.FrontSN.Substring(frontLength - sequential, sequential)); + int endNumber = int.Parse(model.EndSN.Substring(frontLength - sequential, sequential)); + // 用起訖區間推序號 + for (int i = startNumber; i <= endNumber; i++) + { + string serialNumber = title + i.ToString().PadLeft(sequential, '0'); + sn.Add(serialNumber); + } } // BOX else if (model.StockUnit == "1") @@ -364,9 +377,7 @@ namespace AMESCoreStudio.Web.Controllers var boxSn = await _ptdApi.GetBarcodeInfoByBoxInterval(model.FrontSN, model.EndSN); foreach (var item in boxSn.Where(w => w.StatusID == -1)) { - var byBarcodeNo = await _ptdApi.GetZSNInfoByNumber(item.BarcodeNo); - if (byBarcodeNo.Any()) - zsnInfo.Add(byBarcodeNo.FirstOrDefault()); + sn.Add(item.BarcodeNo); } } } @@ -374,69 +385,99 @@ namespace AMESCoreStudio.Web.Controllers // ExcelInput if (!string.IsNullOrWhiteSpace(model.SNData)) { - var sndata = model.SNData.Split("\n"); - foreach (var item in sndata) - { - var byNumber = await _ptdApi.GetZSNInfoByNumber(item); - if (byNumber.Any()) - zsnInfo.Add(byNumber.FirstOrDefault()); - } + sn.AddRange(model.SNData.Split("\n").ToList()); } // Type是WO的 上一個狀態需要是WI if (recordTypeFirst != null) { - if (recordTypeFirst.Status == "WO") + // 確認序號狀態 + foreach (var item in sn) { - // Record 狀態是WI 的ID - var recodeIdBystaus = recordType.Where(w => w.Status == "WI").Select(s => s.ID).ToList(); - // 特殊 - if (model.RecordType == "633") - recodeIdBystaus.Add("631"); + // zsnInfo 資料 + var zSnInfo = await _ptdApi.GetZSNInfoByNumber(item); - correct = zsnInfo.Where(w => recodeIdBystaus.Contains((string)w.recordTypeID) && - w.originalProductID == model.ProductId).ToList(); - } - else if (recordTypeFirst.Status == "WI") - { - // 取得特定上一個作業 - var flowRule = await _ptdApi.GetPtdFlowRules(model.RecordType); - if (flowRule.Any()) + if (recordTypeFirst.Status == "WO") { - var toIDs = flowRule.Select(s => (string)s.toID).ToList(); - // 653需要確認料號是否一樣 - if (recordTypeFirst.ID == "653") + // Record 狀態是WI 的ID + var recodeIdBystaus = recordType.Where(w => w.Status == "WI").Select(s => s.ID).ToList(); + // 特殊 + if (model.RecordType == "633") + recodeIdBystaus.Add("631"); + + // ZsnInfo 符合狀態的序號且料號要一致 + if (zSnInfo.Any()) { - correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID) && - w.originalProductID == model.ProductId).ToList(); + if (zSnInfo.Any(w => recodeIdBystaus.Contains((string)w.recordTypeID) && + w.originalProductID == model.ProductId)) + addInput.Add(item); + else + msgInput.Add(item); } else - correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID)).ToList(); + msgInput.Add(item); + + } + else if (recordTypeFirst.Status == "WI") + { + // 取得特定上一個作業 + var flowRule = await _ptdApi.GetPtdFlowRules(model.RecordType); + if (flowRule.Any()) + { + var toIDs = flowRule.Select(s => (string)s.toID).ToList(); + // 653需要確認料號是否一樣 + if (recordTypeFirst.ID == "653") + { + correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID) && + w.originalProductID == model.ProductId).ToList(); + } + else + correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID)).ToList(); + + // ZsnInfo 符合狀態的序號且料號要一致 + if (zSnInfo.Any()) + { + // 653需要確認料號是否一樣 + if (recordTypeFirst.ID == "653") + { + if (zsnInfo.Any(w => toIDs.Contains((string)w.recordTypeID) && + w.originalProductID == model.ProductId)) + addInput.Add(item); + else + msgInput.Add(item); + } + else + { + if (zsnInfo.Any(w => toIDs.Contains((string)w.recordTypeID))) + addInput.Add(item); + else + msgInput.Add(item); + } + } + else + msgInput.Add(item); + } } } } + addInput = addInput.Except(msgInput.Distinct()).ToList(); var datas = new List(); - foreach (var item in zsnInfo) + // add + foreach (var item in addInput) { - // 符合的顯示出來 - if (correct.Any(a => a.serialNumber == item.serialNumber)) + var newRowData = new { - var newRowData = new - { - dnNo = model.RecordNumber, - lineNo = model.LineNo, - material = model.ProductId, - sn = item.serialNumber - }; - datas.Add(newRowData); - } - else - msg += $"{item.serialNumber}、"; + dnNo = model.RecordNumber, + lineNo = model.LineNo, + material = model.ProductId, + sn = item + }; + datas.Add(newRowData); } - if (!string.IsNullOrWhiteSpace(msg)) - msg = "流程狀態或序號比對料號錯誤:" + msg.Substring(0, msg.Length - 1); + if (msgInput.Any()) + msg = "流程狀態或序號比對料號錯誤:" + string.Join("、", msgInput.Distinct()); return Json(new Result() { success = true, msg = msg, data = datas }); } @@ -450,16 +491,13 @@ namespace AMESCoreStudio.Web.Controllers { // RecordNumber if (string.IsNullOrWhiteSpace(model.RecordNumber)) - { return "請輸入 RecordNumber"; - } // LineNo if (string.IsNullOrWhiteSpace(model.LineNo)) - { - if (model.RecordType != "101" && model.RecordType != "292") - return "請輸入 LineNo"; - } + return "請輸入 LineNo"; + else if (model.LineNo.Trim().Length != 6) + return "LineNo不足6碼"; // Location if (string.IsNullOrWhiteSpace(model.Location)) @@ -501,6 +539,10 @@ namespace AMESCoreStudio.Web.Controllers return "請輸入 Scanner"; } + // 輸入序號或Excel匯入只能選一種 + if (!string.IsNullOrWhiteSpace(model.FrontSN) && !string.IsNullOrWhiteSpace(model.SNData)) + return "條碼區間設定或Excel匯入只能選一種執行"; + // 判斷序號區間格式正確 if (!string.IsNullOrWhiteSpace(model.FrontSN)) { @@ -825,7 +867,6 @@ namespace AMESCoreStudio.Web.Controllers var factory_info = await _basApi.GetFactoryInfo(user_info[0].FactoryID); ViewData["RBU"] = factory_info[0].Address; } - } List RecordTypes = await _ptdApi.GetRecordTypeInfo(); diff --git a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml index 9ca9f752..070dfcc1 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml @@ -76,7 +76,7 @@
- +
@@ -105,7 +105,6 @@
-
@@ -120,54 +119,49 @@
-
-
-
-
- -
-
- -
-
-
- -
+
+ +
+
+
-
- -
- -
+
+
+
-
- -
- -
+
+
+ +
+ +
+
+
+ +
+
+
-
-
-
- -
-
- -
- - +
+
+ +
+
-
- -
- -
+ + +
+
+ +
+
- + 條碼輸入與Excel匯入,只能選一種執行
+
diff --git a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml index a8d3b04f..4390d179 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml @@ -68,7 +68,7 @@
- +
@@ -111,52 +111,47 @@
+
-
-
-
-
- -
-
- -
-
-
- -
+
+ +
+
+
-
- -
- -
- -
- -
+
+
+
- -
-
-
- -
-
- -
- - +
+ +
+
-
- -
- -
+ +
+
+
+
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ 條碼輸入與Excel匯入,只能選一種執行
@@ -411,6 +406,9 @@ if (res.msg) { hg.msg(res.msg); } + else { + layer.msg('備貨成功!', { icon: 1 }); + } var table = layui.table; table.reload('query', { where: { @@ -423,7 +421,7 @@ done: function(res, curr, count) { // 表格更新成功後計算資料筆數 calculateRowCount(res.data); - layer.msg('備貨成功!', { icon: 1 }); + } }); } From f624d6ffe3da593bf8ca7ffe7fbe0a969b42d74c Mon Sep 17 00:00:00 2001 From: Sai Date: Tue, 2 Jul 2024 11:23:49 +0800 Subject: [PATCH 05/23] =?UTF-8?q?1.=20=E5=8A=A0=E5=85=A5=E8=99=9B=E6=93=AC?= =?UTF-8?q?=E8=B7=AF=E5=BE=91=E5=88=A4=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Startup.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/AMESCoreStudio.Web/Startup.cs b/AMESCoreStudio.Web/Startup.cs index ec9efe5d..41af1b38 100644 --- a/AMESCoreStudio.Web/Startup.cs +++ b/AMESCoreStudio.Web/Startup.cs @@ -50,7 +50,7 @@ namespace AMESCoreStudio.Web // ValidationVisitor exceeded the maximum configured validation depth '32' services.AddMvc().AddMvcOptions(options => { - options.MaxModelValidationErrors = 999999; + options.MaxModelValidationErrors = 999999; }); // ɮץؿ @@ -80,11 +80,15 @@ namespace AMESCoreStudio.Web { config.ForEach(f => { - fileServerOptions.Add(new FileServerOptions + try { - FileProvider = new PhysicalFileProvider(@f.RealPath), - RequestPath = new PathString(f.RequestPath), - }); + fileServerOptions.Add(new FileServerOptions + { + FileProvider = new PhysicalFileProvider(@f.RealPath), + RequestPath = new PathString(f.RequestPath), + }); + } + catch { } }); }; services.AddSingleton(new FileServerProvider(fileServerOptions)); From 5857f8791b4faee76e0badf7bc8f71ba9f81b728 Mon Sep 17 00:00:00 2001 From: Sai Date: Thu, 4 Jul 2024 00:09:16 +0800 Subject: [PATCH 06/23] =?UTF-8?q?1.=20=E5=B7=A5=E5=96=AE=E8=B3=87=E8=A8=8A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=8A=E4=BE=9B=E5=96=AE=E6=8A=95=E7=94=A2?= =?UTF-8?q?=E4=B8=AD=E4=BF=AE=E6=94=B9=E8=AA=BF=E6=95=B4=E3=80=80=E7=84=A1?= =?UTF-8?q?=E7=B6=AD=E8=AD=B7=E6=A8=99=E6=BA=96=E5=B7=A5=E6=99=82,?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=B6=AD=E8=AD=B7=E5=B7=A5=E7=A8=8B=E8=B3=87?= =?UTF-8?q?=E8=A8=8A=E4=B8=A6=E9=A1=AF=E7=A4=BA=E8=AD=A6=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Views/PCS/PCS003.cshtml | 451 ++++++++++----------- AMESCoreStudio.Web/Views/PCS/PCS034.cshtml | 450 ++++++++++---------- 2 files changed, 443 insertions(+), 458 deletions(-) diff --git a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml index 6313ab3f..37f1c303 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS003.cshtml @@ -519,18 +519,9 @@
- - - + + +
@@ -546,10 +537,7 @@
- +
@@ -570,10 +558,7 @@
- +
@@ -586,10 +571,7 @@
- +
@@ -605,10 +587,7 @@
- +
@@ -722,252 +701,252 @@ @* 系統-工程資訊sheet *@
-
-
- -
- -
+
+
+
+ +
+ +
- -
- -
+ +
+ +
-
- - @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) - { - 有維護標準工時 - } - else - { - **無維護標準工時** - } +
+ + @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) + { + 有維護標準工時 + } + else + { + **無維護標準工時** + } +
-
-
-
- -
- -
-
- +
+
+ +
+ +
+
+ +
-
-
- -
- +
+ +
+ +
-
-
-
- -
- -
- -
- -
-
小時
- -
- -
- -
- -
-
- - - +
+
+ +
+ +
+ +
+ +
+
小時
+ +
+ +
+ +
+ +
+
-
-
- -
- +
+ +
+ +
-
-
-
- -
- -
-
- -
-
- -
- -
- -
- -
- +
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
+
-
-
-
-
- -
- -
- -
- +
+
+ +
+ +
+ +
+ +
-
-
-
- -
- +
+
+ +
+ +
-
-
-
- -
- +
+
+ +
+ +
+ +
+ +
- -
- +
+ +
+ +
+
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
- -
- -
+
+ 請先維護標工資訊
@@ -1040,8 +1019,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -1065,8 +1044,8 @@ @* - - *@ + + *@ @@ -1225,7 +1204,7 @@ RuleStation($("#flowId").val()); - // 安勤統一只Show工程資訊 + // 統一Show工程資訊 $("#system").show(); $("#board").hide(); @@ -1240,6 +1219,20 @@ } } + // 無標工資訊,不顯示工程資訊 + let totalCt1 = '@Model.itemNoCT1'; + if (totalCt1 === '' || totalCt1 ==='0') + { + $("#wipSystemDataView").hide(); + $("#wipsystemNoCT1AlertShow").show(); + } + else + { + $("#wipSystemDataView").show(); + $("#wipsystemNoCT1AlertShow").hide(); + } + console.log(totalCt1); + // DIV 出貨序號 if ($('#wipBarcodeOtherCount').val() != "0") { $("#barcodeOtherDiv").hide(); diff --git a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml index 8d8c0173..0304f83b 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS034.cshtml @@ -501,18 +501,9 @@
- - - + + +
@@ -528,10 +519,7 @@
- +
@@ -552,10 +540,7 @@
- +
@@ -568,10 +553,7 @@
- +
@@ -587,10 +569,7 @@
- +
@@ -704,252 +683,252 @@ @* 系統-工程資訊sheet *@
-
-
- -
- -
+
+
+
+ +
+ +
- -
- -
+ +
+ +
-
- - @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) - { - 有維護標準工時 - } - else - { - **無維護標準工時** - } +
+ + @if (!string.IsNullOrWhiteSpace(Model.itemNoCT1)) + { + 有維護標準工時 + } + else + { + **無維護標準工時** + } +
-
-
-
- -
- -
-
- +
+
+ +
+ +
+
+ +
-
-
- -
- +
+ +
+ +
-
-
-
- -
- -
- -
- -
-
小時
- -
- -
- -
- -
-
- - - +
+
+ +
+ +
+ +
+ +
+
小時
+ +
+ +
+ +
+ +
+
-
-
- -
- +
+ +
+ +
-
-
-
- -
- -
-
- -
-
- -
- -
- -
- -
- +
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
-
-
-
- -
- -
-
- -
-
- +
+
+ +
+ +
+
+ +
+
+ +
+
-
-
-
-
- -
- -
- -
- +
+
+ +
+ +
+ +
+ +
-
-
-
- -
- +
+
+ +
+ +
-
-
-
- -
- +
+
+ +
+ +
+ +
+ +
- -
- +
+ +
+ +
+
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
- -
- -
+
+ 請先維護標工資訊
@@ -1022,8 +1001,8 @@ SOP文件敘述 @* - 檔案路徑 - *@ + 檔案路徑 + *@ SOP類型 @@ -1047,8 +1026,8 @@ @* - - *@ + + *@ @@ -1206,7 +1185,7 @@ } RuleStation($("#flowId").val()); - // 安勤統一只Show工程資訊 + // 統一Show工程資訊 $("#system").show(); $("#board").hide(); @@ -1221,6 +1200,19 @@ } } + // 無標工資訊,不顯示工程資訊 + let totalCt1 = '@Model.itemNoCT1'; + if (totalCt1 === '' || totalCt1 ==='0') + { + $("#wipSystemDataView").hide(); + $("#wipsystemNoCT1AlertShow").show(); + } + else + { + $("#wipSystemDataView").show(); + $("#wipsystemNoCT1AlertShow").hide(); + } + // DIV 出貨序號 if ($('#wipBarcodeOtherCount').val() != "0") { $("#barcodeOtherDiv").hide(); From 96aab6c8e05f0bb79aefb76e27a4f7f5ac68cc2d Mon Sep 17 00:00:00 2001 From: Sai Date: Fri, 5 Jul 2024 16:00:43 +0800 Subject: [PATCH 07/23] =?UTF-8?q?1.=20=E5=B7=A1=E6=AA=A2=E7=B5=90=E6=9E=9C?= =?UTF-8?q?=E7=B6=AD=E8=AD=B7=20=E7=A8=BD=E6=A0=B8=E7=B5=90=E6=9E=9C?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E9=81=B8=E5=96=AE=E5=8A=A0=E5=85=A5=E9=A1=8F?= =?UTF-8?q?=E8=89=B2=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml | 31 ++- AMESCoreStudio.Web/Views/SPC/SPC005U.cshtml | 125 ++++++---- AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml | 242 +++++++++++--------- 3 files changed, 243 insertions(+), 155 deletions(-) diff --git a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml index 7b81d5b6..7c52fe28 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml @@ -138,7 +138,7 @@ @*回復*@ - - } diff --git a/AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml index 4f1796c7..2e6d316f 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml @@ -1,7 +1,8 @@ @model AMESCoreStudio.WebApi.Models.AMES.InspectionResultMaster -@{ ViewData["Title"] = "SPC005U"; +@{ + ViewData["Title"] = "SPC005U"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; //Layout = "~/Views/Shared/_FormLayout.cshtml"; } @@ -15,12 +16,24 @@ margin-left: -10px; margin-right: -10px; } + .layui-table-cell { height: auto; overflow: visible; text-overflow: inherit; white-space: normal } + + .layui-disabled-red { + color: red !important; + cursor: not-allowed !important + } + + .layui-disabled-green { + color: green !important; + cursor: not-allowed !important + } + green
@@ -64,15 +77,17 @@
-
+
@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); - await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + @{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); + } @*回復*@ } From b94718196e5a6acb569d4f486dae118bde4ab8bf Mon Sep 17 00:00:00 2001 From: Sai Date: Tue, 9 Jul 2024 00:33:05 +0800 Subject: [PATCH 08/23] =?UTF-8?q?1.=20=E8=AA=BF=E6=95=B4=E4=B8=80=E6=AE=B5?= =?UTF-8?q?=E5=BC=8F=E5=88=A4=E6=96=B7=202.=20=E9=82=84=E5=8E=9F=E4=BD=9C?= =?UTF-8?q?=E6=A5=AD=E7=95=AB=E9=9D=A2=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PTDController.cs | 61 ++++++------ AMESCoreStudio.Web/Views/PTD/PTD002.cshtml | 2 - AMESCoreStudio.Web/Views/PTD/PTD008.cshtml | 96 ++++++++++--------- 3 files changed, 81 insertions(+), 78 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PTDController.cs b/AMESCoreStudio.Web/Controllers/PTDController.cs index baa61221..9d1acb44 100644 --- a/AMESCoreStudio.Web/Controllers/PTDController.cs +++ b/AMESCoreStudio.Web/Controllers/PTDController.cs @@ -311,7 +311,6 @@ namespace AMESCoreStudio.Web.Controllers public async Task PTD002_CheckInputData(WebApi.Models.AMES.PTDCheckInputData model) { var inputCheck = await CheckInputData(model); - var correct = new List(); var msg = string.Empty; if (!string.IsNullOrWhiteSpace(inputCheck)) return Json(new Result() { success = false, msg = inputCheck }); @@ -324,7 +323,6 @@ namespace AMESCoreStudio.Web.Controllers var sn = new List(); var addInput = new List(); var msgInput = new List(); - var zsnInfo = new List(); // 序號區間 if (!string.IsNullOrWhiteSpace(model.FrontSN)) @@ -420,42 +418,45 @@ namespace AMESCoreStudio.Web.Controllers } else if (recordTypeFirst.Status == "WI") { - // 取得特定上一個作業 - var flowRule = await _ptdApi.GetPtdFlowRules(model.RecordType); - if (flowRule.Any()) + // 292 不會有Info資料 + if (model.RecordType == "292") { - var toIDs = flowRule.Select(s => (string)s.toID).ToList(); - // 653需要確認料號是否一樣 - if (recordTypeFirst.ID == "653") - { - correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID) && - w.originalProductID == model.ProductId).ToList(); - } - else - correct = zsnInfo.Where(w => toIDs.Contains((string)w.recordTypeID)).ToList(); - - // ZsnInfo 符合狀態的序號且料號要一致 if (zSnInfo.Any()) + msgInput.Add(item); + else + addInput.Add(item); + } + // 其他要走特定上一個作業 + else + { + var flowRule = await _ptdApi.GetPtdFlowRules(model.RecordType); + if (flowRule.Any()) { - // 653需要確認料號是否一樣 - if (recordTypeFirst.ID == "653") + var toIDs = flowRule.Select(s => (string)s.toID).ToList(); + + // ZsnInfo 符合狀態的序號且料號要一致 + if (zSnInfo.Any()) { - if (zsnInfo.Any(w => toIDs.Contains((string)w.recordTypeID) && - w.originalProductID == model.ProductId)) - addInput.Add(item); + // 653需要確認料號是否一樣 + if (recordTypeFirst.ID == "653") + { + if (zSnInfo.Any(w => toIDs.Contains((string)w.recordTypeID) && + w.originalProductID == model.ProductId)) + addInput.Add(item); + else + msgInput.Add(item); + } else - msgInput.Add(item); + { + if (zSnInfo.Any(w => toIDs.Contains((string)w.recordTypeID))) + addInput.Add(item); + else + msgInput.Add(item); + } } else - { - if (zsnInfo.Any(w => toIDs.Contains((string)w.recordTypeID))) - addInput.Add(item); - else - msgInput.Add(item); - } + msgInput.Add(item); } - else - msgInput.Add(item); } } } diff --git a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml index 070dfcc1..02741ef4 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml @@ -408,7 +408,6 @@ return; // Do not add the row } - var postData = { recordType: recordType, workCenter: workCenter, @@ -417,7 +416,6 @@ recordDate: recordDate, location: location, customer: customer, - tableData: tableData }; diff --git a/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml index e237e6c2..77b2fbe2 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml @@ -36,49 +36,47 @@
-
-
-
- -
- -
- -
- -
+
+
+ +
+
-
-
-
-
-
- -
- -
+
+
+ +
+
-
-
-
-
-
- -
- -
+
+
+ +
+
-
- +
+
+
+
+ +
+
+
+ +
+
+
+
+
@@ -88,7 +86,6 @@
-
@@ -97,7 +94,6 @@ @section Scripts{ - -} \ No newline at end of file +} From 5a7308806b1fcd73f5b93adb5007c0668b861f2d Mon Sep 17 00:00:00 2001 From: Marvin Date: Tue, 9 Jul 2024 21:24:04 +0800 Subject: [PATCH 09/23] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E7=BB=93=E8=BD=AC?= =?UTF-8?q?=E7=A8=8B=E5=BC=8Fapi,WriteBarcodeItem4DataCarrier3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AMES/BarcodeItemsController.cs | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs index b6303d72..153ceb05 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs @@ -638,6 +638,85 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// 結轉寫入條碼組件資料 + /// + /// + /// + /// + /// + /// + [HttpPut("WriteBarcodeItem4DataCarrier3/{barcodeID}/{wipID}/{stationID}/{itemData}")] + public async Task> WriteBarcodeItem4DataCarrier3(int barcodeID, int wipID, int stationID, string itemData) + { + Helper helper = new Helper(_context); + ResultModel result = new ResultModel(); + + JArray ja = new JArray(); + ja = JArray.Parse(itemData); + + int ngQty = 0; + string msg = ""; + + if (ja.Count > 0) + { + for (int i = 0; i < ja.Count; i++) + { + JObject jo = new JObject(); + jo = JObject.Parse(ja[i].ToString()); + + string itemNo = jo["ITEM_NO"].ToString(); + string partNo = jo["PART_NO"].ToString(); + string kpItemNo = jo["KP_ITEM_NO"].ToString(); + string kpDateTime = jo["KP_DATETIME"].ToString(); + + try + { + var barcodeItem = await _context.BarcodeItems.Where(m => m.BarcodeID == barcodeID && m.StationID == stationID && m.ItemNo == itemNo && m.PartNo == partNo).FirstOrDefaultAsync(); + if (barcodeItem != null) + { + _context.BarcodeItems.Remove(barcodeItem); + } + + BarcodeItem barcode_item = new BarcodeItem(); + barcode_item.BarcodeItemID = helper.GetIDKey("BARCODEITEM_ID").Result; + barcode_item.BarcodeID = barcodeID; + barcode_item.WipID = wipID; + barcode_item.StationID = stationID; + barcode_item.ItemNo = itemNo; + barcode_item.PartNo = partNo; + barcode_item.KpItemNo = kpItemNo; + barcode_item.SysType = "S"; + barcode_item.CreateDate = DateTime.Parse(kpDateTime.Substring(0, 4) + "-" + kpDateTime.Substring(4, 2) + "-" + kpDateTime.Substring(6, 2) + " " + kpDateTime.Substring(8, 2) + ":" + kpDateTime.Substring(10, 2) + ":" + kpDateTime.Substring(12, 2)); + + _context.BarcodeItems.Add(barcode_item); + await _context.SaveChangesAsync(); + } + catch (Exception ex) + { + ngQty = ngQty + 1; + msg = msg + ex.Message; + } + } + + } + + if (ngQty > 0) + { + //紀錄筆數 + result.Success = false; + result.Msg = "條碼組件資料寫入失敗" + ngQty + "筆;" + msg; + } + else + { + //紀錄筆數 + result.Success = true; + result.Msg = "OK"; + } + + return result; + } + /// /// /// From 0893298fcbce7f2b528adc80dde6f23aac11660d Mon Sep 17 00:00:00 2001 From: Sai Date: Sun, 14 Jul 2024 23:29:09 +0800 Subject: [PATCH 10/23] =?UTF-8?q?1.=20=E8=AA=BF=E6=95=B4WIP=5Flog=E5=BB=BA?= =?UTF-8?q?=E7=AB=8B=E4=BA=BA=E5=93=A1=202.=20PTD=20=E9=82=84=E5=8E=9F?= =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E8=AA=BF=E6=95=B4=EF=BC=8C=E6=9F=A5=E8=A9=A2?= =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E8=AA=BF=E6=95=B4=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AE=A2=E6=88=B6=E6=8F=90=E5=87=BA=E9=9C=80=E6=B1=82=E5=8D=A1?= =?UTF-8?q?=E9=97=9C=E5=8F=8A=E5=AF=AB=E5=85=A5DB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 1 + .../Controllers/PTDController.cs | 183 +++++++++++- AMESCoreStudio.Web/HttpApis/AMES/IPTD.cs | 42 ++- AMESCoreStudio.Web/Views/PTD/PTD002.cshtml | 57 +++- AMESCoreStudio.Web/Views/PTD/PTD003.cshtml | 67 +++-- AMESCoreStudio.Web/Views/PTD/PTD006.cshtml | 73 ++++- AMESCoreStudio.Web/Views/PTD/PTD008.cshtml | 145 +++++----- .../Controllers/AMES/WipInfosController.cs | 23 +- .../Controllers/PTD/PTDController.cs | 266 ++++++++++++++++-- 9 files changed, 723 insertions(+), 134 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 884fb5b1..fcffe24f 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -4251,6 +4251,7 @@ namespace AMESCoreStudio.Web.Controllers wipLog.WipID = wipID; wipLog.WipDesc = "."; wipLog.StatusNO = statusNO; + wipLog.CreateUserID = GetLogInUserID(); // 當切換STOP時,強制收線 if (statusNO == "S") diff --git a/AMESCoreStudio.Web/Controllers/PTDController.cs b/AMESCoreStudio.Web/Controllers/PTDController.cs index 9d1acb44..8e985ca7 100644 --- a/AMESCoreStudio.Web/Controllers/PTDController.cs +++ b/AMESCoreStudio.Web/Controllers/PTDController.cs @@ -302,9 +302,25 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PTD002_Commit(string data) { + var ptd002 = JsonConvert.DeserializeObject(data); + var result = await _ptdApi.PostPTD002Commit(data); + + var item = ptd002.TableData.FirstOrDefault(); + var zDNDetail = await _ptdApi.GetGetZDNDetail(item.DnNo, item.LineNo); + var zProductTrans = await _ptdApi.GetZProductTrans(recordNumber: item.DnNo, lineNo: item.LineNo); + if (zDNDetail.Any() && zProductTrans.Any()) + { + // DN數量 == 已扣帳數量 + if (zDNDetail.FirstOrDefault().shipQty == zProductTrans.Count()) + await _ptdApi.PutZDNDetailByIsRecord(item.DnNo, item.LineNo, 1); + } + //将数据Json化并传到前台视图 - return Json(new { data = result }); + return Json(new + { + data = result + }); } [HttpPost] @@ -500,6 +516,13 @@ namespace AMESCoreStudio.Web.Controllers else if (model.LineNo.Trim().Length != 6) return "LineNo不足6碼"; + // 判斷是否已備貨完成 + var isRecord = await CheckRecordNoIsRecord(model.RecordNumber, model.LineNo); + if (!(isRecord.Value as Result).success) + { + return $"RecordNumber【{model.RecordNumber}】 LineNo【{model.LineNo}】 已備貨完"; + } + // Location if (string.IsNullOrWhiteSpace(model.Location)) { @@ -651,17 +674,19 @@ namespace AMESCoreStudio.Web.Controllers //ViewBag.StartDate = System.DateTime.Now.AddDays(-7).ToString("yyyy/MM/dd"); //ViewBag.EndDate = System.DateTime.Now.ToString("yyyy/MM/dd"); ViewBag.WorkCenter = "TWM0"; - + ViewBag.rowCount = "總筆數: 0"; return View(); } - public async Task PTD003QueryAsync(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, int autoLoad = 0, string RBU = null) + public async Task PTD003QueryAsync(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, + int autoLoad = 0, string RBU = null, string soNumber = null, string soLineNo = null, string customer = 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 _ptdApi.GetData4PTD003(recordType, recordNumber, lineNo, materialNo, shippingSN, dateStart, dateEnd, RBU); + var result = await _ptdApi.GetData4PTD003(recordType, recordNumber, lineNo, materialNo, shippingSN, + dateStart, dateEnd, RBU, soNumber, soLineNo, customer); if (result.DataTotal > 0) { return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); @@ -1111,6 +1136,12 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Result() { success = true, msg = msg, data = new List() }); } + /// + /// 取得 RecordNo & LineNo 訂單數量 + /// + /// RecordNo + /// LineNo + /// public async Task GetRecordNumberQty(string dnNo, string dnlineNo) { var zDNDetail = await _ptdApi.GetGetZDNDetail(dnNo, dnlineNo); @@ -1127,6 +1158,25 @@ namespace AMESCoreStudio.Web.Controllers } + /// + /// 確認 RecordNo & LineNo 是否可備貨 + /// + /// RecordNo + /// LineNo + /// ture可 false不可 + public async Task CheckRecordNoIsRecord(string dnNo, string dnlineNo) + { + var zDNDetail = await _ptdApi.GetGetZDNDetail(dnNo, dnlineNo); + + if (zDNDetail.Any()) + { + var isRecord = zDNDetail.FirstOrDefault().isRecord; + if ((int)isRecord == 1) + return Json(new Result() { success = false }); + } + return Json(new Result() { success = true }); + } + #endregion #region "PTD007 扣帳作業" @@ -1181,7 +1231,34 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PTD007_Commit(string data) { - var result = await _ptdApi.PostPTD007Commit(data); + var ptd007 = JsonConvert.DeserializeObject(data); + var result = new ResultModel(); + // 先確認需求數量是否=備貨數量 + foreach (var item in ptd007.TableData) + { + if (item.shipQty != item.qty) + { + result.Success = false; + result.Msg = $"DN單號【{item.dnno}】 LineNo【{item.dnLineNO}】 數量不符合,請檢查備貨資料"; + return Json(new { data = result }); + } + } + // 執行扣帳 + result = await _ptdApi.PostPTD007Commit(data); + + foreach (var item in ptd007.TableData) + { + var zDNDetail = await _ptdApi.GetGetZDNDetail(item.dnno, item.dnLineNO); + var zProductTrans = await _ptdApi.GetZProductTrans(recordNumber: item.dnno, lineNo: item.dnLineNO); + + if (zDNDetail.Any() && zProductTrans.Any()) + { + // DN數量 == 已扣帳數量 + if (zDNDetail.FirstOrDefault().shipQty == zProductTrans.Count()) + await _ptdApi.PutZDNDetailByIsRecord(item.dnno, item.dnLineNO, 1); + } + } + //将数据Json化并传到前台视图 return Json(new { data = result }); } @@ -1205,12 +1282,96 @@ namespace AMESCoreStudio.Web.Controllers } return Json(new Table() { count = 0, data = null, msg = result.Msg }); } + [HttpPost] - public async Task PTD008_Commit(string data) + public async Task PTD008_Commit(string recordNumber, string lineNo, string materialNo, string shippingSN) { - var result = await _ptdApi.PostPTD008Commit(data); - //将数据Json化并传到前台视图 - return Json(new { data = result }); + var data = await _ptdApi.GetData4PTD008(recordNumber, lineNo, materialNo, shippingSN); + + if (data.Data.Any(w => w.recordTypeID == "101" || w.recordTypeID == "292")) + return Json(new Result() { success = false, msg = "ReCordType狀態是【101】或【292】 ,不可做還原動作" }); + + int okQty = 0, ngQty = 0; + foreach (var item in data.Data) + { + var zProductTrans = await _ptdApi.GetZProductTrans(serialNumber: (string)item.sn); + var delcheck = true; + + if (!zProductTrans.Any()) + { + ngQty += 1; + continue; + } + // 取序號最新一次狀態 + else if (zProductTrans.Any()) + { + var newRecordId = zProductTrans.OrderByDescending(o => o.createDate).FirstOrDefault().recordTypeID; + // 確認目前還原是否是最新的 + if (newRecordId != item.recordTypeID) + { + ngQty += 1; + continue; + } + } + + // 可進行還原 + delcheck = await _ptdApi.Put_PTD008((string)item.sn, recordNumber, lineNo, materialNo); + if (delcheck) + okQty += 1; + else + ngQty += 1; + } + + // 成功刪除筆數大於1 + if (okQty >= 1) + { + await _ptdApi.PutZDNDetailByIsRecord(recordNumber, lineNo, 0); + } + + return Json(new Result() { success = true, msg = $"還原成功筆數【{okQty}】,失敗筆數【{ngQty}】" }); + } + + /// + /// 刪除動作 + /// + /// + /// + [HttpPost] + public async Task PTD008_Del(string recordNumber, string lineNo, string materialNo, string shippingSN) + { + var data = await _ptdApi.GetData4PTD008(recordNumber, lineNo, materialNo, shippingSN); + + if (data.Data.Any(w => w.recordTypeID != "101" && w.recordTypeID != "292")) + return Json(new Result() { success = false, msg = "ReCordType狀態不是【101】或【292】 ,不可做刪除動作" }); + + int okQty = 0, ngQty = 0; + foreach (var item in data.Data) + { + var zProductTrans = await _ptdApi.GetZProductTrans(serialNumber: (string)item.sn); + var delcheck = true; + // 大於一筆 代表尚有其他作業需還原 + if (zProductTrans.Count > 1) + { + ngQty += 1; + } + // 可進行刪除 + else + { + delcheck = await _ptdApi.Del_PTD008((string)item.sn, recordNumber, lineNo, materialNo); + if (delcheck) + okQty += 1; + else + ngQty += 1; + } + } + + // 成功刪除筆數大於1,將ZDetail + if (okQty >= 1) + { + await _ptdApi.PutZDNDetailByIsRecord(recordNumber, lineNo, 0); + } + + return Json(new Result() { success = true, msg = $"刪除成功筆數【{okQty}】,失敗筆數【{ngQty}】" }); } #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPTD.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPTD.cs index 43087f0a..7d0ba979 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPTD.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPTD.cs @@ -44,13 +44,23 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/PTD/GetZDNDetail")] ITask> GetGetZDNDetail(string dnNo, string dnlineNo); + /// + /// 更新 PTD ZDNDetail RecordNumber ByisRecord 已扣帳狀態 + /// + /// RecordNumber + /// LineNo + /// 已扣障 0:未完成 1:已完成 + /// + [WebApiClient.Attributes.HttpPut("api/PTD/PutZDNDetail")] + ITask PutZDNDetail(string dnNo, string dnlineNo, int isRecord); + /// /// 查詢 ZSNInfo 主表 序號區間 /// /// /// [WebApiClient.Attributes.HttpGet("api/PTD/ZSNInfoByIntervalNumber")] - ITask> GetZSNInfoByIntervalNumber(string strNumber ,string endNumber); + ITask> GetZSNInfoByIntervalNumber(string strNumber, string endNumber); /// /// 查詢 ZSNInfo 主表 By 指定序號 @@ -101,7 +111,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, string RBU); + ITask> GetData4PTD003(string recordType, string recordNumber, string lineNo, string materialNo, string shippingSN, string dateStart, string dateEnd, string RBU, string soNumber, string soLineNo, string customer); [WebApiClient.Attributes.HttpGet("api/WipInfos/GetCustomer/{recordNumber}")] ITask GetCustomer(string recordNumber); @@ -140,6 +150,28 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpDelete("api/WipInfos/DeleteRecordTypeInfo/{id}")] ITask> DeleteRecordTypeInfo(string id); + /// + /// 查詢 ZProductTrans + /// + /// 序號 + /// RecordNumber + /// LineNo + /// 料號 + /// 類型 + /// + [WebApiClient.Attributes.HttpGet("api/PTD/GetZProductTrans")] + ITask> GetZProductTrans(string serialNumber = null, string recordNumber = null, string lineNo = null, string productID = null, string recordTypeID = null); + + + /// + /// 更新 PTD ZDNDetail RecordNumber ByisRecord 已扣帳狀態 + /// + /// RecordNumber + /// LineNo + /// 已扣障 0:未完成 1:已完成 + /// + [WebApiClient.Attributes.HttpPut("api/PTD/PutZDNDetail")] + ITask PutZDNDetailByIsRecord(string dnNo, string dnlineNo, int isRecord); #endregion #region "PTD005 設定 ERP 客戶代號和客戶收件人名單" @@ -211,6 +243,12 @@ namespace AMESCoreStudio.Web ITask> GetData4PTD008(string recordNumber, string lineNo, string materialNo, string shippingSN); [WebApiClient.Attributes.HttpPost("api/WipInfos/PostPTD008Commit")] ITask> PostPTD008Commit([FromBody, RawJsonContent] string model); + + [WebApiClient.Attributes.HttpPut("api/PTD/PTD008")] + ITask Put_PTD008(string serialNumber, string recordNumber, string lineNo, string productID); + + [WebApiClient.Attributes.HttpDelete("api/PTD/PTD008")] + ITask Del_PTD008(string serialNumber, string recordNumber, string lineNo, string productID); #endregion } diff --git a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml index 02741ef4..72713685 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD002.cshtml @@ -216,6 +216,7 @@ var recordNumber = document.getElementById('recordNumber').value; var recordType = document.getElementById('recordType').value; var recordTypeInfo = @Html.Raw(Json.Serialize(ViewBag.RecordTypeInfo)); + var lineNo = document.getElementById('lineNo').value; var filteredInfo = recordTypeInfo.find(function (info) { return info.id === recordType; }); @@ -233,8 +234,32 @@ $("#recordNumber").val(''); return; } - var lineNo = document.getElementById('lineNo'); - lineNo.focus(); + + if (lineNo.length === 0) { + document.getElementById('lineNo').focus(); + } + else { + $.ajax({ + url: '@Url.Action("CheckRecordNoIsRecord", "PTD")', + type: 'POST', + data: { dnNo: recordNumber, dnlineNo: lineNo }, + success: function (result) { + // 处理成功的情况 + if (!result.success) { + hg.msg(`RecordNumber【${recordNumber}】 LineNo【${lineNo}】 已備貨完`); + $("#recordNumber").val(''); + $("#lineNo").val(''); + $("#Customer").val(''); + $('#PartNumber').val(''); + $("#PartDesc").val(''); + } + }, + error: function (error) { + hg.msg('錯誤:' + error); + console.log(error); + } + }); + } } }); @@ -269,9 +294,30 @@ console.log(error); } }); - } + $.ajax({ + url: '@Url.Action("CheckRecordNoIsRecord", "PTD")', + type: 'POST', + data: { dnNo: recordNumber, dnlineNo: lineNo }, + success: function (result) { + // 处理成功的情况 + if (!result.success) { + hg.msg(`RecordNumber【${recordNumber}】 LineNo【${lineNo}】 已備貨完`); + $("#recordNumber").val(''); + $("#lineNo").val(''); + $("#Customer").val(''); + $('#PartNumber').val(''); + $("#PartDesc").val(''); + } + }, + error: function (error) { + hg.msg('錯誤:' + error); + console.log(error); + } + }); + } }); + $('#PartNumber').on('keypress', function (event) { if (event.keyCode == 13) { getItemDesc(document.getElementById('PartNumber').value); @@ -366,6 +412,11 @@ } // 用来统计重复的SN var duplicateSNs = []; + // 清空表格 + layui.table.reload('query', { + data: [], + }); + res.data.forEach(function (item) { if (isSNAlreadyExist('query', item.sn)) { // 将重复的SN加入到duplicateSNs数组中 diff --git a/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml index 361979bd..49cb1579 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD003.cshtml @@ -41,7 +41,7 @@
+
@@ -58,15 +58,15 @@
- +
- +
- +
@@ -74,11 +74,19 @@
-
+
- + +
+ +
+ +
+ +
+
@@ -90,7 +98,7 @@
- +
@@ -118,9 +126,12 @@
+
+ +
-
+
@section Scripts{ @@ -214,36 +225,50 @@ }; $('#recordNumber').on('keypress', function (event) { - if (event.keyCode == 13) { getCustomer($('#recordNumber').val()); } - }); //监听表单提交事件 hg.form.onsubmit('querysubmit', function (data) { hg.msghide("重新載入資料.."); data.autoLoad = 1; - table && table.reload(data); + //table && table.reload(data); + console.log(data); + layui.table.reload('query', { + where: { + recordType: data.recordType, + recordNumber: data.recordNumber, + lineNo: data.lineNo, + materialNo: data.materialNo, + shippingSN: data.shippingSN, + dateStart: data.dateStart, + dateEnd: data.dateEnd, + autoLoad: data.autoLoad, + RBU: data.RBU, + soNumber: data.soNumber, + soLineNo: data.soLineNo, + customer: data.customer + }, + done: function (res, curr, count) { + $('#rowCount').text('總筆數: ' + count); + } + }); }); var tableCols = [[ { field: 'recordTypeID', title: 'RecordType', - sort: true }, { field: 'recordNumber', title: 'RecordNumber', - sort: true }, { field: 'lineNo', - width: 120, title: 'LineNo', - sort: true }, { field: 'sn', @@ -259,14 +284,18 @@ { field: 'customer', title: 'Customer', - width: 160, - sort: true + }, + { + field: 'soNumber', + title: 'SO Number', + }, + { + field: 'soLineNo', + title: 'SO Line', }, { field: 'location', title: 'Location', - width: 100, - sort: true }, { field: 'creatorID', diff --git a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml index 4390d179..b012da85 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD006.cshtml @@ -204,9 +204,11 @@ var recordNumber = document.getElementById('recordNumber').value; var recordType = document.getElementById('recordType').value; var recordTypeInfo = @Html.Raw(Json.Serialize(ViewBag.RecordTypeInfo)); + var lineNo = document.getElementById('lineNo').value; var filteredInfo = recordTypeInfo.find(function (info) { return info.id === recordType; }); + //check recordNumber if (recordNumber.length !== filteredInfo.length) { layer.msg('請確認recordNumber碼長!', { icon: 2 }); @@ -221,25 +223,51 @@ return; } - table.reload('query', { - where: { - recordNumber: recordNumber - }, - page: { - curr: 1 + if (lineNo.length === 0) { + document.getElementById('lineNo').focus(); + } + else { + table.reload('query', { + where: { + recordNumber: recordNumber, + LineNO: lineNo + }, + page: { + curr: 1 + }, + done: function (res, curr, count) { + // 表格更新成功後計算資料筆數 + calculateRowCount(res.data); + } + }); + + $.ajax({ + url: '@Url.Action("CheckRecordNoIsRecord", "PTD")', + type: 'POST', + data: { dnNo: recordNumber, dnlineNo: lineNo }, + success: function (result) { + // 处理成功的情况 + if (!result.success) { + hg.msg(`RecordNumber【${recordNumber}】 LineNo【${lineNo}】 已備貨完`); + $("#recordNumber").val(''); + $("#lineNo").val(''); + $("#Customer").val(''); + $('#PartNumber').val(''); + $("#PartDesc").val(''); + } }, - done: function (res, curr, count) { - // 表格更新成功後計算資料筆數 - calculateRowCount(res.data); - var lineNo = document.getElementById('lineNo'); - lineNo.focus(); + error: function (error) { + hg.msg('錯誤:' + error); + console.log(error); } }); + } //calculateRowCount(table.cache['query']); //var lineNo = document.getElementById('lineNo'); //lineNo.focus(); } }); + $('#lineNo').on('keypress', function (event) { if (event.keyCode == 13) { var table = layui.table; @@ -285,8 +313,30 @@ console.log(error); } }); + + $.ajax({ + url: '@Url.Action("CheckRecordNoIsRecord", "PTD")', + type: 'POST', + data: { dnNo: recordNumber, dnlineNo: lineNo }, + success: function (result) { + // 处理成功的情况 + if (!result.success) { + hg.msg(`RecordNumber【${recordNumber}】 LineNo【${lineNo}】 已備貨完`); + $("#recordNumber").val(''); + $("#lineNo").val(''); + $("#Customer").val(''); + $('#PartNumber').val(''); + $("#PartDesc").val(''); + } + }, + error: function (error) { + hg.msg('錯誤:' + error); + console.log(error); + } + }); } }); + $('#snQuery').on('keypress', function (event) { if (event.keyCode == 13) { var table = layui.table; @@ -421,7 +471,6 @@ done: function(res, curr, count) { // 表格更新成功後計算資料筆數 calculateRowCount(res.data); - } }); } diff --git a/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml b/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml index 77b2fbe2..0bf3ae22 100644 --- a/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml +++ b/AMESCoreStudio.Web/Views/PTD/PTD008.cshtml @@ -56,7 +56,7 @@
- +
@@ -69,7 +69,7 @@
-
@@ -97,89 +97,103 @@ } \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs index e6857d5a..492d2ad7 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.Models.SYS; using AMESCoreStudio.CommonTools.Result; using AMESCoreStudio.WebApi.DTO.AMES; using System.Data; @@ -148,6 +149,157 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + /// + /// 查詢工單站別在製條碼資料 + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetWipBarcode4QRS009New(int wipID, int stationID, int page = 0, int limit = 10) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.BarcodeInfoes + join q2 in _context.WipInfos on q1.WipID equals q2.WipID + join q3 in _context.LineInfoes on q2.LineID equals q3.LineID + select new + { + q1.BarcodeID, + q1.WipID, + q1.StationID, + q1.BarcodeNo, + q3.LineDesc, + q1.RuleStatus, + q1.SysType, + q1.CreateDate, + q1.UpdateDate, + UserName = "" + }; + + q = q.Where(w => w.WipID == wipID && w.StationID == stationID); + + var datas = await q.ToListAsync(); + + //紀錄筆數 + result.DataTotal = q.Distinct().ToList().Count(); + + //Table 頁數 + if (page > 0) + { + q = q.Distinct().Skip((page - 1) * limit).Take(limit); + } + + DataTable dt = new DataTable(); + dt.Columns.Add("barcodeID"); + dt.Columns.Add("wipID"); + dt.Columns.Add("stationID"); + dt.Columns.Add("barcodeNo"); + dt.Columns.Add("lineDesc"); + dt.Columns.Add("ruleStatus"); + dt.Columns.Add("sysType"); + dt.Columns.Add("createDate"); + dt.Columns.Add("updateDate"); + dt.Columns.Add("userName"); + dt.AcceptChanges(); + + foreach (var data in datas) + { + IQueryable q2 = _context.BarcodeStation; + q2 = q2.Where(w => w.WipID == data.WipID && w.BarcodeID == data.BarcodeID && w.StationID == data.StationID); + q2 = q2.OrderByDescending(w => w.CreateDate); + + var barcode_item = await q2.ToListAsync(); + + IQueryable q3 = _context.UserInfoes; + q3 = q3.Where(w => w.UserID == barcode_item[0].CreateUserID); + var user_info = await q3.ToListAsync(); + + //data.UserName = user_info[0].UserName; + + DataRow dr = dt.NewRow(); + dr[0] = data.BarcodeID; + dr[1] = data.WipID; + dr[2] = data.StationID; + dr[3] = data.BarcodeNo; + dr[4] = data.LineDesc; + dr[5] = data.RuleStatus; + dr[6] = data.SysType; + dr[7] = data.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"); + dr[8] = data.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss"); + dr[9] = user_info[0].UserName; + + dt.Rows.Add(dr); + dt.AcceptChanges(); + } + + //var dt_data = dt.AsEnumerable().ToList(); + var dt_data = dt.Rows.Cast().Select(row => new QRS009WDto(row)).ToList(); + + result.Data = dt_data; + //result.Data = datas; + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + /// + /// 查詢工單站別在製條碼資料 + /// + /// + [Route("[action]")] + [HttpGet] + public async Task> GetWipBarcodeCount4QRS009(int wipID, int stationID, int page = 0, int limit = 10) + { + ResultModel result = new ResultModel(); + var q = from q1 in _context.BarcodeInfoes + join q2 in _context.WipInfos on q1.WipID equals q2.WipID + join q3 in _context.LineInfoes on q2.LineID equals q3.LineID + select new + { + q1.BarcodeID, + q1.WipID, + q1.StationID, + q1.BarcodeNo, + q3.LineDesc, + q1.RuleStatus, + q1.SysType, + q1.CreateDate, + q1.UpdateDate + }; + + q = q.Where(w => w.WipID == wipID && w.StationID == stationID); + + + //紀錄筆數 + result.DataTotal = q.Distinct().ToList().Count(); + + //Table 頁數 + if (page > 0) + { + q = q.Distinct().Skip((page - 1) * limit).Take(limit); + } + + result.Data = await q.Distinct().ToListAsync(); + + if (result == null) + { + result.Msg = "查無資料"; + result.Success = false; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + /// /// 用工單號碼获取该條碼资料 /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/QRS009WDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/QRS009WDto.cs new file mode 100644 index 00000000..72f36e51 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/QRS009WDto.cs @@ -0,0 +1,35 @@ +using System.Data; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + public class QRS009WDto + { + public string BarcodeID { get; set; } + public string WipID { get; set; } + public string StationID { get; set; } + public string BarcodeNo { get; set; } + public string LineDesc { get; set; } + public string RuleStatus { get; set; } + public string SysType { get; set; } + public string CreateDate { get; set; } + public string UpdateDate { get; set; } + public string UserName { get; set; } + + // 其他需要的列 + + public QRS009WDto(DataRow row) + { + BarcodeID = row.Field("BarcodeID"); + WipID = row.Field("WipID"); + StationID = row.Field("StationID"); + BarcodeNo = row.Field("BarcodeNo"); + LineDesc = row.Field("LineDesc"); + RuleStatus = row.Field("RuleStatus"); + SysType = row.Field("SysType"); + CreateDate = row.Field("CreateDate"); + UpdateDate = row.Field("UpdateDate"); + UserName = row.Field("UserName"); + // 设置其他列的值 + } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/NgRepair.cs b/AMESCoreStudio.WebApi/Models/AMES/NgRepair.cs index df794fa3..0e964661 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/NgRepair.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/NgRepair.cs @@ -62,7 +62,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// 維修說明 /// [Column("REPAIR_DESC")] - [StringLength(100)] + [StringLength(500)] [DataMember] [Display(Name = "維修說明")] public string RepairDesc { get; set; } From 5d4e0358fba00c4b69d37a507cd659cf447ea13a Mon Sep 17 00:00:00 2001 From: Marvin Date: Wed, 7 Aug 2024 22:18:32 +0800 Subject: [PATCH 22/23] =?UTF-8?q?1.=E9=87=8D=E6=96=B0=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AMES/BarcodeInfoesController.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs index 492d2ad7..eca32dcf 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeInfoesController.cs @@ -206,7 +206,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES IQueryable q2 = _context.BarcodeStation; q2 = q2.Where(w => w.WipID == data.WipID && w.BarcodeID == data.BarcodeID && w.StationID == data.StationID); q2 = q2.OrderByDescending(w => w.CreateDate); - var barcode_item = await q2.ToListAsync(); IQueryable q3 = _context.UserInfoes; From 9151cd4a1f7b8dbb6d254fea8c4174ab49583778 Mon Sep 17 00:00:00 2001 From: Marvin Date: Thu, 8 Aug 2024 15:12:22 +0800 Subject: [PATCH 23/23] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9PCSController?= =?UTF-8?q?=E7=9A=84PutWipClearDetail=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8C=87?= =?UTF-8?q?=E5=AE=9Auser=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Controllers/PCSController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index fcffe24f..8bcbd47a 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -9204,6 +9204,8 @@ namespace AMESCoreStudio.Web.Controllers { IResultModel result; + model.UpdateUserID = user_id; + result = await _pcsApi.PutWipClearDetail(model.ClearDetailID, JsonConvert.SerializeObject(model)); if (result.Success)