diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs index c62d321a..9f81a531 100644 --- a/AMESCoreStudio.Web/Controllers/QRSController.cs +++ b/AMESCoreStudio.Web/Controllers/QRSController.cs @@ -709,7 +709,12 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.UnitList = UnitItems; } - private async Task GetLineInfoList() + /// + /// 線別 預設帶全部 + /// + /// 廠商代號 + /// + private async Task GetLineInfoList(string factoryNo = null) { var result = await _basApi.GetLineInfoes(); @@ -719,6 +724,10 @@ namespace AMESCoreStudio.Web.Controllers { LineItems.Add(new SelectListItem(result[i].LineDesc, result[i].LineID.ToString())); } + + if (!string.IsNullOrWhiteSpace(factoryNo)) + LineItems = LineItems.Where(w => w.Text == factoryNo).ToList(); + ViewBag.LineList = LineItems; } @@ -955,7 +964,7 @@ namespace AMESCoreStudio.Web.Controllers [ResponseCache(Duration = 0)] [HttpGet] - public async Task QRS013AAsync(string wipNO, string factoryNo,int page = 0, int limit = 10) + public async Task QRS013AAsync(string wipNO, string factoryNo, int page = 0, int limit = 10) { ViewData["Title"] = "查詢條件 - 工單號碼 : " + wipNO; @@ -1388,17 +1397,19 @@ namespace AMESCoreStudio.Web.Controllers #region PCS021 條碼輸入作業 [ResponseCache(Duration = 0)] [HttpGet] - public async Task PCS021() + public async Task QRS021() { - var model = new PCS021ViewModel(); + var model = new QRS021ViewModel(); await GetUnitList(); + await GetLineInfoList(GetFactoryNo().Result); return View(model); } [HttpPost] - public async Task PCS021_GetWip(PCS021ViewModel model) + public async Task QRS021_GetWip(QRS021ViewModel model) { await GetUnitList(); + await GetLineInfoList(GetFactoryNo().Result); model.KpItemName += "null"; if (string.IsNullOrWhiteSpace(model.WipNO)) { @@ -1416,7 +1427,7 @@ namespace AMESCoreStudio.Web.Controllers } var q = await _pcsApi.GetWipInfoByWipNO(model.WipNO); - q = q.Where(w => w.UnitNO == model.UnitNO).ToList(); + q = q.Where(w => w.UnitNO == model.UnitNO && w.WerksNO == GetFactoryNo().Result).ToList(); // 取作業站的生產製程 var stationUnit = string.Empty; @@ -1449,7 +1460,7 @@ namespace AMESCoreStudio.Web.Controllers if (!BarCodeWip.Success) { ModelState.AddModelError("error", BarCodeWip.Msg); - return View("PCS021", model); + return View("QRS021", model); } // 工單流程ID 取站別 @@ -1538,7 +1549,7 @@ namespace AMESCoreStudio.Web.Controllers var Esop = await _pcsApi.GetDocEsopViewByNo(wipSOPTypeA.SOPName); if (Esop.Count != 0) { - model.Sops.Add(new PCS021ViewModel_SOP + model.Sops.Add(new QRS021ViewModel_SOP { SopName = "SOP文件", SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}" @@ -1553,7 +1564,7 @@ namespace AMESCoreStudio.Web.Controllers var Esop = await _pcsApi.GetEsopBySopName(wipSOPTypeD.SOPName); if (Esop.Count != 0) { - model.Sops.Add(new PCS021ViewModel_SOP + model.Sops.Add(new QRS021ViewModel_SOP { SopName = "暫行文件", SopPath = $@"/e-sop/{Esop.FirstOrDefault().Process}/{Esop.FirstOrDefault().SopName}.pdf" @@ -1561,18 +1572,18 @@ namespace AMESCoreStudio.Web.Controllers } } // 不二過 - model.Sops.Add(new PCS021ViewModel_SOP + model.Sops.Add(new QRS021ViewModel_SOP { SopName = "不二過", SopPath = "/PDF/3.png" }); } - return View("PCS021", model); + return View("QRS021", model); } [HttpPost] - public async Task PCS021_Input(PCS021ViewModel model) + public async Task QRS021_Input(QRS021ViewModel model) { // ResultModel string Msg = string.Empty; @@ -1783,69 +1794,6 @@ namespace AMESCoreStudio.Web.Controllers var NextStopCloseStation = await _pcsApi.CheckNextStopCloseStation(model.WipNO, model.UnitNO, model.Station); #endregion - #region 過站判斷正常 往下處理Table 移到API執行 - // #region 當生產單位為SMT或DIP時,確認是否有綁Group,有綁連片一起過站 - // List GroupBarCodeID = new List(); - // if (model.UnitNO == "S" || model.UnitNO == "D") - // { - // var GroupID = await _pcsApi.GetBarcodeGroupByBarCodeID(model.BarCodeID); - // if (GroupID.Count != 0) - // { - // var BarCodeGroup = await _pcsApi.GetBarcodeGroupByGroupID(GroupID.FirstOrDefault().GroupID); - // GroupBarCodeID = BarCodeGroup.Where(w => w.BarcodeID != model.BarCodeID).Select(s => s.BarcodeID).ToList(); - // } - - // foreach (int id in GroupBarCodeID) - // { - // // 更新 BarCode_Info - // var barcodeGroupID = await _pcsApi.GetBarcodeInfoes(id); - // if (barcodeGroupID.Count() != 0) - // { - // barcodeGroupID[0].StatusNo = BarStatusNo; - // barcodeGroupID[0].RuleStationID = model.RuleStation; - // barcodeGroupID[0].RuleStatus = !model.BarcodeNG ? "P" : "F"; //F 不良 - // barcodeGroupID[0].WipID = model.WipID; - // barcodeGroupID[0].StatusID = NextStopCloseStation.Success ? -1 : 1; - // barcodeGroupID[0].UpdateDate = DateTime.Now; - // await _pcsApi.PutBarcodeInfoes(JsonConvert.SerializeObject(barcodeGroupID[0])); - // } - // // 新增 BarCodeStation - // barcodeStation.BarcodeID = id; - // await _pcsApi.PostBarcodeStation(JsonConvert.SerializeObject(barcodeStation)); - // // 新增 BarCodeItem - // for (int i = 0; i < model.Inputs.Where(w => !w.StartsWith("$")).Count(); i++) - // { - // var barcodeItem = new BarcodeItem - // { - // BarcodeID = id, - // WipID = model.WipID, - // RuleStationID = model.RuleStation, - // ItemNo = model.MaterialKps[i].KpNo, - // PartNo = Kp[i], - // SysType = "S", - // CreateUserID = 0, - // CreateDate = DateTime.Now, - // UpdateDate = DateTime.Now - // }; - // await _pcsApi.PostBarcodeItem(JsonConvert.SerializeObject(barcodeItem)); - // } - // // 新增 BarCodeWip 投入站新增 for 只有投入站才新增 - // if (model.StationSEQ == 1) - // { - // BarcodeWip barcodeWip = new BarcodeWip - // { - // BarcodeID = id, - // WipID = model.WipID - // }; - // await _pcsApi.PostBarcodeWip(JsonConvert.SerializeObject(barcodeWip)); - - // var wipInfo = await _pcsApi.GetWipInfo(model.WipID); - // wipInfo[0].CompleteQTY += 1; - // await _pcsApi.PutWipInfo(JsonConvert.SerializeObject(wipInfo[0])); - - // } - #endregion - if (NextStopCloseStation.Success) { // 刪除 BarCodeGroup DIP完工後刪除 @@ -1861,6 +1809,34 @@ namespace AMESCoreStudio.Web.Controllers return Json(new Result1() { success = Success, msg = Msg, data = Data, data1 = "" }); } + + /// + /// 目前已刷數量 + /// + /// 工單號碼 + /// 生產單位 + /// 作業站 + /// + [HttpPost] + public async Task getBarcodeStationByInputQty(string wipNo, string unitNo, int ststionID) + { + var q = await _pcsApi.GetWipInfoByWipNO(wipNo); + var q1 = q.Where(w => w.UnitNO == unitNo && w.WerksNO == GetFactoryNo().Result).FirstOrDefault(); + if (q1 != null) + { + + // 工單流程ID 取站別 + var ruleStations = await GetRuleStationByFlowRuleID(q1.FlowRuleID); + //var rulestationID = ruleStations.Where(w => w.StationID == ststionID).FirstOrDefault().RuleStationID; + + // 工單已刷數量 + int InputQTY = await _pcsApi.GetBarcodeStationByInputQty(q1.WipID, ststionID); + + //将数据Json化并传到前台视图 + return Json(new { data = InputQTY }); + } + return Json(new { data = 0 }); + } #endregion /// @@ -1881,5 +1857,33 @@ namespace AMESCoreStudio.Web.Controllers } return user_id; } + + /// + /// 廠商代號 + /// + /// + public async Task GetFactoryNo() + { + string factoryNo = string.Empty; + int user_id = 0; + HttpContext.Request.Cookies.TryGetValue("UserID", out string userID); + + if (userID != null) + { + var user_info = await _sysApi.GetUserData(user_id); + + if (user_info.DataTotal > 0) + { + foreach (var item in user_info.Data) + { + JObject jo = JObject.Parse(item.ToString()); + factoryNo = jo["factoryNo"].ToString(); + } + } + } + + + return factoryNo; + } } } diff --git a/AMESCoreStudio.Web/ViewModels/QRS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/QRS/QRS021ViewModel.cs similarity index 96% rename from AMESCoreStudio.Web/ViewModels/QRS/PCS021ViewModel.cs rename to AMESCoreStudio.Web/ViewModels/QRS/QRS021ViewModel.cs index c6ee0c96..76df73c3 100644 --- a/AMESCoreStudio.Web/ViewModels/QRS/PCS021ViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/QRS/QRS021ViewModel.cs @@ -8,7 +8,7 @@ using AMESCoreStudio.WebApi.DTO.AMES; namespace AMESCoreStudio.Web.ViewModels.QRS { - public class PCS021ViewModel + public class QRS021ViewModel { /// /// 工單號碼 @@ -136,7 +136,7 @@ namespace AMESCoreStudio.Web.ViewModels.QRS /// public List MaterialStationsItems { get; set; } = new List(); - public List Sops { get; set; } = new List(); + public List Sops { get; set; } = new List(); } public class WipOutfitDtos : WipOutfitDto @@ -160,7 +160,7 @@ namespace AMESCoreStudio.Web.ViewModels.QRS /// /// SOP /// - public class PCS021ViewModel_SOP + public class QRS021ViewModel_SOP { /// /// 檔案名稱 diff --git a/AMESCoreStudio.Web/Views/QRS/QRS021.cshtml b/AMESCoreStudio.Web/Views/QRS/QRS021.cshtml new file mode 100644 index 00000000..3ba921f0 --- /dev/null +++ b/AMESCoreStudio.Web/Views/QRS/QRS021.cshtml @@ -0,0 +1,615 @@ +@model AMESCoreStudio.Web.ViewModels.QRS.QRS021ViewModel +@{ + ViewData["Title"] = "過站作業"; + Layout = "~/Views/Shared/_AMESLayout.cshtml"; +} + + + + + +
+
+
+
+
+
+
+
    +
  • 過站資料
  • +
  • 治具資料
  • +
+
+
+
+
+
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+
+ +
+ + + + + +
+ +
+ +
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+ 刷讀條碼 +
+
+
+ +
+ +
+
+ +
+
+ @*@Html.ValidationMessage("error")*@ +
+
+
+ 刷入資料 + + + + @* + + + + + *@ +
+
+
+ 檢查項目 + + @{ + int i = 0; + } + + + + + + + + + @foreach (var index in Model.MaterialStationsItems) + { + + + + + + i++; + } + + +
+ 工項順序 + + 工項名稱 + + 工項描述 +
+ @index.StationsItemSeq + + @index.StationsItemNo + + +
+
+
+ 指定KeyPart + +
+
+ 工程備註 +
+ +
+
+
+ KeyParts +
+
+
+ + @{ + int j = 0; + } + + + + + + + + + + + + @foreach (var index in Model.WipKps) + { + + + + + + + + + j++; + } + +
+ KP料號名稱 + + KP料號NO + + 順序 + + 前置碼 + + 長度 + + 生產單位 +
+ + + + + + + + + + + + + @index.UnitNoName +
+
+
+
+
+ + @{ + int k = 0; + } + + + + + + + + + + @foreach (var index in Model.wipOutfits) + { + + + + + + + k++; + } + + +
+ 治具種類 + + 生產單位 + + 作業站 + + 刷入治具條碼 +
+ + + + + + + +
+
+
+
+
+
+ @if (Model.Sops.Count != 0) + { + bool sopfirst = true; +
+
    + @foreach (var index in Model.Sops) + { + if (sopfirst) + { +
  • @index.SopName
  • + sopfirst = false; + } + else + { +
  • @index.SopName
  • + } + } +
+ +
+ @foreach (var index in Model.Sops) + { + if (!sopfirst) + { +
+ +
+ sopfirst = true; + } + else + { +
+ +
+ } + } +
+
+ } +
+
+
+
+
+ +@section Scripts{ + @{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); + await Html.RenderPartialAsync("_FileinputScriptsPartial"); + } + + +} diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs index 4f3abab7..7e240940 100644 --- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckController.cs @@ -1306,8 +1306,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { try { + // 93200036400001 9320003640001 var No = int.Parse(barcode.Substring(barcode.Length - 4, 4)); - foreach (var item in q.Where(w => w.StartNO.Substring(0, barcode.Length - 4) == barcode.Substring(0, barcode.Length - 4))) + foreach (var item in q.Where(w => w.StartNO.Substring(0, barcode.Length - 4) == barcode.Substring(0, barcode.Length - 4) + && w.StartNO.Length == barcode.Length)) { int StartNo = int.Parse(item.StartNO.Substring(item.StartNO.Length - 4, 4)); int EndNo = int.Parse(item.EndNO.Substring(item.EndNO.Length - 4, 4));