diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs
index 2498a305..4e7f9fe1 100644
--- a/AMESCoreStudio.Web/Controllers/PCSController.cs
+++ b/AMESCoreStudio.Web/Controllers/PCSController.cs
@@ -5990,7 +5990,7 @@ namespace AMESCoreStudio.Web.Controllers
model.Sops.Add(new PCS021ViewModel_SOP
{
SopName = "SOP文件",
- SopPath = $@"/aa/T2/20200430184208_T3作業指導書.pdf"
+ SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}"
});
}
}
@@ -6005,7 +6005,7 @@ namespace AMESCoreStudio.Web.Controllers
model.Sops.Add(new PCS021ViewModel_SOP
{
SopName = "暫行文件",
- SopPath = $@"/aa/ASSY-T2/20221212134442_OFT-xxW04系列拆組MB重工測試SOP.pdf"
+ SopPath = $@"/e-sop/{Esop.FirstOrDefault().Process}/{Esop.FirstOrDefault().SopName}.pdf"
});
}
}
@@ -6079,10 +6079,10 @@ namespace AMESCoreStudio.Web.Controllers
{
model.BarcodeNG = true;
// 判斷是否為投入站,投入站不能刷不良
- if (model.StationSEQ == 1)
- {
- Msg += "投入站不能刷不良代碼";
- }
+ //if (model.StationSEQ == 1)
+ //{
+ // Msg += "投入站不能刷不良代碼";
+ //}
if (!string.IsNullOrWhiteSpace(Msg))
{
diff --git a/AMESCoreStudio.Web/Controllers/QRSController.cs b/AMESCoreStudio.Web/Controllers/QRSController.cs
index a2585600..c62d321a 100644
--- a/AMESCoreStudio.Web/Controllers/QRSController.cs
+++ b/AMESCoreStudio.Web/Controllers/QRSController.cs
@@ -9,6 +9,9 @@ using AMESCoreStudio.Web.Models;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Rendering;
using AMESCoreStudio.Web.ViewModels.QRS;
+using System.Linq;
+using AMESCoreStudio.WebApi.DTO.AMES;
+using AMESCoreStudio.WebApi.Models.BAS;
namespace AMESCoreStudio.Web.Controllers
{
@@ -1358,5 +1361,525 @@ namespace AMESCoreStudio.Web.Controllers
return Json(new Table() { count = 0, data = null });
}
+
+ ///
+ /// 流程ID By站別
+ ///
+ /// StationID
+ private async Task> GetRuleStationByFlowRuleID(int flowruleID)
+ {
+ var result = await _basApi.GetRuleStationsByFlow(flowruleID, 0);
+ result = result.Where(w => w.StationType == "M").OrderBy(o => o.Sequence).ToList();
+ var RuleStations = new List();
+ for (int i = 0; i < result.Count; i++)
+ {
+ RuleStations.Add(new SelectListItem(result[i].Sequence + "-" + result[i].Station.StationName, result[i].StationID.ToString()));
+ }
+
+ if (RuleStations.Count == 0)
+ {
+ RuleStations.Add(new SelectListItem("N/A", null));
+ }
+
+ ViewBag.GetRuleStationByFlowRuleIDList = RuleStations;
+ return result;
+ }
+
+ #region PCS021 條碼輸入作業
+ [ResponseCache(Duration = 0)]
+ [HttpGet]
+ public async Task PCS021()
+ {
+ var model = new PCS021ViewModel();
+ await GetUnitList();
+ return View(model);
+ }
+
+ [HttpPost]
+ public async Task PCS021_GetWip(PCS021ViewModel model)
+ {
+ await GetUnitList();
+ model.KpItemName += "null";
+ if (string.IsNullOrWhiteSpace(model.WipNO))
+ {
+ ModelState.AddModelError("error", "請輸入工單號碼");
+ }
+
+ if (string.IsNullOrWhiteSpace(model.UnitNO))
+ {
+ ModelState.AddModelError("error", "請選擇生產單位");
+ }
+
+ if (model.LineID == 0)
+ {
+ ModelState.AddModelError("error", "請選擇線別");
+ }
+
+ var q = await _pcsApi.GetWipInfoByWipNO(model.WipNO);
+ q = q.Where(w => w.UnitNO == model.UnitNO).ToList();
+
+ // 取作業站的生產製程
+ var stationUnit = string.Empty;
+ var station = await _basApi.GetStations(model.Station);
+ if (station.Count() != 0)
+ {
+ stationUnit = station.FirstOrDefault().UnitNo;
+ }
+ else
+ {
+ ModelState.AddModelError("error", "找不到該作業站的生產單位");
+ }
+
+
+ if (q.Count() == 0)
+ {
+ ModelState.AddModelError("error", "找不到該生產單位的工單號碼");
+ }
+
+ if (q.Count != 0)
+ {
+ model.WipID = q.FirstOrDefault().WipID;
+ model.PlanQTY = q.FirstOrDefault().PlanQTY;
+ model.UnitNO = q.FirstOrDefault().UnitNO;
+ model.FlowRuleID = q.FirstOrDefault().FlowRuleID;
+ model.ItemNO = (await _pcsApi.GetWipAtt(model.WipNO)).ItemNO;
+
+ // 判斷工單狀態
+ var BarCodeWip = await _pcsApi.CheckBarCodeWip(model.WipNO, model.UnitNO, model.LineID, model.FlowRuleID);
+ if (!BarCodeWip.Success)
+ {
+ ModelState.AddModelError("error", BarCodeWip.Msg);
+ return View("PCS021", model);
+ }
+
+ // 工單流程ID 取站別
+ var ruleStations = await GetRuleStationByFlowRuleID(model.FlowRuleID);
+ if (model.Station != 0)
+ {
+ if (ruleStations.Where(w => w.StationID == model.Station).Any())
+ {
+ model.RuleStation = ruleStations.Where(w => w.StationID == model.Station).FirstOrDefault().RuleStationID;
+ model.StationTypeNo = ruleStations.Where(w => w.StationID == model.Station).FirstOrDefault().Station.TypeNo;
+ }
+ else
+ {
+ model.RuleStation = ruleStations.FirstOrDefault().RuleStationID;
+ model.StationTypeNo = ruleStations.FirstOrDefault().Station.TypeNo;
+ model.Station = ruleStations.FirstOrDefault().StationID;
+ }
+ }
+ else
+ {
+ model.RuleStation = ruleStations.FirstOrDefault().RuleStationID;
+ model.StationTypeNo = ruleStations.FirstOrDefault().Station.TypeNo;
+ model.Station = ruleStations.FirstOrDefault().StationID;
+ }
+
+ // 工單已刷數量
+ model.InputQTY = await _pcsApi.GetBarcodeStationByInputQty(model.WipID, model.Station);
+
+ // 工單KeyParts
+ model.WipKps = await _pcsApi.GetWipKpByWipNo(model.WipNO);
+ model.WipKps = model.WipKps.Where(w => w.UnitNo == stationUnit).OrderBy(o => o.KpSeq).ToList();
+
+ // 料號檔案
+ model.MaterialItem = await _pcsApi.GetMaterialItemByItemNO(model.ItemNO);
+ if (model.MaterialItem != null)
+ {
+
+ model.MaterialStationsItems = await _pcsApi.GetMaterialStationsItemByItemID(model.MaterialItem.ItemID);
+ model.MaterialStationsItems = model.MaterialStationsItems.Where(w => w.StationID == model.Station).OrderBy(o => o.StationsItemSeq).ToList();
+ if (model.MaterialStationsItems.Count() != 0)
+ {
+ ModelState.AddModelError("error", "該站別有設定作業工項");
+ }
+
+ // 治具
+ var q1 = await _pcsApi.GetWipOutfitByWipNo(model.WipNO);
+ q1 = q1.Where(w => (w.UnitNo == model.UnitNO && w.StationID == null) ||
+ (w.UnitNo == model.UnitNO && w.StationID == model.Station)).ToList();
+ model.wipOutfits.Clear();
+ foreach (var item in q1)
+ {
+ model.wipOutfits.Add(new WipOutfitDtos
+ {
+ OutfitNo = item.OutfitNo,
+ PartNo = item.PartNo,
+ PartNoName = item.PartNoName,
+ StationName = item.StationName,
+ UnitNoName = item.UnitNoName
+ });
+
+ }
+ }
+
+ // 工程工單備註
+ var wipsystem = await _pcsApi.GetWipSystem(model.WipNO);
+ if (wipsystem != null)
+ {
+ if (stationUnit == "B")
+ model.SystemMemo = wipsystem.BabMemo;
+ else if (stationUnit == "T")
+ model.SystemMemo = wipsystem.TestMemo;
+ else if (stationUnit == "P")
+ model.SystemMemo = wipsystem.PackingMemo;
+ }
+
+ // KPSeq順序清除
+ model.KpItemName = string.Empty;
+
+ // 工單SOP
+ var wipSOP = await _pcsApi.GetWipSopByWipNo(model.WipNO);
+ // 標準SOP A
+ if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A").Any())
+ {
+ var wipSOPTypeA = wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "A")
+ .OrderByDescending(w => w.UpdateTime).FirstOrDefault();
+ var Esop = await _pcsApi.GetDocEsopViewByNo(wipSOPTypeA.SOPName);
+ if (Esop.Count != 0)
+ {
+ model.Sops.Add(new PCS021ViewModel_SOP
+ {
+ SopName = "SOP文件",
+ SopPath = $@"/DocEsop/{Esop.FirstOrDefault().file_path}"
+ });
+ }
+ }
+ // 暫行SOP D
+ if (wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "D").Any())
+ {
+ var wipSOPTypeD = wipSOP.Where(w => w.UnitNo == stationUnit && w.SOPType == "D")
+ .OrderByDescending(w => w.UpdateTime).FirstOrDefault();
+ var Esop = await _pcsApi.GetEsopBySopName(wipSOPTypeD.SOPName);
+ if (Esop.Count != 0)
+ {
+ model.Sops.Add(new PCS021ViewModel_SOP
+ {
+ SopName = "暫行文件",
+ SopPath = $@"/e-sop/{Esop.FirstOrDefault().Process}/{Esop.FirstOrDefault().SopName}.pdf"
+ });
+ }
+ }
+ // 不二過
+ model.Sops.Add(new PCS021ViewModel_SOP
+ {
+ SopName = "不二過",
+ SopPath = "/PDF/3.png"
+ });
+ }
+
+ return View("PCS021", model);
+ }
+
+ [HttpPost]
+ public async Task PCS021_Input(PCS021ViewModel model)
+ {
+ // ResultModel
+ string Msg = string.Empty;
+ bool Success = true;
+ string Data = model.Input;
+ // 刷入條碼+異常欄位
+ if (!string.IsNullOrWhiteSpace(model.InputNo))
+ Data += "@" + model.InputNo;
+
+ string ExtNo = string.Empty;
+
+ #region 基本Input 輸入判斷
+ if (model.WipID == 0)
+ Msg += "請確認是否有輸入工單相關訊息";
+
+ // 當有作業站就必須要填治具編號
+ if (model.wipOutfits.Where(w => !string.IsNullOrWhiteSpace(w.StationName) && string.IsNullOrWhiteSpace(w.Inputs)).Any())
+ Msg += "請刷入治具編號";
+
+ if (model.Station == 0)
+ {
+ Msg += "請選擇作業站";
+ }
+
+ if (string.IsNullOrWhiteSpace(model.Input))
+ {
+ Msg += "請刷讀條碼";
+ }
+
+ if (!string.IsNullOrWhiteSpace(Msg))
+ {
+ Success = false;
+ return Json(new Result() { success = Success, msg = Msg, data = Data });
+ }
+ #endregion
+
+ var q = await _pcsApi.CheckBarCodeByWipNo(model.Input, model.WipNO.Trim().ToUpper());
+ // 判斷是否序號與工單號碼是否對應條碼區間值,沒對應到視為組件或不良代碼
+ if (q.Success)
+ {
+ #region 確認序號的狀態
+ // Input為內部序號
+ model.Barcode = true;
+
+ // 取RuleStationID
+ var RuleStations = await _basApi.GetRuleStationsByFlow(model.FlowRuleID, 0);
+ if (RuleStations.Count != 0)
+ {
+ // 抓作業站順序
+ model.RuleStation = RuleStations.Where(w => w.StationID == model.Station).Select(s => s.RuleStationID).FirstOrDefault();
+ model.StationSEQ = RuleStations.Where(w => w.StationID == model.Station).Select(s => s.Sequence).FirstOrDefault();
+ }
+ // 判斷是否有$符號,代表有不良代碼
+ if (model.Inputs.Where(w => w.Input.Contains("$")).Any())
+ {
+ model.BarcodeNG = true;
+ // 判斷是否為投入站,投入站不能刷不良
+ //if (model.StationSEQ == 1)
+ //{
+ // Msg += "投入站不能刷不良代碼";
+ //}
+
+ if (!string.IsNullOrWhiteSpace(Msg))
+ {
+ Success = false;
+ return Json(new Result() { success = Success, msg = Msg, data = Data });
+ }
+ }
+
+ // 取作業站的生產製程
+ var stationUnit = string.Empty;
+ var station = await _basApi.GetStations(model.Station);
+ if (station.Count() != 0)
+ {
+ stationUnit = station.FirstOrDefault().UnitNo;
+ }
+ var keyParts = new List();
+
+ // 先查詢已綁定組件數量
+ var BarCodeItems = await _pcsApi.GetBarcodeItemByBarCode(model.Input);
+ BarCodeItems = BarCodeItems.Where(w => w.S.UnitNo == stationUnit).ToList();
+
+ // KeyParts代碼順序
+ var KeyPartsNo = model.KpItemName == null ? new List() : model.KpItemName.Split(',').ToList();
+ int KpItemQty = BarCodeItems.Count();
+ int i = 0;
+
+ // 判斷指定KeyParts代碼是否有刷足夠數
+ if (KeyPartsNo.Count() > model.Inputs.Where(w => !w.Input.StartsWith("$")).Count())
+ {
+ Msg = "有指定KeyParts代號 刷入數量不足,請在確認!";
+ return Json(new Result() { success = false, msg = Msg, data = Data });
+ }
+
+ foreach (var KeyPartItem in model.Inputs)
+ {
+ // 判斷是組件先+1
+ if (!KeyPartItem.Input.StartsWith("$"))
+ i += 1;
+
+ // 當刷入組組件+已紀錄組件數量 大於 設定組件數量
+ if (i + KpItemQty > model.WipKps.Count())
+ {
+ Msg = "已刷超過組件數量";
+ Success = false;
+ return Json(new Result() { success = Success, msg = Msg, data = Data });
+ }
+
+ // NG代碼
+ if (KeyPartItem.Input.StartsWith("$"))
+ {
+ keyParts.Add(new BarCodeCheckDto.inputItem
+ {
+ inputType = "NG",
+ inputData = KeyPartItem.Input,
+ oldInputData = KeyPartItem.InputNo,
+ kpItemNo = ""
+ });
+ }
+ else // KeaParts
+ {
+ // 判斷是否有輸入KeyParts代碼順序
+ // 有指定KeyParts順序
+ if (i <= KeyPartsNo.Count())
+ {
+ var WipKp = model.WipKps.Where(w => w.KpNoName.ToUpper() == KeyPartsNo[i - 1].ToUpper()).FirstOrDefault();
+ keyParts.Add(new BarCodeCheckDto.inputItem
+ {
+ inputType = WipKp.KpNo,
+ inputData = KeyPartItem.Input,
+ oldInputData = KeyPartItem.InputNo,
+ kpItemNo = WipKp.KpName
+ });
+ }
+ else
+ {
+ var WipKp = model.WipKps.Where(w => !KeyPartsNo.Any(w1 => w1.ToUpper().Contains(w.KpNoName.ToUpper())))
+ .ToList();
+ // 排除有指定數量,其他按照WipKp順序取值
+ var k = i - 1 - KeyPartsNo.Count();
+ keyParts.Add(new BarCodeCheckDto.inputItem
+ {
+ inputType = WipKp[k + KpItemQty].KpNo,
+ inputData = KeyPartItem.Input,
+ oldInputData = KeyPartItem.InputNo,
+ kpItemNo = WipKp[k + KpItemQty].KpName
+ });
+ }
+ }
+ }
+
+ // 治具
+ var outfit = new List();
+ foreach (var outfitItem in model.wipOutfits)
+ {
+ outfit.Add(new BarCodeCheckDto.Outfit
+ {
+ inputData = outfitItem.Inputs
+ });
+ }
+
+ var x = new BarCodeCheckDto
+ {
+ wipNo = model.WipNO,
+ barcode = model.Input,
+ barcodeType = "M",
+ stationID = model.Station,
+ line = model.LineID,
+ unitNo = model.UnitNO,
+ inputItems = keyParts,
+ outfits = outfit,
+ userID = GetLogInUserID()
+ };
+
+ var barcode_result = await _pcsApi.PassIngByCheck(JsonConvert.SerializeObject(x));
+ if (!barcode_result.Success)
+ return Json(new Result() { success = barcode_result.Success, msg = barcode_result.Msg, data = Data });
+ // 過站判斷成功
+ else
+ {
+ Msg = barcode_result.Msg;
+ Data = string.Empty;
+ }
+ #endregion
+ }
+ else
+ {
+ var items = await _pcsApi.GetItems();
+ items = items.Where(w => model.WipKps.Any(wi => wi.KpNo == w.ItemNo)).ToList();
+ if (items.Any(a => a.ItemName.ToUpper() == Data.ToUpper()))
+ {
+ // 判斷是否有重複輸入KP順序代號
+ if (model.KpItemName != null)
+ {
+ if (model.KpItemName.Split(",").Where(w => w.ToUpper() == Data.ToUpper()).Any())
+ {
+ Success = false;
+ Msg = $"KeyParts代號重複輸入:{Data} ";
+ return Json(new Result() { success = Success, msg = Msg, data = Data });
+ }
+ }
+
+ return Json(new Result1() { success = Success, msg = Msg, data = "", data1 = Data });
+ }
+ }
+
+ #region 判斷下一站為完工站
+ 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完工後刪除
+ if (model.UnitNO == "D")
+ {
+ var GroupID = await _pcsApi.GetBarcodeGroupByBarCodeID(model.BarCodeID);
+ if (GroupID.Count != 0)
+ {
+ await _pcsApi.DeleteBarcodeGroupByGroupID(GroupID.FirstOrDefault().GroupID);
+ }
+ }
+ }
+
+ return Json(new Result1() { success = Success, msg = Msg, data = Data, data1 = "" });
+ }
+ #endregion
+
+ ///
+ /// 登入UserID
+ ///
+ ///
+ public int GetLogInUserID()
+ {
+ int user_id = 0;
+ 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/ViewModels/QRS/PCS021ViewModel.cs b/AMESCoreStudio.Web/ViewModels/QRS/PCS021ViewModel.cs
new file mode 100644
index 00000000..c6ee0c96
--- /dev/null
+++ b/AMESCoreStudio.Web/ViewModels/QRS/PCS021ViewModel.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.WebApi.Models.BAS;
+using AMESCoreStudio.WebApi.DTO.AMES;
+
+namespace AMESCoreStudio.Web.ViewModels.QRS
+{
+ public class PCS021ViewModel
+ {
+ ///
+ /// 工單號碼
+ ///
+ public string WipNO { get; set; }
+
+ ///
+ /// 工單ID
+ ///
+ public int WipID { get; set; }
+
+ ///
+ /// BarCodeID
+ ///
+ public int BarCodeID { get; set; }
+
+ ///
+ /// 工單數
+ ///
+ public int PlanQTY { get; set; } = 0;
+
+ ///
+ /// 已刷數
+ ///
+ public int InputQTY { get; set; } = 0;
+
+ ///
+ /// 線別
+ ///
+ public int LineID { get; set; }
+
+ ///
+ /// 生產單位
+ ///
+ public string UnitNO { get; set; }
+
+ ///
+ /// 流程ID
+ ///
+ public int FlowRuleID { get; set; }
+
+ ///
+ /// RuleStationID
+ ///
+ public int RuleStation { get; set; }
+
+ ///
+ /// 作業站
+ ///
+ public int Station { get; set; }
+
+ ///
+ /// 工作站類別
+ ///
+ public string StationTypeNo { get; set; }
+
+ ///
+ /// 料號
+ ///
+ public string ItemNO { get; set; }
+
+ ///
+ /// input
+ ///
+ public string Input { get; set; }
+
+ ///
+ /// inputNo (異常代碼)
+ ///
+ public string InputNo { get; set; }
+
+ ///
+ /// 過站順序
+ ///
+ public int StationSEQ { get; set; } = 0 ;
+
+ ///
+ /// 是否是內部序號
+ ///
+ public bool Barcode { get; set; } = false ;
+
+ ///
+ /// 是否有不良代號
+ ///
+ public bool BarcodeNG { get; set; } = false;
+
+ ///
+ /// 站別測試類別代碼
+ ///
+ public string StationTestType { get; set; }
+
+ ///
+ /// 工程備註
+ ///
+ public string SystemMemo { get; set; }
+
+ ///
+ /// KeyPart 代號
+ ///
+ public string KpItemName { get; set; } = string.Empty;
+
+ ///
+ /// inputs
+ ///
+
+ public List Inputs { get; set; } = new List();
+
+ ///
+ /// 料號相關資料
+ ///
+ public MaterialItem MaterialItem { get; set; }
+
+ ///
+ /// 料號KP資訊資料檔
+ ///
+ public List WipKps { get; set; } = new List();
+
+ ///
+ /// 料號治具資訊
+ ///
+ public List wipOutfits { get; set; } = new List();
+
+ ///
+ /// 站別工項資料檔
+ ///
+ public List MaterialStationsItems { get; set; } = new List();
+
+ public List Sops { get; set; } = new List();
+ }
+
+ public class WipOutfitDtos : WipOutfitDto
+ {
+ public string Inputs { get; set; }
+ }
+
+ public class Inputs
+ {
+ ///
+ /// 不良代號 || KeyPart
+ ///
+ public string Input { get; set; }
+
+ ///
+ /// 異常欄位
+ ///
+ public string InputNo { get; set; }
+ }
+
+ ///
+ /// SOP
+ ///
+ public class PCS021ViewModel_SOP
+ {
+ ///
+ /// 檔案名稱
+ ///
+ public string SopName { get; set; }
+
+ ///
+ /// 檔案路徑
+ ///
+ public string SopPath { get; set; }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs
index 1a970ad2..ab4da9a3 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs
@@ -75,7 +75,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task>> CheckWipBarcodeOtherByNo(string wipNO, string No)
{
var wipBarcodeOther = _context.WipBarcodeOthers
- .FromSqlInterpolated($" SELECT * FROM JHAMES.WIP_BARCODE_OTHER WHERE {No} BETWEEN START_NO AND END_NO ")
+ .FromSqlInterpolated($" SELECT * FROM JHAMES.WIP_BARCODE_OTHER WHERE {No} BETWEEN START_NO AND END_NO AND length(START_NO) = length({No}) ")
.AsNoTracking().ToList();
wipBarcodeOther = wipBarcodeOther.Where(W => W.WipNO == wipNO).ToList();