diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 4168ae24..f4b7128f 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -10,6 +10,7 @@ using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.Web.ViewModels; using AMESCoreStudio.Web.ViewModels.PCS; +using AMESCoreStudio.WebApi.DTO.AMES; using System.Linq; using AMESCoreStudio.CommonTools.Result; using System; @@ -1025,13 +1026,12 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PCS011Async(WipLock model) { - IResultModel result; result = await _pcsApi.PutWipLock(JsonConvert.SerializeObject(model)); if (result.Success) { - var _msg = model.WipLockID == 0 ? "新增成功!" : "修改成功!"; + var _msg = "解鎖成功!"; return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -1069,7 +1069,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task PCS012QueryAsync(string lockStatus, string lockType, string lockReasonType, string stations, string wipNO, string itemNO, string dateStr, string dateEnd) { - IResultModel result = await _pcsApi.GetWipLockQuery(lockStatus: lockStatus, lockType: lockType, lockReasonType: lockReasonType, + IResultModel result = await _pcsApi.GetWipLockQuery(lockStatus: lockStatus, lockType: lockType, lockReasonType: lockReasonType, stations: stations, wipNO: wipNO, itemNO: itemNO, date_str: dateStr, date_end: dateEnd); if (result.Data.Count() != 0) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 406c0f6a..fa6be9f1 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc; using AMESCoreStudio.WebApi.Models.AMES; //using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.CommonTools.Result; - +using AMESCoreStudio.WebApi.DTO.AMES; namespace AMESCoreStudio.Web { [JsonReturn] @@ -199,7 +199,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/WipLock/GetWipLockQuery")] - ITask> GetWipLockQuery(string lockStatus = null, string lockType = null, string lockReasonType = null + ITask> GetWipLockQuery(string lockStatus = null, string lockType = null, string lockReasonType = null , string stations = null, string wipNO = null, string itemNO = null, string date_str = null, string date_end = null); /// diff --git a/AMESCoreStudio.Web/Views/Home/Framework.cshtml b/AMESCoreStudio.Web/Views/Home/Framework.cshtml index 5369889d..ac2b38cb 100644 --- a/AMESCoreStudio.Web/Views/Home/Framework.cshtml +++ b/AMESCoreStudio.Web/Views/Home/Framework.cshtml @@ -239,9 +239,6 @@
  • 工單開線收線作業
  • -
  • - 工單對應站別鎖定 -
  • 製程工單鎖定查詢
  • diff --git a/AMESCoreStudio.Web/Views/PCS/PCS012.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS012.cshtml index 188949f9..a81b287c 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS012.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS012.cshtml @@ -44,8 +44,8 @@
    @@ -104,11 +104,11 @@
    - +
    - +
    @@ -189,7 +189,7 @@ sort: true }, { - field: 'stationID', + field: 'stationName', title: '站別', width: 100, sort: true @@ -203,7 +203,7 @@ { field: 'lockStatus', title: '鎖定狀態', - width: 50, + width: 100, sort: true }, { @@ -212,19 +212,23 @@ }, { field: 'lockDate', - title: '鎖定日期' + title: '鎖定日期', + width: 100, + templet: '
    {{ layui.util.toDateString(d.lockDate, "yyyy/MM/dd") }}
    ' }, { field: 'unLockReason', title: '解鎖原因' }, { - field: 'unLockDate', - title: '解鎖日期' + field: 'unLockDate', + title: '解鎖日期', + width: 100, + templet: '
    {{ layui.util.toDateString(d.unLockDate, "yyyy/MM/dd") }}
    ' }, { field: 'right', - width: 100, + width: 80, title: '操作', align: 'center', fixed: 'right', @@ -242,7 +246,6 @@ //通过行tool编辑,lay-event="edit" function edit(obj) { if (obj.data.wipNO) { - alert(obj.data.wipNO); hg.open('解鎖工單', '/PCS/PCS011/' + obj.data.wipLockID, 480, 480,false); } } diff --git a/AMESCoreStudio.Web/wwwroot/js/grids.min.js b/AMESCoreStudio.Web/wwwroot/js/grids.min.js new file mode 100644 index 00000000..fb479afe --- /dev/null +++ b/AMESCoreStudio.Web/wwwroot/js/grids.min.js @@ -0,0 +1,9 @@ +/** + * Javascript-Equal-Height-Responsive-Rows + * https://github.com/Sam152/Javascript-Equal-Height-Responsive-Rows + */ +(function($){'use strict';$.fn.equalHeight=function(){var heights=[];$.each(this,function(i,element){var $element=$(element);var elementHeight;var includePadding=($element.css('box-sizing')==='border-box')||($element.css('-moz-box-sizing')==='border-box');if(includePadding){elementHeight=$element.innerHeight();}else{elementHeight=$element.height();} +heights.push(elementHeight);});this.css('height',Math.max.apply(window,heights)+'px');return this;};$.fn.equalHeightGrid=function(columns){var $tiles=this.filter(':visible');$tiles.css('height','auto');for(var i=0;i<$tiles.length;i++){if(i%columns===0){var row=$($tiles[i]);for(var n=1;n鎖定類型 /// 料號 /// 鎖定原因類別 - /// 站別 + /// 站別 /// 鎖定日期起 /// 鎖定日期迄 /// [Route("[action]")] [HttpGet] - public async Task> GetWipLockQuery(string wipNO, string lockstatus, string locktype - , string itemno, string lockreasontype, int stationid = 0, string date_str = null, string date_end = null) + public async Task> GetWipLockQuery(string wipNO, string lockstatus, string locktype + , string itemno, string lockreasontype, int stations = 0, string date_str = null, string date_end = null) { IQueryable q = _context.WipLocks; if (!string.IsNullOrWhiteSpace(wipNO)) - q = q.Where(w => w.WipNO == wipNO); + q = q.Where(w => w.WipNO == wipNO); if (!string.IsNullOrWhiteSpace(lockstatus)) q = q.Where(w => w.LockStatus == lockstatus); @@ -114,8 +115,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (!string.IsNullOrWhiteSpace(lockreasontype)) q = q.Where(w => w.LockReasonType == lockreasontype); - if (stationid != 0) - q = q.Where(w => w.StationID == stationid); + if (!string.IsNullOrWhiteSpace(itemno)) + q = q.Where(w => w.WipAtt.ItemNO == itemno); + + if (stations != 0) + q = q.Where(w => w.StationID == stations); DateTime dateValue; if (DateTime.TryParse(date_str, out dateValue)) @@ -127,8 +131,24 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { q = q.Where(w => w.LockDate <= DateTime.Parse(date_end)); } - ResultModel result = new ResultModel(); - result.Data = await q.ToListAsync(); + + ResultModel result = new ResultModel(); + result.Data = await q.Select(s => new WipLockDto + { + WipNO = s.WipNO, + WipLockID = s.WipLockID, + ItemNO = s.WipAtt.ItemNO, + LockDate = s.LockDate, + UnLockDate = s.UnLockDate, + LockUserID = s.LockUserID, + LockReason = s.LockReason, + LockStatus = s.LockStatus == "0" ? "鎖定" : "解鎖", + UnLockUserID = s.UnLockUserID, + UnLockReason = s.UnLockReason, + LockReasonType = s.LockReasonType, + LockType = s.LockType, + StationName = s.Stations.StationName + }).ToListAsync(); return result; } @@ -165,7 +185,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// 工單解鎖資料檔 ///
    /// - [HttpPut()] + [HttpPut] public async Task> PutWipLock([FromBody] WipLock wiplock) { ResultModel result = new ResultModel(); diff --git a/AMESCoreStudio.WebApi/DTO/AMES/WipLockDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/WipLockDto.cs new file mode 100644 index 00000000..1fc0615a --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/WipLockDto.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// WipInfo Select Dto + /// + public class WipLockDto + { + + /// + /// 工單鎖定ID + /// + public int WipLockID { get; set; } + + /// + /// 工單號碼 + /// + public string WipNO { get; set; } + + /// + /// 鎖定狀態(0:鎖定;1:解鎖) + /// + public string LockStatus { get; set; } + + /// + /// 料號 + /// + public string ItemNO { get; set; } + + /// + /// 鎖定原因 + /// + public string LockReason { get; set; } + + /// + /// 解鎖原因 + /// + public string UnLockReason { get; set; } + + /// + /// 站別ID + /// + + + public string StationName { get; set; } + /// + /// 鎖定類型 + /// + public string LockType { get; set; } + + /// + /// 鎖定原因類別(0-3C認證工單;1-驗證工單;3-維修換料待分析) + /// + public string LockReasonType { get; set; } + + /// + /// 鎖定人員 + /// + public decimal LockUserID { get; set; } + + /// + /// 鎖定日期 + /// + public DateTime LockDate { get; set; } + + /// + /// 解鎖人員 + /// + public decimal? UnLockUserID { get; set; } + + /// + /// 解鎖日期 + /// + + public DateTime? UnLockDate { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipAtt.cs b/AMESCoreStudio.WebApi/Models/AMES/WipAtt.cs index 7f09df07..e0c2f99f 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipAtt.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipAtt.cs @@ -6,7 +6,7 @@ using System.Runtime.Serialization; namespace AMESCoreStudio.WebApi.Models.AMES { /// - /// 用户资料表 + /// 工單機種資料 /// [Table("WIP_ATT", Schema = "JHAMES")] [DataContract] diff --git a/AMESCoreStudio.WebApi/Models/AMES/WipLock.cs b/AMESCoreStudio.WebApi/Models/AMES/WipLock.cs index faf75ede..75451035 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipLock.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipLock.cs @@ -62,6 +62,8 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] [Required(ErrorMessage = "{0},不能空白")] [Display(Name = "站別ID")] + + public int StationID { get; set; } = 0; /// @@ -116,5 +118,17 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "解鎖日期")] public DateTime? UnLockDate { get; set; } + + /// + /// 站别資料 + /// + [ForeignKey("StationID")] + public virtual AMESCoreStudio.WebApi.Models.BAS.Stations Stations { get; set; } + + /// + /// 工單機種資料 + /// + [ForeignKey("WipNO")] + public virtual WipAtt WipAtt { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Startup.cs b/AMESCoreStudio.WebApi/Startup.cs index 3adfe683..47ee76e9 100644 --- a/AMESCoreStudio.WebApi/Startup.cs +++ b/AMESCoreStudio.WebApi/Startup.cs @@ -76,6 +76,12 @@ namespace AMESCoreStudio.WebApi var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); + + // Invalid ModelState Filter ( Model ҥѷ|L) + services.Configure(options => + { + options.SuppressModelStateInvalidFilter = true; + }); } /// diff --git a/AMES1112.sql b/其他專案資料/DB備份/AMES1112.sql similarity index 100% rename from AMES1112.sql rename to 其他專案資料/DB備份/AMES1112.sql diff --git a/SQL20211112.txt b/其他專案資料/DB備份/SQL20211112.txt similarity index 100% rename from SQL20211112.txt rename to 其他專案資料/DB備份/SQL20211112.txt diff --git a/其他專案資料/Oracle EF Core.docx b/其他專案資料/Oracle EF Core.docx new file mode 100644 index 00000000..3381fa7b --- /dev/null +++ b/其他專案資料/Oracle EF Core.docx @@ -0,0 +1,23 @@ +套件管理器主控台(檢視>其他視窗>套件管理器主控台)下以下指令 PS.記得選指定專案 +PM 下指令 +Scaffold-DbContext "Data Source=10.0.123.30:1521/shop.aten.com.tw;Password=s20f07s28;User Id=sfs;" +Oracle.EntityFrameworkCore -OutputDir Models -Force -Context "AppDBContext" + +-OutputDir 資料夾名稱 +-Context Context名稱 +-Force 覆寫現有檔案 +-NoOnConfiguring 不要產生 DbContext.OnConfiguring +-Tables 不設定參數,預設全部table + +Scaffold-DbContext "Data Source=10.0.123.30:1521/shop.aten.com.tw;Password=s20f07s28;User Id=sfs;" Oracle.EntityFrameworkCore -OutputDir Models/test -Force -Context "AppDBContext" -NoOnConfiguring -DataAnnotations + +詳細參數說明 +https://docs.microsoft.com/zh-tw/ef/core/cli/powershell#common-parameters + + +AMES 專案測試 +在Models/aaa 建立Model 跟 DBconntext +Scaffold-DbContext "Data Source=61.216.68.18:1521/JHDB;Password=AMES666;User Id=JHAMES;" Oracle.EntityFrameworkCore -OutputDir Models/aaa -DataAnnotations -Tables "Table名稱" -ContextNamespace "DB" + +DBconntext 所產生的ModelBuilder(功能跟DataAnnotations一樣,但ModelBuilder優先度高 可設定一個以上主key) 可以剪貼放到AMESContext.cs + diff --git a/oracle指令.txt b/其他專案資料/oracle指令.txt similarity index 100% rename from oracle指令.txt rename to 其他專案資料/oracle指令.txt