diff --git a/AMESCoreStudio.Web/Controllers/PCBController.cs b/AMESCoreStudio.Web/Controllers/PCBController.cs index 36bd3edc..fface035 100644 --- a/AMESCoreStudio.Web/Controllers/PCBController.cs +++ b/AMESCoreStudio.Web/Controllers/PCBController.cs @@ -1428,10 +1428,130 @@ namespace AMESCoreStudio.Web.Controllers { return View(); } + + //修改页面 + [HttpGet] + public async Task PCB013U(int id) + { + var result = await _pcbApi.GetSteelPlateInfo(id); + return View(result); + } + + //頁面提交,id=0 添加,id>0 修改 + [HttpPost] + public async Task PCB013Async(SteelPlateInfo model) + { + if (ModelState.IsValid) + { + IResultModel result; + if (model.SteelPlateID == 0) + { + model.CreateUserID = GetLogInUserID(); + model.CreateDate = DateTime.Now; + model.UpdateUserID = GetLogInUserID(); + model.UpdateDate = DateTime.Now; + result = await _pcbApi.PostSteelPlateInfo(JsonConvert.SerializeObject(model)); + } + else + { + model.UpdateUserID = GetLogInUserID(); + model.UpdateDate = DateTime.Now; + result = await _pcbApi.PutSteelPlateInfo(JsonConvert.SerializeObject(model)); + } + + if (result.Success) + { + var _msg = model.SteelPlateID == 0 ? "新增成功!" : "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + + ModelState.AddModelError("error", result.Msg); + } + } + + if (model.SteelPlateID == 0) + { + return View("PCB013C", model); + } + return View("PCB013U", model); + } #endregion #region PCB014 錫膏使用管控 + public ActionResult PCB014() + { + return View(); + } + public async Task PCB014QueryAsync(string steelPlateNo, string pcbPartNo + , string side, string status, int page = 0, int limit = 10) + { + //IResultModel result = await _pcbApi.GetSolderPasteInfoQuery(steelPlateNo: steelPlateNo, pcbPartNo: pcbPartNo + //, side: side, status: status, 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 }); + } + + //新增頁面 + public IActionResult PCB014C() + { + return View(); + } + + //修改页面 + [HttpGet] + public async Task PCB014U(int id) + { + var result = await _pcbApi.GetSolderPasteInfo(id); + return View(result); + } + + //頁面提交,id=0 添加,id>0 修改 + [HttpPost] + public async Task PCB014Async(SteelPlateInfo model) + { + if (ModelState.IsValid) + { + IResultModel result; + if (model.SteelPlateID == 0) + { + model.CreateUserID = GetLogInUserID(); + model.CreateDate = DateTime.Now; + model.UpdateUserID = GetLogInUserID(); + model.UpdateDate = DateTime.Now; + result = await _pcbApi.PostSolderPasteInfo(JsonConvert.SerializeObject(model)); + } + else + { + model.UpdateUserID = GetLogInUserID(); + model.UpdateDate = DateTime.Now; + result = await _pcbApi.PutSolderPasteInfo(JsonConvert.SerializeObject(model)); + } + + if (result.Success) + { + var _msg = model.SteelPlateID == 0 ? "新增成功!" : "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + + ModelState.AddModelError("error", result.Msg); + } + } + + if (model.SteelPlateID == 0) + { + return View("PCB014C", model); + } + return View("PCB014U", model); + } #endregion /// diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index d5602f42..79f0db9e 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -21,6 +21,7 @@ using System.Threading.Tasks; using AMESCoreStudio.WebApi.Enum; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Configuration; +using ClosedXML.Excel; namespace AMESCoreStudio.Web.Controllers { @@ -28,6 +29,7 @@ namespace AMESCoreStudio.Web.Controllers public class PCSController : Controller { + private readonly ILogger _logger; private readonly ILogger _log; public readonly ISYS _sysApi; @@ -5873,6 +5875,106 @@ namespace AMESCoreStudio.Web.Controllers #endregion + #region PCS027 組件資料整批刪除 + public async Task PCS027() + { + await GetItemsList(); + return View(); + } + + [HttpPost] + public JsonResult PCS027_Excel(IFormFile Uploader) + { + List Print = new List(); + //通過上傳檔案流初始化Mapper + using (var workbook = new XLWorkbook(Uploader.OpenReadStream())) + { + var worksheet = workbook.Worksheet(1); + // 定義資料起始/結束 Cell + var firstCell = worksheet.FirstCellUsed(); + var lastCell = worksheet.LastCellUsed(); + + // 使用資料起始/結束 Cell,來定義出一個資料範圍 + var data = worksheet.Range(firstCell.Address, lastCell.Address); + var rowCount = data.RowCount(); + var columnCount = data.ColumnCount(); + for (int i = 1; i <= rowCount; i++) + { + // 取得每一欄 + if (data.Cell(i, 1).Value.ToString() != null) + { + Print.Add(data.Cell(i, 0).Value.ToString()); + } + } + } + + //将数据Json化并传到前台视图 + 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; + + // //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); + //} + #endregion + [ResponseCache(Duration = 0)] [HttpGet] public async Task PCS030() @@ -6146,6 +6248,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion + [HttpPost] public JsonResult TestFunc(string number) { @@ -6180,9 +6283,6 @@ namespace AMESCoreStudio.Web.Controllers return PartialView("~/Views/Shared/PCS/_SOPPartial", Json(new Table() { code = 0, msg = "", data = result, count = result.Count })); } - - - [HttpGet] public async Task SOP() { @@ -6312,74 +6412,6 @@ namespace AMESCoreStudio.Web.Controllers } } - - public IActionResult PCS027() - { - return View(); - } - - [HttpPost] - public async Task PCS027CAsync(MaterialSop model, IFormFile formFile) - { - string FileName = string.Empty; - string NewName = string.Empty; - string FilePath = string.Empty; - - //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); - } - #endregion //YIRU ADD ------------------------------------------------------------------------------------------------------------------------------- diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs index 55f38ade..40619be4 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs @@ -83,7 +83,7 @@ namespace AMESCoreStudio.Web /// 工單號碼 /// [WebApiClient.Attributes.HttpGet("api/QcItem/QcItemQuery")] - ITask> GetQcItemQuery(int groupID, int page, int limit,string itemNo = null,string wipNo = null); + ITask> GetQcItemQuery(int groupID, int page, int limit, string itemNo = null, string wipNo = null); /// /// 查詢檢驗項目維護 ID @@ -322,7 +322,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/FqcQuery/{inhouseNo}")] - ITask> GetFqcQuery(string inhouseNo,int? seqid = 1); + ITask> GetFqcQuery(string inhouseNo, int? seqid = 1); /// /// 獲取不良現象群組資料 @@ -343,7 +343,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/NGReasons/Class/{no}")] - ITask> GetNGReasonsByClass(string no , int page = 0, int limit = 1000); + ITask> GetNGReasonsByClass(string no, int page = 0, int limit = 1000); /// /// 用內部序號取BarCode資料 @@ -371,7 +371,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/FqcResultMaster/ByInhouseNo/{inhouseNo}/{seq}")] - ITask> GetFqcResultMasterByInhouseNo(string inhouseNo,int seq); + ITask> GetFqcResultMasterByInhouseNo(string inhouseNo, int seq); /// /// 用入庫單號與序號取檢驗單明细資料 @@ -473,35 +473,78 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/SteelPlateInfo/SteelPlateInfoQuery")] ITask> GetSteelPlateInfoQuery(string steelPlateNo = null, string pcbPartNo = null , string side = null, string status = null, int page = 0, int limit = 10); + + /// + /// 新增鋼板資料 + /// + /// + [WebApiClient.Attributes.HttpPost("api/SteelPlateInfo")] + ITask> PostSteelPlateInfo([FromBody, RawJsonContent] string model); + + /// + /// 更新鋼板資料 + /// + /// + [WebApiClient.Attributes.HttpPut("api/SteelPlateInfo")] + ITask> PutSteelPlateInfo([FromBody, RawJsonContent] string model); + + /// + /// 查詢鋼板資料 ID + /// + /// + [WebApiClient.Attributes.HttpGet("api/SteelPlateInfo/{id}")] + ITask GetSteelPlateInfo(int id); + + /// + /// 查詢鋼板資料 By No + /// + /// + [WebApiClient.Attributes.HttpGet("api/SteelPlateInfo/ByNo/{id}")] + ITask> GetSteelPlateInfoByNo(string id); #endregion - #region FQC009 料號檢驗工項維護 + #region PCB014 錫膏使用管控 /// - /// MaterialItem 料號基本資料檔 + /// 鋼板資料查詢 /// - /// 料號 - [WebApiClient.Attributes.HttpGet("api/MaterialItem/ByItemNO/{id}")] - ITask GetMaterialItemByItemNO(string id); + /// 鋼板編號 + /// PCB板號 + /// 正背面 + /// 狀態 + /// 頁數 + /// 筆數 + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/SolderPasteInfoQuery")] + ITask> GetSolderPasteInfoQuery(string steelPlateNo = null, string pcbPartNo = null + , string side = null, string status = null, int page = 0, int limit = 10); /// - /// MaterialItem 料號查詢綁定檢驗工項 + /// 新增鋼板資料 /// - /// 料號 - [WebApiClient.Attributes.HttpGet("api/MaterialFqcItem/ByitemNo/{id}")] - ITask> GetMaterialFqcItemsByitemNo(string id); + /// + [WebApiClient.Attributes.HttpPost("api/SolderPasteInfo")] + ITask> PostSolderPasteInfo([FromBody, RawJsonContent] string model); + + /// + /// 更新鋼板資料 + /// + /// + [WebApiClient.Attributes.HttpPut("api/SolderPasteInfo")] + ITask> PutSolderPasteInfo([FromBody, RawJsonContent] string model); /// - /// MaterialItem 新增料號綁定檢驗工項 + /// 查詢鋼板資料 ID /// - [WebApiClient.Attributes.HttpPost("api/MaterialFqcItem")] - ITask> PostMaterialFqcItem([FromBody, RawJsonContent] string model); + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/{id}")] + ITask GetSolderPasteInfo(int id); /// - /// MaterialItem 刪除料號綁定檢驗工項 + /// 查詢鋼板資料 By No /// /// - [WebApiClient.Attributes.HttpDelete("api/MaterialFqcItem/{id}")] - ITask> DeleteMaterialFqcItem(int id); + [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/ByNo/{id}")] + ITask> GetSolderPasteInfoByNo(string id); #endregion } } diff --git a/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml index 7e3e4754..6ce89669 100644 --- a/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml +++ b/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml @@ -138,60 +138,58 @@ var tableCols = [[ { field: 'steelPlateNo', - width: 80, - title: '委外廠', + title: '鋼板編號', sort: true }, { field: 'specification', - title: '入庫時間', - sort: true + title: '規格', }, { field: 'pcbPartNo', - width: 150, - title: '入庫單號', + title: 'PCB板編號', sort: true }, { field: 'sideName', - title: '順序', - width: 60 + title: '正背面', + width: 70 }, { field: 'boards', - title: '工單號碼', + title: '連板數', + width: 85, sort: true }, { field: 'standardTension1', - title: '料號', - sort: true + title: '張力1', + width: 70 }, { field: 'standardTension2', - title: '料號', - sort: true + title: '張力2', + width: 70 }, { field: 'standardTension3', - title: '料號', - sort: true + title: '張力3', + width: 70 }, { field: 'standardTension4', - title: '料號', - sort: true + title: '張力4', + width: 70 }, { field: 'standardTension5', - title: '料號', - sort: true + title: '張力5', + width: 70 }, { field: 'statusName', width: 60, - title: '批量' + title: '狀態' }, { title: '操作', @@ -204,8 +202,8 @@ ]]; //通过行tool编辑,lay-event="edit" function edit(obj) { - if (obj.data.inhouseNo) { - hg.open('FQC抽驗作業', '/FQC/FQC007?inhouseNo=' + obj.data.inhouseNo + '&seqID=' + obj.data.seqID, '', '', true); + if (obj.data.steelPlateID) { + hg.open('修改鋼板基本資料', '/PCB/PCB013U?id=' + obj.data.steelPlateID, 700, 500); } } @@ -224,14 +222,4 @@ var table = hg.table.datatable('query', '鋼板資料查詢', '/PCB/PCB013Query', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); // var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/GetWipInfo', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); - - } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml index 19866d69..e5e13e8f 100644 --- a/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml +++ b/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml @@ -59,12 +59,12 @@
- +
- +
@@ -74,12 +74,12 @@
- +
- +
@@ -88,7 +88,7 @@
- +
@@ -133,6 +133,11 @@ parent.hg.msg(error); } }); + + function clearNoNum(obj) { + //先把非數字的都替換掉,除了數字和. + obj.value = obj.value.replace(/[^\d.]/g, ""); + } diff --git a/AMESCoreStudio.Web/Views/PCB/PCB013U.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB013U.cshtml new file mode 100644 index 00000000..dcb1254a --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB013U.cshtml @@ -0,0 +1,142 @@ +@model AMESCoreStudio.WebApi.Models.AMES.SteelPlateInfo +@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ + @Html.ValidationMessage("error") +
+
+ +
+
+
+
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} diff --git a/AMESCoreStudio.Web/Views/PCB/PCB014.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB014.cshtml new file mode 100644 index 00000000..e5994c44 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB014.cshtml @@ -0,0 +1,199 @@ +@{ + ViewData["Title"] = "錫膏資料查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + +
+
+
+
+
@ViewBag.Title
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml new file mode 100644 index 00000000..d3bf15d8 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml @@ -0,0 +1,121 @@ +@model AMESCoreStudio.WebApi.Models.AMES.SolderPasteInfo + + +@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + +
+
+
+
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ + @Html.ValidationMessage("error") +
+
+ +
+
+
+
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} diff --git a/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml new file mode 100644 index 00000000..5377874f --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml @@ -0,0 +1,122 @@ +@model AMESCoreStudio.WebApi.Models.AMES.SolderPasteInfo + + +@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ + @Html.ValidationMessage("error") +
+
+ +
+
+
+
+
+
+ +@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 78bcd698..c59819ae 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS027.cshtml @@ -1,7 +1,6 @@ @model AMESCoreStudio.WebApi.Models.AMES.MaterialSop - -@{ ViewData["Title"] = "PCS030C"; +@{ ViewData["Title"] = "組件批次刪除作業"; Layout = "~/Views/Shared/_AMESLayout.cshtml"; } @@ -12,64 +11,109 @@
-
-
-
- - -
-
- -
- - -
-
+
+
@ViewBag.Title
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
-
- -
- -
- +
+
+
+
+ +
+
-
-
- +
+
+ +
+
+ +
+ +
- -
+
+
+
+
+ +
+
- @Html.ValidationMessage("error") -
-
- -
+
+
+
- -
+
+
+
@section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); await Html.RenderPartialAsync("_FileinputScriptsPartial"); } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs index 824982a7..cf8393e5 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.DTO.AMES; using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.AMES @@ -46,6 +47,67 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return solderPasteInfo; } + /// + /// 錫膏資料查詢 + /// + /// 錫膏編號 + /// PCB板號 + /// 正背面 + /// 狀態 + /// 頁數 + /// 筆數 + /// + [HttpGet("SolderPasteInfoQuery")] + public async Task> GetSolderPasteInfo(string solderPasteNo, string pcbPartNo, string side + , string status, int page = 0, int limit = 10) + { + var q = await _context.SolderPasteInfos.ToListAsync(); + + if (!string.IsNullOrWhiteSpace(solderPasteNo)) + { + q = q.Where(w => w.SolderPasteNo.Contains(solderPasteNo)).ToList(); + } + + //if (!string.IsNullOrWhiteSpace(pcbPartNo)) + //{ + // q = q.Where(w => w.PcbPartNo.Contains(pcbPartNo)).ToList(); + //} + + //if (!string.IsNullOrWhiteSpace(side)) + //{ + // q = q.Where(w => w.Side.ToString() == side).ToList(); + //} + + if (!string.IsNullOrWhiteSpace(status)) + { + q = q.Where(w => w.Status == status).ToList(); + + } + ResultModel result = new ResultModel(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit).ToList(); + } + + // 紀錄筆數 + result.DataTotal = q.Count(); + + result.Data = q.Select(s => new SolderPasteInfoDto + { + SolderPasteID = s.SolderPasteID, + SolderPasteNo = s.SolderPasteNo, + Description = s.Description, + EffectiveDate = s.EffectiveDate, + ManufactoringDate = s.ManufactoringDate, + ReceiptDate = s.ReceiptDate, + StatusName = s.Status == "0" ? "失效" : "有效", + Remark = s.Remark + }).ToList(); + return result; + } + /// /// 更新錫膏基本資料檔 /// @@ -56,8 +118,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); _context.Entry(solderPasteInfo).State = EntityState.Modified; - solderPasteInfo.UpdateDate = DateTime.Now; - solderPasteInfo.UpdateUserID = 0; try { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs index 76e81714..543e1aca 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs @@ -47,6 +47,21 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return steelPlateInfo; } + /// + /// By 鋼板編號 查詢 + /// + /// 鋼板編號 + /// + [HttpGet("ByNo/{id}")] + public async Task>> GetSteelPlateInfoByNo(string id) + { + + var steelPlateInfos = await _context.SteelPlateInfos.Where(w => w.SteelPlateNo == id.ToUpper()) + .ToListAsync(); + + return steelPlateInfos; + } + /// /// 鋼板資料查詢 /// @@ -123,8 +138,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); _context.Entry(steelPlateInfo).State = EntityState.Modified; - steelPlateInfo.UpdateDate = DateTime.Now; - steelPlateInfo.UpdateUserID = 0; try { diff --git a/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs index ff8b36c2..cb6e65dc 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs @@ -44,7 +44,7 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// /// 狀態 0=失效 ; 1=有效 /// - public string Status { get; set; } = "1"; + public string StatusName { get; set; } = "1"; /// /// 備註