diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs index 9eafd2d..daca62b 100644 --- a/AMESCoreStudio.Web/Controllers/FQCController.cs +++ b/AMESCoreStudio.Web/Controllers/FQCController.cs @@ -307,6 +307,24 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.GetInspectionStatusSelect = q; } + /// + /// 生產單位 + /// + /// + private async Task GetFactoryUnit() + { + var result = await _basApi.GetFactoryUnits(); + + var FactoryUnit = new List(); + + for (int i = 0; i < result.Count; i++) + { + FactoryUnit.Add(new SelectListItem(result[i].UnitName, result[i].UnitNo.ToString())); + } + + ViewBag.FactoryUnitList = FactoryUnit; + } + /// /// Mail群組 /// @@ -1810,17 +1828,17 @@ namespace AMESCoreStudio.Web.Controllers { await GetFactoryInfo(); } - + await GetFactoryUnit(); return View(); } public async Task FQC008QueryAsync(string barcodeNo, string wipNo , string boxNo, string inhouseNo, string dateStr, string dateEnd, string factoryID - , string status = "A", int page = 0, int limit = 10) + , string status = "A", int page = 0, int limit = 10, string unit = null) { IResultModel result = await _fqcApi.GetFqcInhouseMasterQuery(barcodeNo: barcodeNo, wipNo: wipNo , boxNo: boxNo, inhouseNo: inhouseNo, date_str: dateStr, date_end: dateEnd - , status: status, page: page, limit: limit, factoryID: factoryID); + , status: status, page: page, limit: limit, factoryID: factoryID, unit: unit); if (result.Data.Count() != 0) { @@ -1829,9 +1847,9 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Table() { count = 0, data = null }); } - public async Task FQC008Query2Async(string barcodeNo, string wipNo, string boxNo, string inhouseNo, string dateStr, string dateEnd, string factoryID, string statusNo, string factoryNo, int page = 0, int limit = 10) + public async Task FQC008Query2Async(string barcodeNo, string wipNo, string boxNo, string inhouseNo, string dateStr, string dateEnd, string factoryID, string statusNo, string factoryNo, string unit, int page = 0, int limit = 10) { - IResultModel result = await _fqcApi.GetFqcInhouseMasterQuery(barcodeNo, wipNo, boxNo, inhouseNo, dateStr, dateEnd, statusNo, page, limit, factoryID, factoryNo); + IResultModel result = await _fqcApi.GetFqcInhouseMasterQuery(barcodeNo, wipNo, boxNo, inhouseNo, dateStr, dateEnd, statusNo, page, limit, factoryID, factoryNo, unit: unit); if (result.Data.Count() != 0) { @@ -1839,6 +1857,25 @@ namespace AMESCoreStudio.Web.Controllers } return Json(new Table() { count = 0, data = null }); } + + [HttpGet] + public IActionResult FQC008A(string wipNo) + { + ViewBag.wipNo = wipNo; + return View(); + } + + public async Task GetFQC008A(string wipNo) + { + var result = await _fqcApi.GetFqcInhouseMasterQueryExamineDetail(wipNo); + + 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 料號對應檢驗工項 @@ -1919,7 +1956,7 @@ namespace AMESCoreStudio.Web.Controllers #endregion #region FQC010 報表 - public async Task FQC010_PDF(string inhouseNo, int seqID) + public IActionResult FQC010_PDF(string inhouseNo, int seqID) { string mimeType = ""; int extension = 1; @@ -1929,7 +1966,7 @@ namespace AMESCoreStudio.Web.Controllers return File(result.MainStream, "application/pdf"); } - public async Task FQC010_Excel(string inhouseNo, int seqID) + public IActionResult FQC010_Excel(string inhouseNo, int seqID) { string mimeType = ""; int extension = 1; diff --git a/AMESCoreStudio.Web/Controllers/PCBController.cs b/AMESCoreStudio.Web/Controllers/PCBController.cs index d272a65..8bee509 100644 --- a/AMESCoreStudio.Web/Controllers/PCBController.cs +++ b/AMESCoreStudio.Web/Controllers/PCBController.cs @@ -42,24 +42,24 @@ namespace AMESCoreStudio.Web.Controllers //#region 下拉選單 /// - /// SOP_Type + /// 錫膏狀態 /// /// - private void GetSteelPlateStatusSelect(string SelectedValue = null) + private void GetSolderPasteStatusSelect(string SelectedValue = null) { List values = new List(); if (SelectedValue != null) { values = SelectedValue.Split(',').ToList(); } - var q = Enum.GetValues(typeof(EnumPCB.EnumSteelPlateStatus)).Cast() + var q = Enum.GetValues(typeof(EnumPCB.EnumSolderPasteStatus)).Cast() .Select(s => new SelectListItem { Text = EnumPCB.GetDisplayName(s).ToString(), Value = s.ToString() }).ToList(); - ViewBag.GetSteelPlateStatusSelect = q; + ViewBag.GetSolderPasteStatusSelect = q; } //#endregion @@ -350,12 +350,14 @@ namespace AMESCoreStudio.Web.Controllers #region PCB014 錫膏使用管控 public ActionResult PCB014() { + GetSolderPasteStatusSelect(); return View(); } - public async Task PCB014QueryAsync(string solderPasteNo, string status, int page = 0, int limit = 10) + public async Task PCB014QueryAsync(string solderPasteNo, string description, string vendor, string status, int page = 0, int limit = 10) { - IResultModel result = await _pcbApi.GetSolderPasteInfoQuery(solderPasteNo: solderPasteNo, status: status, page: page, limit: limit); + IResultModel result = await _pcbApi.GetSolderPasteInfoQuery(solderPasteNo: solderPasteNo, + description: description, vendor: vendor, status: status, page: page, limit: limit); if (result.Data.Count() != 0) { @@ -378,9 +380,14 @@ namespace AMESCoreStudio.Web.Controllers return View(result); } - //頁面提交,id=0 添加,id>0 修改 + /// + /// 頁面提交,id=0 添加,id>0 修改 + /// + /// + /// 編碼生成 + /// [HttpPost] - public async Task PCB014Async(SolderPasteInfo model) + public async Task PCB014Async(SolderPasteInfo model, string numbergeneration) { // 日期判斷 if (model.EffectiveDate < model.ManufactoringDate) @@ -391,8 +398,51 @@ namespace AMESCoreStudio.Web.Controllers { IResultModel result; + // 新增 if (model.SolderPasteID == 0) { + var msg = string.Empty; + // 錫膏編號自動編碼 + if (numbergeneration == "A") + { + // 用規格帶出流水碼 + model.SolderPasteNo = await _pcbApi.GetSolderPasteSerialByAutoSerialNo(model.Description); + if (string.IsNullOrWhiteSpace(model.SolderPasteNo)) + { + msg = "找不到規格對應的代碼"; + } + } + // 人工手動給予 + else if (numbergeneration == "M") + { + + if (string.IsNullOrWhiteSpace(model.SolderPasteNo)) + msg = "請輸入錫膏編號"; + else + { + List solderPasteSerials = await _pcbApi.GetSolderPasteSerial(); + // 目前有設定的代號 + var serialNo = solderPasteSerials.Select(s => s.SerialNo).ToList(); + + if (serialNo.Any(code => model.SolderPasteNo.StartsWith(code))) + { + msg = "不可以輸入系統指定代碼"; + } + + var query = await _pcbApi.GetSolderPasteInfoQuery(solderPasteNo: model.SolderPasteNo); + // 錫膏編號重複 + if (query.DataTotal != 0) + msg = "該錫膏編號已建立過"; + } + } + + // 有錯誤訊息 + if (!string.IsNullOrWhiteSpace(msg)) + { + ModelState.AddModelError("error", msg); + return View("PCB014C", model); + } + model.CreateUserID = GetLogInUserID(); model.CreateDate = DateTime.Now; model.UpdateUserID = GetLogInUserID(); @@ -417,13 +467,230 @@ namespace AMESCoreStudio.Web.Controllers } } - if (model.SolderPasteID == 0) { return View("PCB014C", model); } return View("PCB014U", model); } + + /// + /// PCB014 錫膏刪除 + /// + /// 錫膏ID + /// + [HttpPost] + public async Task PCB014D(int id) + { + var result = await _pcbApi.DeleteSolderPasteInfo(id); + if (result.Success) + return Json(new Result() { success = true, msg = "刪除成功" }); + else + return Json(new Result() { success = false, msg = "刪除失敗" }); + } + + [HttpGet] + public IActionResult PCB017() + { + return View(); + } + + /// + /// 錫膏管制查詢 + /// + /// 錫膏編號 + /// 狀態 + /// 工單號碼 + /// 開始_收貨時間 + /// 結束_收貨時間 + /// 頁數 + /// 筆數 + /// + public async Task PCB017QueryAsync(string solderPasteNo , string status , string wipNo , + string strDate , string endDate , int page = 0, int limit = 10) + { + IResultModel result = await _pcbApi.GetSolderPasteInfoReport(solderPasteNo: solderPasteNo, status: status, + strDate: strDate, endDate: endDate, wipNo: wipNo, 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 PCB017C() + { + PCB017ViewModel model = new PCB017ViewModel(); + return View(model); + } + + /// + /// 錫膏管制作業-新增 + /// + /// 錫膏編號 + /// 狀態(I=入冰箱 ; O=出冰箱 ; C=使用完 ; X=報廢) + /// 數量 + /// + [HttpPost] + public async Task PCB017Async(PCB017ViewModel model) + { + List solderPasteSerials = await _pcbApi.GetSolderPasteSerial(); + // 目前有設定的代號 + var serialNo = solderPasteSerials.Select(s => s.SerialNo).ToList(); + + if (string.IsNullOrEmpty(model.solderPasteNo)) + { + ModelState.AddModelError("error", "請輸入錫膏編號"); + return View("PCB017C", model); + } + + if (model.qty == null && model.status == "I") + { + ModelState.AddModelError("error", "請輸入錫膏入冰箱數量"); + return View("PCB017C", model); + } + // 狀態為入冰箱 => 找未使用 + // 狀態為出冰箱 => 找入冰箱 + // 狀態為使用完 => 找開封中 + var selectStatus = model.status == "I" ? "N" : + model.status == "O" ? "I" : + model.status == "C" ? "U" : model.status; + var query = await _pcbApi.GetSolderPasteInfoByStatus(selectStatus); + + List solderPasteRecords = new List(); + + switch (model.status) + { + case "I": // 入冰箱 + // 判斷是否有序號且未使用 + if (query.Where(w => w.SolderPasteNo == model.solderPasteNo).Any()) + { + var Sn = model.solderPasteNo.Substring(0, 2); + var queryByNo = query.Where(w => w.SolderPasteNo.StartsWith(Sn)).ToList(); + if (model.qty > queryByNo.Count()) + { + ModelState.AddModelError("error", "目前能入冰箱錫膏數量不足,請確認"); + return View("PCB017C", model); + } + + foreach (var item in queryByNo.OrderBy(o => o.SolderPasteNo).Take(int.Parse(model.qty.ToString()))) + { + solderPasteRecords.Add(new SolderPasteRecord + { + SolderPasteID = item.SolderPasteID, + Status = model.status, + CreateUserID = GetLogInUserID(), + CreateDate = DateTime.Now + }); + } + } + else + { + ModelState.AddModelError("error", "找不到該筆錫膏編號是未使用狀態,請確認"); + return View("PCB017C", model); + } + break; + case "O": // 出冰箱 + // 判斷是否有序號且已入冰箱 + if (query.Where(w => w.SolderPasteNo == model.solderPasteNo).Any()) + { + var Sn = model.solderPasteNo.Substring(0, 2); + var queryByNo = query.Where(w => w.SolderPasteNo.StartsWith(Sn)).ToList(); + var first = queryByNo.OrderBy(o => o.UpdateDate).ThenBy(o => o.SolderPasteNo).FirstOrDefault(); + if (model.solderPasteNo != first.SolderPasteNo) + { + ModelState.AddModelError("error", "該筆錫膏編號順序不正確,請確認"); + return View("PCB017C", model); + } + + solderPasteRecords.Add(new SolderPasteRecord + { + SolderPasteID = first.SolderPasteID, + Status = model.status, + CreateUserID = GetLogInUserID(), + CreateDate = DateTime.Now + }); + } + else + { + ModelState.AddModelError("error", "找不到該筆錫膏編號是入冰箱狀態,請確認"); + return View("PCB017C", model); + } + break; + case "C": // 使用完 + // 判斷是否有序號且已開封 + if (query.Where(w => w.SolderPasteNo == model.solderPasteNo).Any()) + { + var first = query.Where(w => w.SolderPasteNo == model.solderPasteNo).FirstOrDefault(); + solderPasteRecords.Add(new SolderPasteRecord + { + SolderPasteID = first.SolderPasteID, + Status = model.status, + CreateUserID = GetLogInUserID(), + CreateDate = DateTime.Now + }); + } + else + { + ModelState.AddModelError("error", "找不到該筆錫膏編號是開封狀態,請確認"); + return View("PCB017C", model); + } + break; + case "X": // 報廢 + if (query.Where(w => w.SolderPasteNo == model.solderPasteNo).Any()) + { + var first = query.Where(w => w.SolderPasteNo == model.solderPasteNo).FirstOrDefault(); + solderPasteRecords.Add(new SolderPasteRecord + { + SolderPasteID = first.SolderPasteID, + Status = model.status, + CreateUserID = GetLogInUserID(), + CreateDate = DateTime.Now + }); + } + else + { + ModelState.AddModelError("error", "找不到該筆錫膏編號可報廢狀態,請確認"); + return View("PCB017C", model); + } + break; + } + + var aa = await _pcbApi.PostSolderPasteRecord(JsonConvert.SerializeObject(solderPasteRecords)); + return RedirectToAction("Refresh", "Home", new { msg = "新增成功!" }); + } + + [HttpGet] + public IActionResult PCB018() + { + return View(); + } + + /// + /// 錫膏報表查詢 + /// + /// 錫膏編號 + /// 工單號碼 + /// 頁數 + /// 筆數 + /// + public async Task PCB018QueryAsync(string solderPasteNo, string wipNo ,int page = 0, int limit = 10) + { + IResultModel result = await _pcbApi.GetSolderPasteInfoReport(solderPasteNo: solderPasteNo, + wipNo: wipNo, 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 }); + } + #endregion #region PCB015連板綁定作業 diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c0fb8f4..0d6ea2a 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -3556,10 +3556,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } @@ -3575,10 +3573,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } @@ -4300,25 +4296,28 @@ namespace AMESCoreStudio.Web.Controllers if (result_barcodeinfo == null) { - // 判斷是否在BarcodeChange 有被置換過 - var result_BarcodeChangeData = await _pcsApi.GetBarcodeChangeByBarcodeNo(model.BarCodeNo ?? model.ExtraBarCodeNo ?? "A"); + var _msg = "查無相關資料!"; + return RedirectToAction("Refresh", "Home", new { msg = _msg }); - // 判斷查詢是內部還是出貨條碼 - if (!string.IsNullOrWhiteSpace(model.BarCodeNo)) - result_BarcodeChangeData = result_BarcodeChangeData.Where(w => w.ChangeType == "P").ToList(); - else - result_BarcodeChangeData = result_BarcodeChangeData.Where(w => w.ChangeType == "E").ToList(); + //// 判斷是否在BarcodeChange 有被置換過 + //var result_BarcodeChangeData = await _pcsApi.GetBarcodeChangeByBarcodeNo(model.BarCodeNo ?? model.ExtraBarCodeNo ?? "A"); - if (result_BarcodeChangeData.Count() != 0) - { - var barcodeIDChange = result_BarcodeChangeData.FirstOrDefault().BarcodeID; - result_barcodeinfo = _pcsApi.GetBarcodeInfoes(barcodeIDChange).InvokeAsync().Result.FirstOrDefault(); - } - else - { - var _msg = "查無相關資料!"; - return RedirectToAction("Refresh", "Home", new { msg = _msg }); - } + //// 判斷查詢是內部還是出貨條碼 + //if (!string.IsNullOrWhiteSpace(model.BarCodeNo)) + // result_BarcodeChangeData = result_BarcodeChangeData.Where(w => w.ChangeType == "P").ToList(); + //else + // result_BarcodeChangeData = result_BarcodeChangeData.Where(w => w.ChangeType == "E").ToList(); + + //if (result_BarcodeChangeData.Count() != 0) + //{ + // var barcodeIDChange = result_BarcodeChangeData.FirstOrDefault().BarcodeID; + // result_barcodeinfo = _pcsApi.GetBarcodeInfoes(barcodeIDChange).InvokeAsync().Result.FirstOrDefault(); + //} + //else + //{ + // var _msg = "查無相關資料!"; + // return RedirectToAction("Refresh", "Home", new { msg = _msg }); + //} } var result = new PCS009RViewModel(); @@ -5190,10 +5189,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodeOther = await _pcsApi.GetWipBarcodeOther(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } @@ -5209,10 +5206,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } @@ -5437,10 +5432,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } @@ -5456,10 +5449,8 @@ namespace AMESCoreStudio.Web.Controllers model.WipInfo = q.FirstOrDefault(); model.WipAtt = await _pcsApi.GetWipAtt(model.WipInfo.WipNO); model.WipBarcodes = await _pcsApi.GetWipBarcode(model.WipInfo.WipNO); - model.RuleStation = await _basApi.GetRuleStationsByFlow(model.WipInfo.FlowRuleID); model.WipInfo.WipType = model.WipInfo.WipType == "S" ? "標準工單" : model.WipInfo.WipType == "R" ? "重工工單" : "無序號工單"; - //model.RuleStation = model.RuleStation.OrderBy(o => o.Sequence); } return View(model); } diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs index cec4b9e..528d1aa 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs @@ -541,19 +541,28 @@ namespace AMESCoreStudio.Web /// 頁數 /// 筆數 /// 委外廠商 + /// 製程 /// [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/FqcInhouseMasterQuery")] ITask> GetFqcInhouseMasterQuery(string barcodeNo = null, string wipNo = null , string boxNo = null, string inhouseNo = null, string date_str = null, string date_end = null - , string status = null, int page = 0, int limit = 10, string factoryID = null, string factoryNo = null); - #endregion + , string status = null, int page = 0, int limit = 10, string factoryID = null, string factoryNo = null , string unit = null); - #region FQC009 料號檢驗工項維護 /// - /// MaterialItem 料號基本資料檔 + /// FQC查詢 - 抽驗明細 /// - /// 料號 - [WebApiClient.Attributes.HttpGet("api/MaterialItem/ByItemNO/{id}")] + /// 工單號碼 + /// + [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/FqcInhouseMasterQuery/ExamineDetail/{id}")] + ITask> GetFqcInhouseMasterQueryExamineDetail(string id); + #endregion + + #region FQC009 料號檢驗工項維護 + /// + /// MaterialItem 料號基本資料檔 + /// + /// 料號 + [WebApiClient.Attributes.HttpGet("api/MaterialItem/ByItemNO/{id}")] ITask GetMaterialItemByItemNO(string id); /// diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs index da941e7..7b82a51 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCB.cs @@ -475,9 +475,9 @@ namespace AMESCoreStudio.Web /// 筆數 /// [WebApiClient.Attributes.HttpGet("api/SteelPlateInfo/SteelPlateInfoQuery")] - ITask> GetSteelPlateInfoQuery(string steelPlateNo = null, string storageLocation = null , - string item = null, string date_str = null , string date_end = null - , string side = null, string status = null,string checkOff = null , int page = 0, int limit = 10); + ITask> GetSteelPlateInfoQuery(string steelPlateNo = null, string storageLocation = null, + string item = null, string date_str = null, string date_end = null + , string side = null, string status = null, string checkOff = null, int page = 0, int limit = 10); /// /// 新增鋼板資料 @@ -578,12 +578,21 @@ namespace AMESCoreStudio.Web /// /// 錫膏編號 /// 狀態 + /// 規格 + /// 廠商 /// 頁數 /// 筆數 /// [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/SolderPasteInfoQuery")] - ITask> GetSolderPasteInfoQuery(string solderPasteNo = null, string pcbPartNo = null - , string side = null, string status = null, int page = 0, int limit = 10); + ITask> GetSolderPasteInfoQuery(string solderPasteNo = null, string status = null, string description = null, string vendor = null, int page = 0, int limit = 10); + + /// + /// 錫膏資料 By狀態 查詢 + /// + /// 狀態 + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/SolderPasteInfoByStatus/{id}")] + ITask> GetSolderPasteInfoByStatus(string id); /// /// 新增錫膏資料 @@ -599,6 +608,35 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpPut("api/SolderPasteInfo")] ITask> PutSolderPasteInfo([FromBody, RawJsonContent] string model); + /// + /// 刪除錫膏資料 + /// + /// + [WebApiClient.Attributes.HttpDelete("api/SolderPasteInfo/{id}")] + ITask> DeleteSolderPasteInfo(int id); + + /// + /// 錫膏編號規則查詢 + /// + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteSerial")] + ITask> GetSolderPasteSerial(); + + /// + /// 自動取得錫膏編號 + /// + /// 規格 + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteSerial/AutoSerialNo/{id}")] + ITask GetSolderPasteSerialByAutoSerialNo(string id); + + /// + /// 更新錫膏編號流水碼 + /// + /// + [WebApiClient.Attributes.HttpPut("api/SolderPasteSerial/AutoMatically/{id}")] + ITask> PutSolderPasteSerialAutoMatically(string id); + /// /// 查詢錫膏資料 ID /// @@ -612,6 +650,28 @@ namespace AMESCoreStudio.Web /// [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/ByNo/{id}")] ITask> GetSolderPasteInfoByNo(string id); + + /// + /// 新增 錫膏管控紀錄 + /// + /// + [WebApiClient.Attributes.HttpPost("api/SolderPasteRecord")] + ITask> PostSolderPasteRecord([FromBody, RawJsonContent] string model); + + /// + /// 錫膏Report + /// + /// 錫膏編號 + /// 狀態 + /// 工單號碼 + /// 開始_收貨時間 + /// 結束_收貨時間 + /// 頁數 + /// 筆數 + /// + [WebApiClient.Attributes.HttpGet("api/SolderPasteInfo/Report")] + ITask> GetSolderPasteInfoReport(string solderPasteNo = null, string status = null, string wipNo = null, + string strDate = null, string endDate = null, int page = 0, int limit = 10); #endregion #region PCB015 連板綁定作業 @@ -627,7 +687,7 @@ namespace AMESCoreStudio.Web /// /// [WebApiClient.Attributes.HttpGet("api/WipBarcode/CheckInRange/")] - ITask> GetWipBarcodesCheckInRange(string WipNo,string BarcodeNO); + ITask> GetWipBarcodesCheckInRange(string WipNo, string BarcodeNO); /// /// 綁定Group @@ -646,7 +706,7 @@ namespace AMESCoreStudio.Web ITask> PostDapperByListBarcodeNO([FromBody, RawJsonContent] string model); - + #endregion } diff --git a/AMESCoreStudio.Web/ViewModels/PCB/PCB017ViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCB/PCB017ViewModel.cs new file mode 100644 index 0000000..b2fb576 --- /dev/null +++ b/AMESCoreStudio.Web/ViewModels/PCB/PCB017ViewModel.cs @@ -0,0 +1,36 @@ +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.Web.ViewModels.PCB +{ + /// + /// 錫膏新增 ViewModel + /// + public partial class PCB017ViewModel + { + /// + /// 錫膏編號 + /// + [DataMember] + public string solderPasteNo { get; set; } + + /// + /// 管制狀態 + /// + [DataMember] + public string status { get; set; } + + /// + /// 入冰箱數量 + /// + [DataMember] + public int? qty { get; set; } = 1; + } +} diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs index 7d05e58..3b71f6f 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS004CViewModel.cs @@ -19,8 +19,6 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public IEnumerable WipBarcodes { get; set; } - public IEnumerable RuleStation { get; set; } - public IEnumerable WipBarcodeOthers { get; set; } // 序號綁定 Type SN:內部序號 SSN:出貨序號 diff --git a/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml index b981471..1525aee 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC007.cshtml @@ -552,38 +552,21 @@ }); //通过行tool檢視,lay-event="detail" function detail(obj) { - var data = $("#FQC007Form").serialize(); - $.ajax({ - url: "@Url.Action("FQC007AjaxJson", "FQC")", - type: "POST", - data: data, - success: function (result) { - let InhouseNo = $("#hInhouseNo").val().trim(); - let SeqID = $("#hSeqID").val().trim(); - layui.use('layer', function () { - var layer = layui.layer; - layer.open({ - title: 'FQC細項資料', - type: 2, - area: ['1000px', '500px'], - fixed: false, //不固定 - maxmin: false, - scrollbar: true, - moveOut: true, - content: '/FQC/FQC007V?inhouseNo=' + InhouseNo + '&seqID=' + SeqID + '&boxNo=' + obj, - end: function () { - window.location.reload(); - } - }); - }); - }, - error: function (result) { - alert(`呼叫API失敗`); - } + let InhouseNo = $("#hInhouseNo").val().trim(); + let SeqID = $("#hSeqID").val().trim(); + layui.use('layer', function () { + var layer = layui.layer; + layer.open({ + title: 'FQC細項資料', + type: 2, + area: ['1000px', '500px'], + fixed: false, //不固定 + maxmin: false, + scrollbar: true, + moveOut: true, + content: '/FQC/FQC007V?inhouseNo=' + InhouseNo + '&seqID=' + SeqID + '&boxNo=' + obj, + }); }); - - - //hg.open('FQC細項資料', '/FQC/FQC007V?inhouseNo=' + InhouseNo + '&seqID=' + SeqID + '&boxNo=' + obj, '1000', '500'); } //UserName diff --git a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml index 11c3fe7..27388d4 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml @@ -7,27 +7,27 @@ /*.layui-table-main .layui-table-cell {*/ /*height: auto !important;*/ /*white-space: normal; - } + } - .layui-table img { - max-width: 60px; - max-height: 28px; - } + .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-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; - }*/ + .layui-table-cell { + height: auto; + white-space: normal; + }*/ @@ -45,7 +45,7 @@
- +
+
- +
- +
- +
@@ -88,7 +88,7 @@
- +
@@ -96,7 +96,7 @@
- +
@@ -106,10 +106,21 @@
+
+
+ +
+
+
+
+
+
-
+
-
-
- +
+
+ +
+ + +
+
@@ -171,6 +187,12 @@ var qs = $('button[lay-filter="querysubmit"]'); qs.click(); }); + + form.on('select(unit)', function (data) { + $("#unitNo").val(data.value); + var qs = $('button[lay-filter="querysubmit"]'); + qs.click(); + }); }); //监听表单提交事件 @@ -213,6 +235,11 @@ title: '工程編號', sort: true }, + { + field: 'unitName', + title: '製程單位', + sort: true + }, { field: 'inhouseQty', width: 60, @@ -242,6 +269,7 @@ { title: '操作', align: 'center', + fixed: 'right', width: 200, templet: function (d) { var aa; @@ -250,8 +278,10 @@ } else { aa = '檢視\ - PDF Excel' + PDF\ + Excel' } + aa += '抽驗明細'; return aa; } } @@ -265,7 +295,7 @@ //alert(param); //基本資料表格 //var table = hg.table.datatable('query', 'FQC查詢', '/FQC/FQC008Query2/' + param, {}, tableCols, '', true, 'full-100', ['filter', 'print', 'exports']); - var table = hg.table.datatable('query', 'FQC查詢', '/FQC/FQC008Query2', { factoryID: $("#factoryID").val() }, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + var table = hg.table.datatable('query', 'FQC查詢', '/FQC/FQC008Query2', { factoryID: $("#factoryID").val(), unit: $("#unit").val() }, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); //通过行tool編輯,lay-event="edit" function edit(obj) { @@ -293,6 +323,22 @@ } } + function detail(obj) { + layui.use('layer', function () { + var layer = layui.layer; + layer.open({ + title: '抽驗明細', + type: 2, + area: ['1100px', '500px'], + fixed: false, //不固定 + maxmin: false, + scrollbar: true, + moveOut: true, + content: '/FQC/FQC008A?wipNo=' + obj.data.wipNo + }); + }); + } + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/FQC/FQC009.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC009.cshtml index 5e45ce3..9438a46 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC009.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC009.cshtml @@ -1,6 +1,7 @@ - -@{ ViewData["Title"] = "工程編號檢驗工項維護"; - Layout = "~/Views/Shared/_AMESLayout.cshtml"; } +@{ + ViewData["Title"] = "工程編號檢驗工項維護"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} @@ -45,20 +45,34 @@
- +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
- -
- - -
@@ -123,7 +137,19 @@ }, { field: 'description', - title: '規格描述', + title: '規格', + }, + { + field: 'alloy', + title: '合金', + }, + { + field: 'vendor', + title: '廠商', + }, + { + field: 'lot', + title: 'LOT', }, { field: 'receiptDate', @@ -151,32 +177,59 @@ { title: '操作', align: 'center', - width: 80, + width: 130, templet: function (d) { - return '修改' - } + var event = `修改`; + if (d.statusName == '未使用') { + event += `刪除`; + } + return event; + } } ]]; //通过行tool編輯,lay-event="edit" function edit(obj) { if (obj.data.solderPasteID) { - hg.open('修改錫膏基本資料', '/PCB/PCB014U?id=' + obj.data.solderPasteID, 700, 500); + hg.open('修改錫膏基本資料', '/PCB/PCB014U?id=' + obj.data.solderPasteID, 800, 500); } } + function del(obj) { + hg.confirm("確定要刪除錫膏編號【" + obj.data.solderPasteNo + "】嗎?", function () { + $.ajax({ + url: '/PCB/PCB014D', + data: { id: obj.data.solderPasteID }, + type: 'POST', + success: function (data) { + if (data.success) { + hg.msghide("刪除成功!"); + var qs = $('button[lay-filter="querysubmit"]'); + qs.click(); + } + else { + hg.msg(data.msg); + } + }, + error: function () { + hg.msg("網路請求失敗!"); + } + }); + }); + } + //新增按鈕 var toolbar = [{ text: '新增', layuiicon: '', class: 'layui-btn', handler: function () { - hg.open('新增錫膏基本資料', '/PCB/PCB014C', 700, 500); + hg.open('新增錫膏基本資料', '/PCB/PCB014C', 800, 500); } }]; //基本資料表格 var table = hg.table.datatable('query', '錫膏基本查詢', '/PCB/PCB014Query', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); - // var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/GetWipInfo', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); + // var table = hg.table.datatable('test', '條碼狀態維護', '/PCS/GetWipInfo', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); } \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml index 1fb81e4..84b36a0 100644 --- a/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml +++ b/AMESCoreStudio.Web/Views/PCB/PCB014C.cshtml @@ -19,45 +19,70 @@
- - + +
+ +
+
- -
- - +
+ +
+ + +
+ +
+ + +
- -
- +
+ +
+ + +
+ +
+ + +
- -
- -
+ + +
- +
- + +
- -
- - +
+ +
+ + +
+ +
+ + +
@@ -116,6 +141,31 @@ } }); + function qrCodeinput(e) { + if (e.keyCode == 13) { + var qrCodeValue = $("#qrCodeInput").val(); + var parts = qrCodeValue.split('/'); + if (parts.length != 5) { + parent.hg.msg(`${qrCodeValue}
QR Code格式錯誤,請確認!`); + return; + } + + // 廠商 + $("#Vendor").val(parts[0]); + // 規格 + $("#Description").val(parts[1]); + // Lot + $("#Lot").val(parts[2]); + // 製造日期 + $("#ManufactoringDate").val(parts[3].replace(/\./g, "/")); + // 有效日期 + $("#EffectiveDate").val(parts[4].replace(/\./g, "/")); + $("#qrCodeInput").val(''); + event.preventDefault(); + return false; + } + }; + diff --git a/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml index 9ef47fd..36d32be 100644 --- a/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml +++ b/AMESCoreStudio.Web/Views/PCB/PCB014U.cshtml @@ -1,7 +1,9 @@ @model AMESCoreStudio.WebApi.Models.AMES.SolderPasteInfo -@{ Layout = "~/Views/Shared/_AMESLayout.cshtml"; } +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +}
-
-
-
-
- - -
- -
- - -
+
+ +
+ + + + +
+ +
+ +
+ +
+
+
-
- +
+
+
- - +
-
- -
- +
- - + +
+
-
- +
+
+
- - + + +
+ +
+ +
+
-
+
+ +
+ + +
+
+ +
+
- +
-
- -
- +
- - + +
+
-
- -
- -
+
+ +
+
+
- @Html.ValidationMessage("error") -
-
- -
+ @Html.ValidationMessage("error") +
+
+
- -
+
+
@section Scripts { - @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); - await Html.RenderPartialAsync("_FileinputScriptsPartial"); } + @{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); + } diff --git a/AMESCoreStudio.Web/Views/PCB/PCB016.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB016.cshtml index 3fe3ef6..76bec1f 100644 --- a/AMESCoreStudio.Web/Views/PCB/PCB016.cshtml +++ b/AMESCoreStudio.Web/Views/PCB/PCB016.cshtml @@ -16,7 +16,7 @@
- +
@@ -24,7 +24,7 @@
- +
@@ -32,7 +32,7 @@
- +
@@ -52,7 +52,7 @@
- +
@@ -64,7 +64,7 @@
- +
diff --git a/AMESCoreStudio.Web/Views/PCB/PCB017.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB017.cshtml new file mode 100644 index 0000000..445bca2 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB017.cshtml @@ -0,0 +1,223 @@ +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
錫膏管制作業
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + + + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/PCB/PCB017C.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB017C.cshtml new file mode 100644 index 0000000..df348b9 --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB017C.cshtml @@ -0,0 +1,82 @@ +@model AMESCoreStudio.Web.ViewModels.PCB.PCB017ViewModel +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + +
+
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + @Html.ValidationMessage("error") +
+
+ +
+
+
+
+
+ +@section Scripts { + @{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); + } + + + + +} diff --git a/AMESCoreStudio.Web/Views/PCB/PCB018.cshtml b/AMESCoreStudio.Web/Views/PCB/PCB018.cshtml new file mode 100644 index 0000000..6865a1c --- /dev/null +++ b/AMESCoreStudio.Web/Views/PCB/PCB018.cshtml @@ -0,0 +1,161 @@ +@{ + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + +
+
+
+
+
錫膏報表
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +@section Scripts{ + + + +} \ No newline at end of file diff --git a/AMESCoreStudio.Web/Views/RPT/RPT002.cshtml b/AMESCoreStudio.Web/Views/RPT/RPT002.cshtml index 83f83d7..7d37642 100644 --- a/AMESCoreStudio.Web/Views/RPT/RPT002.cshtml +++ b/AMESCoreStudio.Web/Views/RPT/RPT002.cshtml @@ -229,7 +229,7 @@
/// 錫膏編號 + /// 規格 + /// 廠商 /// 狀態 /// 頁數 /// 筆數 /// [HttpGet("SolderPasteInfoQuery")] - public async Task> GetSolderPasteInfo(string solderPasteNo , string status, int page = 0, int limit = 10) + public async Task> GetSolderPasteInfo(string solderPasteNo, string description, string vendor, string status, int page = 0, int limit = 10) { var q = await _context.SolderPasteInfos.ToListAsync(); @@ -65,46 +74,277 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES q = q.Where(w => w.SolderPasteNo.Contains(solderPasteNo)).ToList(); } - //if (!string.IsNullOrWhiteSpace(pcbPartNo)) - //{ - // q = q.Where(w => w.PcbPartNo.Contains(pcbPartNo)).ToList(); - //} + if (!string.IsNullOrWhiteSpace(description)) + { + q = q.Where(w => w.Description.Contains(description)).ToList(); + } - //if (!string.IsNullOrWhiteSpace(side)) - //{ - // q = q.Where(w => w.Side.ToString() == side).ToList(); - //} + if (!string.IsNullOrWhiteSpace(vendor)) + { + q = q.Where(w => w.Vendor.Contains(vendor)).ToList(); + } if (!string.IsNullOrWhiteSpace(status)) { q = q.Where(w => w.Status == status).ToList(); - } ResultModel result = new ResultModel(); + // 紀錄筆數 + result.DataTotal = q.Count(); + // Table 頁數 if (page > 0) { q = q.Skip((page - 1) * limit).Take(limit).ToList(); } - - // 紀錄筆數 - result.DataTotal = q.Count(); - result.Data = q.Select(s => new SolderPasteInfoDto { SolderPasteID = s.SolderPasteID, SolderPasteNo = s.SolderPasteNo, Description = s.Description, + Alloy = s.Alloy, + Vendor = s.Vendor, + Lot = s.Lot, EffectiveDate = s.EffectiveDate, ManufactoringDate = s.ManufactoringDate, ReceiptDate = s.ReceiptDate, - StatusName = s.Status == "0" ? "失效" : "有效", + StatusName = EnumPCB.GetDisplayName((EnumPCB.EnumSolderPasteStatus)System.Enum.Parse(typeof(EnumPCB.EnumSolderPasteStatus), s.Status)), Remark = s.Remark }).ToList(); return result; } + /// + /// 錫膏資料 By狀態 查詢 + /// + /// 狀態 + /// + [HttpGet("SolderPasteInfoByStatus/{id}")] + public async Task> GetSolderPasteInfoByStatus(string id) + { + if (id != "X") + { + var result = await _context.SolderPasteInfos.Where(w => w.Status == id).OrderBy(o => o.SolderPasteNo).ToListAsync(); + return result; + } + else + { + // 要報廢 不找已經報廢或已經使用完的錫膏 + var result = await _context.SolderPasteInfos.Where(w => w.Status != "X" && w.Status != "C").OrderBy(o => o.SolderPasteNo).ToListAsync(); + return result; + } + } + + + /// + /// 錫膏Report + /// + /// 錫膏編號 + /// 狀態 + /// 工單號碼 + /// 開始_收貨時間 + /// 結束_收貨時間 + /// 頁數 + /// 筆數 + /// + [HttpGet("Report")] + public ResultModel GetSolderPasteInfoReport(string solderPasteNo, string status, string wipNo, + string strDate, string endDate, int page = 0, int limit = 10) + { + ResultModel result = new ResultModel(); + var sql = @"SELECT + I.SOLDER_PASTE_ID AS SolderPasteID , + I.SOLDER_PASTE_NO AS SolderPasteNo , + I.DESCRIPTION AS Description , + I.VENDOR AS Vendor , + I.ALLOY AS Alloy , + I.LOT AS Lot , + I.WIP_NO AS WipNo , + I.STATUS AS StatusName , + I.RECEIPT_DATE AS ReceiptDate, + I.MANUFACTORING_DATE AS ManufactoringDate, + I.EFFECTIVE_DATE AS EffectiveDate, + I.REMARK AS Remark , + U.USER_NAME AS CreateUserName , + I.CREATE_DATE AS CreateTime , + -- 入冰箱 + U1.USER_NAME AS InUserName , + R1.CREATE_DATE AS InTime , + -- 出冰箱 + U2.USER_NAME AS OutUserName , + R2.CREATE_DATE AS OutTime , + -- 開封 + U3.USER_NAME AS UseUserName , + R3.CREATE_DATE AS UseTime , + -- 用完 + U5.USER_NAME AS CompletedUserName , + R5.CREATE_DATE AS CompletedTime , + -- 報廢 + U4.USER_NAME AS ScrapUserName , + R4.CREATE_DATE AS ScrapTime , + -- 攪拌時間 + CASE + WHEN R3.CREATE_DATE IS NOT NULL THEN R3.CREATE_DATE - INTERVAL '2' MINUTE + ELSE NULL + END AS MixingTime + FROM JHAMES.SOLDER_PASTE_INFO I + INNER JOIN JHSYS.USER_INFO U ON I.CREATE_USERID = U.USER_ID + LEFT JOIN JHAMES.SOLDER_PASTE_RECORD R1 ON I.SOLDER_PASTE_ID = R1.SOLDER_PASTE_ID AND R1.STATUS = 'I' -- 入冰箱 + LEFT JOIN JHSYS.USER_INFO U1 ON R1.CREATE_USERID = U1.USER_ID + LEFT JOIN JHAMES.SOLDER_PASTE_RECORD R2 ON I.SOLDER_PASTE_ID = R2.SOLDER_PASTE_ID AND R2.STATUS = 'O' -- 出冰箱 + LEFT JOIN JHSYS.USER_INFO U2 ON R2.CREATE_USERID = U2.USER_ID + LEFT JOIN JHAMES.SOLDER_PASTE_RECORD R3 ON I.SOLDER_PASTE_ID = R3.SOLDER_PASTE_ID AND R3.STATUS = 'U' -- 開封 + LEFT JOIN JHSYS.USER_INFO U3 ON R3.CREATE_USERID = U3.USER_ID + LEFT JOIN JHAMES.SOLDER_PASTE_RECORD R4 ON I.SOLDER_PASTE_ID = R4.SOLDER_PASTE_ID AND R4.STATUS = 'X' -- 報廢 + LEFT JOIN JHSYS.USER_INFO U4 ON R4.CREATE_USERID = U4.USER_ID + LEFT JOIN JHAMES.SOLDER_PASTE_RECORD R5 ON I.SOLDER_PASTE_ID = R5.SOLDER_PASTE_ID AND R5.STATUS = 'C' -- 用完 + LEFT JOIN JHSYS.USER_INFO U5 ON R5.CREATE_USERID = U5.USER_ID + WHERE 1 = 1"; + + DynamicParameters p = new DynamicParameters(); + + if (!string.IsNullOrWhiteSpace(solderPasteNo)) + { + sql += " AND I.SOLDER_PASTE_NO LIKE :solderPasteNo "; + p.Add("solderPasteNo", $"%{solderPasteNo}%", DbType.AnsiString); + } + + if (!string.IsNullOrWhiteSpace(wipNo)) + { + sql += " AND I.WIP_NO LIKE :wipNo "; + p.Add("wipNo", $"%{wipNo}%", DbType.AnsiString); + } + + if (!string.IsNullOrWhiteSpace(status)) + { + sql += " AND I.STATUS = :status "; + p.Add("status", status, DbType.AnsiString); + } + + if (DateTime.TryParse(strDate, out _)) + { + sql += " AND I.RECEIPT_DATE >= TO_DATE(:strDate, 'YYYY-MM-DD HH24:MI:SS')"; + p.Add("strDate", $"{strDate} 00:00:00"); + } + + if (DateTime.TryParse(endDate, out _)) + { + sql += " AND I.RECEIPT_DATE <= TO_DATE(:endDate, 'YYYY-MM-DD HH24:MI:SS') "; + p.Add("endDate", $"{endDate} 23:59:59"); + } + + try + { + var q = _context.Database.DapperQuery(sql, p); + + // 紀錄筆數 + result.DataTotal = q.Count(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit).ToList(); + } + + result.Data = q; + + // 狀態 + result.Data = result.Data.Select(s => + { + s.StatusName = s.StatusName == "N" ? "未使用" : + s.StatusName == "I" ? "入冰箱" : + s.StatusName == "O" ? "出冰箱" : + s.StatusName == "U" ? "開封" : + s.StatusName == "C" ? "使用完" : + s.StatusName == "X" ? "報廢" : s.StatusName + ; return s; + }).ToList(); + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.Message; + } + + + return result; + } + + /// + /// 錫膏排程 報廢 + /// + /// + [HttpGet("Scheduling")] + public async Task> GetSolderPasteInfoScheduling(int userId = 0) + { + ResultModel result = new ResultModel(); + var sql = @"SELECT I.SOLDER_PASTE_ID AS SolderPasteID , + I.SOLDER_PASTE_NO AS SolderPasteNo , + I.STATUS AS Status , + R.CREATE_DATE AS CreateDate + FROM JHAMES.SOLDER_PASTE_INFO I + INNER JOIN JHAMES.SOLDER_PASTE_RECORD R ON I.SOLDER_PASTE_ID = R.SOLDER_PASTE_ID + WHERE (I.STATUS = 'O' AND R.STATUS='O' AND R.CREATE_DATE + 7 < SYSDATE) -- 出冰箱後7天 + OR ((R.STATUS = 'U' AND I.STATUS ='U' AND R.CREATE_DATE + 1 < SYSDATE)) -- 開封後1天"; + + try + { + DynamicParameters p = new DynamicParameters(); + var q = _context.Database.DapperQuery(sql, p); + if (q.Any()) + { + List solderPasteRecords = q.Select(s => new SolderPasteRecord + { + SolderPasteID = s.SolderPasteID, + Status = "X", + CreateUserID = userId + }).ToList(); + + _context.SolderPasteRecords.AddRange(solderPasteRecords); + await _context.SaveChangesAsync(); + + // 更新基本檔的狀態 + List solderPasteInfos = solderPasteRecords.Select(s => new SolderPasteInfo + { + SolderPasteID = s.SolderPasteID, + Status = s.Status, + UpdateUserID = s.CreateUserID + }).ToList(); + var query = @" UPDATE JHAMES.SOLDER_PASTE_INFO SET STATUS = :Status , + UPDATE_USERID = :UpdateUserID , + UPDATE_DATE = sysdate + WHERE SOLDER_PASTE_ID = :SolderPasteID "; + _context.Database.DapperExecute(query, solderPasteInfos); + result.Success = true; + result.Msg = "OK"; + + #region 發送Mail + if (q.Where(w => w.Status == "O").Any()) + { + string MailGroup = "WIP_ALARM"; + string Subject = $"[AMES系統通知] 錫膏需報廢通知"; + string Body = ""; + + foreach (var item in q.Where(w => w.Status == "O")) + { + Body += $@"{item.SolderPasteNo}已出冰箱7天沒開封需報廢 + 越南文
"; + } + + await new BLL.MailController(_context, _config).PostMail(Subject, Body, MailGroup, "", false); + } + #endregion + } + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.Message; + } + + return result; + } + /// /// 更新錫膏基本資料檔 /// @@ -115,6 +355,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); _context.Entry(solderPasteInfo).State = EntityState.Modified; + _context.Entry(solderPasteInfo).Property("CreateDate").IsModified = false; + _context.Entry(solderPasteInfo).Property("CreateUserID").IsModified = false; + _context.Entry(solderPasteInfo).Property("Status").IsModified = false; + _context.Entry(solderPasteInfo).Property("WipNo").IsModified = false; try { @@ -156,20 +400,27 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return result; } - // DELETE: api/SolderPasteInfo/5 [HttpDelete("{id}")] - public async Task> DeleteSolderPasteInfo(int id) + public async Task> DeleteSolderPasteInfo(int id) { + ResultModel result = new ResultModel(); var solderPasteInfo = await _context.SolderPasteInfos.FindAsync(id); - if (solderPasteInfo == null) + if (solderPasteInfo != null) { - return NotFound(); + try + { + _context.SolderPasteInfos.Remove(solderPasteInfo); + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } } - - _context.SolderPasteInfos.Remove(solderPasteInfo); - await _context.SaveChangesAsync(); - - return solderPasteInfo; + return result; } private bool SolderPasteInfoExists(int id) diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs index 481330f..7dae901 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteRecordController.cs @@ -8,6 +8,9 @@ using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; using AMESCoreStudio.CommonTools.Result; +using Dapper; +using System.Data; +using AMESCoreStudio.WebApi.Extensions; namespace AMESCoreStudio.WebApi.Controllers.AMES { @@ -56,8 +59,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); _context.Entry(solderPasteRecord).State = EntityState.Modified; - solderPasteRecord.UpdateDate = DateTime.Now; - solderPasteRecord.UpdateUserID = 0; try { @@ -76,18 +77,29 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES /// /// 新增錫膏使用紀錄資料檔 /// - /// + /// models /// [HttpPost] - public async Task> PostSolderPasteRecord(SolderPasteRecord solderPasteRecord) + public async Task> PostSolderPasteRecord(List solderPasteRecords) { ResultModel result = new ResultModel(); - Helper helper = new Helper(_context); - solderPasteRecord.SpRecordID = helper.GetIDKey("SP_RECORD_ID").Result; - _context.SolderPasteRecords.Add(solderPasteRecord); try { + _context.SolderPasteRecords.AddRange(solderPasteRecords); await _context.SaveChangesAsync(); + + // 更新基本檔的狀態 + List solderPasteInfos = solderPasteRecords.Select(s => new SolderPasteInfo + { + SolderPasteID = s.SolderPasteID, + Status = s.Status, + UpdateUserID =s.CreateUserID + }).ToList(); + var query = @" UPDATE JHAMES.SOLDER_PASTE_INFO SET STATUS = :Status , + UPDATE_USERID = :UpdateUserID , + UPDATE_DATE = sysdate + WHERE SOLDER_PASTE_ID = :SolderPasteID "; + _context.Database.DapperExecute(query, solderPasteInfos); result.Success = true; result.Msg = "OK"; } @@ -114,10 +126,5 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return solderPasteRecord; } - - private bool SolderPasteRecordExists(int id) - { - return _context.SolderPasteRecords.Any(e => e.SpRecordID == id); - } } } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteSerialController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteSerialController.cs new file mode 100644 index 0000000..87e177c --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SolderPasteSerialController.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using AMESCoreStudio.WebApi; +using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.DTO.AMES; +using AMESCoreStudio.CommonTools.Result; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// + /// 錫膏規格流水碼表 + /// + [Route("api/[controller]")] + [ApiController] + public class SolderPasteSerialController : ControllerBase + { + private readonly AMESContext _context; + + public SolderPasteSerialController(AMESContext context) + { + _context = context; + } + + [HttpGet] + public async Task>> GetSolderPasteSerials() + { + return await _context.SolderPasteSerials.ToListAsync(); + } + + + [HttpGet("{id}")] + public async Task> GetSolderPasteSerial(string id) + { + var solderPasteSerial = await _context.SolderPasteSerials.FindAsync(id); + return solderPasteSerial; + } + + /// + /// 自動取得編號 + /// + /// 規格 + /// + [HttpGet("AutoSerialNo/{id}")] + public async Task> GetSolderPasteSerialByAutoSerialNo(string id) + { + var item = await _context.SolderPasteSerials + .Where(w => w.Description.ToUpper() == id.Trim().ToUpper()).FirstOrDefaultAsync(); + + if (item == null) + return ""; + else + { + var SerialNo = string.Empty; + var Infos = _context.SolderPasteInfos.Where(w => w.SolderPasteNo.StartsWith(item.SerialNo)).Select(s => s.SolderPasteNo).Max(); + if (!string.IsNullOrWhiteSpace(Infos)) + { + SerialNo = $"{item.SerialNo}{(int.Parse(Infos.Substring(2, 5)) + 1).ToString().PadLeft(5, '0')}"; + } + else + { + // 根據規格對應的代碼(2碼)+流水碼(5碼) + SerialNo = $"{item.SerialNo}{(item.SerialNumber + 1).ToString().PadLeft(5, '0')}"; + } + return SerialNo; + } + } + + /// + /// 更新錫膏規格流水碼表 + /// + /// + /// + [HttpPut] + public async Task> PutSolderPasteSerial(SolderPasteSerial solderPasteSerial) + { + ResultModel result = new ResultModel(); + _context.Entry(solderPasteSerial).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// + /// 更新錫膏規格流水碼表 + /// + /// 規格 + /// + [HttpPut("AutoMatically/{id}")] + public async Task> PutSolderPasteSerialAutoMatically(string id) + { + ResultModel result = new ResultModel(); + // 流水碼加1 + string updateSql = @" UPDATE JHAMES.SOLDER_PASTE_SERIAL SET SERIAL_NUMBER = SERIAL_NUMBER + 1 , + WHERE DESCRIPTION = :Description"; + + try + { + // 執行原生 SQL + _context.Database.ExecuteSqlRaw(updateSql); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + /// + /// 新增錫膏規格流水碼表 + /// + /// + /// + [HttpPost] + public async Task> PostSolderPasteSerial(SolderPasteSerial solderPasteSerial) + { + ResultModel result = new ResultModel(); + _context.SolderPasteSerials.Add(solderPasteSerial); + 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/SolderPasteSerial/5 + [HttpDelete("{id}")] + public async Task> DeleteSolderPasteSerial(string id) + { + var solderPasteSerial = await _context.SolderPasteSerials.FindAsync(id); + if (solderPasteSerial == null) + { + return NotFound(); + } + + _context.SolderPasteSerials.Remove(solderPasteSerial); + await _context.SaveChangesAsync(); + + return solderPasteSerial; + } + + private bool SolderPasteSerialExists(string id) + { + return _context.SolderPasteSerials.Any(e => e.SerialNo == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs index 49e1f32..31eb94f 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/SteelPlateInfoController.cs @@ -284,7 +284,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { ResultModel result = new ResultModel(); _context.Entry(steelPlateInfo).State = EntityState.Modified; - + _context.Entry(steelPlateInfo).Property("CreateDate").IsModified = false; + _context.Entry(steelPlateInfo).Property("CreateUserID").IsModified = false; try { await _context.SaveChangesAsync(); diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs index d7b2c7a..433edb9 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs @@ -889,12 +889,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } } #endregion - #region 鋼板 + #region 鋼板或錫膏 else { // 查詢有效鋼板編號 - var steelPlate = _context.SteelPlateInfos.Where(w => w.SteelPlateNo.ToUpper() == item.inputData.ToUpper() - && w.Status == "1").FirstOrDefault(); + var steelPlate = _context.SteelPlateInfos.Where(w => w.SteelPlateNo.ToUpper() == item.inputData.ToUpper() && w.Status == "1").FirstOrDefault(); if (steelPlate != null) { // 查詢鋼板紀錄沒有下線紀錄 @@ -907,7 +906,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES if (!(Measure.WipNo ?? "").Contains(data.wipNo)) { // 更新工單號碼到鋼板量測紀錄 - Measure.WipNo += data.wipNo + ","; + if (string.IsNullOrWhiteSpace(Measure.WipNo)) + Measure.WipNo += data.wipNo; + else + Measure.WipNo += "," + data.wipNo; try { _context.Entry(Measure).State = EntityState.Modified; @@ -936,6 +938,69 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } } } + // 錫膏 + else + { + // 查詢錫膏且出冰箱 + var solderPaste = _context.SolderPasteInfos.Where(w => w.SolderPasteNo.ToUpper() == item.inputData.ToUpper() + && (w.Status == "O" || w.Status == "U")).FirstOrDefault(); + if (solderPaste != null) + { + // 出冰箱 + if (solderPaste.Status == "O") + { + // 更新 錫膏狀態 + string updateSql = $@" UPDATE JHAMES.SOLDER_PASTE_INFO SET STATUS ='U', + WIP_NO = '{data.wipNo}' , + UPDATE_DATE = SYSDATE , + UPDATE_USERID ='{data.userID}' + WHERE SOLDER_PASTE_ID ={solderPaste.SolderPasteID}"; + // 新增 錫膏紀錄 + SolderPasteRecord solderPasteRecord = new SolderPasteRecord + { + SolderPasteID = solderPaste.SolderPasteID, + Status = "U", + CreateUserID = data.userID, + CreateDate = DateTime.Now + }; + + try + { + // 執行原生 SQL + _context.Database.ExecuteSqlRaw(updateSql); + _context.SolderPasteRecords.Add(solderPasteRecord); + _context.SaveChanges(); + } + catch (Exception ex) + { + return ex.InnerException.Message; + } + } + // 已開封 + else if (solderPaste.Status == "U") + { + // 確認第一次紀錄該筆工單號碼 + if (!(solderPaste.WipNo ?? "").Contains(data.wipNo)) + { + // 更新 錫膏工單 + string updateSql = $@" UPDATE JHAMES.SOLDER_PASTE_INFO SET WIP_NO = WIP_NO || ',' || '{data.wipNo}', + UPDATE_DATE = SYSDATE , + UPDATE_USERID ='{data.userID}' + WHERE SOLDER_PASTE_ID ={solderPaste.SolderPasteID}"; + try + { + // 執行原生 SQL + _context.Database.ExecuteSqlRaw(updateSql); + _context.SaveChanges(); + } + catch (Exception ex) + { + return ex.InnerException.Message; + } + } + } + } + } } #endregion //// 確認治具編號使用次數已經超過預計次數 @@ -2030,11 +2095,16 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES var q1 = _context.SteelPlateInfos.Where(w => w.SteelPlateNo.ToUpper() == outfitNo.inputData.ToUpper().Trim() && w.Status == "1").FirstOrDefault(); + // 錫膏取出冰箱 + var q2 = _context.SolderPasteInfos.Where(w => w.SolderPasteNo.ToUpper() == outfitNo.inputData.ToUpper().Trim() + && (w.Status == "O" || w.Status == "U")).FirstOrDefault(); + + // 鋼板 if (q1 != null) { // 查詢鋼板紀錄沒有上線紀錄 var Measure = _context.SteelPlateMeasures.Where(w => w.SteelPlateID == q1.SteelPlateID - && w.OffUserID == null ) + && w.OffUserID == null) .FirstOrDefault(); if (Measure == null) { @@ -2043,13 +2113,34 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES } } - if (q == null && q1 == null) + // 錫膏 + if (q2 != null) + { + // 查詢錫膏紀錄出冰箱紀錄 + var Record = _context.SolderPasteRecords.Where(w => w.SolderPasteID == q2.SolderPasteID + && w.Status == "O") + .FirstOrDefault(); + if (Record == null) + { + resultModel.Msg = $"錫膏編號【{outfitNo.inputData}】 沒有出冰箱紀錄"; + return resultModel; + } + // 錫膏編號必須為出冰箱2hrs後才可投入生產 + else if (Record.CreateDate > DateTime.Now.AddHours(-2)) + { + resultModel.Msg = $"錫膏編號【{outfitNo.inputData}】出冰箱尚未超過2Hrs"; + return resultModel; + + } + } + + if (q == null && q1 == null && q2 == null) outfitNoMsg += $"{outfitNo.inputData}、"; } if (!string.IsNullOrWhiteSpace(outfitNoMsg)) { - resultModel.Msg = $"中央治具找不到該治具編號或鋼板編號【{outfitNoMsg.Substring(0, outfitNoMsg.Length - 1)}】"; + resultModel.Msg = $"中央治具找不到該治具編號、鋼板編號、錫膏編號【{outfitNoMsg.Substring(0, outfitNoMsg.Length - 1)}】"; return resultModel; } diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs index bd33db0..6eb5a08 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/RPTController.cs @@ -18,6 +18,7 @@ using Newtonsoft.Json.Linq; using AMESCoreStudio.WebApi.Controllers.SYS; using System.Data.Common; using System.Collections.Generic; +using System.Reflection; namespace AMESCoreStudio.WebApi.Controllers.BLL { @@ -131,10 +132,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL result.abnormalTime = double.Parse(errTime.ToString("0.00")); //直通率:GetWipStation4QRS014GroupALL - //2023-08-31 BB.Wang Modify 昶亨Werks_No = YS08 - //2023-07-11 BB.Wang Modify 安勤 Jason反映只要查安勤產線即可 Werks_No = YS00 + //2023-07-11 BB.Wang Modify 安勤 Jason反映只要查安勤產線即可 //var d = await new WipStationController(_context).GetWipStation4QRS014GroupALL(null, sDate, eDate, null, null, null); - var d = await new WipStationController(_context).GetWipStation4QRS014GroupALL(null, sDate, eDate, null, "YS08", null); + var d = await new WipStationController(_context).GetWipStation4QRS014GroupALL(null, sDate, eDate, null, "YS00", null); if (d.DataTotal > 0) { double sum_rate = 100.0; @@ -267,10 +267,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL //FQC - //2023-08-31 BB.Wang Modify 昶亨Factory_ID = 12 - //2023-07-11 BB.Wang Modify 安勤 Jason反映只要查安勤產線即可 Factory_ID = 1001 + //2023-07-11 BB.Wang Modify 安勤 Jason反映只要查安勤產線即可 //var f = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016(null, null, null, sDate, eDate, null); - var f = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016(null, null, null, sDate, eDate, "12"); + var f = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016(null, null, null, sDate, eDate, "1001"); if (f.DataTotal > 0) { int sumFqcCnt = 0, sumFqcPassCnt = 0, sumFqcFailCnt = 0; @@ -922,9 +921,8 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL // FQC批退率 Board #region 批退率 Board - //2023-08-31 BB.Wang Modify 昶亨Factory_ID = 12 (原1001) //result.FQCRRBoard = 5.08; - var f_FQCRRBoard = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "12"); + var f_FQCRRBoard = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); if (f_FQCRRBoard.DataTotal > 0) { foreach (var item in f_FQCRRBoard.Data.Where(W => W.type == "單板")) @@ -935,10 +933,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL #endregion // FQC批退率 System - //2023-08-31 BB.Wang Modify 昶亨Factory_ID = 12 (原1001) #region 批退率 System //result.FQCRRSystem = 12.12; - var f_FQCRRSystem = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "12"); + var f_FQCRRSystem = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); if (f_FQCRRSystem.DataTotal > 0) { foreach (var item in f_FQCRRSystem.Data.Where(W => W.type == "系統組裝")) @@ -949,10 +946,9 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL #endregion // FQC批退率 Medical - //2023-08-31 BB.Wang Modify 昶亨Factory_ID = 12 (原1001) #region 批退率 Medical //result.FQCRRMedical = 11.11; - var f_FQCRRMedical = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "12"); + var f_FQCRRMedical = await new FqcResultMasterController(_context).GetFQCHeaderData4QRS016ByDetail(null, null, null, sDate, eDate, "1001"); if (f_FQCRRSystem.DataTotal > 0) { foreach (var item in f_FQCRRMedical.Data.Where(W => W.type == "醫療")) @@ -978,9 +974,8 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL // FPY 立德 Board #region 立德 Board - //2023-08-31 BB.Wang Modify 昶亨Werks_No = YS08 (原YS00) //result.FPYBoard_LEI = 99.15; - var f_FPYBoard_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupB(null, sDate, eDate, null, "YS08", null); + var f_FPYBoard_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupB(null, sDate, eDate, null, "YS00", null); if (f_FPYBoard_LEI.DataTotal > 0) { double sum_rate = 100.0; @@ -1084,9 +1079,8 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL // FPY 立德 System #region 立德 System - //2023-08-31 BB.Wang Modify 昶亨Werks_No = YS08 (原YS00) //result.FPYSystem_LEI = 92.12; - var f_FPYSystem_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, eDate, null, "YS08", null); + var f_FPYSystem_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, eDate, null, "YS00", null); if (f_FPYSystem_LEI.DataTotal > 0) { double sum_rate = 100.0; @@ -1190,9 +1184,8 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL // FPY 立德 Medical #region 立德 Medical - //2023-08-31 BB.Wang Modify 昶亨Werks_No = YS08 (原YS00) //result.FPYMedical_LEI = 90.11; - var f_FPYMedical_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, eDate, null, "YS08", null); + var f_FPYMedical_LEI = await new WipStationController(_context).GetWipStation4QRS014GroupS(null, sDate, eDate, null, "YS00", null); if (f_FPYMedical_LEI.DataTotal > 0) { double sum_rate = 100.0; @@ -1639,6 +1632,28 @@ namespace AMESCoreStudio.WebApi.Controllers.BLL //result.CFQRTotal = 250; result.CFQRTotal = int.Parse(sData_Ary[2].ToString()); + result.IQLRR_EE = Math.Round(result.IQLRR_EE, 2); + result.IQLRR_ME = Math.Round(result.IQLRR_ME, 2); + result.LQC = Math.Round(result.LQC, 2); + result.FQCRRBoard = Math.Round(result.FQCRRBoard, 2); + result.FQCRRMedical = Math.Round(result.FQCRRMedical, 2); + result.FQCRRSystem = Math.Round(result.FQCRRSystem, 2); + result.DOABoard = Math.Round(result.DOABoard, 2); + result.DOAMedical = Math.Round(result.DOAMedical, 2); + result.DOASystem = Math.Round(result.DOASystem, 2); + + result.FPYBoard_LEI = Math.Round(result.FPYBoard_LEI, 2); + result.FPYMedical_LEI = Math.Round(result.FPYMedical_LEI, 2); + result.FPYSystem_LEI = Math.Round(result.FPYSystem_LEI, 2); + + result.FPYBoard = Math.Round(result.FPYBoard, 2); + result.FPYMedical = Math.Round(result.FPYMedical, 2); + result.FPYSystem = Math.Round(result.FPYSystem, 2); + + result.RMABoard = Math.Round(result.RMABoard, 2); + result.RMAMedical = Math.Round(result.RMAMedical, 2); + result.RMASystem = Math.Round(result.RMASystem, 2); + return result; } } diff --git a/AMESCoreStudio.WebApi/DTO/AMES/FQC008DetailDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/FQC008DetailDto.cs new file mode 100644 index 0000000..7314116 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/FQC008DetailDto.cs @@ -0,0 +1,73 @@ +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.DTO.AMES +{ + /// + /// FQC查詢 抽驗明細Dto + /// + public partial class FQC008DetailDto + { + /// + /// 入庫單號碼 + /// + [DataMember] + public string InhouseNo { get; set; } + + /// + /// 順序ID + /// + [Key] + [DataMember] + public int SeqID { get; set; } = 1; + + /// + /// 工單號碼 + /// + [DataMember] + public string WipNo { get; set; } + + /// + /// 內部序號 + /// + [DataMember] + public string BarcodeNo { get; set; } + + /// + /// 箱號/條碼 + /// + [DataMember] + public string BoxNo { get; set; } + + /// + /// 出貨序號 + /// + [DataMember] + public string ExtraBarcodeNo { get; set; } + + /// + /// 抽驗狀態 P-PASS;F-NG; + /// + [DataMember] + public string StatusNo { get; set; } + + /// + /// 生產製程 + /// + [DataMember] + public string UnitName { get; set; } + + /// + /// 抽驗時間 + /// + [DataMember] + public string CreateDate { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs index 07a2898..be1afa4 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs @@ -111,6 +111,12 @@ namespace AMESCoreStudio.WebApi.DTO.AMES [Display(Name = "結束抽驗時間")] public DateTime? EndTime { get; set; } + /// + /// 生產製程 + /// + [DataMember] + public string UnitName { get; set; } + /// /// 建立UserID /// diff --git a/AMESCoreStudio.WebApi/DTO/AMES/PCB013RViewDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/PCB016ViewDto.cs similarity index 100% rename from AMESCoreStudio.WebApi/DTO/AMES/PCB013RViewDto.cs rename to AMESCoreStudio.WebApi/DTO/AMES/PCB016ViewDto.cs diff --git a/AMESCoreStudio.WebApi/DTO/AMES/PCB017ViewDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/PCB017ViewDto.cs new file mode 100644 index 0000000..8ca437e --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/PCB017ViewDto.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 錫膏Report Dto + /// + public partial class PCB017ViewDto + { + /// + /// 錫膏ID + /// + public int SolderPasteID { get; set; } + + /// + /// 錫膏編號 + /// + public string SolderPasteNo { get; set; } + + /// + /// 規格 + /// + public string Description { get; set; } + + /// + /// 合金 + /// + public string Alloy { get; set; } + + /// + /// 廠商 + /// + public string Vendor { get; set; } + + /// + /// LOT + /// + public string Lot { get; set; } + + /// + /// 工單號碼 + /// + public string WipNo { get; set; } + + /// + /// 狀態 0=失效 ; 1=有效 + /// + public string StatusName { get; set; } + + /// + /// 收貨日期 + /// + public DateTime ReceiptDate { get; set; } + + /// + /// 製造日期 + /// + public DateTime ManufactoringDate { get; set; } + + /// + /// 有效日期 + /// + public DateTime EffectiveDate { get; set; } + + /// + /// 備註 + /// + public string Remark { get; set; } + + /// + /// 建立人員 + /// + public string CreateUserName { get; set; } + + /// + /// 建立時間 + /// + public DateTime CreateTime { get; set; } + + /// + /// 入冰箱人員 + /// + public string InUserName { get; set; } + + /// + /// 入冰箱時間 + /// + public DateTime? InTime { get; set; } + + /// + /// 出冰箱人員 + /// + public string OutUserName { get; set; } + + /// + /// 出冰箱時間 + /// + public DateTime? OutTime { get; set; } + + /// + /// 使用人員 + /// + public string UseUserName { get; set; } + + /// + /// 使用時間 + /// + public DateTime? UseTime { get; set; } + + /// + /// 用完人員 + /// + public string CompletedUserName { get; set; } + + /// + /// 用完時間 + /// + public DateTime? CompletedTime { get; set; } + + /// + /// 報廢人員 + /// + public string ScrapUserName { get; set; } + + /// + /// 報廢時間 + /// + public DateTime? ScrapTime { get; set; } + + /// + /// 錫膏攪拌時間 + /// + public DateTime? MixingTime { get; set; } + + + } +} diff --git a/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs index cb6e65d..889840d 100644 --- a/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs +++ b/AMESCoreStudio.WebApi/DTO/AMES/SolderPasteInfoDto.cs @@ -21,10 +21,25 @@ namespace AMESCoreStudio.WebApi.DTO.AMES public string SolderPasteNo { get; set; } /// - /// 規格描述 + /// 規格 /// public string Description { get; set; } + /// + /// 合金 + /// + public string Alloy { get; set; } + + /// + /// 廠商 + /// + public string Vendor { get; set; } + + /// + /// LOT + /// + public string Lot { get; set; } + /// /// 收貨日期 /// diff --git a/AMESCoreStudio.WebApi/Enums/EnumPCB.cs b/AMESCoreStudio.WebApi/Enums/EnumPCB.cs index a0eda1e..85f346c 100644 --- a/AMESCoreStudio.WebApi/Enums/EnumPCB.cs +++ b/AMESCoreStudio.WebApi/Enums/EnumPCB.cs @@ -32,6 +32,48 @@ namespace AMESCoreStudio.WebApi.Enum } + /// + /// 錫膏狀態 + /// + public enum EnumSolderPasteStatus + { + /// + /// 未使用 + /// + [Display(Name = "未使用")] + N, + + /// + /// 入冰箱 + /// + [Display(Name = "入冰箱")] + I, + + /// + /// 出冰箱 + /// + [Display(Name = "出冰箱")] + O, + + /// + /// 開封 + /// + [Display(Name = "開封")] + U, + + /// + /// 使用完 + /// + [Display(Name = "使用完")] + C, + + /// + /// 報廢 + /// + [Display(Name = "報廢")] + X, + } + /// /// Get Enum Display /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs index 5135d0f..73519c3 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteInfo.cs @@ -27,7 +27,6 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 錫膏編號 /// - [Required] [Column("SOLDER_PASTE_NO")] [StringLength(40)] [DataMember] @@ -37,13 +36,40 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 規格描述 /// - [Required] + [Required(ErrorMessage = "{0},不能空白")] [Column("DESCRIPTION")] [StringLength(60)] [DataMember] - [Display(Name = "規格描述")] + [Display(Name = "規格")] public string Description { get; set; } + /// + /// 合金 + /// + [Required(ErrorMessage = "{0},不能空白")] + [Column("ALLOY")] + [DataMember] + [Display(Name = "合金")] + public string Alloy { get; set; } = "Sn96.5/Ag3.0/Cu05"; + + /// + /// 廠商 + /// + [Required(ErrorMessage = "{0},不能空白")] + [Column("VENDOR")] + [DataMember] + [Display(Name = "廠商")] + public string Vendor { get; set; } + + /// + /// LOT + /// + [Required(ErrorMessage = "{0},不能空白")] + [Column("LOT")] + [DataMember] + [Display(Name = "LOT")] + public string Lot { get; set; } + /// /// 收貨日期 /// @@ -76,14 +102,14 @@ namespace AMESCoreStudio.WebApi.Models.AMES public DateTime EffectiveDate { get; set; } /// - /// 狀態 0=失效 ; 1=有效 + /// 狀態( N=未使用 ; I=入冰箱 ; O=出冰箱 ; U=開封 ; C=使用完 ; X=報廢) /// [Required] [Column("STATUS")] [StringLength(2)] [DataMember] [Display(Name = "狀態")] - public string Status { get; set; } = "1"; + public string Status { get; set; } = "N"; /// /// 備註 @@ -94,6 +120,14 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Display(Name = "備註")] public string Remark { get; set; } + /// + /// 工單號碼 + /// + [Column("WIP_NO")] + [DataMember] + [Display(Name = "工單號碼")] + public string WipNo { get; set; } + /// /// 建立UserID /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs index 06d3ac3..d305c3b 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteRecord.cs @@ -15,16 +15,10 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Table("SOLDER_PASTE_RECORD", Schema = "JHAMES")] public partial class SolderPasteRecord { - /// - /// 產品類別ID - /// - [Key] - [Column("SP_RECORD_ID")] - public int SpRecordID { get; set; } - /// /// 錫膏ID /// + [Key] [DataMember] [Display(Name = "錫膏ID")] [Column("SOLDER_PASTE_ID")] @@ -33,21 +27,13 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// /// 狀態 /// + [Key] [DataMember] [Display(Name = "狀態")] - [Required] [Column("STATUS")] - [StringLength(8)] + [StringLength(2)] public string Status { get; set; } - /// - /// 錫膏作業時間 - /// - [DataMember] - [Display(Name = "錫膏作業時間")] - [Column("WORKING_TIME")] - public double WorkingTime { get; set; } - /// /// 建立UserID /// @@ -63,19 +49,5 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("CREATE_DATE")] [DataMember] public DateTime CreateDate { get; set; } = DateTime.Now; - - /// - /// 更新UserID - /// - [Column("UPDATE_USERID")] - [DataMember] - public int UpdateUserID { get; set; } = 0; - - /// - /// 更新日期 - /// - [Column("UPDATE_DATE")] - [DataMember] - public DateTime? UpdateDate { get; set; } = DateTime.Now; } } diff --git a/AMESCoreStudio.WebApi/Models/AMES/SolderPasteSerial.cs b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteSerial.cs new file mode 100644 index 0000000..bf5927e --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/SolderPasteSerial.cs @@ -0,0 +1,58 @@ +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 +{ + /// + /// 錫膏規格流水碼表 + /// + [Table("SOLDER_PASTE_SERIAL", Schema = "JHAMES")] + public partial class SolderPasteSerial + { + /// + /// 代號 + /// + [Key] + [Column("SERIAL_NO")] + [DataMember] + public string SerialNo { get; set; } + + /// + /// 目前流水碼 + /// + [Column("SERIAL_NUMBER")] + [DataMember] + public int SerialNumber { get; set; } + + /// + /// 規格 + /// + [Required] + [Column("DESCRIPTION")] + [DataMember] + public string Description { get; set; } + + /// + /// 合金 + /// + [Required] + [Column("ALLOY")] + [DataMember] + public string Alloy { get; set; } + + /// + /// 廠商 + /// + [Required] + [Column("VENDOR")] + [DataMember] + public string Vendor { get; set; } + + } +}