From ab9eddf28fa7363264c2c8a1b4c59ece1ec9c4a7 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 25 Mar 2023 10:52:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A8=AD=E5=82=99=E9=A0=98=E7=94=A8=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B8=AC=E8=A9=A6=E6=A1=8C=E8=99=9F=E5=8F=8A?= =?UTF-8?q?=E5=B7=A5=E5=96=AE=E6=96=99=E8=99=9F=E9=A1=AF=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/JIGController.cs | 98 +++++++++----- AMESCoreStudio.Web/Views/JIG/JIG005.cshtml | 2 +- AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml | 127 +++++++++++------- .../Models/AMES/OutfitStatusLog.cs | 8 ++ 4 files changed, 158 insertions(+), 77 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/JIGController.cs b/AMESCoreStudio.Web/Controllers/JIGController.cs index de343e6a..c172e8ee 100644 --- a/AMESCoreStudio.Web/Controllers/JIGController.cs +++ b/AMESCoreStudio.Web/Controllers/JIGController.cs @@ -25,7 +25,7 @@ namespace AMESCoreStudio.Web.Controllers public readonly IPPS _ppsApi; private readonly IWebHostEnvironment _env; - public JIGController(ILogger logger, IJIG jigApi, IWHS whsApi,IBAS basApi, IPCS pcsApi, ISYS sysApi, IPPS ppsApi, IWebHostEnvironment env) + public JIGController(ILogger logger, IJIG jigApi, IWHS whsApi, IBAS basApi, IPCS pcsApi, ISYS sysApi, IPPS ppsApi, IWebHostEnvironment env) { _logger = logger; _jigApi = jigApi; @@ -165,7 +165,7 @@ namespace AMESCoreStudio.Web.Controllers } ViewBag.UserID = user_id; } - + //yiru 2022-09-19 private async Task GetOutfitFactoryInfosList() { @@ -179,6 +179,38 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.OutfitFactoryList = GroupList; } + /// + /// 測試桌號 + /// + /// + private void GetTableNo() + { + var GroupList = new List(); + GroupList.Add(new SelectListItem("Other", "Other")); + for (int i = 1; i <= 56; i++) + { + GroupList.Add(new SelectListItem("T" + i.ToString(), "T" + i.ToString())); + } + ViewBag.OutfitTableNo = GroupList; + } + + /// + /// 工單號碼取工單號碼 + /// + /// + /// + [HttpPost] + public async Task getItemNo(string wipNo) + { + var result = await _pcsApi.GetWipAtt(wipNo); + //将数据Json化并传到前台视图 + if (result == null) + return Json(new { data = "" }); + else + + return Json(new { data = result.ItemNO}); + } + //yiru add end #endregion @@ -240,10 +272,11 @@ namespace AMESCoreStudio.Web.Controllers } } - else { - + else + { + ModelState.AddModelError("error", "缺少必填資料"); - return View("JIG001C", model); + return View("JIG001C", model); } } @@ -272,7 +305,7 @@ namespace AMESCoreStudio.Web.Controllers { GetUserID(); ModelState.AddModelError("error", "缺少必填資料"); - return View("JIG001U", model); + return View("JIG001U", model); } } @@ -361,8 +394,8 @@ namespace AMESCoreStudio.Web.Controllers { IResultModel result; - result = await _jigApi.PostOutfitVarityInfo(JsonConvert.SerializeObject(model)); - + result = await _jigApi.PostOutfitVarityInfo(JsonConvert.SerializeObject(model)); + if (result.Success) { @@ -437,7 +470,7 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } - public async Task GetOutfitVarityInfoesByQueryAsync(int TypeFlag, int CommodityID, string Status , int page = 0, int limit = 10) + public async Task GetOutfitVarityInfoesByQueryAsync(int TypeFlag, int CommodityID, string Status, int page = 0, int limit = 10) { var result = await _jigApi.GetOutfitVarityInfoesByQuery(TypeFlag, CommodityID, Status); @@ -478,8 +511,8 @@ namespace AMESCoreStudio.Web.Controllers } public async Task JIG003DAsync(int id) { - var result = await _jigApi.DeleteOutfitVendorInfo(id); - return Json(new Result() { success = true, msg = "" }); + var result = await _jigApi.DeleteOutfitVendorInfo(id); + return Json(new Result() { success = true, msg = "" }); } [HttpPost] @@ -503,7 +536,7 @@ namespace AMESCoreStudio.Web.Controllers msg = result.Msg; } } - if(msg=="") msg = "缺少必填資料"; + if (msg == "") msg = "缺少必填資料"; ModelState.AddModelError("error", msg); return View("JIG003C", model); } @@ -560,7 +593,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task JIG004C(int id) { GetUserID(); - // await GetFactoryList(); + // await GetFactoryList(); await GetOutfitCommodityInfoesList(); await GetOutfitVarityInfoesList(); await GetOutfitVendorInfoesList(); @@ -571,7 +604,7 @@ namespace AMESCoreStudio.Web.Controllers { GetUserID(); - // await GetFactoryList(); + // await GetFactoryList(); await GetOutfitCommodityInfoesList(); await GetOutfitVarityInfoesList(); await GetOutfitVendorInfoesList(); @@ -587,7 +620,7 @@ namespace AMESCoreStudio.Web.Controllers } - public async Task JIG004DAsync(int id ) + public async Task JIG004DAsync(int id) { GetUserID(); await GetOutfitCommodityInfoesList(); @@ -605,14 +638,14 @@ namespace AMESCoreStudio.Web.Controllers return View(result[0]); } - + } [HttpPost] public async Task JIG004CSaveAsync(OutfitInfo model) { var msg = ""; GetUserID(); - // await GetFactoryList(); + // await GetFactoryList(); await GetOutfitCommodityInfoesList(); await GetOutfitVarityInfoesList(); await GetOutfitVendorInfoesList(); @@ -668,7 +701,7 @@ namespace AMESCoreStudio.Web.Controllers //yiru 2022-09-19 add ==== END if (msglist.Where(w => w.Contains("error")).Count() == 0) { - var _msg = string.Join(",", msglist) +"! 共" + msglist.Count() + "筆設備編號"; + var _msg = string.Join(",", msglist) + "! 共" + msglist.Count() + "筆設備編號"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -679,14 +712,14 @@ namespace AMESCoreStudio.Web.Controllers } } if (msg == "") msg = "缺少必填資料"; - ModelState.AddModelError("error", msg ); + ModelState.AddModelError("error", msg); return View("JIG004C", model); } public async Task JIG004USaveAsync(OutfitInfo model) { var msg = ""; GetUserID(); - // await GetFactoryList(); + // await GetFactoryList(); await GetOutfitCommodityInfoesList(); await GetOutfitVarityInfoesList(); await GetOutfitVendorInfoesList(); @@ -719,7 +752,7 @@ namespace AMESCoreStudio.Web.Controllers var result = await _jigApi.DeleteOutfitInfoBlob(id); return Json(new Result() { success = true, msg = "" }); } - + public async Task JIG004RSaveAsync(OutfitInfoBlob model, IFormFile formFile) { IResultModel result; @@ -749,7 +782,7 @@ namespace AMESCoreStudio.Web.Controllers //取得使用者上傳檔案的原始檔名 FileName = Path.GetFileName(formFile.FileName); //為避免使用者上傳的檔案名稱發生重複,重新給一個名稱 設備代號-原檔名 - NewName = model.OutfitID + "-" + FileName ;//Path.GetRandomFileName() + fileExt; + NewName = model.OutfitID + "-" + FileName;//Path.GetRandomFileName() + fileExt; //指定要寫入的路徑、檔名和副檔名 FilePath = $"\\JIGFile\\";//本機目錄 using (var stream = new FileStream(_env.WebRootPath + FilePath + NewName, FileMode.Create)) @@ -815,7 +848,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task JIG004DSaveAsync(OutfitInfo model) { GetUserID(); - + var msg = ""; if (ModelState.IsValid) { @@ -831,12 +864,12 @@ namespace AMESCoreStudio.Web.Controllers model.StatusNo = "A"; Status = "啟用"; } - + result = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(model)); if (result.Success) { - var _msg = Status +"成功!"; + var _msg = Status + "成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -878,7 +911,7 @@ namespace AMESCoreStudio.Web.Controllers if (string.IsNullOrWhiteSpace(QANo)) QANo = "*"; - var result = await _jigApi.GetOutfitInfoesByQuery( TypeFlag, CommodityID, VarityID, Status, QANo, PartNo, UseStatus); + var result = await _jigApi.GetOutfitInfoesByQuery(TypeFlag, CommodityID, VarityID, Status, QANo, PartNo, UseStatus); if (result.Count > 0) { @@ -901,6 +934,7 @@ namespace AMESCoreStudio.Web.Controllers var result = await _jigApi.GetOutfitInfo(id); await GetDeptList(); await GetUserInfo(); + GetTableNo(); ViewBag.OutfitID = id; ViewBag.OutfitNo = result[0].OutfitNo; ViewBag.QANo = result[0].QANo; @@ -963,7 +997,7 @@ namespace AMESCoreStudio.Web.Controllers } else { - msg= result.Msg; + msg = result.Msg; } } } @@ -976,6 +1010,7 @@ namespace AMESCoreStudio.Web.Controllers var tt = await _jigApi.GetOutfitInfo(model.OutfitID); await GetDeptList(); await GetUserInfo(); + GetTableNo(); ViewBag.StatusDate = System.DateTime.Now.ToString("yyyy-MM-dd"); ViewBag.OutfitID = model.OutfitID; ViewBag.OutfitNo = tt[0].OutfitNo; @@ -1000,7 +1035,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _jigApi.PutOutfitInfo(model.OutfitID, JsonConvert.SerializeObject(OutfitInfo[0])); if (result.Success) { - + var _msg = "領用成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } @@ -1045,6 +1080,7 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + #endregion #region JIG006設備送修/報廢相關 @@ -1058,7 +1094,7 @@ namespace AMESCoreStudio.Web.Controllers var result = await _jigApi.GetOutfitInfo(id); await GetDeptList(); await GetUserInfo(); - ViewBag.StatusDate = System.DateTime.Now.ToString("yyyy-MM-dd"); + ViewBag.StatusDate = System.DateTime.Now.ToString("yyyy-MM-dd"); ViewBag.OutfitID = id; ViewBag.OutfitNo = result[0].OutfitNo; ViewBag.QANo = result[0].QANo; @@ -1200,8 +1236,8 @@ namespace AMESCoreStudio.Web.Controllers var result = await _jigApi.GetOutfitInfoesByQuery(TypeFlag, CommodityID, VarityID, Status, QANo, PartNo, UseStatus); - var result_w= result.Where(p => p.UseStatusNo == "B" && p.ScheReturnDay <= System.DateTime.Now).ToList();// 未歸還 - + var result_w = result.Where(p => p.UseStatusNo == "B" && p.ScheReturnDay <= System.DateTime.Now).ToList();// 未歸還 + if (result.Count > 0) diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml index 7569acdd..e6d21c0e 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG005.cshtml @@ -134,7 +134,7 @@ //通过行tool编辑,lay-event="edit" function edit(obj) { if (obj.data.outfitID) { - hg.open('領用設備', '/JIG/JIG005B/' + obj.data.outfitID, 640, 480); + hg.open('領用設備', '/JIG/JIG005B/' + obj.data.outfitID, 640, 550); } } diff --git a/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml b/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml index 430b84a3..da20c5fa 100644 --- a/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml +++ b/AMESCoreStudio.Web/Views/JIG/JIG005B.cshtml @@ -1,8 +1,10 @@ @model AMESCoreStudio.WebApi.Models.AMES.OutfitStatusLog -@{ ViewData["Title"] = "SPC005B"; - Layout = "~/Views/Shared/_FormLayout.cshtml"; } +@{ + ViewData["Title"] = "SPC005B"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; +}