From 55f8b043f8c60620ccead2c99a9554c122560b34 Mon Sep 17 00:00:00 2001 From: Yiru Date: Sun, 24 Sep 2023 17:26:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0IPQC=E5=B7=A1=E6=AA=A2?= =?UTF-8?q?=E9=A0=85=E7=9B=AE=20:=20=E5=9B=9E=E8=A6=86=E5=BE=8C=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E5=AF=84Mail=20=E7=B5=A6IPQC=5FREPLY=E7=BE=A4?= =?UTF-8?q?=E7=B5=84=20QC=E9=80=80=E5=9B=9E=E5=8A=9F=E8=83=BD&=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E5=AF=84MAIL=E9=80=9A=E7=9F=A5(=E5=A2=9E=E5=8A=A0Insp?= =?UTF-8?q?ectionResultReject)=20=E5=B7=A1=E6=AA=A2=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E7=B5=90=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SPCController.cs | 155 +++++++++++++- AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs | 34 ++- AMESCoreStudio.Web/Views/SPC/SPC004J.cshtml | 89 ++++++++ AMESCoreStudio.Web/Views/SPC/SPC004V.cshtml | 66 +++++- AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml | 4 +- .../AMES/InspectionResultDetailsController.cs | 36 +++- .../AMES/InspectionResultRejectsController.cs | 202 ++++++++++++++++++ .../DTO/AMES/InspectionResultDetailDto.cs | 5 + .../Models/AMES/InspectionResultDetail.cs | 10 + .../Models/AMES/InspectionResultReject.cs | 103 +++++++++ AMESCoreStudio.WebApi/Models/AMESContext.cs | 7 + 11 files changed, 701 insertions(+), 10 deletions(-) create mode 100644 AMESCoreStudio.Web/Views/SPC/SPC004J.cshtml create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultRejectsController.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/InspectionResultReject.cs diff --git a/AMESCoreStudio.Web/Controllers/SPCController.cs b/AMESCoreStudio.Web/Controllers/SPCController.cs index 05f295b9..87fd3cbc 100644 --- a/AMESCoreStudio.Web/Controllers/SPCController.cs +++ b/AMESCoreStudio.Web/Controllers/SPCController.cs @@ -28,9 +28,10 @@ namespace AMESCoreStudio.Web.Controllers public readonly IPCS _pcsApi; public readonly ISYS _sysApi; public readonly IPPS _ppsApi; + public readonly IBLL _bllApi; private readonly IWebHostEnvironment _env; - public SPCController(ILogger logger, ISPC spcApi, IWHS whsApi,IBAS basApi, IPCS pcsApi, ISYS sysApi, IPPS ppsApi, IWebHostEnvironment env) + public SPCController(ILogger logger, ISPC spcApi, IWHS whsApi,IBAS basApi, IPCS pcsApi, ISYS sysApi, IPPS ppsApi, IWebHostEnvironment env, IBLL bllApi) { _logger = logger; _spcApi = spcApi; @@ -40,6 +41,7 @@ namespace AMESCoreStudio.Web.Controllers _sysApi = sysApi; _ppsApi = ppsApi; _env = env; + _bllApi = bllApi; } @@ -704,6 +706,10 @@ namespace AMESCoreStudio.Web.Controllers { return View(); } + var FormResult = await _spcApi.GetInspectionForm(result.Select(s=>s.InspectionFormID).FirstOrDefault()); + + ViewBag.FormType = FormResult.Select(s => s.InspectionTypeID).FirstOrDefault(); ; + var user = await _sysApi.GetUserInfo(result[0].CreateUserID); var userName = user[0].UserName; ViewBag.UserName = userName; @@ -750,6 +756,30 @@ namespace AMESCoreStudio.Web.Controllers if (result.Success) { var _msg = "修改成功!"; + var result_Master = await _spcApi.GetInspectionResultMasters(model.InspectionID); + + + if (result_Master.Count() > 0 ) + { + model.ReplyReason = model.ReplyReason == null ? model.ReplyReason : model.ReplyReason.Replace("\r\n", "
"); + model.ReplyMethod = model.ReplyMethod == null ? model.ReplyMethod : model.ReplyMethod.Replace("\r\n", "
"); + #region 寄mail 給IPQC_REPLY + string MailGroup = "IPQC_REPLY"; + string Subject = $"[AMES系統通知] ,IPQC巡檢異常回覆通知"; + string Body = $@"檢驗單號: { result_Master.Select(s=>s.BarcodeNo).FirstOrDefault()}
+ 工單號碼 : {result_Master.Select(s => s.WipNo).FirstOrDefault()}
+ 料號 : {result_Master.Select(s => s.ItemNo).FirstOrDefault()}
+ 回覆異常原因 :
+ {model.ReplyReason}
+ 回覆異常對策 :
+ {model.ReplyMethod}
+ 請QC人員至系統檢視資料"; + + + await _bllApi.PostToMail(Subject, Body, MailGroup, "", false); + } + #endregion + return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else @@ -775,6 +805,115 @@ namespace AMESCoreStudio.Web.Controllers return View(); } + /// + /// IPQC巡檢細項結案 + /// + /// + /// + public async Task SPC004DAsync(int id, int iid) + { + await GetUserID(); + InspectionResultDetail data = new InspectionResultDetail(); + data.InspectionID = id; + data.InspectionItemID = iid; + data.UpdateDate = System.DateTime.Now; + data.UpdateUserID = ViewBag.UserID; + data.InspectionType = "Y"; + var result = await _spcApi.PutInspectionResultDetailForType(JsonConvert.SerializeObject(data)); + return Json(new Result() { success = result.Success, msg = result.Msg }); + } + [HttpGet] + public async Task SPC004JAsync(int id, int Iid) + { + var result = await _spcApi.GetInspectionResultMaster(id); + var userID = ""; + int user_id = 0; + HttpContext.Request.Cookies.TryGetValue("UserID", out userID); + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + var userName = await _sysApi.GetUserInfo(user_id); + + ViewBag.UserID = user_id; + ViewBag.UserName = userName[0].UserName; + ViewBag.InspectionID = id; + ViewBag.InspectionItemID = Iid; + ViewBag.BarcodeNo = result.Select(s => s.BarcodeNo).FirstOrDefault(); + ViewBag.WipNo = result.Select(s => s.WipNo).FirstOrDefault(); + ViewBag.ItemNo = result.Select(s => s.ItemNo).FirstOrDefault(); + + return View(); + } + public async Task SPC004JSaveAsync(InspectionResultReject model) + { + if (ModelState.IsValid) + { + IResultModel result; + var stringList = model.RejectAddress.Split(','); + var EmailMsg = string.Empty; + foreach (var item in stringList) + { + if( !IsValidEmail(item)) + { + EmailMsg += item +","; + } + } + if (!string.IsNullOrEmpty(EmailMsg)) + { + EmailMsg = "Email:" + EmailMsg + "格式錯誤"; + ModelState.AddModelError("error", EmailMsg); + + } + else + { + + model.RejectReason = model.RejectReason == null ? model.RejectReason: model.RejectReason.Replace("\r\n", "
"); + #region 寄mail 給IPQC_REPLY + string Subject = $"[AMES系統通知] ,IPQC巡檢異常回覆退回"; + string Body = $@"檢驗單號: { model.BarcodeNo}
+ 工單號碼 : {model.WipNo}
+ 料號 : {model.ItemNo}
+ 異常回覆退回原因為:
{model.RejectReason}
+ 請人員重新修正異常回覆"; + + + var resultMail = await _bllApi.PostToMail(Subject, Body, "", model.RejectAddress, false); + + #endregion + if (resultMail.Success) + { + result = await _spcApi.PostInspectionResultReject(JsonConvert.SerializeObject(model)); + + if (result.Success) + { + var _msg = "退回成功!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); + } + else + { + if (result.Errors.Count > 0) + { + ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); + } + else + { + ModelState.AddModelError("error", result.Msg); + } + } + } + else + { + ModelState.AddModelError("error", resultMail.Msg); + } + } + + } + return View("SPC004J", model); + } [ResponseCache(Duration = 0)] [HttpGet] @@ -826,6 +965,20 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } + + /// + /// 判斷eMail格式正確性 + /// + /// + /// + public bool IsValidEmail(string email) + { + // 定义一个电子邮件地址的正则表达式模式 + string pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"; + + // 使用正则表达式检查字符串是否匹配电子邮件地址模式 + return System.Text.RegularExpressions.Regex.IsMatch(email, pattern); + } #endregion diff --git a/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs b/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs index 0c643b30..51999830 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/ISPC.cs @@ -144,7 +144,7 @@ namespace AMESCoreStudio.Web #endregion - #region SPC004 每日工時資料維護 + #region SPC004 巡檢結果回覆維護 /// /// InspectionResultDetail By Id and ItemID @@ -160,6 +160,14 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/InspectionResultDetails/Query/{id}")] ITask> GetInspectionResultDetailQuery(int id); + /// + /// 巡檢結果回覆退回 + /// + /// + [WebApiClient.Attributes.HttpPut("api/InspectionResultDetails/{id}")] + ITask> PutInspectionResultDetail(int id, [FromBody, RawJsonContent] string model); + + #endregion #region SPC005 巡檢結果維護 @@ -182,8 +190,8 @@ namespace AMESCoreStudio.Web /// 更新巡檢結果MASTER /// /// - [WebApiClient.Attributes.HttpPut("api/InspectionResultDetails/{id}")] - ITask> PutInspectionResultDetail(int id, [FromBody, RawJsonContent] string model); + [WebApiClient.Attributes.HttpPost("api/InspectionResultRejects")] + ITask> PostInspectionResultReject([FromBody, RawJsonContent] string model); /// @@ -274,6 +282,15 @@ namespace AMESCoreStudio.Web ITask> GetIpqcQuery(int InspectionID); + /// + /// 根據ID獲取指定巡檢結果Masters + /// + /// + [WebApiClient.Attributes.HttpGet("api/InspectionResultMasters/{id}")] + ITask> GetInspectionResultMasters(int id); + + #endregion + #region SPC006 任務性IPQC提醒 /// /// 任務性IPCQ提示查詢 @@ -312,8 +329,17 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPut("api/IPQCTaskNotice/{id}")] ITask> PutIPQCTaskNotice(int id, [FromBody, RawJsonContent] string model); - #endregion + /// + /// 更新巡檢項目狀態 + /// + /// + [WebApiClient.Attributes.HttpPut("api/InspectionResultDetails/InspectionResultDetailForType")] + ITask> PutInspectionResultDetailForType([FromBody, RawJsonContent] string model); + + + + #endregion } diff --git a/AMESCoreStudio.Web/Views/SPC/SPC004J.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC004J.cshtml new file mode 100644 index 00000000..2afb7116 --- /dev/null +++ b/AMESCoreStudio.Web/Views/SPC/SPC004J.cshtml @@ -0,0 +1,89 @@ +@model AMESCoreStudio.WebApi.Models.AMES.InspectionResultReject + + +@{ ViewData["Title"] = "SPC004J"; + Layout = "~/Views/Shared/_FormLayout.cshtml"; } + + + + +
+
+
+
+ + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ + +
+ + + +
+
+ + + +
+ @Html.ValidationMessage("error") +
+ +
+ +
+
+
+ +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + + + +} + diff --git a/AMESCoreStudio.Web/Views/SPC/SPC004V.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC004V.cshtml index 938c93d5..ca403fae 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC004V.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC004V.cshtml @@ -34,6 +34,7 @@ +
@@ -203,14 +204,17 @@ }, { field: 'result', + width: 80, title: '稽核結果' }, { field: 'missingUnitNo', + width: 100, title: '缺失單位' }, { field: 'missingUserID', + width: 100, title: '缺失人員' }, { @@ -251,11 +255,22 @@ }, { field: 'right', - width: 85, + width: 160, title: '操作', fixed: 'right', templet: function (d) { - return '回復' + var btn = ""; + if (d.result == "FAIL") { + btn += '回復'; + } + if ($("#FormType").val() == 1001 && d.result == "FAIL" && d.inspectionType != "Y") { + btn += '退回'; + btn += '結案'; + } + if ($("#FormType").val() == 1001 && d.result == "FAIL" && d.inspectionType == "Y") { + btn += '已結案' + } + return btn; } }] ]; @@ -267,6 +282,47 @@ } } + //通过行tool删除,lay-event="del" + function del(obj) { + if (obj.data.inspectionID) { + if (obj.data.method == "Y") { + if ( !obj.data.peplyMethod) { + hg.msg("項目尚未回覆對策,不可結案!"); + return false; + } + } + // else + { + if (obj.data.peplyReason) { + hg.confirm("确定要結案嗎?", function () { + $.ajax({ + url: '/SPC/SPC004D', + data: { id: obj.data.inspectionID, iid: obj.data.inspectionItemID }, + type: 'POST', + success: function (data) { + if (data.success) { + hg.msghide("已結案!"); + table && table.reload(data); + } + else { + hg.msg(data.msg); + } + }, + error: function () { + hg.msg("网络请求失败!"); + } + }); + }); + } + else { + hg.msg("項目尚未回覆原因,不可結案!"); + return false; + } + } + + } + } + function View(obj) { var id = $("#InspectionID").val(); @@ -297,6 +353,12 @@ } + //通过行tool编辑,lay-event="reject" + function reject(obj) { + if (obj.data.inspectionID) { + hg.open('檢視巡檢結果回覆退回', '/SPC/SPC004J?id=' + obj.data.inspectionID + '&Iid=' + obj.data.inspectionItemID, 480, 480); + } + } //基本数据表格 var table; diff --git a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml index 955f17f7..d0079d95 100644 --- a/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml +++ b/AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml @@ -40,8 +40,8 @@
- - + + diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultDetailsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultDetailsController.cs index 78ba5c64..3d516bb3 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultDetailsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultDetailsController.cs @@ -115,7 +115,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES InspectionResult =q1.Result, PeplyReason = q1.ReplyReason, PeplyMethod = q1.ReplyMethod, - + InspectionType = q1.InspectionType }; @@ -192,6 +192,40 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } + + /// + /// 更新入巡檢項目狀態 + /// + /// + /// + [HttpPut("InspectionResultDetailForType")] + public async Task> PutInspectionResultDetailForType([FromBody] InspectionResultDetail inspectionResultDetail) + { + ResultModel result = new ResultModel(); + var data = await _context.InspectionResultDetails.Where(w => w.InspectionID == inspectionResultDetail.InspectionID && + w.InspectionItemID == inspectionResultDetail.InspectionItemID).FirstOrDefaultAsync(); + data.InspectionType = inspectionResultDetail.InspectionType; + data.UpdateUserID = inspectionResultDetail.UpdateUserID; + data.UpdateDate = inspectionResultDetail.UpdateDate; + _context.Entry(data).State = EntityState.Modified; + _context.Entry(data).Property("InspectionType").IsModified = true; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + + /// /// 新增巡檢類別資料 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultRejectsController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultRejectsController.cs new file mode 100644 index 00000000..772c1093 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/InspectionResultRejectsController.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using AMESCoreStudio.WebApi; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.CommonTools.Result; + + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// + /// 巡檢類別資料维护 + /// + [Route("api/[controller]")] + [ApiController] + public class InspectionResultRejectsController : ControllerBase + { + private readonly AMESContext _context; + + /// + /// + /// + /// + public InspectionResultRejectsController(AMESContext context) + { + _context = context; + } + + /// + /// 获取全部巡檢類別資料 + /// + /// + // GET: api/InspectionResultRejects + [HttpGet] + public async Task>> GetInspectionResultRejects() + { + IQueryable q = _context.InspectionResultRejects; + q = q.OrderBy(p => p.InspectionID); + q = q.OrderBy(p => p.InspectionItemID); + + var InspectionResultRejects = await q.ToListAsync(); + + return InspectionResultRejects; + } + + /// + /// 用ID获取该巡檢類別資料 + /// + /// + /// + // GET: api/InspectionResultRejects/5 + [HttpGet("{id}")] + public async Task>> GetInspectionResultRejects(int id) + { + + IQueryable q = _context.InspectionResultRejects; + q = q.Where(p => p.InspectionRejectID.Equals(id)); + q = q.OrderBy(p => p.InspectionItemID); + var InspectionResultReject = await q.ToListAsync(); + + if (InspectionResultReject == null) + { + return NotFound(); + } + + return InspectionResultReject; + } + + /// + /// 用ID获取该巡檢類別資料 + /// + /// + /// + /// + // GET: api/InspectionResultRejects/5 + [HttpGet("Query/{id}/{Iid}")] + public async Task>> GetInspectionResultRejectByQuery(int id, int Iid) + { + + IQueryable q = _context.InspectionResultRejects; + q = q.Where(p => p.InspectionID.Equals(id)); + q = q.Where(p => p.InspectionItemID.Equals(Iid)); + var InspectionResultReject = await q.ToListAsync(); + + if (InspectionResultReject == null) + { + return InspectionResultReject; + } + + return InspectionResultReject; + } + + + /// + /// 更新巡檢類別資料 + /// + /// + /// + /// + // PUT: api/InspectionResultRejects/5 + // 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> PutInspectionResultReject(int id, [FromBody] InspectionResultReject InspectionResultReject) + { + ResultModel result = new ResultModel(); + if (id != InspectionResultReject.InspectionID) + { + result.Success = false; + result.Msg = "序號錯誤"; + return result; + } + + _context.Entry(InspectionResultReject).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + } + + /// + /// 新增巡檢類別資料 + /// + /// + /// + // POST: api/InspectionResultRejects + // 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> PostInspectionResultRejects(InspectionResultReject InspectionResultReject) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + var InspectionResultRejectID = helper.GetIDKey("INSPECTION_REJECT_ID").Result; + InspectionResultReject.InspectionRejectID = InspectionResultRejectID; + _context.InspectionResultRejects.Add(InspectionResultReject); + try + { + await _context.SaveChangesAsync(); + } + catch (Exception e) + { + result.Success = false; + result.Msg = e.Message; + return result; + } + + result.Success = true; + result.Msg = "OK"; + return result; + + } + + /// + /// 删除巡檢類別資料 + /// + /// + /// + // DELETE: api/InspectionResultRejects/5 + [HttpDelete("{id}")] + public async Task> DeleteInspectionResultRejects(int id) + { + ResultModel result = new ResultModel(); + var inspectionType = await _context.InspectionResultRejects.Where(m => m.InspectionID == id).FirstOrDefaultAsync(); + if (inspectionType == null) + { + result.Success = false; + result.Msg = "序號不存在"; + return result; + } + + _context.InspectionResultRejects.Remove(inspectionType); + await _context.SaveChangesAsync(); + + result.Success = true; + result.Msg = "OK"; + return result; + } + + private bool InspectionResultRejectsExists(int id) + { + return _context.InspectionResultRejects.Any(e => e.InspectionID == id); + } + + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultDetailDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultDetailDto.cs index 03a0bd5a..801705f2 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultDetailDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/InspectionResultDetailDto.cs @@ -126,5 +126,10 @@ namespace AMESCoreStudio.WebApi.DTO.AMES /// 圖片數量 ///
public int BolbQty { get; set; } + + /// + /// 項目結案否 + /// + public string InspectionType { get; set; } } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/InspectionResultDetail.cs b/AMESCoreStudio.WebApi/Models/AMES/InspectionResultDetail.cs index d020b651..c12d8a62 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/InspectionResultDetail.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/InspectionResultDetail.cs @@ -190,6 +190,16 @@ namespace AMESCoreStudio.WebApi.Models.AMES [DataMember] public DateTime UpdateDate { get; set; } = System.DateTime.Now; + + /// + /// 結案 Y/N + /// + [Column("INSPECTION_TYPE")] + [StringLength(4)] + [Display(Name = "結案")] + [DataMember] + public string InspectionType { get; set; } = "N"; + /// /// 線別 /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/InspectionResultReject.cs b/AMESCoreStudio.WebApi/Models/AMES/InspectionResultReject.cs new file mode 100644 index 00000000..628ef777 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/InspectionResultReject.cs @@ -0,0 +1,103 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; +using Microsoft.EntityFrameworkCore; +using AMESCoreStudio.WebApi.Models.BAS; +using AMESCoreStudio.WebApi.Models.SYS; + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// + /// 巡檢結果回覆明細資料檔 + /// + [Keyless] + [Table("INSPECTION_RESULT_REJECT", Schema = "JHAMES")] + public partial class InspectionResultReject + { + + /// + /// 巡檢結果退回ID + /// + [Column("INSPECTION_REJECT_ID")] + [Key] + [DataMember] + [Required(ErrorMessage = "{0},不能空白")] + public int InspectionRejectID { get; set; } + + /// + /// 巡檢結果ID + /// + [Column("INSPECTION_ID")] + [DataMember] + [Required(ErrorMessage = "{0},不能空白")] + public int InspectionID { get; set; } + + /// + /// 巡檢項目ID + /// + [Column("INSPECTION_ITEMID")] + [DataMember] + [Required(ErrorMessage = "{0},不能空白")] + public int InspectionItemID { get; set; } + + + /// + /// 退回原因 + /// + [Column("REJECT_REASON")] + [StringLength(200)] + [Display(Name = "退回原因")] + [DataMember] + [Required(ErrorMessage = "{0},不能空白")] + public string RejectReason { get; set; } + + /// + /// 退回通知人 + /// + [Column("REJECT_ADDRESS")] + [Display(Name = "退回通知人")] + [DataMember] + [Required(ErrorMessage = "{0},不能空白")] + public string RejectAddress { get; set; } + + /// + /// 創建者ID + /// + [Column("CREATE_USERID")] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// + /// 創建日期 + /// + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = System.DateTime.Now; + /// + /// 工單號碼 + /// + /// + [Display(Name = "工單號碼")] + [NotMapped] + [DataMember] + public string WipNo { get; set; } + /// + /// 料號 + /// + [Display(Name = "料號")] + [NotMapped] + [DataMember] + public string ItemNo { get; set; } + /// + /// 檢驗編號 + /// + [Display(Name = "檢驗編號")] + [NotMapped] + [DataMember] + public string BarcodeNo { get; set; } + + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 304f4d80..76ac99c2 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -141,6 +141,7 @@ namespace AMESCoreStudio.WebApi modelBuilder.Entity().HasKey(c => new { c.InspectionItemID, c.InspectionID, c.CreateDate }); modelBuilder.Entity().HasKey(c => new { c.InspectionItemID, c.InspectionID }); + modelBuilder.Entity().HasKey(c => new { c.InspectionRejectID }); modelBuilder.Entity().HasOne(r => r.Stations).WithMany().HasForeignKey(r => r.RuleStationID).IsRequired(); @@ -966,6 +967,12 @@ namespace AMESCoreStudio.WebApi /// 任務性IPQC提示mail記錄 ///
public virtual DbSet IPQCTaskMailLogs { get; set; } + + + /// + /// 任務性IPQC提示mail記錄 + /// + public virtual DbSet InspectionResultRejects { get; set; } } }