From 765c9b82d47980d0d975e66fb6a2747ce3cce6c4 Mon Sep 17 00:00:00 2001 From: Ray <raylin@aten.com> Date: Tue, 26 Jul 2022 18:20:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=E9=8B=BC=E6=9D=BF?= =?UTF-8?q?=E3=80=81=E9=8C=AB=E8=86=8F=20=E7=9B=B8=E9=97=9CAPI=E7=A8=8B?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PCBController.cs | 1456 +++++++++++++++++ AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs | 507 ++++++ AMESCoreStudio.Web/Views/PCB/PCB013.cshtml | 237 +++ AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml | 139 ++ .../AMES/SolderPasteInfoController.cs | 123 ++ .../AMES/SolderPasteRecordController.cs | 123 ++ .../AMES/SteelPlateInfoController.cs | 190 +++ .../AMES/SteelPlateMeasureController.cs | 123 ++ .../DTO/AMES/SolderPasteInfoDto.cs | 54 + .../DTO/AMES/SteelPlateInfoDto.cs | 99 ++ .../Models/AMES/SolderPasteInfo.cs | 119 ++ .../Models/AMES/SolderPasteRecord.cs | 81 + .../Models/AMES/SteelPlateInfo.cs | 174 ++ .../Models/AMES/SteelPlateMeasure.cs | 145 ++ AMESCoreStudio.WebApi/Models/AMESContext.cs | 21 +- 15 files changed, 3590 insertions(+), 1 deletion(-) create mode 100644 AMESCoreStudio.Web/Controllers/PCBController.cs create mode 100644 AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs create mode 100644 AMESCoreStudio.Web/Views/PCB/PCB013.cshtml create mode 100644 AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateMeasureController.cs create mode 100644 AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs create mode 100644 AMESCoreStudio.WebApi/DTO/AMES/SteelPlateInfoDto.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/SteelPlateInfo.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/SteelPlateMeasure.cs diff --git a/AMESCoreStudio.Web/Controllers/PCBController.cs b/AMESCoreStudio.Web/Controllers/PCBController.cs new file mode 100644 index 00000000..36bd3edc --- /dev/null +++ b/AMESCoreStudio.Web/Controllers/PCBController.cs @@ -0,0 +1,1456 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using AMESCoreStudio.Web.Models; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using AMESCoreStudio.WebApi; +using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc.Rendering; +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; +using System.IO; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Hosting; +using System.ComponentModel.DataAnnotations; +using AspNetCore.Reporting; +using System.Text.Encodings; + +namespace AMESCoreStudio.Web.Controllers +{ + /// <summary> + /// PCB管理模組 + /// </summary> + public class PCBController : Controller + { + private readonly ILogger<PCBController> _logger; + public readonly IPCB _pcbApi; + private readonly IWebHostEnvironment _env; + public readonly IPCS _pcsApi; + public PCBController(ILogger<PCBController> logger, IPCB pcbApi, IWebHostEnvironment env, IPCS pcsApi) + { + _logger = logger; + _pcbApi = pcbApi; + _env = env; + _pcsApi = pcsApi; + } + + //#region 下拉選單 + ///// <summary> + ///// 檢驗類別 Select + ///// </summary> + ///// <returns></returns> + //private async Task GetQCGroupSelect() + //{ + + // var result = await _fqcApi.GetQcGroup(); + + // var QCGroupList = new List<SelectListItem>(); + // for (int i = 0; i < result.Count; i++) + // { + // QCGroupList.Add(new SelectListItem(result[i].GroupNameCN + "【" + result[i].GroupNameEN + "】", result[i].GroupID.ToString())); + // } + + // if (QCGroupList.Count == 0) + // { + // QCGroupList.Add(new SelectListItem("N/A", null)); + // } + + // ViewBag.QCGroupSelect = QCGroupList; + //} + + ///// <summary> + ///// 抽驗係數 Select + ///// </summary> + ///// <returns></returns> + //private async Task GetQcQuotSelect() + //{ + // var result = await _fqcApi.GetQcQuot(); + + // var QcQuotList = new List<SelectListItem>(); + // for (int i = 0; i < result.Count; i++) + // { + // QcQuotList.Add(new SelectListItem(result[i].QuotName, result[i].QuotID.ToString())); + // } + + // if (QcQuotList.Count == 0) + // { + // QcQuotList.Add(new SelectListItem("N/A", null)); + // } + + // ViewBag.QcQuotSelect = QcQuotList; + //} + + ///// <summary> + ///// FQC狀態維護 Select + ///// </summary> + ///// <returns></returns> + //private async Task GetStatusTypeSelect() + //{ + // var result = await _fqcApi.GetStatusType(); + + // var StatusTypetList = new List<SelectListItem>(); + // result = result.OrderByDescending(o => o.StatusNo).ToList(); + // for (int i = 0; i < result.Count; i++) + // { + // StatusTypetList.Add(new SelectListItem(result[i].StatusName, result[i].StatusNo.ToString())); + // } + + // if (StatusTypetList.Count == 0) + // { + // StatusTypetList.Add(new SelectListItem("N/A", null)); + // } + + // ViewBag.StatusTypeSelect = StatusTypetList; + //} + + ///// <summary> + ///// 不良群組 + ///// </summary> + ///// <returns></returns> + //private async Task GetNGGroupSelect() + //{ + // var result = await _fqcApi.GetNGGroups(0); + + // var NGGroupList = new List<SelectListItem>(); + // for (int i = 0; i < result.Count; i++) + // { + // NGGroupList.Add(new SelectListItem(result[i].NGGroupName, result[i].NGGroupNo.ToString())); + // } + // ViewBag.NGGroupSelect = NGGroupList; + //} + + ///// <summary> + ///// 不良類別 By NGGroup + ///// </summary> + ///// <param name="group_no">NGGroupNo</param> + ///// <returns></returns> + //[HttpPost] + //public async Task<JsonResult> GetNGClassByGroupAsync(string group_no) + //{ + // var result = await _fqcApi.GetNGClassesByGroup(group_no); + + // var item = new List<SelectListItem>(); + + // for (int i = 0; i < result.Count; i++) + // { + // item.Add(new SelectListItem(result[i].NGClassName, result[i].NGClassNo.ToString())); + // } + // //将数据Json化并传到前台视图 + // return Json(new { data = item }); + //} + + ///// <summary> + ///// 不良原因 By NGClass + ///// </summary> + ///// <param name="ngClassNo"></param> + ///// <returns></returns> + //[HttpPost] + //public async Task<JsonResult> GetNGReasonsByClassAsync(string ngClassNo) + //{ + // var result = await _fqcApi.GetNGReasonsByClass(ngClassNo); + + // var item = new List<SelectListItem>(); + + // for (int i = 0; i < result.Count; i++) + // { + // item.Add(new SelectListItem(result[i].NGReasonDesc, result[i].NGReasonNo.ToString())); + // } + // //将数据Json化并传到前台视图 + // return Json(new { data = item }); + //} + + ///// <summary> + ///// 廠別/委外廠 + ///// </summary> + ///// <returns></returns> + //private async Task GetFactoryInfo() + //{ + // var result = await _pcsApi.GetFactoryInfo(); + + // var FactoryInfo = new List<SelectListItem>(); + // for (int i = 0; i < result.Count; i++) + // { + // FactoryInfo.Add(new SelectListItem(result[i].FactoryNo + "-" + result[i].FactoryNameCh, result[i].FactoryID.ToString())); + // } + + // if (FactoryInfo.Count == 0) + // { + // FactoryInfo.Add(new SelectListItem("N/A", null)); + // } + + // ViewBag.FactoryInfoList = FactoryInfo; + //} + //#endregion + + //#region FQC001 檢驗類別維護 + //public IActionResult FQC001() + //{ + // return View(); + //} + + ////新增頁面 + //public IActionResult FQC001C() + //{ + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC001UAsync(int id) + //{ + // var result = await _fqcApi.GetQcGroup(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC001DAsync(int id) + //{ + // var result = await _fqcApi.DeleteQcGroup(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + ////頁面提交,id=0 添加,id>0 修改 + //[HttpPost] + //public async Task<IActionResult> FQC001Async(QcGroup model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + // if (model.GroupID == 0) + // { + // result = await _fqcApi.PostQcGroup(JsonConvert.SerializeObject(model)); + // } + // else + // { + // result = await _fqcApi.PutQcGroup(JsonConvert.SerializeObject(model)); + // } + + // if (result.Success) + // { + // var _msg = model.GroupID == 0 ? "新增成功!" : "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + + // ModelState.AddModelError("error", result.Msg); + // } + // } + // if (model.GroupID == 0) + // { + // return View("FQC001C", model); + // } + // return View("FQC001U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC001QueryAsync(int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetQcGroupQuery(page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC002 檢驗項目維護 + //public async Task<IActionResult> FQC002() + //{ + // await GetQCGroupSelect(); + // return View(); + //} + + ////新增頁面 + //public async Task<IActionResult> FQC002C() + //{ + // await GetQCGroupSelect(); + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC002UAsync(int id) + //{ + // await GetQCGroupSelect(); + // var result = await _fqcApi.GetQcItem(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC002DAsync(int id) + //{ + // var result = await _fqcApi.DeleteQcItem(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + ////頁面提交,id=0 添加,id>0 修改 + //[HttpPost] + //public async Task<IActionResult> FQC002Async(QcItem model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + // if (model.ItemID == 0) + // { + // result = await _fqcApi.PostQcItem(JsonConvert.SerializeObject(model)); + // } + // else + // { + // result = await _fqcApi.PutQcItem(JsonConvert.SerializeObject(model)); + // } + + // if (result.Success) + // { + // var _msg = model.ItemID == 0 ? "新增成功!" : "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + + // ModelState.AddModelError("error", result.Msg); + // } + // } + // if (model.ItemID == 0) + // { + // return View("FQC002C", model); + // } + // return View("FQC002U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC002QueryAsync(int groupID = 0, int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetQcItemQuery(groupID, page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC003 檢驗結果維護 + //public IActionResult FQC003() + //{ + // return View(); + //} + + ////新增頁面 + //public IActionResult FQC003C() + //{ + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC003UAsync(string id) + //{ + // var result = await _fqcApi.GetFqcResult(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC003DAsync(string id) + //{ + // var result = await _fqcApi.DeleteFqcResult(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + ////頁面提交,id=0 添加,id>0 修改 + //[HttpPost] + //public async Task<IActionResult> FQC003Async(FqcResult model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + // if (string.IsNullOrWhiteSpace(model.FqcNo)) + // { + // result = await _fqcApi.PostFqcResult(JsonConvert.SerializeObject(model)); + // } + // else + // { + // result = await _fqcApi.PutFqcResult(JsonConvert.SerializeObject(model)); + // } + + // if (result.Success) + // { + // var _msg = string.IsNullOrWhiteSpace(model.FqcNo) ? "新增成功!" : "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + + // ModelState.AddModelError("error", result.Msg); + // } + // } + // if (string.IsNullOrWhiteSpace(model.FqcNo)) + // { + // return View("FQC003C", model); + // } + // return View("FQC003U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC003QueryAsync(int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetFqcResultQuery(page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC004 抽驗係數維護 + //public IActionResult FQC004() + //{ + // return View(); + //} + + ////新增頁面 + //public IActionResult FQC004C() + //{ + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC004UAsync(int id) + //{ + // var result = await _fqcApi.GetQcQuot(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC004DAsync(int id) + //{ + // var result = await _fqcApi.DeleteQcQuot(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + ////頁面提交,id=0 添加,id>0 修改 + //[HttpPost] + //public async Task<IActionResult> FQC004Async(QcQuot model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + // if (model.QuotID == 0) + // { + // result = await _fqcApi.PostQcQuot(JsonConvert.SerializeObject(model)); + // } + // else + // { + // result = await _fqcApi.PutQcQuot(JsonConvert.SerializeObject(model)); + // } + + // if (result.Success) + // { + // var _msg = model.QuotID == 0 ? "新增成功!" : "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + + // ModelState.AddModelError("error", result.Msg); + // } + // } + // if (model.QuotID == 0) + // { + // return View("FQC004C", model); + // } + // return View("FQC004U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC004QueryAsync(int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetQcQuotQuery(page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC005 抽驗係數維護 + //public async Task<IActionResult> FQC005() + //{ + // await GetQcQuotSelect(); + // return View(); + //} + + ////新增頁面 + //public async Task<IActionResult> FQC005C() + //{ + // await GetQcQuotSelect(); + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC005UAsync(int id) + //{ + // await GetQcQuotSelect(); + // var result = await _fqcApi.GetQcCriterion(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC005DAsync(int id) + //{ + // var result = await _fqcApi.DeleteQcCriterion(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + ////頁面提交,id=0 添加,id>0 修改 + //[HttpPost] + //public async Task<IActionResult> FQC005Async(QcCriterion model) + //{ + // await GetQcQuotSelect(); + // if (ModelState.IsValid) + // { + // #region 判斷設定起訖數量區間是否有重疊 + // var query = await _fqcApi.GetQcCriterionByQuotID(model.QuotID); + // // 排除自己 + // query = query.Where(w => w.CritID != model.CritID).ToList(); + + // if (query.Where(w => w.QcStart <= model.QcStart && model.QcStart <= w.QcEnd).Any() || + // query.Where(w => w.QcStart <= model.QcEnd && model.QcEnd <= w.QcEnd).Any()) + // { + // ModelState.AddModelError("error", "設定起訖數量區間有重疊,請確認"); + // if (model.CritID == 0) + // { + // return View("FQC005C", model); + // } + // return View("FQC005U", model); + // } + // #endregion + + // IResultModel result; + // if (model.CritID == 0) + // { + // result = await _fqcApi.PostQcCriterion(JsonConvert.SerializeObject(model)); + // } + // else + // { + // result = await _fqcApi.PutQcCriterion(JsonConvert.SerializeObject(model)); + // } + + // if (result.Success) + // { + // var _msg = model.CritID == 0 ? "新增成功!" : "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + // ModelState.AddModelError("error", result.Msg); + // } + // } + // if (model.CritID == 0) + // { + // return View("FQC005C", model); + // } + // return View("FQC005U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC005QueryAsync(int quotID = 0, int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetQcCriterionQuery(quotID, page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC006 FQC狀態維護 + //public IActionResult FQC006() + //{ + // return View(); + //} + + ////新增頁面 + //public IActionResult FQC006C() + //{ + // return View(); + //} + + ////修改页面 + //[HttpGet] + //public async Task<IActionResult> FQC006UAsync(string id) + //{ + // var result = await _fqcApi.GetStatusType(id); + // return View(result); + //} + + //public async Task<IActionResult> FQC006DAsync(string id) + //{ + // var result = await _fqcApi.DeleteStatusType(id); + // return Json(new Result() { success = result.Success, msg = result.Msg }); + //} + + //// 添加 + //[HttpPost] + //public async Task<IActionResult> FQC006CAsync(StatusType model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + + // result = await _fqcApi.PostStatusType(JsonConvert.SerializeObject(model)); + + // if (result.Success) + // { + // var _msg = "新增成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + // ModelState.AddModelError("error", result.Msg); + // } + // } + + // return View("FQC006C", model); + //} + + //// 修改 + //[HttpPost] + //public async Task<IActionResult> FQC006UAsync(StatusType model) + //{ + // if (ModelState.IsValid) + // { + // IResultModel result; + + // result = await _fqcApi.PutStatusType(JsonConvert.SerializeObject(model)); + + // if (result.Success) + // { + // var _msg = "修改成功!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + // else + // { + // ModelState.AddModelError("error", result.Msg); + // } + // } + + // return View("FQC006U", model); + //} + + //[ResponseCache(Duration = 0)] + //[HttpGet] + //public async Task<IActionResult> FQC006QueryAsync(int page = 0, int limit = 10) + //{ + // var result = await _fqcApi.GetStatusTypeQuery(page, limit); + + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC007 FQC抽驗作業 + //public async Task<IActionResult> FQC007(string inhouseNo = null, int seqID = 0) + //{ + // var model = new FqcDto(); + // if (!string.IsNullOrWhiteSpace(inhouseNo) && seqID != 0) + // { + // IResultModel<FqcDto> result; + // result = await _fqcApi.GetFqcQuery(inhouseNo, seqID); + // if (result.Data.Count() != 0) + // { + // model = result.Data.FirstOrDefault(); + // model.h_InhouseNo = model.InhouseNo; + // model.h_SeqID = model.SeqID.ToString(); + + // // 抓全部檢驗工項 + // var result_QcItem = await _fqcApi.GetQcItemQuery(0, 0, 0); + // // 取綁定工單檢驗工項資料 + // var result_WipFQC = await _fqcApi.GetWipFqcItemByWipNo(model.WipNo); + // if (result_WipFQC.Count == 0) + // { + // //工單無設定檢驗工項時 在抓料號綁定檢驗工項 + // var result_MaterialFQC = await _fqcApi.GetMaterialFqcItemsByitemNo(model.ItemNo); + // if (result_MaterialFQC.Count != 0) + // { + // model.qcItemDtos = result_QcItem.Data.Where(w => result_MaterialFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList(); + // } + // } + // else + // { + // model.qcItemDtos = result_QcItem.Data.Where(w => result_WipFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList(); + // } + // } + // else + // { + // ModelState.AddModelError("error", "找不到入庫單號【" + model.InhouseNo + "】的資料"); + // model.h_InhouseNo = ""; + // model.h_SeqID = ""; + // } + // } + + // return View(model); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC007Async(FqcDto model, string action) + //{ + // if (string.IsNullOrWhiteSpace(model.InhouseNo)) + // { + // ModelState.AddModelError("error", "請輸入入庫單號"); + // return View("FQC007", model); + // } + + // IResultModel<FqcDto> result; + + // result = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); + + // if (action == "儲存") + // { + // var result_FQCResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); + + // if (result_FQCResultMaster != null) + // { + // result_FQCResultMaster.OS = model.OS; + // result_FQCResultMaster.CPU = model.CPU; + // result_FQCResultMaster.RAM = model.RAM; + // result_FQCResultMaster.BIOS = model.BIOS; + // result_FQCResultMaster.Supervisor = model.Supervisor; + // result_FQCResultMaster.Proved = model.Proved; + // result_FQCResultMaster.OutfitNo = model.OutfitNo; + // await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(result_FQCResultMaster)); + // ModelState.AddModelError("error", "儲存成功!"); + // } + // } + + // if (result.Data.Count() != 0) + // { + // model = result.Data.FirstOrDefault(); + // model.h_InhouseNo = model.InhouseNo; + // model.h_SeqID = model.SeqID.ToString(); + + // // 抓全部檢驗工項 + // var result_QcItem = await _fqcApi.GetQcItemQuery(0, 0, 0); + // // 取綁定工單檢驗工項資料 + // var result_WipFQC = await _fqcApi.GetWipFqcItemByWipNo(model.WipNo); + // if (result_WipFQC.Count == 0) + // { + // //工單無設定檢驗工項時 在抓料號綁定檢驗工項 + // var result_MaterialFQC = await _fqcApi.GetMaterialFqcItemsByitemNo(model.ItemNo); + // if (result_MaterialFQC.Count != 0) + // { + // model.qcItemDtos = result_QcItem.Data.Where(w => result_MaterialFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList(); + // } + // } + // else + // { + // model.qcItemDtos = result_QcItem.Data.Where(w => result_WipFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList(); + // } + // } + // else + // { + // ModelState.AddModelError("error", "找不到入庫單號【" + model.InhouseNo + "】的資料"); + // model.h_InhouseNo = ""; + // model.h_SeqID = ""; + // } + + + + // return View(model); + //} + + //#region 抽驗 + //[HttpGet] + //public async Task<IActionResult> FQC007C(string inhouseNo, string seq) + //{ + // await GetStatusTypeSelect(); + // await GetNGGroupSelect(); + // var model = new FqcResultDto(); + // model.InhouseNo = inhouseNo; + // model.SeqID = int.Parse(seq); + // return View(model); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC007CAsync(FqcResultDto model) + //{ + // await GetStatusTypeSelect(); + // await GetNGGroupSelect(); + // if (string.IsNullOrWhiteSpace(model.BarcodeNo) && + // string.IsNullOrWhiteSpace(model.BoxNo) && + // string.IsNullOrWhiteSpace(model.ExtraBarcodeNo)) + // { + // ModelState.AddModelError("error", "請輸入要抽驗的相關序號"); + // return View("FQC007C", model); + // } + + // #region 相關查詢序號找出包裝箱號 + // var result_BarCodeInfo = new List<BarcodeInfo>(); + // if (!string.IsNullOrWhiteSpace(model.BarcodeNo)) + // { + // result_BarCodeInfo = await _fqcApi.GetBarcodeInfoesByNo(model.BarcodeNo); + // } + // else if (!string.IsNullOrWhiteSpace(model.ExtraBarcodeNo)) + // { + // result_BarCodeInfo = await _fqcApi.GetBarcodeInfoesByExtraNo(model.ExtraBarcodeNo); + // } + // else if (!string.IsNullOrWhiteSpace(model.BoxNo)) + // { + // result_BarCodeInfo = await _fqcApi.GetBarcodeInfoesByBoxNo(model.BoxNo); + // } + + // if (result_BarCodeInfo.Count == 0) + // { + // ModelState.AddModelError("error", "找不到相關資料"); + // return View("FQC007C", model); + // } + // else + // model.BoxNo = result_BarCodeInfo.FirstOrDefault().BoxNo; + // #endregion + + // #region 判斷是否包裝外箱是否跟入庫單號綁一起 + // var result_FqcInhouseDetail = await _fqcApi.GetFqcInhouseDetail(model.InhouseNo, model.SeqID); + // if (!result_FqcInhouseDetail.Where(w => w.SerialNo == model.BoxNo).Any()) + // { + // ModelState.AddModelError("error", "入庫單號【" + model.InhouseNo + "】找不到包裝箱號【" + model.BoxNo + "】"); + // return View("FQC007C", model); + // } + // #endregion + + // #region Set_FqcResultDetail + // if (model.StatusNo == "F" && model.NgReasonNo == "0") + // { + // ModelState.AddModelError("error", "請選擇不良代碼"); + // return View("FQC007C", model); + // }; + + // var FqcResultDetail = new FqcResultDetail + // { + // BarcodeNo = result_BarCodeInfo.FirstOrDefault().BarcodeNo, + // ExtraBarcodeNo = result_BarCodeInfo.FirstOrDefault().ExtraBarcodeNo, + // BoxNo = result_BarCodeInfo.FirstOrDefault().BoxNo, + // StatusNo = model.StatusNo, + // NgMemo = model.NgMemo, + // NgReasonNo = model.NgReasonNo, + // CreateUserID = GetLogInUserID(), + // UpdateUserID = GetLogInUserID() + // }; + + // if (string.IsNullOrWhiteSpace(FqcResultDetail.ExtraBarcodeNo)) + // { + // ModelState.AddModelError("error", "找不到該筆資料的客戶序號"); + // return View("FQC007C", model); + // } + // #endregion + + // #region 判斷已有抽驗過 + // var result_FqcResultMaster = await _fqcApi.GetFqcResultMasterByInhouseNo(model.InhouseNo, model.SeqID); + // if (result_FqcResultMaster.Count() != 0) + // { + // var result_ResultDetail = await _fqcApi.GetFqcResultDetail(result_FqcResultMaster.FirstOrDefault().FqcID); + // if (result_ResultDetail.Where(w => w.BarcodeNo == FqcResultDetail.BarcodeNo).Any()) + // { + // ModelState.AddModelError("error", "內部序號【" + FqcResultDetail.BarcodeNo + "】已抽驗過"); + // return View("FQC007C", model); + // } + // } + // #endregion + + // #region Set_FqcResultMaster + // var FqcResultMaster = new FqcResultMaster(); + // if (result_FqcResultMaster.Count != 0) + // { + // FqcResultMaster = result_FqcResultMaster.FirstOrDefault(); + // FqcResultMaster.QaQty += 1; + // FqcResultMaster.UpdateDate = DateTime.Now; + // FqcResultMaster.UpdateUserID = GetLogInUserID(); + // } + // else + // { + // IResultModel<FqcDto> FqcDto; + // FqcDto = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); + // var FirstFqc = FqcDto.Data.FirstOrDefault(); + // FqcResultMaster.InhouseNo = model.InhouseNo; + // FqcResultMaster.SeqID = model.SeqID; + // FqcResultMaster.LotQty = FirstFqc.InhouseQty; + // FqcResultMaster.WipNo = FirstFqc.WipNo; + // FqcResultMaster.QaQty = 1; + // FqcResultMaster.ItemNo = FirstFqc.ItemNo; + // FqcResultMaster.ModelNo = FirstFqc.ModelNo; + // FqcResultMaster.StartTime = DateTime.Now; + // FqcResultMaster.EndTime = DateTime.Now; + // FqcResultMaster.CreateUserID = GetLogInUserID(); + // } + + // // 判斷是PASS || FAIL + // if (model.StatusNo == "F") + // FqcResultMaster.FailQty += 1; + // else + // { + // FqcResultMaster.PassQty += 1; + // FqcResultDetail.NgReasonNo = ""; + // FqcResultDetail.NgMemo = ""; + // } + // #endregion + + // IResultModel<FqcResultMaster> result; + // if (result_FqcResultMaster.Count == 0) + // { + // result = await _fqcApi.PostFqcResultMaster(JsonConvert.SerializeObject(FqcResultMaster)); + // FqcResultDetail.FqcID = result.Data.FirstOrDefault().FqcID; + // } + // else + // { + // result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(FqcResultMaster)); + // FqcResultDetail.FqcID = result_FqcResultMaster.FirstOrDefault().FqcID; + // } + // IResultModel result_detail; + // result_detail = await _fqcApi.PostFqcResultDetail(JsonConvert.SerializeObject(FqcResultDetail)); + + // if (result_detail.Success) + // { + // ModelState.AddModelError("error", "新增成功!"); + // //return RedirectToAction("WindowReload", "Home", new { msg = _msg }); + // return View("FQC007C", model); + // } + // else + // { + // ModelState.AddModelError("error", result_detail.Msg); + // } + + + // return View("FQC007C", model); + //} + //#endregion + + //#region 檢驗結果 + //[HttpGet] + //public async Task<IActionResult> FQC007B(string inhouseNo, string seq, int fqc) + //{ + // var model = new FqcResultMaster(); + // model.InhouseNo = inhouseNo; + // model.SeqID = int.Parse(seq); + // model.FqcID = fqc; + // var result = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); + // var fqcItem = result.Data.FirstOrDefault(); + + // //當抽驗數量 小於 抽樣數量就離開 + // if (fqcItem.QcQty > fqcItem.PassQty + fqcItem.FailQty) + // { + // var _msg = "抽樣數量不足,無法判定"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + // } + + // // 判斷狀態選擇 + // if (fqcItem.FailQty >= fqcItem.ReQty) + // model.QaResult = "R"; + // else + // model.QaResult = "P"; + + // return View(model); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC007BAsync(FqcResultMaster model, string Result) + //{ + // var FqcQuery = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); + // var fqcItem = FqcQuery.Data.FirstOrDefault(); + // // 判斷狀態選擇 + // if (fqcItem.FailQty >= fqcItem.ReQty) + // { + // if (model.QaResult == "P" && string.IsNullOrWhiteSpace(model.SpecialPo)) + // { + // ModelState.AddModelError("error", "請輸入特採單號"); + // return View("FQC007B", model); + // } + // } + + // var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); + // var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID); + + // fqcResultMaster.QaResult = model.QaResult; + // fqcResultMaster.QaMeno = model.QaMeno; + // fqcResultMaster.EndTime = DateTime.Now; + // fqcResultMaster.UpdateDate = DateTime.Now; + // fqcResultMaster.SpecialPo = model.SpecialPo; + // fqcResultMaster.UpdateUserID = GetLogInUserID(); + + // fqcInhouseMaster.Status = model.QaResult; + // fqcInhouseMaster.UpdateDate = DateTime.Now; + // fqcInhouseMaster.UpdateUserID = GetLogInUserID(); + + // IResultModel result; + // result = await _fqcApi.PutFqcInhouseMaster(JsonConvert.SerializeObject(fqcInhouseMaster)); + // result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(fqcResultMaster)); + // if (result.Success) + // { + // if (model.QaResult == "P") + // await _fqcApi.PassingByFQC(model.InhouseNo, model.SeqID, GetLogInUserID()); + + // var _msg = "新增成功!"; + // return RedirectToAction("WindowReload", "Home", new { msg = _msg }); + // } + // else + // { + // ModelState.AddModelError("error", result.Msg); + // } + + // return View("FQC007B", model); + //} + //#endregion + + //#region 附件 + //[HttpGet] + //public async Task<IActionResult> FQC007D(int fqc) + //{ + // FqcDto fqcDto = new FqcDto(); + // var model = await _fqcApi.GetFqcResultMasterBlobByFqcID(fqc); + // fqcDto.fqcResultMasterBlobs = model; + // fqcDto.FqcID = fqc; + // return View(fqcDto); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC007DAsync(FqcDto model, string Result, IFormFile formFile) + //{ + // FqcResultMaster fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); + // if (fqcResultMaster == null) + // { + // ModelState.AddModelError("error", "找不到FQC開單紀錄"); + // return View("FQC007D", model); + // } + + // if (formFile != null) + // { + // if (formFile.Length > 0) + // { + // // 檔案上傳 + // string FileName = string.Empty; + // string NewName = string.Empty; + // string FilePath = string.Empty; + // //取得使用者上傳檔案的原始檔名 + // FileName = Path.GetFileName(formFile.FileName); + // //取原始檔名中的副檔名 + // //var fileExt = Path.GetExtension(FileName); + // //為避免使用者上傳的檔案名稱發生重複,重新給一個亂數名稱 + // //NewName = Path.GetRandomFileName() + fileExt; + // //指定要寫入的路徑、檔名和副檔名 + // FilePath = $@"{_env.WebRootPath}\UploadFolder\FQC\{fqcResultMaster.InhouseNo}-{fqcResultMaster.SeqID}"; + // var path = $@"{FilePath}\{FileName}"; + + // if (!System.IO.Directory.Exists(FilePath)) + // { + // System.IO.Directory.CreateDirectory(FilePath); + // } + + // using (var stream = new FileStream(path, FileMode.Create)) + // { + // await formFile.CopyToAsync(stream); + // } + + // FqcResultMasterBlob fqcResultMasterBlob = new FqcResultMasterBlob() + // { + // FqcID = model.FqcID, + // ImageName = FileName, + // Filepath = $@"\UploadFolder\FQC\{fqcResultMaster.InhouseNo}-{fqcResultMaster.SeqID}\", + // CreateUserID = GetLogInUserID(), + // UpdateUserID = GetLogInUserID() + // }; + + // var result = await _fqcApi.PostFqcResultMasterBlob(JsonConvert.SerializeObject(fqcResultMasterBlob)); + + // if (result.Success) + // { + // ModelState.AddModelError("error", "上傳成功!"); + // } + // else + // { + // ModelState.AddModelError("error", "上傳失敗,錯誤訊息:" + result.Msg); + // } + // } + // } + // else + // { + // ModelState.AddModelError("error", "ssddf"); + // } + // model.fqcResultMasterBlobs = await _fqcApi.GetFqcResultMasterBlobByFqcID(model.FqcID); + // return View("FQC007D", model); + //} + //#endregion + + //#region 檢驗工項維護 + //[HttpGet] + //public ActionResult FQC007A(FqcDto model) + //{ + // return View(model); + //} + + //[HttpGet] + //public async Task<IActionResult> FQC007AItemQuery(string wipNo, string itemNo) + //{ + // var result = await _fqcApi.GetQcItemQuery(0, 0, 0, itemNo, wipNo); + // return Json(new Table() { code = 0, data = result.Data, count = result.DataTotal }); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC007AAsync(string itemID, string groupID, string wipNo, string itemNo) + //{ + // // 取工單綁定檢驗工項 + // var result_WipFQC = await _fqcApi.GetWipFqcItemByWipNo(wipNo); + // // 有勾選的ItemID + // var checkItemID = itemID.Split(',').ToList(); + // // 有勾選的GroupID + // var checkGroupID = groupID.Split(',').ToList(); + + // // 取勾選有的 = 新增 + // var insertItemID = checkItemID.Except(result_WipFQC.Select(s => s.QcItemID.ToString())); + // for (int i = 0; i < checkItemID.Count; i++) + // { + // if (insertItemID.Where(w => w == checkItemID[i]).Any()) + // { + // WipFqcItem wipFqcItem = new WipFqcItem + // { + // WipNo = wipNo, + // ItemNo = itemNo, + // QcItemID = Int32.Parse(checkItemID[i]), + // QcGroupID = Int32.Parse(checkGroupID[i]), + // CreateUserID = GetLogInUserID(), + // CreateDate = DateTime.Now, + // UpdateUserID = GetLogInUserID(), + // UpdateDate = DateTime.Now + // }; + // await _fqcApi.PostWipFqcItem(JsonConvert.SerializeObject(wipFqcItem)); + // } + // } + + // // 取有料號綁定 = 需要刪除 + // var deteleItemID = result_WipFQC.Select(s => s.QcItemID.ToString()).Except(checkItemID); + // foreach (var item in deteleItemID) + // { + // var wipFQCID = result_WipFQC.Where(w => w.QcItemID == Int32.Parse(item)).FirstOrDefault().WipFqcitemID; + // await _fqcApi.DeleteWipFqcItem(wipFQCID); + // } + + // return Json(new { code = 0, msg = "", success = true }); + //} + //#endregion + + //#region FQC細項資料 + //[HttpGet] + //public async Task<IActionResult> FQC007V(string inhouseNo, int seqID, string boxNo) + //{ + // ViewBag.inhouseNo = inhouseNo; + // ViewBag.seqID = seqID; + // ViewBag.boxNo = boxNo; + // return View(); + //} + + + //public async Task<IActionResult> GetFQC007V(string inhouseNo, int seqID, string boxNo) + //{ + // var result = await _fqcApi.FQC007V(inhouseNo, seqID, boxNo); + + // if (result.Data.Count() > 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#endregion + + //#region FQC008 FQC查詢 + //public async Task<IActionResult> FQC008() + //{ + // await GetFactoryInfo(); + // return View(); + //} + + //public async Task<IActionResult> FQC008QueryAsync(string barcodeNo, string wipNo + // , string boxNo, string inhouseNo, string date_str, string date_end, string factoryID + // , string status, int page = 0, int limit = 10) + //{ + // IResultModel<FqcInhouseMasterDto> result = await _fqcApi.GetFqcInhouseMasterQuery(barcodeNo: barcodeNo, wipNo: wipNo + // , boxNo: boxNo, inhouseNo: inhouseNo, date_str: date_str, date_end: date_end + // , status: status, page: page, limit: limit, factoryID: factoryID); + + // await GetFactoryInfo(); + // if (result.Data.Count() != 0) + // { + // return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + // } + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC009 料號對應檢驗工項 + + //public ActionResult FQC009() + //{ + // return View(); + //} + + //[HttpPost] + //public async Task<IActionResult> FQC009Async(string itemID, string groupID, string itemNo) + //{ + // var result = await _fqcApi.GetMaterialItemByItemNO(itemNo); + // if (result == null) + // { + // var Msg = "在料號主檔找不到該筆料號【" + itemNo + "】"; + // return Json(new { code = 0, msg = Msg, success = false }); + // } + + // // 取料號綁定檢驗工項 + // var result_MasterFQC = await _fqcApi.GetMaterialFqcItemsByitemNo(itemNo); + // // 有勾選的ItemID + // var checkItemID = itemID.Split(',').ToList(); + // // 有勾選的GroupID + // var checkGroupID = groupID.Split(',').ToList(); + + // // 取勾選有的 = 新增 + // var insertItemID = checkItemID.Except(result_MasterFQC.Select(s => s.QcItemID.ToString())); + // for (int i = 0; i < checkItemID.Count; i++) + // { + // if (insertItemID.Where(w => w == checkItemID[i]).Any()) + // { + // MaterialFqcItem materialFqcItem = new MaterialFqcItem + // { + // ItemID = result.ItemID, + // QcItemID = Int32.Parse(checkItemID[i]), + // QcGroupID = Int32.Parse(checkGroupID[i]), + // CreateUserID = GetLogInUserID(), + // CreateDate = DateTime.Now, + // UpdateUserID = GetLogInUserID(), + // UpdateDate = DateTime.Now + // }; + // await _fqcApi.PostMaterialFqcItem(JsonConvert.SerializeObject(materialFqcItem)); + // } + // } + + // // 取有料號綁定 = 需要刪除 + // var deteleItemID = result_MasterFQC.Select(s => s.QcItemID.ToString()).Except(checkItemID); + // foreach (var item in deteleItemID) + // { + // var masterFQCID = result_MasterFQC.Where(w => w.QcItemID == Int32.Parse(item)).FirstOrDefault().MaterialFqcitemID; + // await _fqcApi.DeleteMaterialFqcItem(masterFQCID); + // } + + // return Json(new { code = 0, msg = "", success = true }); + //} + + //[HttpGet] + //public async Task<IActionResult> FQC009ItemQueryAsync(int groupID = 0, int page = 0, int limit = 1, string itemNo = null) + //{ + // var msg = ""; + // var result = await _fqcApi.GetQcItemQuery(groupID, 0, limit, itemNo); + // if (result.Data.Count() != 0) + // { + // if (!string.IsNullOrWhiteSpace(itemNo)) + // { + // var masterlItem = await _fqcApi.GetMaterialItemByItemNO(itemNo); + // if (masterlItem == null) + // { + // msg = "在料號主檔找不到該筆料號【" + itemNo + "】"; + // } + // } + // return Json(new Table() { code = 0, msg = msg, data = result.Data, count = result.DataTotal }); + // } + + // return Json(new Table() { count = 0, data = null }); + //} + //#endregion + + //#region FQC010 報表 + //public ActionResult FQC010() + //{ + // string mimeType = ""; + // int extension = 1; + // var path = $"{this._env.WebRootPath}\\Reports\\View.rdlc"; + // LocalReport localReport = new LocalReport(path); + // Dictionary<string, string> param = new Dictionary<string, string>(); + // System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + // System.Text.Encoding.GetEncoding(1252); + // var FQC010Master = new FQC010VIiew + // { + // DefectDescription = "N/A", + // InspectionDate = "2022/06/30", + // AC = "0", + // Approved = "王曉明", + // AQL = "2.5", + // SpeciallyAdoption = "特採Specially Adoption", + // BIOSVer = "2.04A CS:7672H", + // ECN = "22N0202", + // ECNMemo = "工單生產已是最新ECN", + // Factory = "YS00", + // FactoryRemark = "N/A", + // InspectionInstrumentNumber = "N/A", + // InspectionItems = "OS:[Win10 IoT]CPU test:[1.10G] RAM test:[4096]", + // InspectionNumber = "Q944000114000001", + // InspectionStatus = "廠驗", + // InspectionType = "First Insp.", + // Inspector = "蔡喬虎", + // Judgment = "Defect Quantity", + // Line = "安勤產線", + // LotSize = "1", + // Major = "0", + // MedicalModel = "N", + // Minor = "1", + // Model = "CAXA0-1000A1-S01R", + // ModelName = "CAXA0 w/N3350/4G RAM/64G SSD/NFC", + // NOTE = @"ACC-M2 + // E1589 + // ESW-075R + // ACC-BAT", + // OrderNumber = "9440001400", + // Product99 = "一般二級水準正常檢驗", + // ReMajor = "1", + // Sample = "5", + // SamplingInspectionPlan = "ANSI/ASQZ 1.4II", + // StorageLocation = "9000", + // Avalue = "AVALUE", + // VIP = "N", + // WaiveRequisition = "XX", + // Detail1 = new List<FQC010Detail1>{ + // new FQC010Detail1 + // { + // ItemID = "1", + // ItemName = "AA", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }, + // new FQC010Detail1{ + // ItemID = "2", + // ItemName = "BB", + // ItemType = "Major" + // }}, + // Detail2 = new List<FQC010Detail2> + // { + // new FQC010Detail2 + // { + // ShippingSerialNumber= "AAAAAAAAAAAAAAAA", + // IsSample ="Y", + // ProductionSerialNumber = "DASKJDKLFJS", + // InspectionResults = "1" + // }} + // }; + + // var FQC010Masters = new List<FQC010VIiew>(); + // FQC010Masters.Add(FQC010Master); + + // localReport.AddDataSource("DataSet1", FQC010Masters); + // localReport.AddDataSource("DataSet2", FQC010Master.Detail1); + // localReport.AddDataSource("DataSet3", FQC010Master.Detail2); + + // var result = localReport.Execute(RenderType.Pdf, extension, param, mimeType); + // return File(result.MainStream, "application/pdf"); + //} + //#endregion + + #region PCB013 鋼板量測紀錄 + public ActionResult PCB013() + { + return View(); + } + + public async Task<IActionResult> PCB013QueryAsync(string steelPlateNo, string pcbPartNo + , string side, string status, int page = 0, int limit = 10) + { + IResultModel<SteelPlateInfoDto> result = await _pcbApi.GetSteelPlateInfoQuery(steelPlateNo: steelPlateNo, pcbPartNo: pcbPartNo + , side: side, status: status, page: page, limit: limit); + + if (result.Data.Count() != 0) + { + return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); + } + return Json(new Table() { count = 0, data = null }); + } + + //新增頁面 + public IActionResult PCB013C() + { + return View(); + } + #endregion + + #region PCB014 錫膏使用管控 + + #endregion + + /// <summary> + /// 登入UserID + /// </summary> + /// <returns></returns> + public int GetLogInUserID() + { + int user_id = -1; + HttpContext.Request.Cookies.TryGetValue("UserID", out string userID); + + if (userID != null) + { + if (int.Parse(userID.ToString()) >= 0) + { + user_id = int.Parse(userID.ToString()); + } + } + return user_id; + } + } +} diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs new file mode 100644 index 00000000..55f38ade --- /dev/null +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs @@ -0,0 +1,507 @@ +using System.Collections.Generic; +using WebApiClient; +using WebApiClient.Attributes; +using AMESCoreStudio.WebApi; +using Microsoft.AspNetCore.Mvc; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.CommonTools.Result; +using AMESCoreStudio.WebApi.DTO.AMES; + +namespace AMESCoreStudio.Web +{ + [JsonReturn] + public interface IPCB : IHttpApi + { + #region FQC001 檢驗類別維護 + /// <summary> + /// 新增檢驗類別維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/QcGroup")] + ITask<ResultModel<QcGroup>> PostQcGroup([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新檢驗類別維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/QcGroup")] + ITask<ResultModel<QcGroup>> PutQcGroup([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除檢驗類別維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/QcGroup/{id}")] + ITask<ResultModel<string>> DeleteQcGroup(int id); + + /// <summary> + /// 查詢檢驗類別維護 + /// </summary> + /// <param name="page">頁數</param> + /// <param name="limit"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcGroup/QcGroupQuery")] + ITask<ResultModel<QcGroup>> GetQcGroupQuery(int page = 0, int limit = 10); + + /// <summary> + /// 查詢檢驗類別維護 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcGroup/{id}")] + ITask<QcGroup> GetQcGroup(int id); + #endregion + + #region FQC002 檢驗項目維護 + /// <summary> + /// 新增檢驗項目維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/QcItem")] + ITask<ResultModel<QcItem>> PostQcItem([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新檢驗項目維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/QcItem")] + ITask<ResultModel<QcItem>> PutQcItem([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除檢驗項目維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/QcItem/{id}")] + ITask<ResultModel<string>> DeleteQcItem(int id); + + /// <summary> + /// 查詢檢驗項目維護 + /// </summary> + /// <param name="groupID">檢驗類別ID</param> + /// <param name="page">頁數</param> + /// <param name="limit">比數</param> + /// <param name="itemNo">料號</param> + /// <param name="wipNo">工單號碼</param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcItem/QcItemQuery")] + ITask<ResultModel<QcItemDto>> GetQcItemQuery(int groupID, int page, int limit,string itemNo = null,string wipNo = null); + + /// <summary> + /// 查詢檢驗項目維護 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcItem/{id}")] + ITask<QcItem> GetQcItem(int id); + + /// <summary> + /// 查詢檢驗項目維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcGroup")] + ITask<List<QcGroup>> GetQcGroup(); + #endregion + + #region FQC003 檢驗結果維護 + /// <summary> + /// 新增檢驗結果維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/FqcResult")] + ITask<ResultModel<FqcResult>> PostFqcResult([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新檢驗結果維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/FqcResult")] + ITask<ResultModel<FqcResult>> PutFqcResult([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除檢驗結果維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/FqcResult/{id}")] + ITask<ResultModel<string>> DeleteFqcResult(string id); + + /// <summary> + /// 查詢檢驗結果維護 + /// </summary> + /// <param name="page">頁數</param> + /// <param name="limit"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResult/FqcResultQuery")] + ITask<ResultModel<FqcResult>> GetFqcResultQuery(int page = 0, int limit = 10); + + /// <summary> + /// 查詢檢驗結果維護 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResult/{id}")] + ITask<FqcResult> GetFqcResult(string id); + #endregion + + #region FQC004 抽驗係數維護 + /// <summary> + /// 新增抽驗係數維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/QcQuot")] + ITask<ResultModel<QcQuot>> PostQcQuot([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新抽驗係數維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/QcQuot")] + ITask<ResultModel<QcQuot>> PutQcQuot([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除抽驗係數維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/QcQuot/{id}")] + ITask<ResultModel<string>> DeleteQcQuot(int id); + + /// <summary> + /// 查詢抽驗係數維護 + /// </summary> + /// <param name="page">頁數</param> + /// <param name="limit"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcQuot/QcQuotQuery")] + ITask<ResultModel<QcQuot>> GetQcQuotQuery(int page = 0, int limit = 10); + + /// <summary> + /// 查詢抽驗係數維護 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcQuot/{id}")] + ITask<QcQuot> GetQcQuot(int id); + #endregion + + #region FQC005 抽驗標準維護 + /// <summary> + /// 新增抽驗標準維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/QcCriterion")] + ITask<ResultModel<QcCriterion>> PostQcCriterion([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新抽驗標準維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/QcCriterion")] + ITask<ResultModel<QcCriterion>> PutQcCriterion([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除抽驗標準維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/QcCriterion/{id}")] + ITask<ResultModel<string>> DeleteQcCriterion(int id); + + /// <summary> + /// 查詢抽驗標準維護 + /// </summary> + /// <param name="quotID">抽驗係數ID</param> + /// <param name="page">頁數</param> + /// <param name="limit"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcCriterion/QcCriterionQuery")] + ITask<ResultModel<QcCriterionDto>> GetQcCriterionQuery(int quotID, int page, int limit); + + /// <summary> + /// 查詢抽驗標準維護 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcCriterion/{id}")] + ITask<QcCriterion> GetQcCriterion(int id); + + /// <summary> + /// 查詢檢驗項目維護 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcQuot")] + ITask<List<QcQuot>> GetQcQuot(); + + /// <summary> + /// 查詢抽驗標準 ByQuotID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/QcCriterion/ByQuotID/{id}")] + ITask<List<QcCriterion>> GetQcCriterionByQuotID(int id); + #endregion + + #region FQC006 FQC狀態維護 + /// <summary> + /// 新增過站狀態檔 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/StatusType")] + ITask<ResultModel<StatusType>> PostStatusType([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新過站狀態檔 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/StatusType")] + ITask<ResultModel<StatusType>> PutStatusType([FromBody, RawJsonContent] string model); + + /// <summary> + /// 刪除過站狀態檔 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/StatusType/{id}")] + ITask<ResultModel<string>> DeleteStatusType(string id); + + /// <summary> + /// 查詢過站狀態檔 Query + /// </summary> + /// <param name="page">頁數</param> + /// <param name="limit"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/StatusType/StatusTypeQuery")] + ITask<ResultModel<StatusType>> GetStatusTypeQuery(int page = 0, int limit = 10); + + /// <summary> + /// 查詢過站狀態檔 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/StatusType/{id}")] + ITask<StatusType> GetStatusType(string id); + + /// <summary> + /// 過站狀態檔-List + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/StatusType")] + ITask<List<StatusType>> GetStatusType(); + + + #endregion + + #region FQC007 FQC抽驗作業 + /// <summary> + /// 新增FQC檢驗單結果 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/FqcResultMaster")] + ITask<ResultModel<FqcResultMaster>> PostFqcResultMaster([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新FQC檢驗單結果 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/FqcResultMaster")] + ITask<ResultModel<FqcResultMaster>> PutFqcResultMaster([FromBody, RawJsonContent] string model); + + /// <summary> + /// 新增FQC檢驗結果明細 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/FqcResultDetail")] + ITask<ResultModel<FqcResultDetail>> PostFqcResultDetail([FromBody, RawJsonContent] string model); + + /// <summary> + /// 更新入庫單 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPut("api/FqcInhouseMaster")] + ITask<ResultModel<FqcInhouseMaster>> PutFqcInhouseMaster([FromBody, RawJsonContent] string model); + + /// <summary> + /// 新增抽驗批退 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/QngInfo")] + ITask<ResultModel<QngInfo>> PostQngInfo([FromBody, RawJsonContent] string model); + + /// <summary> + /// 查詢過站狀態檔 ID + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/FqcQuery/{inhouseNo}")] + ITask<ResultModel<FqcDto>> GetFqcQuery(string inhouseNo,int? seqid = 1); + + /// <summary> + /// 獲取不良現象群組資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/NGGroups")] + ITask<List<NGGroup>> GetNGGroups(int page = 0, int limit = 10); + + /// <summary> + /// 根据群組代碼獲取不良現象類別資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/NGClasses/Group/{no}")] + ITask<List<NGClass>> GetNGClassesByGroup(string no, int page = 0, int limit = 10); + + /// <summary> + /// 不良現象-List + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/NGReasons/Class/{no}")] + ITask<List<NGReason>> GetNGReasonsByClass(string no , int page = 0, int limit = 1000); + + /// <summary> + /// 用內部序號取BarCode資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/No/{id}")] + ITask<List<BarcodeInfo>> GetBarcodeInfoesByNo(string id); + + /// <summary> + /// 用客戶序號取BarCode資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/ByExtraNo/{extraNo}")] + ITask<List<BarcodeInfo>> GetBarcodeInfoesByExtraNo(string extraNo); + + /// <summary> + /// 用包裝箱號取BarCode資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/BarcodeInfoes/ByBoxNo/{boxNo}")] + ITask<List<BarcodeInfo>> GetBarcodeInfoesByBoxNo(string boxNo); + + /// <summary> + /// 用入庫單號與序號取檢驗單結果 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResultMaster/ByInhouseNo/{inhouseNo}/{seq}")] + ITask<List<FqcResultMaster>> GetFqcResultMasterByInhouseNo(string inhouseNo,int seq); + + /// <summary> + /// 用入庫單號與序號取檢驗單明细資料 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcInhouseDetail/{inhouseNo}/{seq}")] + ITask<List<FqcInhouseDetail>> GetFqcInhouseDetail(string inhouseNo, int seq); + + /// <summary> + /// 用FQCID取檢驗結果明細 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResultDetail/{id}")] + ITask<List<FqcResultDetail>> GetFqcResultDetail(int id); + + + /// <summary> + /// 用id取檢驗單結果 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResultMaster/{id}")] + ITask<FqcResultMaster> GetFqcResultMaster(int id); + + /// <summary> + /// 用id取檢驗單結果 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/{inhouseNo}/{seqID}")] + ITask<FqcInhouseMaster> GetFqcInhouseMaster(string inhouseNo, int seqID); + + /// <summary> + /// 新增 檢驗結果上傳圖檔資料表 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpPost("api/FqcResultMasterBlob")] + ITask<ResultModel<FqcResultMasterBlob>> PostFqcResultMasterBlob([FromBody, RawJsonContent] string model); + + /// <summary> + /// 查詢 檢驗結果上傳圖檔資料表 By FQCID + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcResultMasterBlob/ByFQCID/{id}")] + ITask<List<FqcResultMasterBlob>> GetFqcResultMasterBlobByFqcID(int id); + + /// <summary> + /// WipFqcItem 查詢工單綁定檢驗工項 + /// </summary> + /// <param name="id">料號</param> + [WebApiClient.Attributes.HttpGet("api/WipFqcItem/ByWipNo/{id}")] + ITask<List<WipFqcItem>> GetWipFqcItemByWipNo(string id); + + /// <summary> + /// WipFqcItem 新增工單綁定檢驗工項 + /// </summary> + [WebApiClient.Attributes.HttpPost("api/WipFqcItem")] + ITask<ResultModel<WipFqcItem>> PostWipFqcItem([FromBody, RawJsonContent] string model); + + /// <summary> + /// WipFqcItem 刪除工單綁定檢驗工項 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/WipFqcItem/{id}")] + ITask<ResultModel<string>> DeleteWipFqcItem(int id); + + /// <summary> + /// FQC抽驗過站 + /// </summary> + /// <param name="inhouseNo">入庫單號</param> + /// <param name="seqID">順序</param> + /// <param name="userID">UserID</param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/BarCodeCheck/PassIngByFQC")] + ITask<ResultModel<string>> PassingByFQC(string inhouseNo, int seqID, int userID); + + /// <summary> + /// FQC 細項資料 + /// </summary> + /// <param name="inhouseNo">入庫單號</param> + /// <param name="seqID">順序</param> + /// <param name="boxNo">箱號</param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/FqcInhouseDetail/FqcInhouseDetailByFQC007V")] + ITask<ResultModel<FqcResultDto>> FQC007V(string inhouseNo, int seqID, string boxNo); + #endregion + + #region PCB013 鋼板量測紀錄 + /// <summary> + /// 鋼板資料查詢 + /// </summary> + /// <param name="steelPlateNo">鋼板編號</param> + /// <param name="pcbPartNo">PCB板號</param> + /// <param name="side">正背面</param> + /// <param name="status">狀態</param> + /// <param name="page">頁數</param> + /// <param name="limit">筆數</param> + /// <returns></returns> + [WebApiClient.Attributes.HttpGet("api/SteelPlateInfo/SteelPlateInfoQuery")] + ITask<ResultModel<SteelPlateInfoDto>> GetSteelPlateInfoQuery(string steelPlateNo = null, string pcbPartNo = null + , string side = null, string status = null, int page = 0, int limit = 10); + #endregion + + #region FQC009 料號檢驗工項維護 + /// <summary> + /// MaterialItem 料號基本資料檔 + /// </summary> + /// <param name="id">料號</param> + [WebApiClient.Attributes.HttpGet("api/MaterialItem/ByItemNO/{id}")] + ITask<MaterialItem> GetMaterialItemByItemNO(string id); + + /// <summary> + /// MaterialItem 料號查詢綁定檢驗工項 + /// </summary> + /// <param name="id">料號</param> + [WebApiClient.Attributes.HttpGet("api/MaterialFqcItem/ByitemNo/{id}")] + ITask<List<MaterialFqcItem>> GetMaterialFqcItemsByitemNo(string id); + + /// <summary> + /// MaterialItem 新增料號綁定檢驗工項 + /// </summary> + [WebApiClient.Attributes.HttpPost("api/MaterialFqcItem")] + ITask<ResultModel<MaterialFqcItem>> PostMaterialFqcItem([FromBody, RawJsonContent] string model); + + /// <summary> + /// MaterialItem 刪除料號綁定檢驗工項 + /// </summary> + /// <returns></returns> + [WebApiClient.Attributes.HttpDelete("api/MaterialFqcItem/{id}")] + ITask<ResultModel<string>> DeleteMaterialFqcItem(int id); + #endregion + } +} diff --git a/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml new file mode 100644 index 00000000..7e3e4754 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB013.cshtml @@ -0,0 +1,237 @@ +@{ + ViewData["Title"] = "鋼板資料查詢"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +<style type="text/css"> + /*.layui-table-main .layui-table-cell {*/ + /*height: auto !important;*/ + /*white-space: normal; + } + + .layui-table img { + max-width: 60px; + max-height: 28px; + } + + .layui-tree-main { + cursor: pointer; + padding-right: 10px; + float: left; + border-width: 1px; + border-style: solid; + border-color: #e6e6e6; + margin: 10px 0; + } + + .layui-table-cell { + height: auto; + white-space: normal; + }*/ +</style> + + +<div class="layui-card"> + <div class="layui-card-header"> + <div class="layui-form"> + <div class="layui-form-item"> + <div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> + </div> + </div> + </div> + <div class="layui-card-body"> + <div class="layui-form"> + <div class="layui-row"> + <div class="layui-form-item"> + <div class="layui-col-sm3"> + <div class="layui-inline"> + <label class="layui-form-label" style="width:60px">鋼板編號:</label> + <div class="layui-input-inline" style="width:150px"> + <input id="steelPlateNo" name="steelPlateNo" autocomplete="off" oninput="let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);" class="layui-input"> + </div> + </div> + </div> + <div class="layui-col-sm3"> + <div class="layui-inline"> + <label class="layui-form-label" style="width:60px">PCB板號:</label> + <div class="layui-input-inline" style="width:150px"> + <input id="pcbPartNo" name="pcbPartNo" autocomplete="off" oninput="let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);" class="layui-input"> + </div> + </div> + </div> + <div class="layui-col-sm2"> + <div class="layui-inline"> + <label class="layui-form-label" style="width:50px">正背面:</label> + <div class="layui-input-inline" style="width:80px"> + <select id="Side" lay-filter="Side" name="Side" class=""> + <option value="">全部</option> + <option value="11">B/背面</option> + <option value="12">A/正面</option> + </select> + </div> + </div> + </div> + <div class="layui-col-sm2"> + <div class="layui-inline"> + <label class="layui-form-label" style="width:50px">狀態:</label> + <div class="layui-input-inline" style="width:80px"> + <select id="status" lay-filter="status" name="status" class=""> + <option value="">全部</option> + <option value="0">失效</option> + <option value="1">有效</option> + </select> + </div> + </div> + </div> + <div class="layui-col-sm1"> + <div class="layui-inline layui-show-xs-block"> + <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="querysubmit"> + <i class="layui-icon layui-icon-sm"></i> + </button> + </div> + </div> + </div> + </div> + </div> + <table class="layui-hide" id="query" lay-filter="query"></table> + </div> +</div> + +@section Scripts{ + <script type="text/javascript"> + layui.use(['form', 'layer', 'laydate'], function () { + form = layui.form; + //laydate = layui.laydate; + //laydate.render({ + // elem: '#dateStr' + // , trigger: 'click' + // , format: 'yyyy/MM/dd' + // , theme: 'grid' + //}); + + //laydate.render({ + // elem: '#dateEnd' + // , trigger: 'click' + // , format: 'yyyy/MM/dd' + // , theme: 'grid' + //}); + + //form.on('select(factory)', function (data) { + // $("#factoryID").val(data.value); + // //roleName = data.elem[data.elem.selectedIndex].text; + // var qs = $('button[lay-filter="querysubmit"]'); + // qs.click(); + + // //hg.msghide("刷新数据!"); + // //table && table.reload(); + //}); + }); + + + + //监听表单提交事件 + hg.form.onsubmit('querysubmit', function (data) { + hg.msghide("重新載入資料.."); + table && table.reload(data); + }); + + var tableCols = [[ + { + field: 'steelPlateNo', + width: 80, + title: '委外廠', + sort: true + }, + { + field: 'specification', + title: '入庫時間', + sort: true + }, + { + field: 'pcbPartNo', + width: 150, + title: '入庫單號', + sort: true + }, + { + field: 'sideName', + title: '順序', + width: 60 + }, + { + field: 'boards', + title: '工單號碼', + sort: true + }, + { + field: 'standardTension1', + title: '料號', + sort: true + }, + { + field: 'standardTension2', + title: '料號', + sort: true + }, + { + field: 'standardTension3', + title: '料號', + sort: true + }, + { + field: 'standardTension4', + title: '料號', + sort: true + }, + { + field: 'standardTension5', + title: '料號', + sort: true + }, + { + field: 'statusName', + width: 60, + title: '批量' + }, + { + title: '操作', + align: 'center', + width: 80, + templet: function (d) { + return '<a class="layui-btn layui-btn-warm layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>' + } + } + ]]; + //通过行tool编辑,lay-event="edit" + function edit(obj) { + if (obj.data.inhouseNo) { + hg.open('FQC抽驗作業', '/FQC/FQC007?inhouseNo=' + obj.data.inhouseNo + '&seqID=' + obj.data.seqID, '', '', true); + } + } + + //新增按鈕 + var toolbar = [{ + text: '新增', + layuiicon: '', + class: 'layui-btn', + handler: function () { + hg.open('新增鋼板基本資料', '/PCB/PCB013C', 700, 500); + + } + }]; + + //基本数据表格 + var table = hg.table.datatable('query', '鋼板資料查詢', '/PCB/PCB013Query', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + // var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/GetWipInfo', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + </script> + + <script type="text/html" id="statusName"> + {{# if(d.statusName === '允收'){ }} + <span style="color: #07ab2a;">{{ d.statusName }}</span> + {{# } else if(d.statusName === '批退'){ }} + <span style="color: #d70841;">{{ d.statusName }}</span> + {{# } else { }} + {{ d.statusName }} + {{# } }} + </script> +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml new file mode 100644 index 00000000..19866d69 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB013C.cshtml @@ -0,0 +1,139 @@ +@model AMESCoreStudio.WebApi.Models.AMES.SteelPlateInfo + + +@{ ViewData["Title"] = "FQC001C"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; } + +<style> + .control-label { + justify-content: flex-end !important; + } +</style> + +<div class="layui-card"> + <div class="row"> + <div class="col-sm-12"> + <form enctype="multipart/form-data" method="post" asp-action="PCB013" class="layui-form"> + <div asp-validation-summary="ModelOnly" class="text-danger"></div> + + <div class="layui-form-item"> + <label class="layui-form-label">鋼板編號</label> + <div class="layui-input-inline"> + <input asp-for="SteelPlateNo" class="layui-input" autocomplete="off" placeholder="請輸入鋼板編號" /> + <span asp-validation-for="SteelPlateNo" class="layui-bg-red"></span> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label">規格</label> + <div class="layui-input-inline"> + <input asp-for="Specification" class="layui-input" autocomplete="off" placeholder="請輸入規格" /> + <span asp-validation-for="Specification" class="layui-bg-red"></span> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label">PCB板料號</label> + <div class="layui-input-inline"> + <input asp-for="PcbPartNo" class="layui-input" placeholder="請輸入PCB板料號" /> + <span asp-validation-for="PcbPartNo" class="layui-bg-red"></span> + </div> + </div> + + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">正背面</label> + <div class="layui-input-inline" style="width:200px;"> + <input type="radio" asp-for="Side" value="11" title="B/背面" checked> + <input type="radio" asp-for="Side" value="12" title="A/正面"> + </div> + <label class="layui-form-label">連板數</label> + <div class="layui-input-inline"> + <input asp-for="Boards" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="Boards" class="layui-bg-red"></span> + </div> + </div> + </div> + + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">標準張力_1</label> + <div class="layui-input-inline"> + <input asp-for="StandardTension1" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="StandardTension1" class="layui-bg-red"></span> + </div> + <label class="layui-form-label">標準張力_2</label> + <div class="layui-input-inline"> + <input asp-for="StandardTension2" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="StandardTension2" class="layui-bg-red"></span> + </div> + </div> + </div> + + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label">標準張力_3</label> + <div class="layui-input-inline"> + <input asp-for="StandardTension3" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="StandardTension3" class="layui-bg-red"></span> + </div> + <label class="layui-form-label">標準張力_4</label> + <div class="layui-input-inline"> + <input asp-for="StandardTension4" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="StandardTension4" class="layui-bg-red"></span> + </div> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label">標準張力_5</label> + <div class="layui-input-inline"> + <input asp-for="StandardTension5" class="layui-input" style="width: 70px;"/> + <span asp-validation-for="StandardTension5" class="layui-bg-red"></span> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label">狀態</label> + <div class="layui-input-inline"> + <input type="radio" asp-for="Status" value="1" title="有效" checked> + <input type="radio" asp-for="Status" value="0" title="失效"> + </div> + </div> + + <div class="layui-form-item"> + <label class="layui-form-label">備註</label> + <div class="layui-input-block"> + <input asp-for="Remark" class="layui-input" /> + </div> + </div> + + <span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> + <div class="layui-row" style="text-align:center"> + <div class="layui-col-md12"> + <input type="submit" value="保存" class="layui-btn" /> + </div> + </div> + </form> + </div> + </div> +</div> + +@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + + <script type="text/javascript"> + layui.use(['form'], function () { + form = layui.form; + }); + $(document).ready(function () { + var error = '@Html.ValidationMessage("error")'; + if ($(error).text() != '') { + parent.hg.msg(error); + } + }); + </script> + + +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs new file mode 100644 index 00000000..824982a7 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteInfoController.cs @@ -0,0 +1,123 @@ +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.CommonTools.Result; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// <summary> + /// 錫膏基本資料檔 + /// </summary> + [Route("api/[controller]")] + [ApiController] + public class SolderPasteInfoController : ControllerBase + { + private readonly AMESContext _context; + + public SolderPasteInfoController(AMESContext context) + { + _context = context; + } + + // GET: api/SolderPasteInfo + [HttpGet] + public async Task<ActionResult<IEnumerable<SolderPasteInfo>>> GetSolderPasteInfos() + { + return await _context.SolderPasteInfos.ToListAsync(); + } + + // GET: api/SolderPasteInfo/5 + [HttpGet("{id}")] + public async Task<ActionResult<SolderPasteInfo>> GetSolderPasteInfo(int id) + { + var solderPasteInfo = await _context.SolderPasteInfos.FindAsync(id); + + if (solderPasteInfo == null) + { + return NotFound(); + } + + return solderPasteInfo; + } + + /// <summary> + /// 更新錫膏基本資料檔 + /// </summary> + /// <param name="solderPasteInfo"></param> + /// <returns></returns> + [HttpPut] + public async Task<ResultModel<SolderPasteInfo>> PutSolderPasteInfo(SolderPasteInfo solderPasteInfo) + { + ResultModel<SolderPasteInfo> result = new ResultModel<SolderPasteInfo>(); + _context.Entry(solderPasteInfo).State = EntityState.Modified; + solderPasteInfo.UpdateDate = DateTime.Now; + solderPasteInfo.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// <summary> + /// 新增錫膏基本資料檔 + /// </summary> + /// <param name="solderPasteInfo"></param> + /// <returns></returns> + [HttpPost] + public async Task<ResultModel<SolderPasteInfo>> PostSolderPasteInfo(SolderPasteInfo solderPasteInfo) + { + ResultModel<SolderPasteInfo> result = new ResultModel<SolderPasteInfo>(); + Helper helper = new Helper(_context); + solderPasteInfo.SolderPasteID = helper.GetIDKey("SOLDER_PASTE_ID").Result; + _context.SolderPasteInfos.Add(solderPasteInfo); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + // DELETE: api/SolderPasteInfo/5 + [HttpDelete("{id}")] + public async Task<ActionResult<SolderPasteInfo>> DeleteSolderPasteInfo(int id) + { + var solderPasteInfo = await _context.SolderPasteInfos.FindAsync(id); + if (solderPasteInfo == null) + { + return NotFound(); + } + + _context.SolderPasteInfos.Remove(solderPasteInfo); + await _context.SaveChangesAsync(); + + return solderPasteInfo; + } + + private bool SolderPasteInfoExists(int id) + { + return _context.SolderPasteInfos.Any(e => e.SolderPasteID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs new file mode 100644 index 00000000..481330f4 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs @@ -0,0 +1,123 @@ +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.CommonTools.Result; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// <summary> + /// 錫膏使用紀錄資料檔 + /// </summary> + [Route("api/[controller]")] + [ApiController] + public class SolderPasteRecordController : ControllerBase + { + private readonly AMESContext _context; + + public SolderPasteRecordController(AMESContext context) + { + _context = context; + } + + // GET: api/SolderPasteRecord + [HttpGet] + public async Task<ActionResult<IEnumerable<SolderPasteRecord>>> GetSolderPasteRecords() + { + return await _context.SolderPasteRecords.ToListAsync(); + } + + // GET: api/SolderPasteRecord/5 + [HttpGet("{id}")] + public async Task<ActionResult<SolderPasteRecord>> GetSolderPasteRecord(int id) + { + var solderPasteRecord = await _context.SolderPasteRecords.FindAsync(id); + + if (solderPasteRecord == null) + { + return NotFound(); + } + + return solderPasteRecord; + } + + /// <summary> + /// 更新錫膏使用紀錄資料檔 + /// </summary> + /// <param name="solderPasteRecord"></param> + /// <returns></returns> + [HttpPut] + public async Task<ResultModel<SolderPasteRecord>> PutSolderPasteRecord(SolderPasteRecord solderPasteRecord) + { + ResultModel<SolderPasteRecord> result = new ResultModel<SolderPasteRecord>(); + _context.Entry(solderPasteRecord).State = EntityState.Modified; + solderPasteRecord.UpdateDate = DateTime.Now; + solderPasteRecord.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// <summary> + /// 新增錫膏使用紀錄資料檔 + /// </summary> + /// <param name="solderPasteRecord"></param> + /// <returns></returns> + [HttpPost] + public async Task<ResultModel<SolderPasteRecord>> PostSolderPasteRecord(SolderPasteRecord solderPasteRecord) + { + ResultModel<SolderPasteRecord> result = new ResultModel<SolderPasteRecord>(); + Helper helper = new Helper(_context); + solderPasteRecord.SpRecordID = helper.GetIDKey("SP_RECORD_ID").Result; + _context.SolderPasteRecords.Add(solderPasteRecord); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + // DELETE: api/SolderPasteRecord/5 + [HttpDelete("{id}")] + public async Task<ActionResult<SolderPasteRecord>> DeleteSolderPasteRecord(int id) + { + var solderPasteRecord = await _context.SolderPasteRecords.FindAsync(id); + if (solderPasteRecord == null) + { + return NotFound(); + } + + _context.SolderPasteRecords.Remove(solderPasteRecord); + await _context.SaveChangesAsync(); + + return solderPasteRecord; + } + + private bool SolderPasteRecordExists(int id) + { + return _context.SolderPasteRecords.Any(e => e.SpRecordID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs new file mode 100644 index 00000000..76e81714 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs @@ -0,0 +1,190 @@ +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 +{ + /// <summary> + /// 鋼板基本資料檔 + /// </summary> + [Route("api/[controller]")] + [ApiController] + public class SteelPlateInfoController : ControllerBase + { + private readonly AMESContext _context; + + public SteelPlateInfoController(AMESContext context) + { + _context = context; + } + + // GET: api/SteelPlateInfo + [HttpGet] + public async Task<ActionResult<IEnumerable<SteelPlateInfo>>> GetSteelPlateInfos() + { + return await _context.SteelPlateInfos.ToListAsync(); + } + + // GET: api/SteelPlateInfo/5 + [HttpGet("{id}")] + public async Task<ActionResult<SteelPlateInfo>> GetSteelPlateInfo(int id) + { + var steelPlateInfo = await _context.SteelPlateInfos.FindAsync(id); + + if (steelPlateInfo == null) + { + return NotFound(); + } + + return steelPlateInfo; + } + + /// <summary> + /// 鋼板資料查詢 + /// </summary> + /// <param name="steelPlateNo">鋼板編號</param> + /// <param name="pcbPartNo">PCB板號</param> + /// <param name="side">正背面</param> + /// <param name="status">狀態</param> + /// <param name="page">頁數</param> + /// <param name="limit">筆數</param> + /// <returns></returns> + [HttpGet("SteelPlateInfoQuery")] + public async Task<ResultModel<SteelPlateInfoDto>> GetSteelPlateInfoQuery(string steelPlateNo, string pcbPartNo, string side + , string status, int page = 0, int limit = 10) + { + var q = await _context.SteelPlateInfos.ToListAsync(); + + if (!string.IsNullOrWhiteSpace(steelPlateNo)) + { + q = q.Where(w => w.SteelPlateNo.Contains(steelPlateNo)).ToList(); + } + + if (!string.IsNullOrWhiteSpace(pcbPartNo)) + { + q = q.Where(w => w.PcbPartNo.Contains(pcbPartNo)).ToList(); + } + + if (!string.IsNullOrWhiteSpace(side)) + { + q = q.Where(w => w.Side.ToString() == side).ToList(); + } + + if (!string.IsNullOrWhiteSpace(status)) + { + q = q.Where(w => w.Status == status).ToList(); + + } + ResultModel<SteelPlateInfoDto> result = new ResultModel<SteelPlateInfoDto>(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit).ToList(); + } + + // 紀錄筆數 + result.DataTotal = q.Count(); + + result.Data = q.Select(s => new SteelPlateInfoDto + { + SteelPlateID = s.SteelPlateID, + SteelPlateNo = s.SteelPlateNo, + Specification = s.Specification, + PcbPartNo = s.PcbPartNo, + StandardTension1 = s.StandardTension1, + StandardTension2 = s.StandardTension2, + StandardTension3 = s.StandardTension3, + StandardTension4 = s.StandardTension4, + StandardTension5 = s.StandardTension5, + Boards = s.Boards, + SideName = s.Side == 11 ? "B/背面" : "A/正面", + StatusName = s.Status == "0" ? "失效" : "有效", + Remark = s.Remark + }).ToList(); + return result; + } + + /// <summary> + /// 更新鋼板基本資料檔 + /// </summary> + /// <param name="steelPlateInfo"></param> + /// <returns></returns> + [HttpPut] + public async Task<ResultModel<SteelPlateInfo>> PutSteelPlateInfo(SteelPlateInfo steelPlateInfo) + { + ResultModel<SteelPlateInfo> result = new ResultModel<SteelPlateInfo>(); + _context.Entry(steelPlateInfo).State = EntityState.Modified; + steelPlateInfo.UpdateDate = DateTime.Now; + steelPlateInfo.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// <summary> + /// 新增鋼板基本資料檔 + /// </summary> + /// <param name="steelPlateInfo"></param> + /// <returns></returns> + [HttpPost] + public async Task<ResultModel<SteelPlateInfo>> PostSteelPlateInfo(SteelPlateInfo steelPlateInfo) + { + ResultModel<SteelPlateInfo> result = new ResultModel<SteelPlateInfo>(); + Helper helper = new Helper(_context); + steelPlateInfo.SteelPlateID = helper.GetIDKey("STEEL_PLATE_ID").Result; + _context.SteelPlateInfos.Add(steelPlateInfo); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + // DELETE: api/SteelPlateInfo/5 + [HttpDelete("{id}")] + public async Task<ActionResult<SteelPlateInfo>> DeleteSteelPlateInfo(int id) + { + var steelPlateInfo = await _context.SteelPlateInfos.FindAsync(id); + if (steelPlateInfo == null) + { + return NotFound(); + } + + _context.SteelPlateInfos.Remove(steelPlateInfo); + await _context.SaveChangesAsync(); + + return steelPlateInfo; + } + + private bool SteelPlateInfoExists(int id) + { + return _context.SteelPlateInfos.Any(e => e.SteelPlateID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateMeasureController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateMeasureController.cs new file mode 100644 index 00000000..2fcf47fc --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateMeasureController.cs @@ -0,0 +1,123 @@ +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.CommonTools.Result; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// <summary> + /// 鋼板量測記錄資料檔 + /// </summary> + [Route("api/[controller]")] + [ApiController] + public class SteelPlateMeasureController : ControllerBase + { + private readonly AMESContext _context; + + public SteelPlateMeasureController(AMESContext context) + { + _context = context; + } + + // GET: api/SteelPlateMeasure + [HttpGet] + public async Task<ActionResult<IEnumerable<SteelPlateMeasure>>> GetSteelPlateMeasures() + { + return await _context.SteelPlateMeasures.ToListAsync(); + } + + // GET: api/SteelPlateMeasure/5 + [HttpGet("{id}")] + public async Task<ActionResult<SteelPlateMeasure>> GetSteelPlateMeasure(int id) + { + var steelPlateMeasure = await _context.SteelPlateMeasures.FindAsync(id); + + if (steelPlateMeasure == null) + { + return NotFound(); + } + + return steelPlateMeasure; + } + + /// <summary> + /// 更新鋼板量測記錄資料檔 + /// </summary> + /// <param name="steelPlateMeasure"></param> + /// <returns></returns> + [HttpPut] + public async Task<ResultModel<SteelPlateMeasure>> PutSteelPlateMeasure(SteelPlateMeasure steelPlateMeasure) + { + ResultModel<SteelPlateMeasure> result = new ResultModel<SteelPlateMeasure>(); + _context.Entry(steelPlateMeasure).State = EntityState.Modified; + steelPlateMeasure.UpdateDate = DateTime.Now; + steelPlateMeasure.UpdateUserID = 0; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// <summary> + /// 新增鋼板量測記錄資料檔 + /// </summary> + /// <param name="solderPasteRecord"></param> + /// <returns></returns> + [HttpPost] + public async Task<ResultModel<SteelPlateMeasure>> PostSolderPasteRecord(SteelPlateMeasure steelPlateMeasure) + { + ResultModel<SteelPlateMeasure> result = new ResultModel<SteelPlateMeasure>(); + Helper helper = new Helper(_context); + steelPlateMeasure.SpMeasureID = helper.GetIDKey("SP_MEASURE_ID").Result; + _context.SteelPlateMeasures.Add(steelPlateMeasure); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + // DELETE: api/SteelPlateMeasure/5 + [HttpDelete("{id}")] + public async Task<ActionResult<SteelPlateMeasure>> DeleteSteelPlateMeasure(int id) + { + var steelPlateMeasure = await _context.SteelPlateMeasures.FindAsync(id); + if (steelPlateMeasure == null) + { + return NotFound(); + } + + _context.SteelPlateMeasures.Remove(steelPlateMeasure); + await _context.SaveChangesAsync(); + + return steelPlateMeasure; + } + + private bool SteelPlateMeasureExists(int id) + { + return _context.SteelPlateMeasures.Any(e => e.SpMeasureID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs new file mode 100644 index 00000000..ff8b36c2 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// <summary> + /// SolderPasteInfoDto 錫膏基本資料檔Dto + /// </summary> + public partial class SolderPasteInfoDto + { + /// <summary> + /// 錫膏ID + /// </summary> + public int SolderPasteID { get; set; } + + /// <summary> + /// 錫膏編號 + /// </summary> + public string SolderPasteNo { get; set; } + + /// <summary> + /// 規格描述 + /// </summary> + public string Description { get; set; } + + /// <summary> + /// 收貨日期 + /// </summary> + public DateTime ReceiptDate { get; set; } + + /// <summary> + /// 製造日期 + /// </summary> + public DateTime ManufactoringDate { get; set; } + + /// <summary> + /// 有效日期 + /// </summary> + + public DateTime EffectiveDate { get; set; } + + /// <summary> + /// 狀態 0=失效 ; 1=有效 + /// </summary> + public string Status { get; set; } = "1"; + + /// <summary> + /// 備註 + /// </summary> + public string Remark { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/SteelPlateInfoDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/SteelPlateInfoDto.cs new file mode 100644 index 00000000..a294c88e --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/SteelPlateInfoDto.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// <summary> + /// SteelPlateInfoDto 鋼板基本資料檔Dto + /// </summary> + public partial class SteelPlateInfoDto + { + /// <summary> + /// 鋼板ID + /// </summary> + public int SteelPlateID { get; set; } + + /// <summary> + /// 鋼板編號 + /// </summary> + public string SteelPlateNo { get; set; } + + /// <summary> + /// 規格 + /// </summary> + public string Specification { get; set; } + + /// <summary> + /// PCB板料號 + /// </summary> + public string PcbPartNo { get; set; } + + /// <summary> + /// 正背面 11=B/背面 ; 12=A/正面 + /// </summary> + public string SideName { get; set; } + + /// <summary> + /// 連板數 + /// </summary> + public int Boards { get; set; } = 1; + + /// <summary> + /// 標準張力_1 + /// </summary> + public string StandardTension1 { get; set; } + + /// <summary> + /// 標準張力_2 + /// </summary> + public string StandardTension2 { get; set; } + + /// <summary> + /// 標準張力_3 + /// </summary> + public string StandardTension3 { get; set; } + + /// <summary> + /// 標準張力_4 + /// </summary> + public string StandardTension4 { get; set; } + + /// <summary> + /// 標準張力_5 + /// </summary> + public string StandardTension5 { get; set; } + + /// <summary> + /// STATUS 0=失效 ; 1=有效 + /// </summary> + public string StatusName { get; set; } + + /// <summary> + /// 備註 + /// </summary> + public string Remark { get; set; } + + + /// <summary> + /// 建立UserID + /// </summary> + public int CreateUserID { get; set; } = 0; + + /// <summary> + /// 建立日期 + /// </summary> + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// <summary> + /// 更新UserID + /// </summary> + public int UpdateUserID { get; set; } = 0; + + /// <summary> + /// 更新日期 + /// </summary> + public DateTime? UpdateDate { get; set; } = DateTime.Now; + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs new file mode 100644 index 00000000..d6d62dfd --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// <summary> + /// 錫膏基本資料檔 + /// </summary> + [Table("SOLDER_PASTE_INFO", Schema = "JHAMES")] + public partial class SolderPasteInfo + { + /// <summary> + /// 錫膏ID + /// </summary> + [Key] + [Column("SOLDER_PASTE_ID")] + [DataMember] + public int SolderPasteID { get; set; } + + /// <summary> + /// 錫膏編號 + /// </summary> + [Required] + [Column("SOLDER_PASTE_NO")] + [StringLength(40)] + [DataMember] + [Display(Name = "錫膏編號")] + public string SolderPasteNo { get; set; } + + /// <summary> + /// 規格描述 + /// </summary> + [Required] + [Column("DESCRIPTION")] + [StringLength(60)] + [DataMember] + [Display(Name = "規格描述")] + public string Description { get; set; } + + /// <summary> + /// 收貨日期 + /// </summary> + [DataMember] + [Display(Name = "收貨日期")] + [Column("RECEIPT_DATE", TypeName = "DATE")] + public DateTime ReceiptDate { get; set; } + + /// <summary> + /// 製造日期 + /// </summary> + [DataMember] + [Display(Name = "製造日期")] + [Column("MANUFACTORING_DATE", TypeName = "DATE")] + public DateTime ManufactoringDate { get; set; } + + /// <summary> + /// 有效日期 + /// </summary> + [DataMember] + [Display(Name = "有效日期")] + [Column("EFFECTIVE_DATE", TypeName = "DATE")] + public DateTime EffectiveDate { get; set; } + + /// <summary> + /// 狀態 0=失效 ; 1=有效 + /// </summary> + [Required] + [Column("STATUS")] + [StringLength(2)] + [DataMember] + [Display(Name = "狀態")] + public string Status { get; set; } = "1"; + + /// <summary> + /// 備註 + /// </summary> + [Column("REMARK")] + [StringLength(1024)] + [DataMember] + [Display(Name = "備註")] + public string Remark { get; set; } + + /// <summary> + /// 建立UserID + /// </summary> + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// <summary> + /// 建立日期 + /// </summary> + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// <summary> + /// 更新UserID + /// </summary> + [Column("UPDATE_USERID")] + [DataMember] + public int UpdateUserID { get; set; } = 0; + + /// <summary> + /// 更新日期 + /// </summary> + [Column("UPDATE_DATE")] + [DataMember] + public DateTime? UpdateDate { get; set; } = DateTime.Now; + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs new file mode 100644 index 00000000..06d3ac31 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// <summary> + /// 錫膏使用紀錄資料檔 + /// </summary> + [Table("SOLDER_PASTE_RECORD", Schema = "JHAMES")] + public partial class SolderPasteRecord + { + /// <summary> + /// 產品類別ID + /// </summary> + [Key] + [Column("SP_RECORD_ID")] + public int SpRecordID { get; set; } + + /// <summary> + /// 錫膏ID + /// </summary> + [DataMember] + [Display(Name = "錫膏ID")] + [Column("SOLDER_PASTE_ID")] + public int SolderPasteID { get; set; } + + /// <summary> + /// 狀態 + /// </summary> + [DataMember] + [Display(Name = "狀態")] + [Required] + [Column("STATUS")] + [StringLength(8)] + public string Status { get; set; } + + /// <summary> + /// 錫膏作業時間 + /// </summary> + [DataMember] + [Display(Name = "錫膏作業時間")] + [Column("WORKING_TIME")] + public double WorkingTime { get; set; } + + /// <summary> + /// 建立UserID + /// </summary> + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// <summary> + /// 建立日期 + /// </summary> + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// <summary> + /// 更新UserID + /// </summary> + [Column("UPDATE_USERID")] + [DataMember] + public int UpdateUserID { get; set; } = 0; + + /// <summary> + /// 更新日期 + /// </summary> + [Column("UPDATE_DATE")] + [DataMember] + public DateTime? UpdateDate { get; set; } = DateTime.Now; + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/SteelPlateInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/SteelPlateInfo.cs new file mode 100644 index 00000000..e4dad491 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/SteelPlateInfo.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; + + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// <summary> + /// 鋼板基本資料檔 + /// </summary> + [Table("STEEL_PLATE_INFO", Schema = "JHAMES")] + public partial class SteelPlateInfo + { + /// <summary> + /// 鋼板ID + /// </summary> + [DataMember] + [Display(Name = "鋼板ID")] + [Key] + [Column("STEEL_PLATE_ID")] + public int SteelPlateID { get; set; } + + /// <summary> + /// 鋼板編號 + /// </summary> + [DataMember] + [Display(Name = "鋼板編號")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STEEL_PLATE_NO")] + [StringLength(40)] + public string SteelPlateNo { get; set; } + + /// <summary> + /// 規格 + /// </summary> + [DataMember] + [Display(Name = "規格")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("SPECIFICATION")] + [StringLength(60)] + public string Specification { get; set; } + + /// <summary> + /// PCB板料號 + /// </summary> + [DataMember] + [Display(Name = "PCB板料號")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("PCB_PART_NO")] + [StringLength(40)] + public string PcbPartNo { get; set; } + + /// <summary> + /// 正背面 11=B/背面 ; 12=A/正面 + /// </summary> + [DataMember] + [Display(Name = "正背面")] + [Column("SIDE")] + public int Side { get; set; } = 11; + + /// <summary> + /// 連板數 + /// </summary> + [DataMember] + [Display(Name = "連板數")] + [Column("BOARDS")] + public int Boards { get; set; } = 1; + + /// <summary> + /// 標準張力_1 + /// </summary> + [DataMember] + [Display(Name = "標準張力_1")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STANDARD_TENSION_1")] + [StringLength(10)] + public string StandardTension1 { get; set; } + + /// <summary> + /// 標準張力_2 + /// </summary> + [DataMember] + [Display(Name = "標準張力_2")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STANDARD_TENSION_2")] + [StringLength(10)] + public string StandardTension2 { get; set; } + + /// <summary> + /// 標準張力_3 + /// </summary> + [DataMember] + [Display(Name = "標準張力_3")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STANDARD_TENSION_3")] + [StringLength(10)] + public string StandardTension3 { get; set; } + + /// <summary> + /// 標準張力_4 + /// </summary> + [DataMember] + [Display(Name = "標準張力_4")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STANDARD_TENSION_4")] + [StringLength(10)] + public string StandardTension4 { get; set; } + + /// <summary> + /// 標準張力_5 + /// </summary> + [DataMember] + [Display(Name = "標準張力_5")] + [Required(ErrorMessage = "{0},不能空白")] + [Column("STANDARD_TENSION_5")] + [StringLength(10)] + public string StandardTension5 { get; set; } + + /// <summary> + /// STATUS 0=失效 ; 1=有效 + /// </summary> + [DataMember] + [Display(Name = "狀態")] + [Required] + [Column("STATUS")] + [StringLength(2)] + public string Status { get; set; } = "1"; + + /// <summary> + /// 備註 + /// </summary> + [DataMember] + [Display(Name = "備註")] + [Column("REMARK")] + [StringLength(1024)] + public string Remark { get; set; } + + + /// <summary> + /// 建立UserID + /// </summary> + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// <summary> + /// 建立日期 + /// </summary> + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// <summary> + /// 更新UserID + /// </summary> + [Column("UPDATE_USERID")] + [DataMember] + public int UpdateUserID { get; set; } = 0; + + /// <summary> + /// 更新日期 + /// </summary> + [Column("UPDATE_DATE")] + [DataMember] + public DateTime? UpdateDate { get; set; } = DateTime.Now; + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/SteelPlateMeasure.cs b/AMESCoreStudio.WebApi/Models/AMES/SteelPlateMeasure.cs new file mode 100644 index 00000000..a173566d --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/SteelPlateMeasure.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; + + +#nullable disable + +namespace AMESCoreStudio.WebApi.Models.AMES +{ + /// <summary> + /// 鋼板量測記錄資料檔 + /// </summary> + [Table("STEEL_PLATE_MEASURE", Schema = "JHAMES")] + public partial class SteelPlateMeasure + { + /// <summary> + /// 鋼板量測記錄ID + /// </summary> + [Key] + [Column("SP_MEASURE_ID")] + [DataMember] + [Display(Name = "鋼板量測記錄ID")] + public int SpMeasureID { get; set; } + + /// <summary> + /// 鋼板ID + /// </summary> + [Column("STEEL_PLATE_ID")] + [DataMember] + [Display(Name = "鋼板ID")] + public int SteelPlateID { get; set; } + + /// <summary> + /// 張力_1 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("TENSION_1")] + [StringLength(10)] + [DataMember] + [Display(Name = "張力_1")] + public string Tension1 { get; set; } + + /// <summary> + /// 張力_2 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("TENSION_2")] + [StringLength(10)] + [DataMember] + [Display(Name = "張力_2")] + public string Tension2 { get; set; } + + /// <summary> + /// 張力_3 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("TENSION_3")] + [StringLength(10)] + [DataMember] + [Display(Name = "張力_3")] + public string Tension3 { get; set; } + + /// <summary> + /// 張力_4 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("TENSION_4")] + [StringLength(10)] + [DataMember] + [Display(Name = "張力_4")] + public string Tension4 { get; set; } + + /// <summary> + /// 張力_5 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("TENSION_5")] + [StringLength(10)] + [DataMember] + [Display(Name = "張力_5")] + public string Tension5 { get; set; } + + /// <summary> + /// 檢查狀態 + /// </summary> + [Required(ErrorMessage = "{0},不能空白")] + [Column("STATUS")] + [StringLength(8)] + [DataMember] + [Display(Name = "狀態")] + public string Status { get; set; } + + /// <summary> + /// 備註 + /// </summary> + [Column("REMARK")] + [StringLength(1024)] + [DataMember] + [Display(Name = "備註")] + public string Remark { get; set; } + + /// <summary> + /// 判定結果 P=PASS ; F=FAIL ; N=未量測 + /// </summary> + [Required] + [Column("MEASURE_RESULT")] + [StringLength(2)] + [DataMember] + [Display(Name = "判定結果")] + public string MeasureResult { get; set; } + + /// <summary> + /// 建立UserID + /// </summary> + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// <summary> + /// 建立日期 + /// </summary> + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + /// <summary> + /// 更新UserID + /// </summary> + [Column("UPDATE_USERID")] + [DataMember] + public int UpdateUserID { get; set; } = 0; + + /// <summary> + /// 更新日期 + /// </summary> + [Column("UPDATE_DATE")] + [DataMember] + public DateTime? UpdateDate { get; set; } = DateTime.Now; + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index e00ae8dd..aecf7829 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -820,8 +820,27 @@ namespace AMESCoreStudio.WebApi /// <summary> /// 生產工時報工資料檔 /// </summary> - public DbSet<WipTimeSheet> WipTimeSheets { get; set; } + ///public DbSet<WipTimeSheet> WipTimeSheets { get; set; } + /// <summary> + /// 鋼板基本資料檔 + /// </summary> + public virtual DbSet<SteelPlateInfo> SteelPlateInfos { get; set; } + + /// <summary> + /// 鋼板量測記錄資料檔 + /// </summary> + public virtual DbSet<SteelPlateMeasure> SteelPlateMeasures { get; set; } + + /// <summary> + /// 錫膏基本資料檔 + /// </summary> + public virtual DbSet<SolderPasteInfo> SolderPasteInfos { get; set; } + + /// <summary> + /// 錫膏使用紀錄資料檔 + /// </summary> + public virtual DbSet<SolderPasteRecord> SolderPasteRecords { get; set; } } }