diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c0b322bd..5b27c068 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1045,6 +1045,32 @@ namespace AMESCoreStudio.Web.Controllers var result = await _pcsApi.GetPlmMeterialInfoAutoComplete(search); return Json(new { data = result }); } + + + public async Task MaterialKpQueryAsync(string itemno = null, string station = null) + { + + IEnumerable result = await _pcsApi.GetMaterialKpQuery(itemno: itemno, station: station); + + if (result.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count() }); + } + return Json(new Table() { count = 0, data = null }); + } + + + public async Task MaterialOutfitByItemNo(string itemno = null, string station = null) + { + + var result = await _pcsApi.GetMaterialOutfitByItemNo(itemno); + + if (result.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result, count = result.Count() }); + } + return Json(new Table() { count = 0, data = null }); + } #endregion [ResponseCache(Duration = 0)] @@ -1210,6 +1236,17 @@ namespace AMESCoreStudio.Web.Controllers { int wipID = int.Parse(result.Msg); + // 料號判斷,沒有就Insert + var checkMaterialItem = await _pcsApi.GetMaterialItemByItemNO(model.wipAtt.ItemNO); + if (checkMaterialItem == null) + { + await _pcsApi.PostMaterialItem(JsonConvert.SerializeObject( + new MaterialItem + { + ItemNo = model.wipAtt.ItemNO + })); + } + // 工單屬性 model.wipAtt.WipNO = model.wipInfo.WipNO; await _pcsApi.PostWipAtt(JsonConvert.SerializeObject(model.wipAtt)); @@ -1253,14 +1290,6 @@ namespace AMESCoreStudio.Web.Controllers } } - // 工單對應SOP - var q = await _pcsApi.GetMaterialSopQuery(itemNo: model.wipAtt.ItemNO, unitNo: model.wipInfo.UnitNO, state: "Y"); - if (q.Data.Count() != 0) - { - ////model.wipSop.MaterialSopID = q.Data.FirstOrDefault().MaterialSopID; - ////await _pcsApi.PostWipSop(JsonConvert.SerializeObject(model.wipSop)); - } - // 內部條碼 if (!string.IsNullOrWhiteSpace(model.wipBarcode.StartNO) && !string.IsNullOrWhiteSpace(model.wipBarcode.EndNO)) { @@ -1304,10 +1333,11 @@ namespace AMESCoreStudio.Web.Controllers } } - // KeyParts 組合 + // 料號相關 var materialItem = await _pcsApi.GetMaterialItemByItemNO(model.wipAtt.ItemNO); if (materialItem != null) { + // KeyParts 組合 var materialKp = await _pcsApi.GetMaterialKpByItemID(materialItem.ItemID); foreach (var item in materialKp.Where(w => w.StationType == model.wipInfo.UnitNO)) { @@ -1324,6 +1354,37 @@ namespace AMESCoreStudio.Web.Controllers }; await _pcsApi.PostWipKp(JsonConvert.SerializeObject(wipKp)); } + + // 治具 + var materialOutfit = await _pcsApi.GetMaterialOutfitByItemNo(model.wipAtt.ItemNO); + foreach (var item in materialOutfit.Where(w => w.UnitNo == model.wipInfo.UnitNO)) + { + var wipOutfit = new WipOutfit + { + WipNo = model.wipInfo.WipNO, + ItemNo = model.wipAtt.ItemNO, + UnitNo = model.wipInfo.UnitNO, + OutfitNo = item.OutfitNo, + PartNo = item.StationType + }; + await _pcsApi.PostWipOutfit(JsonConvert.SerializeObject(wipOutfit)); + } + + // 工單對應SOP + var materialSop = await _pcsApi.GetMaterialSopByItemNo(model.wipAtt.ItemNO); + foreach (var item in materialSop.Where(w => w.UnitNo == model.wipInfo.UnitNO)) + { + var wipSop = new WipSop + { + WipNo = model.wipInfo.WipNO, + ItemNo = model.wipAtt.ItemNO, + UnitNo = model.wipInfo.UnitNO, + SOPName = item.SopName, + SOPPath = item.SopPath, + SOPType = item.SopType + }; + await _pcsApi.PostWipSop(JsonConvert.SerializeObject(wipSop)); + } } } @@ -1690,7 +1751,7 @@ namespace AMESCoreStudio.Web.Controllers // 先比對新舊ID 當舊ID有 新的沒有代表已刪除 var resultOld_WipKp = await _pcsApi.GetWipKpByWipNo(model.wipInfo.WipNO); var delete_WipKpID = resultOld_WipKp.Select(s => s.WipKpID).Except(model.WipKps.Select(s => s.WipKpID)); - foreach(var id in delete_WipKpID) + foreach (var id in delete_WipKpID) { await _pcsApi.DeleteWipKp(id); } @@ -1992,18 +2053,6 @@ namespace AMESCoreStudio.Web.Controllers } #endregion - public async Task MaterialKpQueryAsync(string itemno = null, string station = null) - { - - IEnumerable result = await _pcsApi.GetMaterialKpQuery(itemno: itemno, station: station); - - if (result.Count() != 0) - { - return Json(new Table() { code = 0, msg = "", data = result, count = result.Count() }); - } - return Json(new Table() { count = 0, data = null }); - } - #region PCS005 工單資料查詢 public async Task PCS005() { @@ -3585,10 +3634,10 @@ namespace AMESCoreStudio.Web.Controllers /// 鎖定日期迄 /// public async Task PCS030QueryAsync(string itemNo, string unitNo - , string fileName, string state, string date_str, string date_end) + , string sopName, string sopType, string date_str, string date_end) { IResultModel result = await _pcsApi.GetMaterialSopQuery(itemNo: itemNo, unitNo: unitNo - , fileName: fileName, state: state, date_str: date_str, date_end: date_end); + , sopName: sopName, sopType: sopType, date_str: date_str, date_end: date_end); if (result.Data.Count() != 0) { @@ -3614,6 +3663,7 @@ namespace AMESCoreStudio.Web.Controllers [HttpGet] public async Task PCS030C() { + GetSOPTypeSelect(); await GetFactoryUnit(); return View(); } @@ -3621,63 +3671,98 @@ namespace AMESCoreStudio.Web.Controllers [HttpPost] public async Task PCS030CAsync(MaterialSop model, IFormFile formFile) { - string FileName = string.Empty; - string NewName = string.Empty; - string FilePath = string.Empty; + //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("/"); + //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); - //} + // //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; + // 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(); + GetSOPTypeSelect(); + + IResultModel result; + result = await _pcsApi.PostMaterialSop(JsonConvert.SerializeObject(model)); + if (model.MaterialSopID == 0) + { - 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", "請選擇要上傳檔案"); + //result = await _basApi.putmat(model.FactoryID, JsonConvert.SerializeObject(model)); } - await GetFactoryUnit(); - return View(model); + + if (result.Success) + { + var _msg = model.MaterialSopID == 0 ? "新增成功!" : "修改成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors != null) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + + if (model.MaterialSopID == 0) + { + return View("PCS030C", model); + } + return View("PCS030U", model); + } [HttpPost] @@ -3961,9 +4046,9 @@ namespace AMESCoreStudio.Web.Controllers IResultModel result; - model.FileName = FileName; - model.NewName = NewName; - model.FilePath = FilePath;// fileInfo.PhysicalPath; + //model.FileName = FileName; + //model.NewName = NewName; + //model.FilePath = FilePath;// fileInfo.PhysicalPath; result = await _pcsApi.PostMaterialSop(JsonConvert.SerializeObject(model)); if (result.Success) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index f992ce18..4dd72a4a 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -522,6 +522,13 @@ namespace AMESCoreStudio.Web /// 料號 [WebApiClient.Attributes.HttpGet("api/MaterialItem/ByItemNO/{id}")] ITask GetMaterialItemByItemNO(string id); + + /// + /// 新增料號基本資料檔 + /// + /// + [WebApiClient.Attributes.HttpPost("api/MaterialItem")] + ITask> PostMaterialItem([FromBody, RawJsonContent] string model); #endregion #region MaterialKp Keypart 料號KP資訊資料檔 @@ -539,6 +546,8 @@ namespace AMESCoreStudio.Web /// 站別 [WebApiClient.Attributes.HttpGet("api/MaterialKp/GetMaterialKpQuery")] ITask> GetMaterialKpQuery(string itemno = null, string station = null); + + #endregion #region MaterialOutfit 料號治具資訊資料檔 @@ -555,10 +564,10 @@ namespace AMESCoreStudio.Web /// 料號 [WebApiClient.Attributes.HttpGet("api/MaterialOutfit/ByItemNO/{id}")] ITask> GetMaterialOutfitByItemNo(string id); - + #endregion - #region MaterialOutfit 料號站別工項資料檔 + #region MaterialStationsItem 料號站別工項資料檔 /// /// 料號站別工項資料檔 By ItemID /// @@ -575,23 +584,27 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/MaterialSop/{id}")] ITask GetMaterialSop(int id); + /// + /// 料號SOP資訊資料檔 ByItemNo + /// + /// 料號 + [WebApiClient.Attributes.HttpGet("api/MaterialSop/ByItemNO/{id}")] + ITask> GetMaterialSopByItemNo(string id); /// - /// 製程工單鎖定查詢 Query + /// 料號SOP查詢 Query /// - /// 工單狀態:鎖定|解鎖 - /// 鎖定類型 - /// 鎖定原因類別 - /// 站別 - /// 工單 - /// 料號 + /// 工單狀態:料號 + /// 生產但為 + /// 檔案名稱 + /// sop類型 /// 鎖定日期起 /// 鎖定日期迄 /// /// [WebApiClient.Attributes.HttpGet("api/MaterialSop/GetMaterialSopQuery")] ITask> GetMaterialSopQuery(string itemNo = null, string unitNo = null - , string fileName = null, string state = null, string date_str = null, string date_end = null); + , string sopName = null, string sopType = null, string date_str = null, string date_end = null); /// /// 新增SOP文件 diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml index 2ec7c857..2a6c1388 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001.cshtml @@ -30,8 +30,8 @@
- - + +
@@ -41,7 +41,7 @@
- +
@@ -449,6 +449,7 @@ +
@@ -456,8 +457,7 @@
- - +
@@ -465,7 +465,7 @@
- +
@@ -643,42 +643,27 @@ @* 治具組合sheet *@ -
- - @{ int j = 0;} - - - - - - - - - @foreach (var index in Model.Outfits) - { - - - - - - j++; - } - -
- 治具NO - - 治具名稱 - - 流程名稱ID -
- - @index.OutfitNo - - @index.StationType - - @index.RuleStationID -
-
+
+ @* + + + + + + + + + +
+ 治具NO + + 治具名稱 + + 流程名稱ID +
*@ + 刷新 +
+
@* SOP文件 sheet *@
@@ -832,8 +817,8 @@ , theme: 'grid' }); - // PLM料號關鍵字 - $(".autocomplete").each(function () { + // PLM料號關鍵字 + $(".autocomplete").each(function () { layui.autocomplete({ element: this, display: 'meterialNo', @@ -844,12 +829,26 @@ query: {}, resArray: 'data', done: function (item) { - $(this.element).closest('div.layui-inline').find('input[id*=' + this.element.id + '_Desc]').val(item.productionMemo); + $(this.element).closest('div.layui-inline').find('input[id*=' + this.element.id + '_Desc]').val(item.meterialDesc); } }); }) + // PowerMode + layui.autocomplete({ + element: '#wipSystem_PowerMode', + display: 'meterialNo', + shortcut: 'modelName', + num: 2, + count: 10, + url: '/PCS/getPLMMeterialAutoComplete', + query: {}, + resArray: 'data', + done: function (item) { + $('#wipSystem_PowerMode_Desc').val(item.productionMemo); + } + }); - form.on('select(unit)', function (data) { + form.on('select(unit)', function (data) { $("#unitNo").val(data.value); getFlowRuleList(data.value); getLineInfoList(data.value); @@ -1007,6 +1006,40 @@ hg.msghide("重新載入資料.."); tableKeyParts ; }); + @* Outfit sheet *@ + hg.form.onsubmit('queryOutfit', function (data) { + var item = $("#wipAtt_ItemNO").val(); + if ($.trim(item) == '' || item == undefined) { + parent.hg.msg("請輸入料號"); + return; + } + var tableCols = [[ + { + field: 'outfitNo', + width: 150, + title: '設備編碼', + sort: true + }, + { + field: 'stationType', + title: '設備名稱', + width: 200, + sort: true + }, + { + field: 'unit.unitName', + title: '生產單位', + sort: true, + templet: function (fileIng) { + return fileIng.unit.unitName; + } + } + ] + ]; + var tableOutfit = hg.table.datatable('Outfit', '治具維護', '/PCS/MaterialOutfitByItemNo?itemNo=' + item, {}, tableCols, '', false, 'full-100'); + hg.msghide("重新載入資料.."); + tableOutfit; + }); @* SOP文件 sheet *@ hg.form.onsubmit('querysop', function (data) { var item = $("#wipAtt_ItemNO").val(); @@ -1094,7 +1127,7 @@ tableruleStation; }; - function getPLMMeterial(val) { + function getPLMMeterial(val) { var data = $("#PCS001").serialize(); console.info(data); $.ajax( @@ -1112,5 +1145,24 @@ } }); }; + + function refreshTable() { + var FactoryUnit = getFactoryUnitList(); + var Select = "'; + + $.each(result, function (key, item) { + var contactdiv = '' + + '' + + '' + + '' + Select + '' + + '刪除' + + ''; + $('#OutfitTable').append(contactdiv); + }); + } } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS030.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS030.cshtml index f5efcce1..b282f127 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS030.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS030.cshtml @@ -58,12 +58,10 @@
- +
- - -
@@ -75,9 +73,9 @@
- +
- +
@@ -194,13 +192,13 @@ sort: true }, { - field: 'fileName', + field: 'sopName', title: '檔案名稱', sort: true }, { - field: 'state', - title: '狀態', + field: 'spType', + title: 'SOP類型', width: 100, sort: true }, @@ -216,7 +214,6 @@ width: 150, templet: '
{{ layui.util.toDateString(d.updateDate, "yyyy/MM/dd") }}
' }, - { field: 'state', title: '啟用/停用', width: 120, templet: '#switchState', unresize: true }, { field: 'right', width: 80, diff --git a/AMESCoreStudio.Web/Views/PCS/PCS030C.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS030C.cshtml index e6524e17..98a8eaf1 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS030C.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS030C.cshtml @@ -27,7 +27,6 @@
-
@@ -38,12 +37,31 @@
- + + +
+ + +
+
+
- +
+
+ +
+ + +
+
+
+ +
+
+ +
+ +
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs index ffe55c93..4b18306f 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs @@ -83,7 +83,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); Helper helper = new Helper(_context); - + MaterialItem.ItemID = helper.GetIDKey("ITEM_ID").Result; _context.MaterialItems.Add(MaterialItem); try { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialKpController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialKpController.cs index 4546a7a8..32e5b3d1 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialKpController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialKpController.cs @@ -57,7 +57,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } - /// /// 料號基本資料檔 to ItemID /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialSopController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialSopController.cs index c9541191..3ab9fc6c 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialSopController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialSopController.cs @@ -60,20 +60,33 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return materialSop; } + /// + /// 料號SOP資料檔 to ItemID + /// + /// ItemID + /// + [HttpGet("ByItemNo/{id}")] + public async Task> GetMaterialSopByItemNo(string id) + { + IQueryable q = _context.MaterialSops; + var result = await q.Where(p => p.ItemNo == id).ToListAsync(); + return result; + } + /// /// SOP文件查詢 /// /// 料號 /// 生產單位 - /// 檔案名稱 - /// 狀態 + /// 檔案名稱 + /// SOP類型 /// 建立日期起 /// 建立日期迄 /// [Route("[action]")] [HttpGet] public async Task> GetMaterialSopQuery(string itemNo = null, string unitNo = null - , string fileName = null, string state = null, string date_str = null, string date_end = null) + , string sopName = null, string sopType = null, string date_str = null, string date_end = null) { IQueryable q = _context.MaterialSops; @@ -83,11 +96,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (!string.IsNullOrWhiteSpace(unitNo)) q = q.Where(w => w.UnitNo == unitNo); - if (!string.IsNullOrWhiteSpace(fileName)) - q = q.Where(w => w.FileName.Contains(fileName)); + if (!string.IsNullOrWhiteSpace(sopName)) + q = q.Where(w => w.SopType.Contains(sopName)); - if (!string.IsNullOrWhiteSpace(state)) - q = q.Where(w => w.State == state); + if (!string.IsNullOrWhiteSpace(sopType)) + q = q.Where(w => w.SopType == sopType); if (DateTime.TryParse(date_str, out _)) @@ -106,10 +119,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES MaterialSopID = s.MaterialSopID, ItemNo = s.ItemNo, UnitName = s.FactoryUnit.UnitName, - FileName = s.FileName, - FilePath = s.FilePath, - State = s.State == "Y" ? "使用中" : "停用", - NewName = s.NewName, + SopName = s.SopName, + SopPath = s.SopPath, + SopType = s.SopType, CreateDate = s.CreateDate, CreateUserID = s.CreateUserID, UpdateDate = s.UpdateDate, @@ -125,7 +137,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES ResultModel result = new ResultModel(); Helper helper = new Helper(_context); materialSop.MaterialSopID = helper.GetIDKey("MATERIAL_SOP_ID").Result; - materialSop.State = "Y"; //wipLog.WipSopID = wipLog.WipID == 0 ? helper.GetIDKeyNoPost("WIP_ID").Result : wipLog.WipID; _context.MaterialSops.Add(materialSop); try @@ -150,7 +161,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES var materialSop = new MaterialSop { MaterialSopID = id, - State = state, UpdateUserID = 1, UpdateDate = System.DateTime.Now @@ -158,7 +168,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES _context.Attach(materialSop); // 指定更新某個欄位 - _context.Entry(materialSop).Property(p => p.State).IsModified = true; _context.Entry(materialSop).Property(p => p.UpdateUserID).IsModified = true; _context.Entry(materialSop).Property(p => p.UpdateDate).IsModified = true; diff --git a/AMESCoreStudio.WebApi/DTO/AMES/MaterialSopDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/MaterialSopDto.cs index 69d03c62..671e3993 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/MaterialSopDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/MaterialSopDto.cs @@ -27,24 +27,19 @@ namespace AMESCoreStudio.WebApi.DTO.AMES public string UnitName { get; set; } /// - /// 上傳檔案名稱 + /// 檔案名稱 /// - public string FileName { get; set; } - - /// - /// 存放檔案名稱 - /// - public string NewName { get; set; } + public string SopName { get; set; } /// /// 檔案路徑 /// - public string FilePath { get; set; } + public string SopPath { get; set; } /// - /// Y:使用中N:停用 + /// SOP類型 /// - public string State { get; set; } = "Y"; + public string SopType { get; set; } /// /// 建立UserID diff --git a/AMESCoreStudio.WebApi/Models/AMES/MaterialSop.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialSop.cs index 69f5e782..2b9bb06a 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/MaterialSop.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialSop.cs @@ -39,50 +39,41 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// 生產單位ID /// [Display(Name = "生產單位")] - [Required] + [Required(ErrorMessage = "{0},不能空白")] [Column("UNIT_NO")] - [StringLength(1)] + [StringLength(2)] [DataMember] public string UnitNo { get; set; } /// - /// 上傳檔案名稱 + /// 檔案名稱 /// [Display(Name = "檔案名稱")] - [Required] - [Column("FILENAME")] - [StringLength(100)] - [DataMember] - public string FileName { get; set; } - - /// - /// 存放檔案名稱 - /// - [Display(Name = "存放檔案名稱")] - [Required] - [Column("NEWNAME")] - [StringLength(100)] + [Required(ErrorMessage = "{0},不能空白")] + [Column("SOP_NAME")] + [StringLength(60)] [DataMember] - public string NewName { get; set; } + public string SopName { get; set; } /// /// 檔案路徑 /// - [DataMember] [Display(Name = "檔案路徑")] - [Required] - [Column("FILEPATH")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("SOP_PATH")] [StringLength(100)] - public string FilePath { get; set; } + [DataMember] + public string SopPath { get; set; } /// - /// Y:使用中N:停用 + /// SOP類型 /// - [Display(Name = "狀態")] - [Column("STATE")] - [StringLength(1)] [DataMember] - public string State { get; set; } = "Y"; + [Display(Name = "SOP類型")] + [Required] + [Column("SOP_TYPE")] + [StringLength(10)] + public string SopType { get; set; } /// /// 建立UserID