diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index 7d4a3e3a..bdb50fd7 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -199,7 +199,7 @@ namespace AMESCoreStudio.Web.Controllers var RuleStationItems = new List(); for (int i = 0; i < result.Count; i++) { - RuleStationItems.Add(new SelectListItem(result[i].Station.UnitNo + result[i].Station.StationName, result[i].RuleStationID.ToString())); + RuleStationItems.Add(new SelectListItem(result[i].StationDesc, result[i].RuleStationID.ToString())); } ViewBag.RuleStationList = RuleStationItems; } @@ -325,7 +325,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutFactoryInfo(model.FactoryID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.FactoryID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -365,7 +365,7 @@ namespace AMESCoreStudio.Web.Controllers #endregion - #region BAS002模组资料维护相关 + #region BAS002製程單位资料维护相关 public IActionResult BAS002() { @@ -416,7 +416,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutFactoryUnit(model.UnitNo, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.SEQ == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -521,7 +521,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutLineInfo(model.LineID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.LineID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -645,7 +645,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutClassInfo(model.ClassID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.ClassID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -754,7 +754,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutTimeSegment(model.SegmentID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.SegmentID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -1482,7 +1482,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutRepairResponsibleUnits(model.RRID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.RRID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -1572,7 +1572,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutMailGroup(model.GroupID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.GroupID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -1667,7 +1667,7 @@ namespace AMESCoreStudio.Web.Controllers result = await _basApi.PutMailGroupDetail(model.MailID, JsonConvert.SerializeObject(model)); } - if (!result.Success) + if (result.Success) { var _msg = model.MailID == 0 ? "添加成功!" : "修改成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); @@ -2023,7 +2023,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - #region BAS017料號燒机時間资料维护相关 + #region BAS017料號工項资料维护相关 public IActionResult BAS017() { @@ -2191,7 +2191,7 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - #region BAS018料號燒机時間资料维护相关 + #region BAS018料號治具资料维护相关 public IActionResult BAS018() { diff --git a/AMESCoreStudio.Web/Controllers/KCSController.cs b/AMESCoreStudio.Web/Controllers/KCSController.cs index 63f706fd..f9ccf6d0 100644 --- a/AMESCoreStudio.Web/Controllers/KCSController.cs +++ b/AMESCoreStudio.Web/Controllers/KCSController.cs @@ -86,6 +86,19 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.FactoryUnit = FactoryItems; } + private async Task GetItemsList() + { + var result = await _kcsApi.GetItems(); + + var Items = new List(); + for (int i = 0; i < result.Count; i++) + { + Items.Add(new SelectListItem(result[i].ItemName, result[i].ItemNo.ToString())); + } + ViewBag.ItemsList = Items; + } + + #region KCS001 MAC資料維護相關 public IActionResult KCS001() @@ -551,6 +564,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task KCS007C() { + await GetItemsList(); await GetFactoryUnitList(); GetUserID(); @@ -562,6 +576,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task KCS007UAsync(int id) { + await GetItemsList(); await GetFactoryUnitList(); GetUserID(); var result = await _kcsApi.GetMaterialKp(id); diff --git a/AMESCoreStudio.Web/HttpApis/IBAS.cs b/AMESCoreStudio.Web/HttpApis/IBAS.cs index b709640d..0d6f7546 100644 --- a/AMESCoreStudio.Web/HttpApis/IBAS.cs +++ b/AMESCoreStudio.Web/HttpApis/IBAS.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.CommonTools.Result; +using AMESCoreStudio.WebApi.DTO.AMES; namespace AMESCoreStudio.Web { @@ -573,14 +574,14 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/MailGroupDetails")] - ITask> GetMailGroupDetails(); + ITask> GetMailGroupDetails(); /// /// 根据角色ID獲取用户角色資料 /// /// [WebApiClient.Attributes.HttpGet("api/MailGroupDetails/Group/{id}")] - ITask> GetMailGroupDetailByGroup(int id); + ITask> GetMailGroupDetailByGroup(int id); #endregion diff --git a/AMESCoreStudio.Web/Views/BAS/BAS002C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS002C.cshtml index 816114a2..105cde02 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS002C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS002C.cshtml @@ -16,6 +16,7 @@
+
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS002U.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS002U.cshtml index 56766104..8b41fc44 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS002U.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS002U.cshtml @@ -16,6 +16,7 @@
+
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS003U.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS003U.cshtml index ac1cf25e..c0166470 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS003U.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS003U.cshtml @@ -18,13 +18,14 @@ - + +
- +
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS008.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS008.cshtml index 0c57481e..d536adf1 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS008.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS008.cshtml @@ -146,12 +146,14 @@ { field: 'stationName', width: 150, - title: '站别名稱' + title: '站别名稱', + sort: true }, { field: 'stationNameSt', minWidth: 150, title: '站别簡稱', + sort: true }, { diff --git a/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml index b84c37de..fe0fc258 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS012.cshtml @@ -121,7 +121,7 @@ function del(obj) { //alert(obj); if (obj.data.mfid) { - hg.confirm("系統:" + obj.data.mfid + ",确定要删除吗?", function () { + hg.confirm("系統:" + obj.data.materialItem.itemNo + ",确定要删除吗?", function () { $.ajax({ url: '/BAS/BAS012D', data: { id: obj.data.mfid}, diff --git a/AMESCoreStudio.Web/Views/BAS/BAS016.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS016.cshtml index 6511148b..2e0a6260 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS016.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS016.cshtml @@ -161,35 +161,54 @@ cols: [ { field: 'mailID', - width: 100, + width: 80, title: '#', sort: true }, + //{ + // field: 'user', + // width: 200, + // title: '工號' + // , + // templet: function (d) { + // return d.user['userNo']; + // } + //}, { - field: 'user', - width: 200, + field: 'userNo', + width: 100, title: '工號' - , - templet: function (d) { - return d.user['userNo']; - } }, { - field: 'group', + field: 'userName', + width: 100, + title: '使用者' + }, + { + field: 'groupName', width: 250, title: 'MAIL群組' - , - templet: function (d) { - return d.group['groupDesc']; - } }, + //{ + // field: 'group', + // width: 250, + // title: 'MAIL群組' + // , + // templet: function (d) { + // return d.group['groupDesc']; + // } + //}, + //{ + // field: 'user', + // title: '使用者MAIL' + // , + // templet: function (d) { + // return d.user['userEMail']; + // } + //}, { - field: 'user', + field: 'userEMail', title: '使用者MAIL' - , - templet: function (d) { - return d.user['userEMail']; - } }, { align: 'center', title: '操作', diff --git a/AMESCoreStudio.Web/Views/BAS/BAS017C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS017C.cshtml index de678ef3..832cebf1 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS017C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS017C.cshtml @@ -96,7 +96,9 @@ $("#ItemID").val(result.data.itemID); } else { - alert('請確認料號是否正確!!!'); + $("#ItemNo").val(''); + $("#ItemID").val(''); + alert('料號不正確,請重新輸入!!!'); } } diff --git a/AMESCoreStudio.Web/Views/BAS/BAS018C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS018C.cshtml index c1ed133a..223ca2b8 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS018C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS018C.cshtml @@ -86,7 +86,9 @@ $("#ItemID").val(result.data.itemID); } else { - alert('請確認料號是否正確!!!'); + $("#ItemNo").val(''); + $("#ItemID").val(''); + alert('料號不正確,請重新輸入!!!'); } } diff --git a/AMESCoreStudio.Web/Views/KCS/KCS007.cshtml b/AMESCoreStudio.Web/Views/KCS/KCS007.cshtml index 03115aa5..1c19354f 100644 --- a/AMESCoreStudio.Web/Views/KCS/KCS007.cshtml +++ b/AMESCoreStudio.Web/Views/KCS/KCS007.cshtml @@ -59,8 +59,16 @@ title: '組件料號名稱' }, { - field: 'kpNo', - title: '組件料號編碼' + field: 'items', + title: '組件編碼', + templet: function (d) { + var items; + if (d.items) + items = d.items["itemName"]; + else + items = "N/A"; + return items; + } }, { field: 'kpSeq', diff --git a/AMESCoreStudio.Web/Views/KCS/KCS007C.cshtml b/AMESCoreStudio.Web/Views/KCS/KCS007C.cshtml index 606568af..dd5d18b2 100644 --- a/AMESCoreStudio.Web/Views/KCS/KCS007C.cshtml +++ b/AMESCoreStudio.Web/Views/KCS/KCS007C.cshtml @@ -34,7 +34,9 @@
- +
diff --git a/AMESCoreStudio.Web/Views/KCS/KCS007U.cshtml b/AMESCoreStudio.Web/Views/KCS/KCS007U.cshtml index 34ab09f0..071ec197 100644 --- a/AMESCoreStudio.Web/Views/KCS/KCS007U.cshtml +++ b/AMESCoreStudio.Web/Views/KCS/KCS007U.cshtml @@ -34,7 +34,9 @@
- +
diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.dll b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.dll index d0e1fd44..0763dc5d 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.dll and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.dll differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.pdb b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.pdb index d5b7f0a4..d92c4088 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.pdb and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.Views.pdb differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.dll b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.dll index 53139e93..ccbeb63c 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.dll and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.dll differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.exe b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.exe index 16350871..4d9bdef4 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.exe and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.exe differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.pdb b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.pdb index db784a94..11c7c45c 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.pdb and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.pdb differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.runtimeconfig.dev.json b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.runtimeconfig.dev.json index aec0d570..2d16c522 100644 --- a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.runtimeconfig.dev.json +++ b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.Web.runtimeconfig.dev.json @@ -1,9 +1,8 @@ { "runtimeOptions": { "additionalProbingPaths": [ - "C:\\Users\\rita.su\\.dotnet\\store\\|arch|\\|tfm|", - "C:\\Users\\rita.su\\.nuget\\packages", - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + "C:\\Users\\USER\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\USER\\.nuget\\packages" ] } } \ No newline at end of file diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll index a8882517..73dc25f2 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb index 8afa6aff..162e7459 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll index 927dccad..a027d025 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe index d19973b1..76055799 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb index 5d1e538f..ab5ca1c1 100644 Binary files a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb and b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb differ diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json index aec0d570..2d16c522 100644 --- a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json +++ b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json @@ -1,9 +1,8 @@ { "runtimeOptions": { "additionalProbingPaths": [ - "C:\\Users\\rita.su\\.dotnet\\store\\|arch|\\|tfm|", - "C:\\Users\\rita.su\\.nuget\\packages", - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + "C:\\Users\\USER\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\USER\\.nuget\\packages" ] } } \ No newline at end of file diff --git a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml index 8f4cd333..9725bef2 100644 --- a/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml +++ b/AMESCoreStudio.Web/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml @@ -2337,6 +2337,52 @@ + + + 工作群組維護 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 新增资料 + + + + + + + + + + + @@ -7179,6 +7225,21 @@ 內部序號對應的治具序號明細 + + + 設備種類資料檔 + + + + + 設備規格資料檔 + + + + + 廠商資料檔 + + 條碼變更資料表 @@ -9550,6 +9611,7 @@ 工單機種資料 + 料號治具資訊資料檔 @@ -10290,6 +10352,188 @@ 更新日期 + + + 設備種類資料檔 + + + + + 設備種類ID + + + + + 種類代碼 + + + + + 種類名稱 + + + + + 種類英文名稱 + + + + + 保養預警提前天數 + + + + + 累計天數 + + + + + 設備種類 + 0:設備/料件; 2:耗材 + + + + + 狀態(A-可用;S-停用) + + + + + 特殊種類 + (X-錫膏; H-紅膠;G-鋼網) + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + + + + 設備規格資料檔 + + + + + 設備規格ID + + + + + 設備種類ID + + + + + 規格代碼 + + + + + 規格名稱 + + + + + 安全庫存數量 + + + + + 狀態(A-可用;S-停用) + + + + + 預定試用次數 + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + + + + 廠商資料檔 + + + + + 廠商ID + + + + + 廠商名稱 + + + + + 連絡電話 + + + + + 地址 + + + + + 備註 + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + 序號料號資料表 @@ -12895,11 +13139,6 @@ 部門资料 - - - 部門资料 - - 料號流程資料檔 diff --git a/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.csproj b/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.csproj index 0d7e23bc..904ffb97 100644 --- a/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.csproj +++ b/AMESCoreStudio.WebApi/AMESCoreStudio.WebApi.csproj @@ -17,12 +17,18 @@ + + + + + + diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/FactoryInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/FactoryInfoesController.cs index 0be97329..a59cacb2 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/FactoryInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/FactoryInfoesController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -79,11 +80,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutFactoryInfo(int id, [FromBody] FactoryInfo factoryInfo) + public async Task> PutFactoryInfo(int id, [FromBody] FactoryInfo factoryInfo) { + ResultModel result = new ResultModel(); if (id != factoryInfo.FactoryID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(factoryInfo).State = EntityState.Modified; @@ -93,20 +97,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!FactoryInfoExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return factoryInfo; + return result; } @@ -119,8 +118,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostFactoryInfo(FactoryInfo factoryInfo) + public async Task> PostFactoryInfo(FactoryInfo factoryInfo) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); factoryInfo.FactoryID = helper.GetIDKey("FACTORY_ID").Result; factoryInfo.FactoryCode = "T" + factoryInfo.FactoryID.ToString(); @@ -128,9 +128,19 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS _context.FactoryInfos.Add(factoryInfo); - await _context.SaveChangesAsync(); - return CreatedAtAction("GetFactoryInfo", new { id = factoryInfo.FactoryID }, factoryInfo); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } @@ -141,13 +151,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/FactoryInfoes/5 [HttpDelete("{id}")] - public async Task> DeleteFactoryInfo(int id) + public async Task> DeleteFactoryInfo(int id) { + ResultModel result = new ResultModel(); //var factoryInfo = await _context.FactoryInfo.FindAsync(id); var factoryInfo = await _context.FactoryInfos.Where(m => m.FactoryID == id).FirstOrDefaultAsync(); if (factoryInfo == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } ////// var factoryInfoNew = new FactoryInfo(); @@ -161,34 +174,20 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS factoryInfoNew.StatusNo = "A"; factoryInfoNew.UpdateDate = DateTime.Now; + try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!FactoryInfoExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } + return result; - return factoryInfoNew; - - - - ///// - - - - ////_context.FactoryInfos.Remove(factoryInfo); - ////await _context.SaveChangesAsync(); - - ////return factoryInfo; } private bool FactoryInfoExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/FactoryUnitsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/FactoryUnitsController.cs index 5accd402..57f104f1 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/FactoryUnitsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/FactoryUnitsController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -71,32 +72,31 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutFactoryUnit(string id, FactoryUnit factoryUnit) + public async Task> PutFactoryUnit(string id, FactoryUnit factoryUnit) { + ResultModel result = new ResultModel(); if (id != factoryUnit.UnitNo) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(factoryUnit).State = EntityState.Modified; + try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!FactoryUnitExistsStr(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return factoryUnit; + return result; } /// @@ -107,17 +107,28 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostFactoryUnit(FactoryUnit factoryUnit) + public async Task> PostFactoryUnit(FactoryUnit factoryUnit) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); //factoryUnit.UnitName = factoryUnit.UnitName.Trim(); factoryUnit.SEQ = helper.GetIDKey("UNIT_ID").Result; //SHANI? factoryUnit.StatusNo = "A"; _context.FactoryUnits.Add(factoryUnit); - await _context.SaveChangesAsync(); - return CreatedAtAction("GetFactoryUnit", new { id = factoryUnit.SEQ }, factoryUnit); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } /// @@ -126,12 +137,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/FactoryUnits/5 [HttpDelete("{id}")] - public async Task> DeleteFactoryUnit(string id) + public async Task> DeleteFactoryUnit(string id) { + ResultModel result = new ResultModel(); var factoryUnit = await _context.FactoryUnits.FindAsync(id); if (factoryUnit == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } ////// var factoryUnitNew = new FactoryUnit(); @@ -143,23 +157,19 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS else factoryUnitNew.StatusNo = "A"; + try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!FactoryUnitExistsStr(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return factoryUnitNew; + return result; diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/LineInfoesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/LineInfoesController.cs index 1bc0f97d..c165de76 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/LineInfoesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/LineInfoesController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -143,11 +144,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutLineInfo(int id, LineInfo lineInfo) + public async Task> PutLineInfo(int id, LineInfo lineInfo) { + ResultModel result = new ResultModel(); if (id != lineInfo.LineID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(lineInfo).State = EntityState.Modified; @@ -155,20 +159,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!LineInfoExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } + return result; - return lineInfo; } /// @@ -178,11 +178,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// 工單ID /// [HttpPut("{id}/{wipid}")] - public async Task> PutLineInfoToWipNO(int id = 0, int wipid = 0) + public async Task> PutLineInfoToWipNO(int id = 0, int wipid = 0) { + ResultModel result = new ResultModel(); if (id == 0) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } LineInfo lineinfo = new LineInfo(); @@ -193,16 +196,20 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // 指定更新欄位 _context.Entry(lineinfo).Property(p => p.WipNo).IsModified = true; _context.Entry(lineinfo).Property(p => p.UpdateDate).IsModified = true; + try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - return NotFound(); + result.Success = false; + result.Msg = ex.InnerException.Message; } + return result; - return lineinfo; } /// @@ -213,8 +220,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostLineInfo(LineInfo lineInfo) + public async Task> PostLineInfo(LineInfo lineInfo) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); lineInfo.LineID = helper.GetIDKey("LINE_ID").Result; //SHANI? lineInfo.CreateDate = DateTime.Now; @@ -223,9 +231,19 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS lineInfo.WipNo = -1; _context.LineInfoes.Add(lineInfo); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; - return CreatedAtAction("GetLineInfo", new { id = lineInfo.LineID }, lineInfo); } /// @@ -234,12 +252,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/LineInfoes/5 [HttpDelete("{id}")] - public async Task> DeleteLineInfo(int id) + public async Task> DeleteLineInfo(int id) { + ResultModel result = new ResultModel(); var lineInfo = await _context.LineInfoes.FindAsync(id); if (lineInfo == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } ////// @@ -257,20 +278,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!LineInfoExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } + return result; - return lineInfoNew; diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupDetailsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupDetailsController.cs index 2cb04232..0821a2b9 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupDetailsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupDetailsController.cs @@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; +using AMESCoreStudio.WebApi.DTO.AMES; + namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -34,18 +37,26 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // GET: api/MailGroupDetails [HttpGet] - public async Task>> GetMailGroupDetail() + public async Task>> GetMailGroupDetail() { IQueryable q = _context.MailGroupDetails; q = q.OrderBy(p => p.MailID); - var MailGroupDetail = await q.ToListAsync(); - - foreach (var data in MailGroupDetail) + var MailGroupDetail = await q.Select(s => new MailGroupDetailDto { - data.User = _context.UserInfoes.Find(data.UserID); - data.Group = _context.MailGroups.Find(data.GroupID); - } + MailID = s.MailID, + GroupID = s.GroupID, + //Station = s.StationTypeList.TypeDesc, SHANI edit + GroupName = _context.MailGroups.Where(p1 => p1.GroupID.Equals(s.GroupID)).FirstOrDefault().GroupDesc, + UserID = s.UserID, + UserName = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserName, + UserNo = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserNo, + UserEMail = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserEMail, + CreateDate = s.CreateDate, + UpdateDate = s.UpdateDate, + CreateUserId = s.CreateUserId, + UpdateUserId = s.UpdateUserId + }).ToListAsync(); return MailGroupDetail; //return await _context.MailGroupDetail.ToListAsync(); @@ -67,7 +78,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS foreach (var data in mailGroupDetail) { - data.User = _context.UserInfoes.Where(p1 => p1.UserID.Equals(data.UserID)).FirstOrDefault(); + // data.User = _context.UserInfoes.Where(p1 => p1.UserID.Equals(data.UserID)).FirstOrDefault().UserName; data.Group = _context.MailGroups.Where(p1 => p1.GroupID.Equals(data.GroupID)).FirstOrDefault(); } @@ -87,7 +98,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // GET: api/MailGroupDetails/Group/5 [HttpGet("Group/{id}")] - public async Task>> GetMailGroupDetailByGroup(int id) + public async Task>> GetMailGroupDetailByGroup(int id) { IQueryable q = _context.MailGroupDetails; @@ -97,14 +108,21 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS } q.OrderBy(p => p.MailID); - var mailGroupDetail = await q.ToListAsync(); - - foreach (var data in mailGroupDetail) + var mailGroupDetail = await q.Select(s => new MailGroupDetailDto { - data.User = _context.UserInfoes.Where(p1 => p1.UserID.Equals(data.UserID)).FirstOrDefault(); - data.Group = _context.MailGroups.Where(p1 => p1.GroupID.Equals(data.GroupID)).FirstOrDefault(); - - } + MailID = s.MailID, + GroupID = s.GroupID, + //Station = s.StationTypeList.TypeDesc, SHANI edit + GroupName = _context.MailGroups.Where(p1 => p1.GroupID.Equals(s.GroupID)).FirstOrDefault().GroupDesc, + UserID = s.UserID, + UserName = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserName, + UserNo = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserNo, + UserEMail = _context.UserInfoes.Where(p1 => p1.UserID.Equals(s.UserID)).FirstOrDefault().UserEMail, + CreateDate = s.CreateDate, + UpdateDate = s.UpdateDate, + CreateUserId = s.CreateUserId, + UpdateUserId = s.UpdateUserId + }).ToListAsync(); if (mailGroupDetail is null) { @@ -126,11 +144,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutMailGroupDetail(int id, [FromBody] MailGroupDetail mailGroupDetail) + public async Task> PutMailGroupDetail(int id, [FromBody] MailGroupDetail mailGroupDetail) { + ResultModel result = new ResultModel(); if (id != mailGroupDetail.MailID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } mailGroupDetail.UpdateDate = System.DateTime.Now; _context.Entry(mailGroupDetail).State = EntityState.Modified; @@ -138,20 +159,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception e) { - if (!MailGroupDetailExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = e.Message; } - return mailGroupDetail; + return result; } /// @@ -163,15 +180,26 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostMailGroupDetail(MailGroupDetail mailGroupDetail) + public async Task> PostMailGroupDetail(MailGroupDetail mailGroupDetail) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); mailGroupDetail.MailID = helper.GetIDKey("MAIL_ID").Result; _context.MailGroupDetails.Add(mailGroupDetail); - await _context.SaveChangesAsync(); - return CreatedAtAction("GetMailGroupDetail", new { id = mailGroupDetail.MailID }, mailGroupDetail); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + } + return result; } @@ -182,19 +210,32 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/MailGroupDetails/5 [HttpDelete("{id}")] - public async Task> DeleteMailGroupDetail(int id) + public async Task> DeleteMailGroupDetail(int id) { - //var mailGroupDetail = await _context.MailGroupDetail.FindAsync(id); + ResultModel result = new ResultModel(); var mailGroupDetail = await _context.MailGroupDetails.Where(m => m.MailID == id).FirstOrDefaultAsync(); if (mailGroupDetail == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.MailGroupDetails.Remove(mailGroupDetail); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + return result; + } - return mailGroupDetail; + return result; } private bool MailGroupDetailExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupsController.cs index 232ab27f..655d46e6 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/MailGroupsController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -76,11 +77,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutMailGroup(int id, [FromBody] MailGroup mailGroup) + public async Task> PutMailGroup(int id, [FromBody] MailGroup mailGroup) { + + ResultModel result = new ResultModel(); if (id != mailGroup.GroupID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } mailGroup.UpdateDate = System.DateTime.Now; @@ -89,20 +94,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!MailGroupExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return mailGroup; + return result; } /// @@ -114,15 +114,25 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostMailGroup(MailGroup mailGroup) + public async Task> PostMailGroup(MailGroup mailGroup) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); mailGroup.GroupID = helper.GetIDKey("GROUP_ID").Result; _context.MailGroups.Add(mailGroup); - await _context.SaveChangesAsync(); - - return CreatedAtAction("GetMailGroup", new { id = mailGroup.GroupID }, mailGroup); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } @@ -133,19 +143,32 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/MailGroups/5 [HttpDelete("{id}")] - public async Task> DeleteMailGroup(int id) + public async Task> DeleteMailGroup(int id) { - //var mailGroup = await _context.MailGroup.FindAsync(id); + ResultModel result = new ResultModel(); var mailGroup = await _context.MailGroups.Where(m => m.GroupID == id).FirstOrDefaultAsync(); + if (mailGroup == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.MailGroups.Remove(mailGroup); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; - return mailGroup; } private bool MailGroupExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RepairResponsibleUnitsesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RepairResponsibleUnitsesController.cs index 9574e0bb..882f9850 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/RepairResponsibleUnitsesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/RepairResponsibleUnitsesController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -76,11 +77,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutRepairResponsibleUnits(int id, [FromBody] RepairResponsibleUnits repairResponsibleUnits) + public async Task> PutRepairResponsibleUnits(int id, [FromBody] RepairResponsibleUnits repairResponsibleUnits) { + ResultModel result = new ResultModel(); if (id != repairResponsibleUnits.RRID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(repairResponsibleUnits).State = EntityState.Modified; @@ -88,20 +92,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception e) { - if (!RepairResponsibleUnitsExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = e.Message; } - return repairResponsibleUnits; + return result; } /// @@ -113,16 +113,26 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostRepairResponsibleUnits(RepairResponsibleUnits repairResponsibleUnits) + public async Task> PostRepairResponsibleUnits(RepairResponsibleUnits repairResponsibleUnits) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); repairResponsibleUnits.RRID = helper.GetIDKey("RR_ID").Result; _context.RepairResponsibleUnitses.Add(repairResponsibleUnits); - await _context.SaveChangesAsync(); - - return CreatedAtAction("GetRepairResponsibleUnits", new { id = repairResponsibleUnits.RRID }, repairResponsibleUnits); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + } + return result; } /// @@ -132,19 +142,32 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/RepairResponsibleUnitses/5 [HttpDelete("{id}")] - public async Task> DeleteRepairResponsibleUnits(int id) + public async Task> DeleteRepairResponsibleUnits(int id) { + ResultModel result = new ResultModel(); //var repairResponsibleUnits = await _context.RepairResponsibleUnits.FindAsync(id); var repairResponsibleUnits = await _context.RepairResponsibleUnitses.Where(m => m.RRID == id).FirstOrDefaultAsync(); if (repairResponsibleUnits == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.RepairResponsibleUnitses.Remove(repairResponsibleUnits); - await _context.SaveChangesAsync(); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + } - return repairResponsibleUnits; + return result; } private bool RepairResponsibleUnitsExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/StationTypesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/StationTypesController.cs index 32783e9d..49740224 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/StationTypesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/StationTypesController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -79,11 +80,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutStationType(string id, StationType stationType) + public async Task> PutStationType(string id, StationType stationType) { + ResultModel result = new ResultModel(); if (id != stationType.TypeNo) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(stationType).State = EntityState.Modified; @@ -91,20 +95,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!StationTypeExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return stationType; + return result; } /// @@ -115,13 +114,24 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostStationType(StationType stationType) + public async Task> PostStationType(StationType stationType) { + ResultModel result = new ResultModel(); stationType.SysType = "U"; _context.StationTypes.Add(stationType); - await _context.SaveChangesAsync(); - return CreatedAtAction("GetStationType", new { id = stationType.TypeNo }, stationType); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } /// @@ -130,18 +140,30 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/StationTypes/5 [HttpDelete("{id}")] - public async Task> DeleteStationType(string id) + public async Task> DeleteStationType(string id) { + ResultModel result = new ResultModel(); var stationType = await _context.StationTypes.FindAsync(id); if (stationType == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } - _context.StationTypes.Remove(stationType); - await _context.SaveChangesAsync(); - return stationType; + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } private bool StationTypeExists(string id) diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs index dd7509b7..de0b7a0d 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs @@ -94,7 +94,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS { q = q.Where(p => p.UnitNo.Equals(id)); } - q.OrderBy(p => p.StationID); + q.OrderBy(p => p.UnitNo); var stations = await q.ToListAsync(); diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/TimeSegmentsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/TimeSegmentsController.cs index dc9fa102..bc0867b9 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/TimeSegmentsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/TimeSegmentsController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.BAS { @@ -76,11 +77,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] - public async Task> PutTimeSegment(int id, [FromBody] TimeSegment timeSegment) + public async Task> PutTimeSegment(int id, [FromBody] TimeSegment timeSegment) { + ResultModel result = new ResultModel(); if (id != timeSegment.SegmentID) { - return BadRequest(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.Entry(timeSegment).State = EntityState.Modified; @@ -88,20 +92,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS try { await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; } - catch (DbUpdateConcurrencyException) + catch (Exception ex) { - if (!TimeSegmentExists(id)) - { - return NotFound(); - } - else - { - throw; - } + result.Success = false; + result.Msg = ex.InnerException.Message; } - - return timeSegment; + return result; } /// @@ -113,15 +112,25 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] - public async Task> PostTimeSegment(TimeSegment timeSegment) + public async Task> PostTimeSegment(TimeSegment timeSegment) { + ResultModel result = new ResultModel(); Helper helper = new Helper(_context); timeSegment.SegmentID = helper.GetIDKey("SEGMENT_ID").Result; _context.TimeSegments.Add(timeSegment); - await _context.SaveChangesAsync(); - - return CreatedAtAction("GetTimeSegment", new { id = timeSegment.SegmentID }, timeSegment); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } @@ -132,19 +141,31 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS /// // DELETE: api/TimeSegments/5 [HttpDelete("{id}")] - public async Task> DeleteTimeSegment(int id) + public async Task> DeleteTimeSegment(int id) { + ResultModel result = new ResultModel(); //var timeSegment = await _context.TimeSegment.FindAsync(id); var timeSegment = await _context.TimeSegments.Where(m => m.SegmentID == id).FirstOrDefaultAsync(); if (timeSegment == null) { - return NotFound(); + result.Success = false; + result.Msg = "序號錯誤"; + return result; } _context.TimeSegments.Remove(timeSegment); - await _context.SaveChangesAsync(); - - return timeSegment; + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; } private bool TimeSegmentExists(int id) diff --git a/AMESCoreStudio.WebApi/DTO/AMES/MailGroupDetailDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/MailGroupDetailDto.cs new file mode 100644 index 00000000..c43c398a --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/MailGroupDetailDto.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + + public class MailGroupDetailDtos + { + public List mailGroupDetailDto { get; set; } + } + public class MailGroupDetailDto + { + public int MailID { get; set; } + + public int GroupID { get; set; } + public string GroupName { get; set; } + + public int UserID { get; set; } + public string UserName { get; set; } + public string UserNo { get; set; } + public string UserEMail { get; set; } + + public int CreateUserId { get; set; } + + public DateTime CreateDate { get; set; } + + public int UpdateUserId { get; set; } + public DateTime UpdateDate { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs index d479db8e..c2763c6a 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialKp.cs @@ -136,6 +136,10 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// [ForeignKey("StationType")] public virtual AMESCoreStudio.WebApi.Models.BAS.FactoryUnit Unit { get; set; } - //public virtual AMESCoreStudio.WebApi.Models.BAS.StationType StationTypeList { get; set; } + + /// 工單機種資料 + /// + [ForeignKey("KpNo")] + public virtual Items Items { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index ceaaf91c..46052736 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -75,7 +75,7 @@ namespace AMESCoreStudio.WebApi // modelBuilder.Entity().HasKey(c => new { c.ItemID,c.FlowRuleID,c.UnitNo}); // modelBuilder.Entity().HasKey(c => new { c.ItemID, c.FlowSEQ, c.UnitNo }); - modelBuilder.Entity().HasKey(c => new { c.ItemID }); + //modelBuilder.Entity().HasKey(c => new { c.ItemID }); modelBuilder.Entity().HasOne(r => r.MaterialItem).WithMany().HasForeignKey(r => r.ItemID).IsRequired(); modelBuilder.Entity().HasOne(r => r.FlowRule).WithMany().HasForeignKey(r => r.FlowRuleID).IsRequired(); modelBuilder.Entity().HasKey(c => new { c.ItemNo }); @@ -711,6 +711,38 @@ namespace AMESCoreStudio.WebApi /// public virtual DbSet BarcodeOutfits { get; set; } + /// + /// 治具區域資料檔 + /// + //public virtual DbSet OutfitAreaInfoes { get; set; } + + /// + /// 設備種類資料檔 + /// + public virtual DbSet OutfitCommodityInfoes { get; set; } + + /// + /// 層別資料檔 + /// + // public virtual DbSet OutfitLevelInfoes { get; set; } + + /// + /// 位置資料檔 + /// + //public virtual DbSet OutfitSiteInfoes { get; set; } + + /// + /// 設備規格資料檔 + /// + public virtual DbSet OutfitVarityInfoes { get; set; } + + /// + /// 廠商資料檔 + /// + public virtual DbSet OutfitVendorInfoes { get; set; } + + + } } diff --git a/AMESCoreStudio.WebApi/Models/BAS/MailGroupDetail.cs b/AMESCoreStudio.WebApi/Models/BAS/MailGroupDetail.cs index 75a82072..9088e42e 100644 --- a/AMESCoreStudio.WebApi/Models/BAS/MailGroupDetail.cs +++ b/AMESCoreStudio.WebApi/Models/BAS/MailGroupDetail.cs @@ -67,10 +67,5 @@ namespace AMESCoreStudio.WebApi.Models.BAS /// 部門资料 /// public virtual MailGroup Group { get; set; } - - /// - /// 部門资料 - /// - public virtual UserInfo User { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/BAS/MaterialFlow.cs b/AMESCoreStudio.WebApi/Models/BAS/MaterialFlow.cs index 7f2ca9fc..8a5033f2 100644 --- a/AMESCoreStudio.WebApi/Models/BAS/MaterialFlow.cs +++ b/AMESCoreStudio.WebApi/Models/BAS/MaterialFlow.cs @@ -26,7 +26,7 @@ namespace AMESCoreStudio.WebApi.Models.BAS /// /// 料號ID /// - [Key] + //[Key] [Column("ITEM_ID")] [Display(Name = "料號")] [DataMember] diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll index a8882517..73dc25f2 100644 Binary files a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll and b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.dll differ diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb index 8afa6aff..162e7459 100644 Binary files a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb and b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.Views.pdb differ diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll index 927dccad..a027d025 100644 Binary files a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll and b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.dll differ diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe index d19973b1..76055799 100644 Binary files a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe and b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.exe differ diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb index 5d1e538f..ab5ca1c1 100644 Binary files a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb and b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.pdb differ diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json index aec0d570..2d16c522 100644 --- a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json +++ b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.runtimeconfig.dev.json @@ -1,9 +1,8 @@ { "runtimeOptions": { "additionalProbingPaths": [ - "C:\\Users\\rita.su\\.dotnet\\store\\|arch|\\|tfm|", - "C:\\Users\\rita.su\\.nuget\\packages", - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + "C:\\Users\\USER\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\USER\\.nuget\\packages" ] } } \ No newline at end of file diff --git a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml index 8f4cd333..9725bef2 100644 --- a/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml +++ b/AMESCoreStudio.WebApi/bin/Debug/netcoreapp3.1/AMESCoreStudio.WebApi.xml @@ -2337,6 +2337,52 @@ + + + 工作群組維護 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 新增资料 + + + + + + + + + + + @@ -7179,6 +7225,21 @@ 內部序號對應的治具序號明細 + + + 設備種類資料檔 + + + + + 設備規格資料檔 + + + + + 廠商資料檔 + + 條碼變更資料表 @@ -9550,6 +9611,7 @@ 工單機種資料 + 料號治具資訊資料檔 @@ -10290,6 +10352,188 @@ 更新日期 + + + 設備種類資料檔 + + + + + 設備種類ID + + + + + 種類代碼 + + + + + 種類名稱 + + + + + 種類英文名稱 + + + + + 保養預警提前天數 + + + + + 累計天數 + + + + + 設備種類 + 0:設備/料件; 2:耗材 + + + + + 狀態(A-可用;S-停用) + + + + + 特殊種類 + (X-錫膏; H-紅膠;G-鋼網) + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + + + + 設備規格資料檔 + + + + + 設備規格ID + + + + + 設備種類ID + + + + + 規格代碼 + + + + + 規格名稱 + + + + + 安全庫存數量 + + + + + 狀態(A-可用;S-停用) + + + + + 預定試用次數 + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + + + + 廠商資料檔 + + + + + 廠商ID + + + + + 廠商名稱 + + + + + 連絡電話 + + + + + 地址 + + + + + 備註 + + + + + 創建者ID + + + + + 創建日期 + + + + + 更新者ID + + + + + 更新日期 + + 序號料號資料表 @@ -12895,11 +13139,6 @@ 部門资料 - - - 部門资料 - - 料號流程資料檔