/// <summary> /// 維修輸入SN Fail次數管控 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNRepairCountChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { //string inputValue = Input.Value.ToString(); if (Paras.Count != 2) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession SN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SN_Session == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" })); } SN sn = (SN)SN_Session.Value; string skuno = null; //Paras: SESSION_TYPE='SKU' SESSION_KEY='1' VALUE='0,1' switch (Paras[1].VALUE) { case "0": skuno = sn.SkuNo; break; default: skuno = "ALL"; break; } OleExec sfcdb = Station.SFCDB; C_REPAIR_DAY repairDay = new T_C_REPAIR_DAY(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySkuno(sfcdb, skuno); if (repairDay != null) { //repair_count if (repairDay.REPAIR_COUNT == 3) { Station.AddMessage("MES00000087", new string[] { repairDay.REPAIR_COUNT.ToString(), "請注意" }, StationMessageState.Message); } if (repairDay.REPAIR_COUNT > 3) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000087", new string[] { repairDay.REPAIR_COUNT.ToString(), "已鎖定" })); } } }
public static void PanelVirtualSNChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { string PanelSN = ""; bool CheckFlag = false; SN SNObj = new SN(); MESStationSession PanelSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (PanelSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } PanelSN = PanelSession.InputValue.ToString(); CheckFlag = SNObj.CheckPanelVirtualSNExist(PanelSN, Station.SFCDB, DB_TYPE_ENUM.Oracle); if (!CheckFlag) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000139", new string[] { PanelSN })); } }
//Add by LLF 2018-02-19 End /// <summary> /// 加載輸入的字符串到指定的 MESStationSession /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"> /// </param> public static void GetWaitShipToData(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { try { var res = Station.SFCDB.ORM .Queryable <R_TO_HEAD, R_TO_DETAIL, R_DN_STATUS>((rth, rtd, rds) => rth.TO_NO == rtd.TO_NO && rtd.DN_NO == rds.DN_NO && rds.DN_FLAG == "0") .OrderBy((rth) => rth.TO_CREATETIME, OrderByType.Desc) .GroupBy(rth => new { rth.TO_NO, rth.PLAN_STARTIME, rth.PLAN_ENDTIME, rth.TO_CREATETIME }) .Select(rth => new { rth.TO_NO, rth.PLAN_STARTIME, rth.PLAN_ENDTIME, rth.TO_CREATETIME }).ToList(); MESStationInput s = Station.Inputs.Find(t => t.DisplayName == "TO_LIST"); s.Value = res; } catch (Exception exception) { throw exception; } }
//Add by LLF 2018-01-26 End /// <summary> /// 檢查當前工單是否上料齊套 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SMTPanelNoCheck(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { MESStationSession WO_Session = Station.StationSession.Find(t => t.MESDataType == "WO" && t.SessionKey == "1"); if (WO_Session == null) { Station.AddMessage("MES00000007", new string[] { "WO" }, StationMessageState.Fail); return; } string wo = WO_Session.Value.ToString(); OleExec apdb = Station.APDB; //string msg = apdb.ExecProcedureNoReturn("", null); if (apdb != null) { } }
/// <summary> /// 維修輸入SN Fail狀態檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNRepairFailChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec sfcdb = Station.SFCDB; //input test /*string inputValue = Input.Value.ToString(); * if (string.IsNullOrEmpty(inputValue)) * { * throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "SN輸入值" })); * } * SN sn = new SN(inputValue, sfcdb, DB_TYPE_ENUM.Oracle);*/ MESStationSession SN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SN_Session == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" })); } SN sn = (SN)SN_Session.Value; if (sn.RepairFailedFlag == "0") { //正常品 throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000078", new string[] { sn.SerialNo })); } List <R_REPAIR_MAIN> repairMains = new T_R_REPAIR_MAIN(sfcdb, DB_TYPE_ENUM.Oracle).GetRepairMainBySN(sfcdb, sn.SerialNo); if (repairMains == null || repairMains.Count == 0) { //無維修主檔信息 throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000079", new string[] { "SN", sn.SerialNo })); } foreach (R_REPAIR_MAIN rm in repairMains) { //存在closed_flag=0 if (rm.CLOSED_FLAG != "0") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000097", new string[] { "SN", rm.SN })); } } Station.AddMessage("MES00000046", new string[] { "OK" }, StationMessageState.Pass); }
/// <summary> /// 從SKU加載Series /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SeriesFromSKUDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { //加載SeriesSavePoint MESStationSession SeriesSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SeriesSession == null) { SeriesSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, SessionKey = Paras[0].SESSION_KEY }; Station.StationSession.Add(SeriesSession); } //SKULoadPoint MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (SkuSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SKU" })); } SKU sku = (SKU)SkuSession.Value; if (sku == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SKU" })); } OleExec sfcdb = Station.SFCDB; T_C_SERIES t_c_series = new T_C_SERIES(sfcdb, DB_TYPE_ENUM.Oracle); C_SERIES c_series = t_c_series.GetDetailById(sfcdb, sku.CSeriesId);//sku.CSeriesId if (c_series == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SERIES" })); } SeriesSession.Value = c_series; Station.AddMessage("MES00000029", new string[] { "SERIES", c_series.SERIES_NAME }, StationMessageState.Pass); }
/// <summary> /// 重新加载 TRSN 的数量并进行判断 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void TRInputResetAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { //獲取TR_SN string TRSN = string.Empty; if (Paras.Count != 2) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } TRSN = Paras[1].VALUE.ToString(); //使用 TRSN 重新加載 TRSNWIP,目前不存在 DataLoader 來根據 TRSN 加載 TRSNWIP 信息 MESStationSession TRSNWip = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TRSNWip == null) { TRSNWip = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TRSNWip); } double ExtQty = ((DataRow)TRSNWip.Value)["EXT_QTY"] == null?0.0d:double.Parse(((DataRow)TRSNWip.Value)["EXT_QTY"].ToString()); TRSN = ((DataRow)TRSNWip.Value)["TR_SN"] == null?"": ((DataRow)TRSNWip.Value)["TR_SN"].ToString(); if (ExtQty <= 0) { MESStationInput input = Station.FindInputByName("TRSN"); input.Enable = true; Station.NextInput = input; Station.AddMessage("MES00000039", new string[] { TRSN }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } else { TRSNWip.Value = ExtQty--; MESStationInput input = Station.FindInputByName("NEW_SN"); } }
public static void StationItemsDataloader(MESStationBase Station, MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession ReturnStationItemsSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (ReturnStationItemsSession == null) { ReturnStationItemsSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(ReturnStationItemsSession); } ReturnStationItemsSession.Value = Input.Value.ToString(); // Input.DataForUse.Add(Input.Value.ToString()); }
/// <summary> /// 檢查SN是否有掃REPAIR_CHECK_IN /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void RepairInChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionSN == null || sessionSN.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } SN snObject = (SN)sessionSN.Value; T_R_REPAIR_TRANSFER t_r_repair = new T_R_REPAIR_TRANSFER(Station.SFCDB, Station.DBType); if (!t_r_repair.SNIsRepairIn(snObject.SerialNo, Station.SFCDB)) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180619154342", new string[] { snObject.SerialNo })); } }
/// <summary> /// 檢查線體是否被鎖 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void LineLockedChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { //GET LINE string LineName = Station.Line; string CurrentStation = Station.StationName; if (string.IsNullOrEmpty(LineName)) { throw new MESReturnMessage("LINE線體加載異常"); } OleExec sfcdb = Station.SFCDB; R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, LineName, CurrentStation);//sn.SerialNo,sn.CurrentStation if (r_sn_lock != null) { Station.AddMessage("MES00000044", new string[] { "LINE", r_sn_lock.SN, r_sn_lock.LOCK_EMP }, StationMessageState.Fail); //return; throw new MESReturnMessage("線體被鎖定"); } }
/// <summary> /// 從SN對象加載該SN已經維修的次數 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNRepairCountDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 2) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionSN == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" })); } if (sessionSN.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" })); } //Repair Count Session MESStationSession sessionRepairCount = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionRepairCount == null) { sessionRepairCount = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionRepairCount); } try { LogicObject.SN snObject = (LogicObject.SN)sessionSN.Value; T_R_REPAIR_MAIN t_r_repair_main = new T_R_REPAIR_MAIN(Station.SFCDB, Station.DBType); sessionRepairCount.Value = t_r_repair_main.GetRepairedCount(snObject.SerialNo, Station.SFCDB, Station.DBType); sessionRepairCount.InputValue = t_r_repair_main.GetRepairedCount(snObject.SerialNo, Station.SFCDB, Station.DBType).ToString(); sessionRepairCount.ResetInput = Input; Station.AddMessage("MES00000029", new string[] { Paras[1].SESSION_TYPE, sessionRepairCount.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
/// <summary> /// 連板數量檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> //Add by LLF 2018-01-26 Begin public static void SMTLoadingLinkQtyChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { try { MESStationSession AP_LinkQty = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (AP_LinkQty == null) { Station.Inputs[2].Value = ""; Station.Inputs[3].Enable = false; throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000133", new string[] { })); } if (Convert.ToInt16(AP_LinkQty.Value.ToString()) <= 0) { Station.Inputs[2].Value = ""; Station.Inputs[3].Enable = false; throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000137", new string[] { AP_LinkQty.Value.ToString() })); } MESStationSession Input_LinkQty = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (Input_LinkQty == null) { Station.Inputs[2].Value = ""; Station.Inputs[3].Enable = false; throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000132", new string[] { })); } if (Convert.ToInt16(Input_LinkQty.Value.ToString()) > Convert.ToInt16(AP_LinkQty.Value.ToString())) { Station.Inputs[2].Value = ""; Station.Inputs[3].Enable = false; throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000131", new string[] { Input_LinkQty.Value.ToString(), AP_LinkQty.Value.ToString() })); } Station.Inputs[3].Enable = true; Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw (ex); } }
/// <summary> /// 檢查SN/PanelSN是否被鎖 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNLockedChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { //input test //string inputValue = Input.Value.ToString(); //MESStationSession snSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); //if (snSession == null) //{ // throw new MESReturnMessage("SN加載異常"); //} //SN sn = (SN) snSession.Value; OleExec sfcdb = Station.SFCDB; //R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, sn.SerialNo, Station.StationName);//sn.SerialNo,sn.CurrentStation R_SN_LOCK r_sn_lock = new T_R_SN_LOCK(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailBySN(sfcdb, Input.Value.ToString(), Station.StationName);//sn.SerialNo,sn.CurrentStation if (r_sn_lock != null) { Station.AddMessage("MES00000044", new string[] { "SN", r_sn_lock.SN, r_sn_lock.LOCK_EMP }, StationMessageState.Fail); //return; throw new MESReturnMessage("SN被鎖定"); } }
/// <summary> /// 檢查當前站是否在下一站的清單中 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> /// add by LLF 2018-01-27 public static void NextStationDataChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { List <string> ListNextStation = new List <string>(); SN SNObj = new SN(); string StrStation = ""; MESStationSession NextStation_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (NextStation_Session == null) { //Station.AddMessage("MES00000135", new string[] { "ListNextStation--Function:NextStationDataChecker" }, StationMessageState.Fail); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000135", new string[] { "ListNextStation--Function:NextStationDataChecker" })); } ListNextStation = (List <string>)NextStation_Session.Value; StrStation = SNObj.StringListToString(ListNextStation); if (!ListNextStation.Contains(Station.StationName)) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000136", new string[] { StrStation })); } }
public static void TESTGetPoBuySKUDataLoader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string skuno = Input.Value.ToString(); MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "PO"); List <object> ret = I.DataForUse; ret.Clear(); if (skuno == "A03022ASS-A") { ret.Add("00045879"); ret.Add("00045880"); ret.Add("00045881"); //"{SKUNO:[SKU],TT:'2222'}" } else if (skuno == "A03023UBB-A") { ret.Add("00095879"); ret.Add("00095880"); ret.Add("00095881"); } }
public static void ObaSampleStationInit(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationInput snInput = Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE); MESStationInput scanTypeInput = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE); MESStationInput failSnInput = Station.Inputs.Find(t => t.DisplayName == Paras[2].SESSION_TYPE); MESStationInput FailCodeInput = Station.Inputs.Find(t => t.DisplayName == Paras[3].SESSION_TYPE); MESStationInput LocationInput = Station.Inputs.Find(t => t.DisplayName == Paras[4].SESSION_TYPE); MESStationInput FailDescInput = Station.Inputs.Find(t => t.DisplayName == Paras[5].SESSION_TYPE); snInput.Visable = false; failSnInput.Visable = false; FailCodeInput.Visable = false; LocationInput.Visable = false; FailDescInput.Visable = false; scanTypeInput.Visable = false; scanTypeInput.DataForUse.Add("Pass"); scanTypeInput.DataForUse.Add("Fail"); }
public static void PanelRuleDataChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { //input test //string inputValue = Input.Value.ToString(); MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SkuSession == null) { SkuSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SkuSession); } MESStationSession PanelSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (PanelSession == null) { throw new MESReturnMessage("Panel加載異常"); } Station.AddMessage("OK", new string[] { "ok" }, StationMessageState.Pass); }
public static void CloseLot(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { DisplayOutPut Dis_LotNo = Station.DisplayOutput.Find(t => t.Name == "LOTNO"); MESStationInput Level = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL"); T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType); Row_R_LOT_STATUS r = tRLotStatus.GetByLotNo(Dis_LotNo.Value.ToString(), Station.SFCDB); if (r.LOT_NO == null || !r.CLOSED_FLAG.Equals("0")) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528103627", new string[] { Dis_LotNo.Value.ToString() })); } try { //根據關閉時的AQL更新LotStatus T_C_AQLTYPE tCAqlType = new T_C_AQLTYPE(Station.SFCDB, Station.DBType); List <C_AQLTYPE> cAqlTypeList = tCAqlType.GetAqlTypeBySkunoAndLevel(r.SKUNO, Level.Value.ToString(), Station.SFCDB); r.REJECT_QTY = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].REJECT_QTY; r.SAMPLE_QTY = cAqlTypeList.Where(t => t.LOT_QTY > r.LOT_QTY).OrderBy(t => t.LOT_QTY).Take(1).ToList <C_AQLTYPE>()[0].SAMPLE_QTY; r.SAMPLE_QTY = r.SAMPLE_QTY > r.LOT_QTY ? r.LOT_QTY : r.SAMPLE_QTY; r.CLOSED_FLAG = "1"; r.AQL_LEVEL = Level.Value.ToString(); r.EDIT_EMP = Station.LoginUser.EMP_NO; Station.SFCDB.ThrowSqlExeception = true; r.EDIT_TIME = tRLotStatus.GetDBDateTime(Station.SFCDB); Station.SFCDB.ExecSQL(r.GetUpdateString(Station.DBType)); } catch (Exception e) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180528105826", new string[] { Dis_LotNo.Value.ToString(), e.Message })); } finally { Station.SFCDB.ThrowSqlExeception = false; } #region 清空界面信息 Station.StationSession.Clear(); Station.Inputs.Find(t => t.DisplayName == Paras[0].SESSION_TYPE).DataForUse.Clear(); Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL").DataForUse.Clear(); #endregion }
/// <summary> /// 從維修大項加載維修小項 /// </summary> /// <param name="Station"></param> /// <param name="Input">RootCause輸入值轉換為大寫</param> /// <param name="Paras">ErrorCode</param> public static void RepairItemsSonFromRepairItemsDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { T_C_REPAIR_ITEMS RepairItems = new T_C_REPAIR_ITEMS(Station.SFCDB, Station.DBType); Row_C_REPAIR_ITEMS RowItems; T_C_REPAIR_ITEMS_SON RepairItemsSon = new T_C_REPAIR_ITEMS_SON(Station.SFCDB, Station.DBType); List <string> RepairItemsSonList = new List <string>(); List <string> RepairItemsList = new List <string>(); T_C_REPAIR_ITEMS TC_REPAIR_ITEM = new T_C_REPAIR_ITEMS(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); string ITEM_NAME = Input.Value.ToString(); MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "Son_Items"); List <object> ret = I.DataForUse; ret.Clear(); try { //RepairItemsList = TC_REPAIR_ITEM.GetRepairItemsList(ITEM_NAME, Station.SFCDB); //Input.DataForUse.Add(RepairItemsList);//初始化維修大項 RowItems = RepairItems.GetIDByItemName(ITEM_NAME, Station.SFCDB); RepairItemsSonList = RepairItemsSon.GetRepairItemsSonList(RowItems.ID, Station.SFCDB); //ret.Add(RepairItemsSonList); //添加維修小項 foreach (object item in RepairItemsSonList) { ret.Add(item); } Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }
/// <summary> /// /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void InputPackNoDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession PackNoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (PackNoSession != null) { Station.StationSession.Remove(PackNoSession); } else { PackNoSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; PackNoSession.InputValue = Input.Value.ToString(); Station.StationSession.Add(PackNoSession); } }
/// <summary> /// /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void InputSNDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count == 0) { throw new Exception("參數數量不正確!"); } MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SNSession == null) { SNSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SNSession); } string inputValue = Input.Value.ToString(); SN SNObj = null; try { SNObj = new SN(inputValue, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); if (string.IsNullOrEmpty(SNObj.SerialNo)) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "SN:" + inputValue })); } SNSession.Value = SNObj; SNSession.InputValue = inputValue; SNSession.ResetInput = Input; Station.AddMessage("MES00000029", new string[] { "SN:", inputValue }, StationMessageState.Pass); } catch (Exception ex) { throw ex; } }
/// <summary> /// 從Sn加載 stationName List /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void GetStationBySnDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057")); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionSN == null || sessionSN.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } MESStationSession sessionStation = new MESStationSession(); SN SNObj = (SN)sessionSN.Value; List <string> stationList = new List <string>(); T_C_ROUTE_DETAIL RouteDetailTable = new T_C_ROUTE_DETAIL(Station.SFCDB, Station.DBType); List <C_ROUTE_DETAIL> RouteDetails = RouteDetailTable.GetByRouteIdOrderBySEQASC(SNObj.RouteID, Station.SFCDB); MESStationInput stationInput = Station.Inputs.Find(t => t.DisplayName == "ReturnStation"); if (RouteDetails.Count > 0) { stationInput.DataForUse.Clear(); stationInput.DataForUse.Add(""); foreach (C_ROUTE_DETAIL c in RouteDetails) { stationInput.DataForUse.Add(c.STATION_NAME); } } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000194", new string[] { SNObj.WorkorderNo })); } Station.AddMessage("MES00000001", new string[] { }, StationMessageState.Message); }
public static void WOInputResetAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { MESStationInput input = null; WorkOrder wo = null; double? TargetQty = 0.0d; double InputQty = 0.0d; if (Paras.Count != 2) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //準備數據 begin MESStationSession WoCount = new MESStationSession(); WoCount.SessionKey = "1"; WoCount.MESDataType = "COUNT"; WoCount.Value = "100"; Station.StationSession.Add(WoCount); WorkOrder workorder = new WorkOrder(); workorder.Init(Input.Value.ToString(), Station.SFCDB); MESStationSession Wo = new MESStationSession(); Wo.SessionKey = "1"; Wo.MESDataType = "WO"; Wo.Value = workorder; Station.StationSession.Add(Wo); //準備數據 end MESStationSession WoInputCount = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoInputCount == null) { //WoInputCount = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; //Station.StationSession.Add(WoInputCount); //throw new Exception("無法獲取工單投入總量,請確認"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } MESStationSession WoInput = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WoInput == null) { //WoInput = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; //Station.StationSession.Add(WoInput); //throw new Exception("無法獲取工單信息,請確認"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); } wo = (WorkOrder)WoInput.Value; TargetQty = wo.WORKORDER_QTY; InputQty = double.Parse(WoInputCount.Value.ToString()); if (TargetQty <= InputQty) { input = Station.FindInputByName("WO"); if (input != null) { input.Enable = true; Station.NextInput = input; WoInputCount.InputValue = "0"; } Station.AddMessage( "MES00000030", new string[] { wo.WorkorderNo.ToString(), TargetQty.ToString(), WoInputCount.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } else { input = Station.FindInputByName("NEW_SN"); if (input != null) { Station.NextInput = input; WoInputCount.InputValue = InputQty++.ToString(); } } }
/// <summary> /// 檢查HWD Link Keypart檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> //public static void SNCallHWWSchecker(MESStationBase Station, MESStationInput Input, List<R_Station_Action_Para> Paras) public static void SNSubKPchecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > KPList_Temp = new List <Dictionary <string, string> >(); Dictionary <string, string> DicKP = new Dictionary <string, string>(); List <C_KEYPART> SubKP = new List <C_KEYPART>(); string KpSN = Input.Value.ToString(); //C_KEYPART SUBKP = null; if (Paras.Count != 3) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession SubSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SubSNSession == null) { SubSNSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SubSNSession); } MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (SubKPSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); } MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (KPListSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY })); } SN Sn = new SN(KpSN, Station.SFCDB, DB_TYPE_ENUM.Oracle); if (Sn == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000048", new string[] { KpSN })); } KPListSession.Value = null; SubSNSession.Value = Sn; T_R_SN_KEYPART_DETAIL _R_SN_KEYPART_DETAIL = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); T_C_KEYPART _C_KEYPART = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle); List <R_SN_KEYPART_DETAIL> KEYPARTDETAIL = new List <R_SN_KEYPART_DETAIL>(); if (Sn.ShippedFlag == "1") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000070", new string[] { KpSN })); } if (Sn.RepairFailedFlag == "1") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000071", new string[] { KpSN })); } if (Sn.CompletedFlag == "0") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000144", new string[] { KpSN })); } if (Sn.CurrentStation == "MRB") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000174", new string[] { KpSN })); } else { //Modify by LLF 2018-04-01,有多階綁定 //KEYPARTDETAIL = _R_SN_KEYPART_DETAIL.GetKeypartBySN(Station.SFCDB, KpSN, Station.StationName); //R_SN_KEYPART_DETAIL kpl = KEYPARTDETAIL.Find(z=>z.VALID=="1"); //if (kpl != null) //{ // throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000165", new string[] { KpSN })); //} //else //{ SubKP = (List <C_KEYPART>)SubKPSession.Value; C_KEYPART ckp = SubKP.Find(c => c.PART_NO == Sn.SkuNo); if (ckp == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000175", new string[] { Sn.SkuNo })); } //} } }
/// <summary> /// 檢查HWD Link Keypart檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNMainKPchecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > KPList_Temp = new List <Dictionary <string, string> >(); Dictionary <string, string> DicKP = new Dictionary <string, string>(); List <C_KEYPART> MainKP = new List <C_KEYPART>(); string MainSN = Input.Value.ToString(); if (Paras.Count != 3) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession MainSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (MainSNSession == null) { MainSNSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(MainSNSession); } MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (MainKPSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); } MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (KPListSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY })); } SN Sn = new SN(MainSN, Station.SFCDB, DB_TYPE_ENUM.Oracle); if (Sn == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000048", new string[] { MainSN })); } MainSNSession.Value = Sn; T_R_SN_KEYPART_DETAIL _R_SN_KEYPART_DETAIL = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); T_C_KEYPART _C_KEYPART = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle); List <R_SN_KEYPART_DETAIL> KEYPARTDETAIL = new List <R_SN_KEYPART_DETAIL>(); if (Sn.ShippedFlag == "1") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000070", new string[] { MainSN })); } if (Sn.RepairFailedFlag == "1") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000071", new string[] { MainSN })); } if (Sn.CompletedFlag == "0") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000144", new string[] { MainSN })); } if (Sn.CurrentStation == "MRB") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000174", new string[] { MainSN })); } else { KEYPARTDETAIL = _R_SN_KEYPART_DETAIL.GetKeypartBySN(Station.SFCDB, MainSN, Station.StationName); R_SN_KEYPART_DETAIL KP_Main = KEYPARTDETAIL.Find(z => z.VALID == "1"); if (KP_Main != null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000165", new string[] { MainSN })); } else { MainKP = (List <C_KEYPART>)MainKPSession.Value; C_KEYPART ckp = MainKP.Find(c => c.PART_NO == Sn.SkuNo); if (ckp == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000175", new string[] { Sn.SkuNo })); } else { KPList_Temp = (List <Dictionary <string, string> >)KPListSession.Value; if (KPList_Temp.Count > 0) { DicKP = KPList_Temp.Find(a => a.ContainsValue(Sn.SerialNo)); if (DicKP != null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000193", new string[] { MainSN })); } } Station.AddMessage("MES00000067", new string[] { MainSN }, StationMessageState.Pass); } } } }
public void StationInput(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string DisplayName = Data["Station"]["DisplayName"]?.ToString(); string Token = requestValue["Token"]?.ToString(); JToken RCurrInput = Data["Input"]; MESStationInput CurrInput = null; OleExec SFCDB = this.DBPools["SFCDB"].Borrow(); OleExec APDB = this.DBPools["APDB"].Borrow(); //將工站返回的值加載入工站模型中 MESStationBase Station = null; if (StationPool.ContainsKey(Token + DisplayName)) { Station = StationPool[Token + DisplayName]; } Station.StationMessages.Clear(); Station.NextInput = null; Station.SFCDB = SFCDB; Station.APDB = APDB; Station.IP = requestValue["IP"]["Value"].ToString(); Station.LabelPrint.Clear(); Station.ScanKP.Clear(); try { for (int i = 0; i < Data["Station"]["Inputs"].Count(); i++) { JToken rinput = Data["Station"]["Inputs"][i]; MESStationInput input = Station.Inputs.Find(t => t.DisplayName == rinput["DisplayName"].ToString()); if (input == null) { continue; } input.Value = rinput["Value"].ToString(); if (Data["ScanType"].ToString() == "Pass" && input.DisplayName == RCurrInput["DisplayName"].ToString()) { CurrInput = input; } } if (Station.FailStation != null) { //2018/02/05 肖倫 failStation的db以及dbPool為空的情況 Begin Station.FailStation.DBS = Station.DBS; Station.FailStation.SFCDB = SFCDB; Station.FailStation.APDB = APDB; //2018/02/05 肖倫 failStation的db以及dbPool為空的情況 End for (int i = 0; i < Data["Station"]["FailStation"]["Inputs"].Count(); i++) { JToken rinput = Data["Station"]["FailStation"]["Inputs"][i]; MESStationInput input = Station.FailStation.Inputs.Find(t => t.DisplayName == rinput["DisplayName"].ToString()); if (input == null) { continue; } input.Value = rinput["Value"].ToString(); if (Data["ScanType"].ToString() == "Fail" && input.DisplayName == RCurrInput["DisplayName"].ToString()) { CurrInput = input; } } } MESStation.MESReturnView.Station.CallStationReturn ret = new MESReturnView.Station.CallStationReturn(); ret.ScanType = Data["ScanType"].ToString(); //add by ZGJ 2018-03-19 清空之前的輸入動作執行後輸出到前台的消息 CurrInput.Station.StationMessages.Clear(); //調用處理邏輯 CurrInput.Run(); Station.MakeOutput(); if (Data["ScanType"].ToString() == "Pass") { if (Station.NextInput == null) { for (int i = 0; i < Station.Inputs.Count; i++) { if (Station.Inputs[i] == CurrInput) { if (i != Station.Inputs.Count - 1) { ret.NextInput = Station.Inputs[i + 1]; } else { ret.NextInput = Station.Inputs[0]; } } } } else { ret.NextInput = Station.NextInput; } } else if (Station.FailStation != null) { if (Station.FailStation.NextInput == null) { for (int i = 0; i < Station.FailStation.Inputs.Count; i++) { if (Station.FailStation.Inputs[i] == CurrInput) { if (i != Station.FailStation.Inputs.Count - 1) { ret.NextInput = Station.FailStation.Inputs[i + 1]; } else { ret.NextInput = Station.FailStation.Inputs[0]; } } } } else { ret.NextInput = Station.FailStation.NextInput; } } //2018/02/05 肖倫 failStation的db以及dbPool為空的情況 Begin if (Station.FailStation != null) { Station.FailStation.DBS = null; Station.FailStation.SFCDB = null; } //2018/02/05 肖倫 failStation的db以及dbPool為空的情況 end this.DBPools["SFCDB"].Return(SFCDB); this.DBPools["APDB"].Return(APDB); Station.SFCDB = null; Station.APDB = null; ret.Station = Station; StationReturn.Data = ret; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "Station '" + DisplayName + "' Input successfull."; } catch (Exception ee) { Station.MakeOutput(); this.DBPools["SFCDB"].Return(SFCDB); this.DBPools["APDB"].Return(APDB); Station.SFCDB = null; Station.APDB = null; MESStation.MESReturnView.Station.CallStationReturn ret = new MESReturnView.Station.CallStationReturn(); ret.Station = Station; Station.StationMessages.Add(new MESReturnView.Station.StationMessage() { Message = ee.Message, State = MESReturnView.Station.StationMessageState.Fail }); Station.NextInput = CurrInput; StationReturn.Data = ret; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "Station '" + DisplayName + "' Input not successfull."; } }
public static void LoadSampleLotByPackNo(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } string packNo = Input.Value.ToString(); #region 用於界面上顯示的批次信息 R_LOT_STATUS rLotStatus = new R_LOT_STATUS(); List <R_LOT_PACK> rLotPackList = new List <R_LOT_PACK>(); #endregion T_R_LOT_STATUS tRLotStatus = new T_R_LOT_STATUS(Station.SFCDB, Station.DBType); T_R_LOT_PACK rRLotPack = new T_R_LOT_PACK(Station.SFCDB, Station.DBType); List <R_LOT_STATUS> rLotStatusList = tRLotStatus.getSampleLotByPackNo(packNo, Station.SFCDB); if (rLotStatusList.FindAll(t => t.CLOSED_FLAG == "1").Count > 1) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529105040", new string[] { packNo })); } else if (rLotStatusList.FindAll(t => t.CLOSED_FLAG == "0").Count > 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529111019", new string[] { packNo, rLotStatusList.Find(t => t.CLOSED_FLAG == "0").LOT_NO })); } else if (rLotStatusList.FindAll(t => t.CLOSED_FLAG != "2").Count == 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529111245", new string[] { packNo })); } rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "1"); rLotPackList = rRLotPack.GetRLotPackByLotNo(Station.SFCDB, rLotStatus.LOT_NO); #region 加載界面信息 MESStationSession lotNoSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; MESStationSession skuNoSession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; MESStationSession aqlSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; MESStationSession lotQtySession = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; MESStationSession sampleQtySession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; MESStationSession rejectQtySession = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input }; MESStationSession sampleQtyWithAQLSession = new MESStationSession() { MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input }; MESStationSession passQtySession = new MESStationSession() { MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input }; MESStationSession failQtySession = new MESStationSession() { MESDataType = Paras[8].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[8].SESSION_KEY, ResetInput = Input }; Station.StationSession.Clear(); Station.StationSession.Add(lotNoSession); Station.StationSession.Add(skuNoSession); Station.StationSession.Add(aqlSession); Station.StationSession.Add(lotQtySession); Station.StationSession.Add(sampleQtySession); Station.StationSession.Add(rejectQtySession); Station.StationSession.Add(sampleQtyWithAQLSession); Station.StationSession.Add(passQtySession); Station.StationSession.Add(failQtySession); lotNoSession.Value = rLotStatus.LOT_NO; skuNoSession.Value = rLotStatus.SKUNO; aqlSession.Value = rLotStatus.AQL_TYPE; lotQtySession.Value = rLotStatus.LOT_QTY; sampleQtySession.Value = rLotStatus.SAMPLE_QTY; rejectQtySession.Value = rLotStatus.REJECT_QTY; sampleQtyWithAQLSession.Value = rLotStatus.PASS_QTY + rLotStatus.FAIL_QTY; passQtySession.Value = rLotStatus.PASS_QTY; failQtySession.Value = rLotStatus.FAIL_QTY; MESStationInput s = Station.Inputs.Find(t => t.DisplayName == Paras[9].SESSION_TYPE); s.DataForUse.Clear(); foreach (var VARIABLE in rLotPackList) { s.DataForUse.Add(VARIABLE.PACKNO); } MESStationInput snInput = Station.Inputs.Find(t => t.DisplayName == "SN"); MESStationInput packInput = Station.Inputs.Find(t => t.DisplayName == "PACKNO"); MESStationInput scanTypeInput = Station.Inputs.Find(t => t.DisplayName == "ScanType"); packInput.Visable = false; snInput.Visable = true; scanTypeInput.Visable = true; #endregion }
public static void SNLinkMainSNKPAction(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > KPList_Temp = new List <Dictionary <string, string> >(); Dictionary <string, string> DicKP = new Dictionary <string, string>(); List <C_KEYPART> MainKP = null; C_KEYPART MainKP_Temp = null; WorkOrder WO = null; SN MainSnObj = null; SN SubSnObj = null; string SubSn = ""; string ErrMessage = string.Empty; if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession SubSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SubSNSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } MESStationSession MainSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (MainSNSession == null) { MainSNSession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(MainSNSession); } MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (MainKPSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY })); } MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (KPListSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY })); } MainSnObj = (SN)MainSNSession.Value; SubSnObj = (SN)SubSNSession.Value; MainKP = (List <C_KEYPART>)MainKPSession.Value; MainKP_Temp = MainKP.Find(c => c.PART_NO == MainSnObj.SkuNo); if (MainKP_Temp == null) { throw new Exception("MainSN 料號與配置的料號不一致!"); } KPList = (List <Dictionary <string, string> >)KPListSession.Value; //SubSn = KPList.Find(kp => kp["KP_TYPE"].ToString() == "SUB_SN")["SUB_SN"].ToString(); DicKP["SN"] = SubSnObj.SerialNo; DicKP["SN_ID"] = SubSnObj.ID; DicKP["KEYPART_SN"] = MainSnObj.SerialNo; DicKP["KP_SN_ID"] = MainSnObj.ID; DicKP["PART_NO"] = MainSnObj.SkuNo; DicKP["SEQ_NO"] = MainKP_Temp.SEQ_NO.ToString(); DicKP["CATEGORY_NAME"] = MainKP_Temp.CATEGORY_NAME; DicKP["CATEGORY"] = MainKP_Temp.CATEGORY; DicKP["KP_TYPE"] = "MAIN_SN"; KPList.Add(DicKP); KPListSession.Value = KPList; }
/// <summary> /// 檢查Pack狀態是否可以入OBA /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void CheckPackStatusInOba(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { DisplayOutPut Dis_LotNo = Station.DisplayOutput.Find(t => t.Name == "LOTNO"); DisplayOutPut Dis_SkuNo = Station.DisplayOutput.Find(t => t.Name == "SKUNO"); DisplayOutPut Dis_Ver = Station.DisplayOutput.Find(t => t.Name == "VER"); MESStationInput Level = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL"); MESStationSession packSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); #region 用於界面上顯示的批次信息 R_LOT_STATUS rLotStatus = new R_LOT_STATUS(); List <R_LOT_PACK> rLotPackList = new List <R_LOT_PACK>(); List <string> cAqlLevel = new List <string>(); #endregion T_R_PACKING t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType); //add by fgg 2018.6.28 卡棧板是否關閉,避免棧板還沒有關閉就拿去抽檢OBA,導致抽檢總數異常,進而導致OBA抽檢數量不對 if (!t_r_packing.CheckCloseByPackno(packSession.Value.ToString(), Station.SFCDB)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180611104338", new string[] { packSession.Value.ToString() })); } LotNo LotNo = new LotNo(Station.DBType); T_R_LOT_PACK tRLotPack = new T_R_LOT_PACK(Station.SFCDB, Station.DBType); rLotPackList = tRLotPack.GetRLotPackWithWaitClose(Station.SFCDB, packSession.Value.ToString()); List <R_LOT_STATUS> rLotStatusList = tRLotPack.GetRLotStatusWithWaitClose(Station.SFCDB, packSession.Value.ToString()); rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "1"); if (rLotStatus != null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526181007", new string[] { packSession.Value.ToString() })); } else { rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0"); } if (Dis_LotNo.Value.Equals("")) { #region 當前Lot為空=>檢查當前Pack無有效LOT?新建LOT:加載LOT; if (rLotPackList.Count == 0) { rLotStatus = LotNo.CreateLotByPackno(Station.LoginUser, packSession.Value.ToString(), Station.SFCDB); rLotPackList.Add( new R_LOT_PACK() { LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString() }); } else { rLotStatus = rLotStatusList.Find(t => t.CLOSED_FLAG == "0"); } #endregion } else { #region 當前Lot不為空=>PackNo與當前頁面LOT的機種版本是否一致?ReLoad LOT信息:Throw e; T_R_PACKING tRPacking = new T_R_PACKING(Station.SFCDB, Station.DBType); Row_R_PACKING rowRPacking = tRPacking.GetRPackingByPackNo(Station.SFCDB, packSession.Value.ToString()); if (!rowRPacking.SKUNO.Equals(Dis_SkuNo.Value.ToString())) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185434", new string[] { packSession.Value.ToString() })); } if (rLotPackList.Count == 0) { rLotStatus = LotNo.ObaInLotByPackno(Station.User, rLotStatus, packSession.Value.ToString(), Level.Value.ToString(), Station.SFCDB); rLotPackList.Add(new R_LOT_PACK() { LOTNO = rLotStatus.LOT_NO, PACKNO = packSession.Value.ToString() }); } else { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185618", new string[] { packSession.Value.ToString(), rLotStatus.LOT_NO })); } #endregion } #region 加載AQL等級 T_C_AQLTYPE tCAqlType = new T_C_AQLTYPE(Station.SFCDB, Station.DBType); cAqlLevel = tCAqlType.GetAqlLevelByType(rLotStatus.AQL_TYPE, Station.SFCDB); T_C_SKU_AQL tCSkuAql = new T_C_SKU_AQL(Station.SFCDB, Station.DBType); C_SKU_AQL cSkuAql = tCSkuAql.GetSkuAql(Station.SFCDB, rLotStatus.SKUNO); #endregion #region 加載界面信息 MESStationSession lotNoSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; MESStationSession skuNoSession = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; MESStationSession aqlSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; MESStationSession lotQtySession = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input }; MESStationSession sampleQtySession = new MESStationSession() { MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input }; MESStationSession RejectQtySession = new MESStationSession() { MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input }; Station.StationSession.Clear(); Station.StationSession.Add(lotNoSession); Station.StationSession.Add(skuNoSession); Station.StationSession.Add(aqlSession); Station.StationSession.Add(lotQtySession); Station.StationSession.Add(sampleQtySession); Station.StationSession.Add(RejectQtySession); lotNoSession.Value = rLotStatus.LOT_NO; skuNoSession.Value = rLotStatus.SKUNO; aqlSession.Value = rLotStatus.AQL_TYPE; lotQtySession.Value = rLotStatus.LOT_QTY; sampleQtySession.Value = rLotStatus.SAMPLE_QTY; RejectQtySession.Value = rLotStatus.REJECT_QTY; MESStationInput s = Station.Inputs.Find(t => t.DisplayName == Paras[1].SESSION_TYPE); s.DataForUse.Clear(); foreach (var VARIABLE in rLotPackList) { s.DataForUse.Add(VARIABLE.PACKNO); } MESStationInput l = Station.Inputs.Find(t => t.DisplayName == "AQLLEVEL"); l.DataForUse.Clear(); foreach (string VARIABLE in cAqlLevel) { l.DataForUse.Add(VARIABLE); } //設置默認等級 l.Value = cSkuAql.DEFAULLEVEL; #endregion }
/// <summary> /// 加載REWORK工站ROUTE LIST站 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void RouteDetailDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; List <string> NoCheckStation = new List <string>(); MESStationSession StationSave = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (StationSave == null) { StationSave = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(StationSave); } MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WoSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } WorkOrder ObjWo = (WorkOrder)WoSession.Value; List <R_Station_Action_Para> NoCheckSession = Paras.FindAll(t => t.SESSION_TYPE.Equals("NOCHECK")); try { MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "StationName"); List <object> snStationList = I.DataForUse; snStationList.Clear(); snStationList.Add(""); ///BY SDL 加載頁面默認賦予空值,操作員必須點選其他有內容選項 Route routeDetail = new Route(ObjWo.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); List <RouteDetail> routeDetailList = routeDetail.DETAIL; RouteDetail h = routeDetailList.Find(t => t.STATION_NAME == ObjWo.START_STATION); if (h == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000204", new string[] { ObjWo.WorkorderNo, ObjWo.START_STATION }); throw new MESReturnMessage(ErrMessage); } for (int i = 0; i < routeDetailList.Count; i++) { if (routeDetailList[i].SEQ_NO <= h.SEQ_NO) { snStationList.Add(routeDetailList[i].STATION_NAME); if (routeDetailList[i].DIRECTLINKLIST != null) { foreach (var item in routeDetailList[i].DIRECTLINKLIST) { snStationList.Add(item.STATION_NAME); } } } } for (int i = 0; i < NoCheckSession.Count; i++) { snStationList.Remove(NoCheckSession[i].VALUE.ToString()); } StationSave.Value = snStationList; Station.AddMessage("MES00000029", new string[] { "RouteID :", ObjWo.RouteID }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw ex; } }