From 95c155fa9280e2f0db5622eb825a0283e34f56a4 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 8 Aug 2022 00:06:07 +0800 Subject: [PATCH] =?UTF-8?q?1=20UI=E4=B8=8A=E5=82=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCSController.cs | 112 ++++++------ AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 14 ++ .../ViewModels/PCS/PCS027ViewModel.cs | 33 ++++ AMESCoreStudio.Web/Views/PCS/PCS022.cshtml | 169 ++++++++++++++++++ AMESCoreStudio.Web/Views/PCS/PCS027.cshtml | 139 ++++++++++---- .../AMES/BarcodeItemsController.cs | 53 ++++++ .../DTO/AMES/BarcodeItemDto.cs | 11 ++ 7 files changed, 439 insertions(+), 92 deletions(-) create mode 100644 AMESCoreStudio.Web/ViewModels/PCS/PCS027ViewModel.cs create mode 100644 AMESCoreStudio.Web/Views/PCS/PCS022.cshtml diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 79f0db9e..b9fe05f7 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -5643,6 +5643,37 @@ namespace AMESCoreStudio.Web.Controllers } #endregion + #region PCS022 條碼输入整批作業 + public async Task PCS022() + { + await GetItemsList(); + return View(); + } + + /// + /// PCS022 Query + /// + /// 工單號料 + /// 內部條碼 + /// 組件編號 + /// 內部條碼List + /// 選擇查詢類型 + /// + public async Task PCS022QueryAsync(string wipNo, string barCode, string KPItemNo, + string BarCodeItem, string type, int page = 0, int limit = 10) + { + IResultModel result = await _pcsApi.GetBarcodeItemByPCS027Query(wipNO: wipNo, + barCode: barCode, KPItemNo: KPItemNo, BarCodeItem: BarCodeItem + , page: page, limit: limit); + + if (result.Data.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + return Json(new Table() { count = 0, data = null }); + } + #endregion + #region PCS023 條碼置換 public ActionResult PCS023() { @@ -5912,67 +5943,28 @@ namespace AMESCoreStudio.Web.Controllers return Json(new { data = string.Join(",", Print) }); } - //[HttpPost] - //public async Task PCS027CAsync(MaterialSop model, IFormFile formFile) - //{ - // string FileName = string.Empty; - // string NewName = string.Empty; - // string FilePath = string.Empty; + /// + /// PCS027 Query + /// + /// 工單號料 + /// 內部條碼 + /// 組件編號 + /// 內部條碼List + /// 選擇查詢類型 + /// + public async Task PCS027QueryAsync(string wipNo, string barCode, string KPItemNo, + string BarCodeItem, string type, int page = 0, int limit = 10) + { + IResultModel result = await _pcsApi.GetBarcodeItemByPCS027Query(wipNO: wipNo, + barCode: barCode, KPItemNo: KPItemNo, BarCodeItem: BarCodeItem + , page: page, limit: limit); - // //var fileProvider = _fileServerProvider.GetProvider("/aa"); - // //var fileInfo = fileProvider.GetFileInfo("/"); - // if (formFile != null) - // { - // if (formFile.Length > 0) - // { - // //取得使用者上傳檔案的原始檔名 - // FileName = Path.GetFileName(formFile.FileName); - // //取原始檔名中的副檔名 - // var fileExt = Path.GetExtension(FileName); - // //為避免使用者上傳的檔案名稱發生重複,重新給一個亂數名稱 - // NewName = Path.GetRandomFileName() + fileExt; - // //指定要寫入的路徑、檔名和副檔名 - // FilePath = $"\\PDF\\";//本機目錄 - // using (var stream = new FileStream(_env.WebRootPath + FilePath + NewName, FileMode.Create)) - // { - // await formFile.CopyToAsync(stream); - // } - - // //var fileProvider = _fileServerProvider.GetProvider("/aa"); - // //var fileInfo = fileProvider.GetFileInfo(formFile.FileName); - // //fileInfo = fileProvider.GetFileInfo(formFile.FileName); - // ////遠端目錄 - // //using (var stream = new FileStream(fileInfo.PhysicalPath, FileMode.Create)) - // //{ - // // await formFile.CopyToAsync(stream); - // //} - - - - // IResultModel result; - // //model.FileName = FileName; - // //model.NewName = NewName; - // //model.FilePath = FilePath;// fileInfo.PhysicalPath; - - // result = await _pcsApi.PostMaterialSop(JsonConvert.SerializeObject(model)); - // if (result.Success) - // { - // var _msg = model.MaterialSopID == 0 ? "新增成功!" : "修改成功!"; - // return RedirectToAction("Refresh", "Home", new { msg = _msg }); - // } - // else - // { - // ModelState.AddModelError("error", result.Msg); - // } - // } - // } - // else - // { - // ModelState.AddModelError("error", "請選擇要上傳檔案"); - // } - // await GetFactoryUnit(); - // return View(model); - //} + if (result.Data.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + return Json(new Table() { count = 0, data = null }); + } #endregion [ResponseCache(Duration = 0)] diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 15de7efa..9f682694 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -369,6 +369,20 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpGet("api/BarcodeItems/ByPartNo/{id}")] ITask> GetBarcodeItemByPartNo(string id); + + /// + /// 製程工單鎖定查詢 Query By組件批次刪除 + /// + /// 工單號料 + /// 內部條碼 + /// 組件編號 + /// 內部條碼List + /// 頁數 + /// 筆數 + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeItems/BarCodeByPCS027")] + ITask> GetBarcodeItemByPCS027Query(string wipNO = null, string barCode = null, string KPItemNo = null, + string BarCodeItem = null, int page = 0, int limit = 10); #endregion #region NgInfo 測試不良基本資料檔 PCS021 PCS009 diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS027ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS027ViewModel.cs new file mode 100644 index 00000000..b20b5b2a --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS027ViewModel.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.DTO.AMES; + +namespace AMESCoreStudio.Web.ViewModels.PCS +{ + public class PCS027ViewModel + { + /// + /// 工單號碼 + /// + public string WipNo { get; set; } + + /// + /// 內部序號 + /// + public string Barcode { get; set; } + + /// + /// 內部序號 List + /// + public string BarCodeItem { get; set; } + + /// + /// KP ItemNo + /// + public int KPItemNo { get; set; } = 0; + } +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml new file mode 100644 index 00000000..c621a360 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCS/PCS022.cshtml @@ -0,0 +1,169 @@ + + +@{ ViewData["Title"] = "條碼输入整批作業"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + +
+
+
@ViewBag.Title
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + @*
+
+ +
+
*@ + +
+
+
+@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + +} + diff --git a/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml index c59819ae..75a31165 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml @@ -1,4 +1,4 @@ -@model AMESCoreStudio.WebApi.Models.AMES.MaterialSop +@model AMESCoreStudio.Web.ViewModels.PCS.PCS027ViewModel @{ ViewData["Title"] = "組件批次刪除作業"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; @@ -21,7 +21,7 @@
-
@@ -29,29 +29,29 @@
- +
- +
- +
- +
- +
@@ -66,15 +66,27 @@
- +
-
+
+
+ +
+
+ +
+
+ + @*
-
+
*@ +
@@ -82,10 +94,17 @@ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); await Html.RenderPartialAsync("_FileinputScriptsPartial"); } - + }); + + var tableCols = [[ + { + field: 'wipNo', + width: 150, + title: '工單號碼', + sort: true + }, + { + field: 'barcode', + title: '內部條碼', + sort: true + }, + { + field: 'itemNoName', + title: '組件類別', + width: 150, + sort: true + }, + { + field: 'partNo', + title: '組件條碼', + sort: true + }, + { + field: 'kpItemNo', + title: '組件料號', + width: 100, + sort: true + }, + { + field: 'stationName', + title: '過站別', + width: 100 + }, + { + field: 'unLockDate', + title: '過站時間', + width: 100, + templet: '
{{ layui.util.toDateString(d.unLockDate, "yyyy/MM/dd") }}
' + }] + ]; + + var toolbar = [{ + text: '批次刪除', + layuiicon: '', + class: 'layui-btn-danger', + handler: function () { + hg.open('新增條碼鎖定', '/PCS/PCS013/', 700, 480); + + } + } + ]; + + //基本数据表格 + var table = hg.table.datatable('query', '組件批次刪除料查詢', '/PCS/PCS027Query', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs index cf51fe21..1974f031 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeItemsController.cs @@ -271,6 +271,59 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return await q.ToListAsync(); } + /// + /// + /// + /// 工單號料 + /// 內部條碼 + /// 組件編號 + /// 內部條碼List + /// 頁數 + /// 筆數 + /// + [HttpGet("BarCodeByPCS027")] + public async Task> GetBarcodeItemByPCS027(string wipNO, string barCode, string KPItemNo, + string BarCodeItem, int page = 0, int limit = 10) + { + + var q = from q1 in _context.BarcodeItems.Where(w => w.WipID == 1002) + join q2 in _context.Items on q1.ItemNo equals q2.ItemNo + join q3 in _context.RuleStations on q1.RuleStationID equals q3.RuleStationID + join q4 in _context.UserInfoes on q1.CreateUserID equals q4.UserID + join q5 in _context.WipInfos on q1.WipID equals q5.WipID + join q6 in _context.BarcodeInfoes on q1.BarcodeID equals q6.BarcodeID + select new BarcodeItemDTO + { + BarcodeID = q1.BarcodeID, + Barcode = q6.BarcodeNo, + WipID = q1.WipID, + PartNo = q1.PartNo, + KpItemNo = q1.KpItemNo, + ItemNoName = q2.ItemName, + StationName = q3.StationDesc, + RuleStationID = q1.RuleStationID, + CreateUser = q4.UserName, + CreateDate = q1.CreateDate, + SysType = q1.SysType, + WipNo = q5.WipNO + }; + + ResultModel result = new ResultModel(); + + // 紀錄筆數 + result.DataTotal = q.Count(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + + result.Data = await q.ToListAsync(); + + return result; + } + /// /// 用barcode獲取資料 /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs index 9384a571..7bf69c7e 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/BarcodeItemDto.cs @@ -18,11 +18,22 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// public int BarcodeID { get; set; } + + /// + /// 内部條碼 + /// + public string Barcode { get; set; } + /// /// 工單ID /// public int WipID { get; set; } + /// + /// 工單 + /// + public string WipNo { get; set; } + /// /// 流程站 ///