public static void SetNextInputActionForShipFinish(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string dnNo = Station.DisplayOutput.Find(t => t.Name == "DN_NO").Value.ToString(), dnLine = Station.DisplayOutput.Find(t => t.Name == "DN_ITEM").Value.ToString(); var dnComplete = Station.SFCDB.ORM.Queryable <R_DN_STATUS>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine && x.DN_FLAG == "1").Any(); #region 加載界面信息 if (dnComplete) { Station.StationSession.Clear(); MESStationInput s = Station.Inputs.Find(t => t.DisplayName == "TO_LIST"); s.Value = 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, SqlSugar.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(); } var rShipDetail = Station.SFCDB.ORM.Queryable <R_SHIP_DETAIL>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine).ToList(); Station.StationSession.Find(x => x.MESDataType == "REAL_QTY").Value = rShipDetail.Count; MESStationInput sp = Station.Inputs.Find(t => t.DisplayName == "PACKNO"); sp.Value = ""; #endregion }
public static void OutLot(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec DB = Station.SFCDB; string strSql = ""; var SN_Session = Station.StationSession.Find(t => t.MESDataType == "SN" && t.SessionKey == "1"); SN sn = (SN)SN_Session.Value; var LotStates = DB.ORM.Queryable <R_LOT_STATUS, R_LOT_DETAIL> ((lot, detail) => lot.LOT_NO == detail.LOT_ID) .Where((lot, detail) => detail.SN == sn.SerialNo && detail.STATUS == "0" && SqlFunc.StartsWith(lot.LOT_NO, "LOT-")) .Select((lot, detail) => new { LOT = lot, Detail = detail }).ToList(); if (LotStates.Count == 0) { throw new Exception($@"{sn.SerialNo } not in Lot"); } T_R_SN TRS = new T_R_SN(DB, DB_TYPE_ENUM.Oracle); for (int i = 0; i < LotStates.Count; i++) { var LS = LotStates[i]; LS.Detail.STATUS = "1"; LS.Detail.EDIT_EMP = Station.LoginUser.EMP_NO; LS.Detail.EDIT_TIME = DateTime.Now; DB.ORM.Updateable <R_LOT_DETAIL>(LS.Detail).Where(t => t.ID == LS.Detail.ID).ExecuteCommand(); TRS.RecordPassStationDetail(sn.SerialNo, Station.Line, Station.StationName, LS.LOT.SAMPLE_STATION, Station.BU, DB); Station.StationMessages.Add(new StationMessage() { Message = $@"'{sn.SerialNo}' Scanout Lot'{LS.LOT.LOT_NO}','{LS.LOT.SAMPLE_STATION}'", State = StationMessageState.Message }); } }
public static void LoadSn(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } string NewSN = Input.Value.ToString(); if (NewSN.Length != 8 && NewSN.Length != 9) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000022", new string[] { "SN" })); } else { Input.Value = NewSN.Substring(0, 8); } MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (s == null) { s = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(s); } }
public static void TEST1(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string SN = SNMaker.SNmaker.GetNextSN("TEST", Station.SFCDB); Station.StationMessages.Add(new StationMessage() { Message = SN, State = StationMessageState.Message }); }
public static void SetNextInput(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { MESStationInput input = Station.Inputs.Find(t => t.DisplayName == Paras[0].VALUE.ToString().Trim()); if (input != null) { Station.NextInput = input; } }
public static void InputsEnable(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { for (int i = 0; i < Paras.Count; i++) { MESStationInput input = Station.Inputs.Find(t => t.DisplayName == Paras[i].VALUE.ToString().Trim()); if (input != null) { input.Enable = true; } } }
public static void LOTNOINPUT(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec DB = Station.SFCDB; string LOTNO = Input.Value.ToString().ToUpper(); T_R_LOT_STATUS TRLS = new T_R_LOT_STATUS(Station.SFCDB, DB_TYPE_ENUM.Oracle); var LOT_COUNT_session = Station.StationSession.Find(t => t.MESDataType == "LOT_COUNT" && t.SessionKey == "1"); if (LOT_COUNT_session == null) { LOT_COUNT_session = new MESStationSession() { MESDataType = "LOT_COUNT", SessionKey = "1", Value = 0 }; Station.StationSession.Add(LOT_COUNT_session); } var Lot = TRLS.GetByLotNo(LOTNO, DB); if (Lot.ID == null || Lot.ID == "") { throw new Exception($@"LotNo '{LOTNO}' is not exten"); } if (Lot.CLOSED_FLAG == "1") { throw new Exception($@"LotNo '{LOTNO}' is closed"); } if (Lot.SAMPLE_STATION != Station.DisplayName) { throw new Exception($@"LotNo '{LOTNO}' is use to '{Lot.SAMPLE_STATION}'"); } var LOT_session = Station.StationSession.Find(t => t.MESDataType == "LOTNO" && t.SessionKey == "1"); if (LOT_session == null) { LOT_session = new MESStationSession() { MESDataType = "LOTNO", SessionKey = "1" }; Station.StationSession.Add(LOT_session); } LOT_session.Value = LOTNO; int count = DB.ORM.Queryable <R_LOT_DETAIL>().Where(t => t.LOT_ID == Lot.ID).Count(); LOT_COUNT_session.Value = count; Station.NextInput = Station.Inputs[1]; }
public static void CheckPackNoAndDnLineStatus(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string packNo = Input.Value.ToString(), dnNo = Station.DisplayOutput.Find(t => t.Name == "DN_NO").Value.ToString(), dnLine = Station.DisplayOutput.Find(t => t.Name == "DN_ITEM").Value.ToString(), skuNo = Station.DisplayOutput.Find(t => t.Name == "SKU_NO").Value.ToString(); if (dnNo.Length == 0 && dnLine.Length == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180801113040")); } var rPacking = new PalletBase(packNo, Station.SFCDB); if (rPacking.GetCount(Station.SFCDB) != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180602102010", new string[] { packNo })); } if (!rPacking.DATA.SKUNO.Equals(skuNo)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180801085546", new string[] { packNo, rPacking.DATA.SKUNO, dnNo, dnLine, skuNo })); } var rDnStatus = Station.SFCDB.ORM.Queryable <R_DN_STATUS>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine && x.DN_FLAG == "0").ToList(); if (rDnStatus.Count != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731133647", new string[] { dnNo, dnLine })); } var rShipDetail = Station.SFCDB.ORM.Queryable <R_SHIP_DETAIL>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine).ToList(); var packSnQty = rPacking.GetSnCount(Station.SFCDB); if (packSnQty > rDnStatus.FirstOrDefault().QTY - rShipDetail.Count) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180801091520", new string[] { packNo, packSnQty.ToString(), rDnStatus.FirstOrDefault().QTY.ToString() })); } rShipDetail = Station.SFCDB.ORM.Queryable <R_SHIP_DETAIL, R_PACKING, R_SN_PACKING>((rsd, rp, rsp) => rsd.ID == rsp.SN_ID && rp.ID == rsp.PACK_ID && rp.PARENT_PACK_ID == rPacking.DATA.ID).Select((rsd, rp, rsp) => rsd).ToList(); if (rShipDetail.Count > 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180802105858", new string[] { packNo })); } }
/// <summary> /// 栈板出货 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void PalletShipOut(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string packNo = Input.Value.ToString(), dnNo = Station.DisplayOutput.Find(t => t.Name == "DN_NO").Value.ToString(), dnLine = Station.DisplayOutput.Find(t => t.Name == "DN_ITEM").Value.ToString(); T_R_SN rSn = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle); var rDnStatus = Station.SFCDB.ORM.Queryable <R_DN_STATUS>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine && x.DN_FLAG == "0").ToList().FirstOrDefault(); rSn.PalletShipOutRecord(packNo, Station.LoginUser.EMP_NO, Station.Line, Station.BU, Station.StationName, rDnStatus, Station.SFCDB); if (rDnStatus.DN_FLAG == "1") { Station.StationMessages.Add(new StationMessage() { Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180802154903", new string[] { dnNo, dnLine }) }); } }
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 }
public static void LotClose(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec DB = Station.SFCDB; string strSql = ""; var LOT_session = Station.StationSession.Find(t => t.MESDataType == "LOTNO" && t.SessionKey == "1"); if (LOT_session == null) { LOT_session = new MESStationSession() { MESDataType = "LOTNO", SessionKey = "1" }; Station.StationSession.Add(LOT_session); } T_R_LOT_STATUS TRLS = new T_R_LOT_STATUS(DB, DB_TYPE_ENUM.Oracle); Row_R_LOT_STATUS RRLS = (Row_R_LOT_STATUS)TRLS.NewRow(); string lotno = ""; if (LOT_session.Value == null) { return; } else { lotno = LOT_session.Value.ToString(); strSql = $@"select * from R_LOT_STATUS where lot_no = '{lotno}'"; var d = DB.RunSelect(strSql); RRLS.loadData(d.Tables[0].Rows[0]); } RRLS.CLOSED_FLAG = "1"; RRLS.EDIT_EMP = Station.LoginUser.EMP_NO; RRLS.EDIT_TIME = DateTime.Now; RRLS.LOT_QTY = DB.ORM.Queryable <R_LOT_DETAIL>().Where(t => t.LOT_ID == lotno).Count(); DB.ExecSQL(RRLS.GetUpdateString(DB_TYPE_ENUM.Oracle)); Station.StationSession.Clear(); Station.NextInput = Station.Inputs[0]; }
/// <summary> /// 從輸入加載工單 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras">1個參數,WO保存的位置</param> public static void WoDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession Swo = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (Swo == null) { Swo = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(Swo); } WorkOrder ObjWorkorder = new WorkOrder(); string WOSavePoint = Input.Value.ToString(); try { ObjWorkorder.Init(WOSavePoint, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); if (ObjWorkorder == null) { //throw new Exception("Can Not Find " + WOSavePoint + " 'Information ' !"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000189", new string[] { WOSavePoint })); } Swo.Value = ObjWorkorder; Station.AddMessage("MES00000029", new string[] { "Workorder", WOSavePoint }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }
/// <summary> /// 維修輸入加載TR_SN的DataRow對象,并把KP_NO,MFR_Name,Date_Code,Lot_Code到加載到對應輸入框的值 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void RepairTRSNObjDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057")); } string inputValue = Input.Value.ToString(); MESStationSession sessionTRSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionTRSN == null) { sessionTRSN = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionTRSN); } try { AP_DLL APDLL = new AP_DLL(); List <DataRow> TRSNlist = APDLL.R_TR_SN_GetBYTR_SN(inputValue, Station.APDB); if (TRSNlist.Count == 0) { Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value = ""; Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value = ""; Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = ""; Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value = ""; Station.Inputs.Find(input => input.DisplayName == "TR_SN").Value = ""; throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + inputValue, "R_TR_SN" })); } else { Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value = TRSNlist[0]["CUST_KP_NO"].ToString(); Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value = TRSNlist[0]["MFR_KP_NO"].ToString(); Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = TRSNlist[0]["DATE_CODE"].ToString(); Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value = TRSNlist[0]["Lot_Code"].ToString(); Dictionary <string, DataRow> TRSNInfo = new Dictionary <string, DataRow>(); TRSNInfo.Add("TR_SN", TRSNlist[0]); sessionTRSN.Value = TRSNlist[0]; sessionTRSN.InputValue = inputValue; sessionTRSN.ResetInput = Input; Station.NextInput = Station.Inputs.Find(input => input.DisplayName == "Description"); Station.AddMessage("MES00000001", new string[] { inputValue }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } } catch (Exception ex) { throw ex; } }
//Add by LLF 2017-01-26 End /// <summary> /// TR_SN數據對象加載其中每個欄位 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void LoadDataFromTRSNDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { object TRSN_SessionObject; if (Paras.Count == 0) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } try { MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TRSN_Session == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } else if (TRSN_Session.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } TRSN_SessionObject = TRSN_Session.Value; //獲取TR_SN 欄位數據 Dictionary <string, DataRow> dd = (Dictionary <string, DataRow>)TRSN_SessionObject; DataRow tr; dd.TryGetValue("R_TR_SN", out tr); MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "KP_NO"); List <object> ret = I.DataForUse; ret.Clear(); if (I != null) { ret.Add(tr["CUST_KP_NO"].ToString()); } MESStationInput I1 = Station.Inputs.Find(t => t.DisplayName == "MFR_Name"); List <object> ret1 = I1.DataForUse; if (I1 != null) { ret1.Add(tr["MFR_KP_NO"].ToString()); } MESStationInput I2 = Station.Inputs.Find(t => t.DisplayName == "Date_Code"); List <object> ret2 = I2.DataForUse; if (I2 != null) { ret2.Add(tr["DATE_CODE"].ToString()); } MESStationInput I3 = Station.Inputs.Find(t => t.DisplayName == "Lot_Code"); List <object> ret3 = I3.DataForUse; if (I3 != null) { ret3.Add(tr["LOT_CODE"].ToString()); } Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
/// <summary> /// 加載SKU在Allpart的配置信息從Allpart系統加載mes1.c_product_config, mes4.r_pcba_link /// 將查詢到的結果存入Dictionary<string_Datarow> 中, key為表名如:" c_product_config " /// 2018/1/3 肖倫 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SkuAPInfoDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string StrSku = ""; string StrVer = ""; SKU sku = new SKU(); OleExec apdb = null; Dictionary <string, List <DataRow> > APInfo = new Dictionary <string, List <DataRow> >(); if (Paras.Count != 2) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } MESStationSession APConfig_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (APConfig_Session == null) { APConfig_Session = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(APConfig_Session); } MESStationSession Wo_Session = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (Wo_Session == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); } //Modify by LLF 2017-01-25 For 獲取工單對象,從工單對象中獲取料號,版本 //MESStationSession Sku_Session = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); //if (Sku_Session == null) //{ // throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); //} //else //{ // sku = (SKU)Sku_Session.Value; // if (sku == null || sku.SkuNo == null || sku.SkuNo.Length <= 0) // { // throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); // } // if (sku.Version == null || sku.Version.Length <= 0) // { // throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY + " Version" })); // } //} //獲取ALLPART數據 try { StrSku = ((MESStation.LogicObject.WorkOrder)Wo_Session.Value).SkuNO; StrVer = ((MESStation.LogicObject.WorkOrder)Wo_Session.Value).SKU_VER; apdb = Station.APDB; AP_DLL APDLL = new AP_DLL(); List <DataRow> ConfigList = APDLL.C_Product_Config_GetBYSkuAndVerson(StrSku, StrVer, apdb); if (ConfigList.Count <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "SKU:" + StrSku + ",VER:" + StrVer, "C_PRODUCT_CONFIG" })); } APInfo.Add("C_PRODUCT_CONFIG", ConfigList); List <DataRow> PCBALinkList = APDLL.R_PCBA_LINK_GetBYSku(StrSku, apdb); if (PCBALinkList.Count <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "SKU:" + StrSku, "R_PCBA_LINK" })); } APInfo.Add("R_PCBA_LINK", PCBALinkList); APConfig_Session.Value = APInfo; Station.AddMessage("MES00000001", new string[] { StrSku }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); //Modify By LLF 2018-01-25 For 料號&版本從工單對象中獲取,而不是從C_SKU 中獲取 /* List<DataRow> ConfigList = APDLL.C_Product_Config_GetBYSkuAndVerson(sku.SkuNo, sku.Version, apdb); * if (ConfigList.Count <= 0) * { * throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "SKU:" + sku.SkuNo, "C_PRODUCT_CONFIG" })); * } * APInfo.Add("C_PRODUCT_CONFIG", ConfigList); * List<DataRow> PCBALinkList = APDLL.R_PCBA_LINK_GetBYSku(sku.SkuNo, apdb); * if (PCBALinkList.Count <= 0) * { * throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "SKU:" + sku.SkuNo, "R_PCBA_LINK" })); * } * APInfo.Add("R_PCBA_LINK", PCBALinkList); * APConfig_Session.Value = APInfo; * Station.DBS["APDB"].Return(apdb); * Station.AddMessage("MES00000001", new string[] { sku.SkuNo }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); */ } catch (Exception ex) { if (apdb != null) { } throw ex; } }
//Add by LLF 2017-01-26 Begin public static void TrCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string Process = ""; string Message = ""; string StrWO = ""; string StrCode = ""; string IP = string.Empty; OleExec APDB = null; Dictionary <string, DataRow> TrSnTable = null; T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType); MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(Message); } StrWO = WoSession.Value.ToString(); //獲取 TRSN 對象 MESStationSession TrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (TrSnSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(Message); } TrSnTable = (Dictionary <string, DataRow>)TrSnSession.Value; Process = Paras[2].VALUE.ToString(); IP = Paras[3].VALUE.ToString(); try { APDB = Station.APDB; StrCode = Table.GetAPTrCode(StrWO, TrSnTable["R_TR_SN"]["TR_SN"].ToString(), Process, Station.LoginUser.EMP_NO, IP, APDB); MESStationSession TrCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (TrCodeSession == null) { TrCodeSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TrCodeSession); } TrCodeSession.Value = StrCode; Station.AddMessage("MES00000001", new string[] { TrCodeSession.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw (ex); } }
/// <summary> /// TR_SN數據加載,查詢R_TR_SN,R_TR_SN_WIP的數據保存到Dictionary<string_Datarow>中,key為表名 "R_TR_SN","R_TR_SN_WIP" /// 2018/1/3 肖倫 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void TRSNDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { Dictionary <string, DataRow> APInfo = new Dictionary <string, DataRow>(); string strTRSN = ""; string ErrMessage = ""; OleExec apdb = null; if (Paras.Count != 1) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } strTRSN = Input.Value.ToString(); MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TRSN_Session == null) { TRSN_Session = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TRSN_Session); } else { TRSN_Session.ResetInput = Input; TRSN_Session.InputValue = strTRSN; } //獲取ALLPART數據 APInfo = new Dictionary <string, DataRow>(); AP_DLL APDLL = new AP_DLL(); try { apdb = Station.APDB; List <DataRow> TRSNlist = APDLL.R_TR_SN_GetBYTR_SN(strTRSN, apdb); if (TRSNlist.Count <= 0) { //throw new Exception("TRSN:" + "不存在ALLPART系統R_TR_SN中"); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + strTRSN, "R_TR_SN" })); } else { APInfo.Add("R_TR_SN", TRSNlist[0]); } List <DataRow> TRSNWIPlist = APDLL.R_TR_SN_WIP_GetBYTR_SN(strTRSN, apdb); if (TRSNWIPlist.Count <= 0) { //throw new Exception("TRSN:" + "不存在ALLPART系統R_TR_SN_WIP中"); //throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + strTRSN, "R_TR_SN_WIP" })); APInfo.Add("R_TR_SN_WIP", null); } else { APInfo.Add("R_TR_SN_WIP", TRSNWIPlist[0]); } TRSN_Session.Value = APInfo; Station.AddMessage("MES00000001", new string[] { TRSN_Session.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { if (apdb != null) { } throw ex; } }
/// <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 WoSessionUpdateAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; string StrWO = ""; if (Paras.Count != 9) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000051", new string[] { "3", Paras.Count.ToString() }); throw new MESReturnMessage(ErrMessage); } MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } MESStationSession WoQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WoQtySession == null) { WoQtySession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoQtySession); } MESStationSession WoSkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (WoSkuSession == null) { WoSkuSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoSkuSession); } MESStationSession WoSkuVerSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (WoSkuVerSession == null) { WoSkuVerSession = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoSkuVerSession); } MESStationSession WoInputQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (WoInputQtySession == null) { WoInputQtySession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoInputQtySession); } MESStationSession WoFinishQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY); if (WoFinishQtySession == null) { WoFinishQtySession = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoFinishQtySession); } MESStationSession WoStatusSession = Station.StationSession.Find(t => t.MESDataType == Paras[6].SESSION_TYPE && t.SessionKey == Paras[6].SESSION_KEY); if (WoStatusSession == null) { WoStatusSession = new MESStationSession() { MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoStatusSession); } MESStationSession WoRouteIDSession = Station.StationSession.Find(t => t.MESDataType == Paras[7].SESSION_TYPE && t.SessionKey == Paras[7].SESSION_KEY); if (WoRouteIDSession == null) { WoRouteIDSession = new MESStationSession() { MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoRouteIDSession); } MESStationSession WoRouteNameSession = Station.StationSession.Find(t => t.MESDataType == Paras[8].SESSION_TYPE && t.SessionKey == Paras[8].SESSION_KEY); if (WoRouteNameSession == null) { WoRouteNameSession = new MESStationSession() { MESDataType = Paras[8].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[8].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WoRouteNameSession); } WorkOrder WoObj = (WorkOrder)WoSession.Value; StrWO = WoObj.WorkorderNo; WorkOrder WO = new WorkOrder(); WO.Init(StrWO, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); WoSession.Value = WO; WoQtySession.Value = WO.WORKORDER_QTY; WoSkuSession.Value = WO.SkuNO; WoSkuVerSession.Value = WO.SKU_VER; WoInputQtySession.Value = WO.INPUT_QTY; WoFinishQtySession.Value = WO.FINISHED_QTY; WoStatusSession.Value = WO.CLOSED_FLAG; WoRouteIDSession.Value = WO.RouteID; if (WO.ROUTE != null) { WoRouteNameSession.Value = WO.ROUTE.ROUTE_NAME; } else { WoRouteNameSession.Value = ""; } }
public static void CutWOAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; int WoQty = 0; int WoInputQty = 0; int CutQty = 0; string StrWO = ""; WorkOrder WO = new WorkOrder(); T_R_WO_BASE R_Wo_Base = new T_R_WO_BASE(Station.SFCDB, Station.DBType); if (Paras.Count != 5) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000051", new string[] { "3", Paras.Count.ToString() }); throw new MESReturnMessage(ErrMessage); } MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } WorkOrder WoObj = (WorkOrder)WoSession.Value; StrWO = WoObj.WorkorderNo; MESStationSession WoQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WoQtySession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } WoQty = Convert.ToInt16(WoQtySession.Value); MESStationSession CutQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (CutQtySession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } CutQty = Convert.ToInt16(CutQtySession.Value); MESStationSession WoInputQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (WoInputQtySession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } WoInputQty = Convert.ToInt16(WoInputQtySession.Value); MESStationSession WoFinishQtySession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (WoFinishQtySession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } WoInputQty = Convert.ToInt16(WoInputQtySession.Value); if (WoQty - WoInputQty < CutQty) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000208", new string[] { StrWO, CutQty.ToString(), (WoQty - WoInputQty).ToString() }); throw new MESReturnMessage(ErrMessage); } int Result = R_Wo_Base.UpdateWoQty(StrWO, CutQty, Station.LoginUser.EMP_NO, Station.SFCDB); if (Result > 0) { WO.Init(StrWO, Station.SFCDB, Station.DBType); WoInputQtySession.Value = WO.INPUT_QTY; WoFinishQtySession.Value = WO.FINISHED_QTY; WoQtySession.Value = WO.WORKORDER_QTY; Station.AddMessage("MES00000210", new string[] { StrWO, CutQty.ToString() }, StationMessageState.Pass); //回饋消息到前台 } else { Station.AddMessage("MES00000209", new string[] { StrWO, CutQty.ToString() }, StationMessageState.Fail);//回饋消息到前台 } }
//Add by LLF 2018-02-19 Begin public static void PTHTrCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string Message = ""; string StrWO = ""; string StrCode = ""; string StationName = string.Empty; string StrStationNum = string.Empty; OleExec APDB = null; T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType); MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WOSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(Message); } StrWO = WOSession.Value.ToString(); //獲取 TRSN 對象 MESStationSession StationNumSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (StationNumSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(Message); } StrStationNum = StationNumSession.Value.ToString(); //StationName = Station.Line + Station.StationName + StrStationNum; var pStation = Paras.Find(t => t.SESSION_TYPE == "PTHSTATION"); StrStationNum = StationNumSession.Value.ToString(); if (pStation == null) { StationName = Station.Line + Station.StationName + StrStationNum; } else { StationName = Station.Line + pStation.VALUE + StrStationNum; } try { APDB = Station.APDB; StrCode = Table.GetAPPTHTrCode(StrWO, StationName, APDB); MESStationSession PTHTrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (PTHTrSnSession == null) { PTHTrSnSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(PTHTrSnSession); } PTHTrSnSession.Value = StrCode; Station.AddMessage("MES00000001", new string[] { PTHTrSnSession.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw (ex); } }
/// <summary> /// 加載TR_SN的KP_NO,MFR_Name,Date_Code,Lot_Code到MESStationSession,以便輸出 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void TRSNInfoDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { object TRSN_SessionObject; if (Paras.Count == 0) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } try { MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TRSN_Session == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } else if (TRSN_Session.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } MESStationSession sessionKPNO = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionKPNO == null) { sessionKPNO = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionKPNO); } MESStationSession sessionMFRName = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (sessionMFRName == null) { sessionMFRName = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionMFRName); } MESStationSession sessionDateCode = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (sessionDateCode == null) { sessionDateCode = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionDateCode); } MESStationSession sessionLotCode = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (sessionLotCode == null) { sessionLotCode = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionLotCode); } TRSN_SessionObject = TRSN_Session.Value; //獲取TR_SN 欄位數據 Dictionary <string, DataRow> dd = (Dictionary <string, DataRow>)TRSN_SessionObject; DataRow tr; dd.TryGetValue("R_TR_SN", out tr); if (tr != null) { sessionKPNO.Value = tr["CUST_KP_NO"].ToString(); sessionMFRName.Value = tr["MFR_KP_NO"].ToString(); sessionDateCode.Value = tr["DATE_CODE"].ToString(); sessionLotCode.Value = tr["Lot_Code"].ToString(); Station.Inputs.Find(input => input.Name == Paras[1].SESSION_TYPE).Value = tr["CUST_KP_NO"].ToString(); Station.Inputs.Find(input => input.Name == Paras[2].SESSION_TYPE).Value = tr["MFR_KP_NO"].ToString(); Station.Inputs.Find(input => input.Name == Paras[3].SESSION_TYPE).Value = tr["DATE_CODE"].ToString(); Station.Inputs.Find(input => input.Name == Paras[4].SESSION_TYPE).Value = tr["Lot_Code"].ToString(); } Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根據SN的SKUNO帶出維修LOCATION /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void LocationFromSNDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { List <string> LocationList = new List <string>(); string ErrMessage = ""; OleExec apdb = null; if (Paras.Count != 1) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SNSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } SN ObjSn = (SN)SNSession.Value; //獲取ALLPART數據 AP_DLL APDLL = new AP_DLL(); MESStationInput I = Station.Inputs.Find(t => t.DisplayName == "Location"); List <object> ret = I.DataForUse; ret.Clear(); try { apdb = Station.APDB; LocationList = APDLL.GetLocationList(ObjSn.SkuNo, apdb); if (LocationList.Count <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { })); } else { foreach (object item in LocationList) { ret.Add(item); } } Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { if (apdb != null) { } throw ex; } }
/// <summary> /// 獲取批次抽樣數量 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras">1個參數,SKU 保存的位置</param> public static void GetSampleQtyDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { Row_C_SKU_SAMPLE RLotSku; Row_C_AQLTYPE RAqltype; T_C_AQLTYPE QR = new T_C_AQLTYPE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); T_C_SKU_SAMPLE TR = new T_C_SKU_SAMPLE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); if (Paras.Count != 10) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession SessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession SessionSKU = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); MESStationSession SessionAQLTYPE = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); MESStationSession SessionLotQTY = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); MESStationSession SessionSAMPLEQTY = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); MESStationSession SessionREJECTQTY = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY); MESStationSession SessionPassQty = Station.StationSession.Find(t => t.MESDataType == Paras[6].SESSION_TYPE && t.SessionKey == Paras[6].SESSION_KEY); MESStationSession SessionFailQty = Station.StationSession.Find(t => t.MESDataType == Paras[7].SESSION_TYPE && t.SessionKey == Paras[7].SESSION_KEY); MESStationSession SessionLotNewFlag = Station.StationSession.Find(t => t.MESDataType == Paras[8].SESSION_TYPE && t.SessionKey == Paras[8].SESSION_KEY); MESStationSession SessionLotNo = Station.StationSession.Find(t => t.MESDataType == Paras[9].SESSION_TYPE && t.SessionKey == Paras[9].SESSION_KEY); if (SessionSN == null) { //throw new Exception("请输入SN!"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } SN ObjSN = (SN)SessionSN.Value; //if (SessionSKU == null) //{ // SessionSKU = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; // Station.StationSession.Add(SessionSKU); //} if (SessionAQLTYPE == null) { SessionAQLTYPE = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionAQLTYPE); } if (SessionLotQTY == null) { SessionLotQTY = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionLotQTY); } if (SessionSAMPLEQTY == null) { SessionSAMPLEQTY = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionSAMPLEQTY); } if (SessionREJECTQTY == null) { SessionREJECTQTY = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionREJECTQTY); } if (SessionPassQty == null) { SessionPassQty = new MESStationSession() { MESDataType = Paras[6].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[6].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionPassQty); } if (SessionFailQty == null) { SessionFailQty = new MESStationSession() { MESDataType = Paras[7].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[7].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionFailQty); } if (SessionLotNewFlag == null) { SessionLotNewFlag = new MESStationSession() { MESDataType = Paras[8].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[8].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SessionLotNewFlag); } if (SessionLotNo == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[9].SESSION_TYPE + Paras[9].SESSION_KEY })); } try { if ((string)SessionLotNewFlag.Value == "1") { if (Paras[1].VALUE.ToString() == "ALL") { RLotSku = TR.GetBySkuNo(Paras[1].VALUE.ToString(), ObjSN.NextStation, Station.SFCDB); RAqltype = QR.GetByAqltype(RLotSku.AQL_TYPE, Station.SFCDB); SessionAQLTYPE.Value = RAqltype.AQL_TYPE; //Marked by LLF //SessionLotQTY.Value = RAqltype.LOT_QTY; //SessionSAMPLEQTY.Value = RAqltype.SAMPLE_QTY; //SessionREJECTQTY.Value = RAqltype.REJECT_QTY; } else { RLotSku = TR.GetBySkuNo(ObjSN.SkuNo, ObjSN.NextStation, Station.SFCDB); RAqltype = QR.GetByAqltype(RLotSku.AQL_TYPE, Station.SFCDB); SessionAQLTYPE.Value = RAqltype.AQL_TYPE; //Marked by LLF //SessionLotQTY.Value = RAqltype.LOT_QTY; //SessionSAMPLEQTY.Value = RAqltype.SAMPLE_QTY; //SessionREJECTQTY.Value = RAqltype.REJECT_QTY; } SessionPassQty.Value = 0; SessionFailQty.Value = 0; SessionLotQTY.Value = 0; SessionSAMPLEQTY.Value = 0; SessionREJECTQTY.Value = 0; } else { SessionAQLTYPE.Value = ((LotNo)SessionLotNo.Value).AQL_TYPE; SessionLotQTY.Value = ((LotNo)SessionLotNo.Value).LOT_QTY; SessionSAMPLEQTY.Value = ((LotNo)SessionLotNo.Value).SAMPLE_QTY; SessionREJECTQTY.Value = ((LotNo)SessionLotNo.Value).REJECT_QTY; SessionPassQty.Value = ((LotNo)SessionLotNo.Value).PASS_QTY; SessionFailQty.Value = ((LotNo)SessionLotNo.Value).FAIL_QTY; } //Station.AddMessage("MES00000104", new string[] { "AQLTYPE", RAqltype.AQL_TYPE, "LotQTY", RAqltype.LOT_QTY.ToString(), "SAMPLEQTY", RAqltype.SAMPLE_QTY.ToString(), "REJECTQTY", RAqltype.REJECT_QTY.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); Station.AddMessage("MES00000104", new string[] { "AQLTYPE", SessionAQLTYPE.Value.ToString(), "LotQTY", SessionLotQTY.Value.ToString(), "SAMPLEQTY", SessionSAMPLEQTY.Value.ToString(), "REJECTQTY", SessionREJECTQTY.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }
//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; } }
public static void SmtSkuFromWODataCheck(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 3) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //加載SKUSavePoint位置 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); } //加載WoLoadPoint MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WOSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); // throw new Exception("WO參數不存在!"); } WorkOrder WOObject = (WorkOrder)WOSession.Value; //WOObject.SkuNO SKU sku = new SKU(); try { MESDBHelper.OleExec ole = Station.SFCDB; sku = sku.Init(WOObject.SkuNO, ole, MESDataObject.DB_TYPE_ENUM.Oracle); MESStationSession SessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); DisplayOutPut CurrentSkuno = Station.DisplayOutput.Find(t => t.Name == "SKUNO"); //SN機種與當前操作機種不一致卡住 if (CurrentSkuno.Value != null && CurrentSkuno.Value.ToString().Trim().Length > 0 && !sku.SkuNo.Equals(CurrentSkuno.Value.ToString())) { string ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000235", new string[] { SessionSN.Value.ToString(), sku.SkuNo, CurrentSkuno.Value.ToString() }); throw new MESReturnMessage(ErrMessage); } SkuSession.Value = sku; Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception e) { Station.AddMessage("MES00000007", new string[] { "Skuno" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail); throw e; } }
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(); } } }
public static void SampleLotDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string StrSN = ""; Row_R_LOT_STATUS RLotStatus; T_R_LOT_STATUS TR = new T_R_LOT_STATUS(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); LotNo LOT = new LotNo(); if (Paras.Count <= 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession LotNoSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (SNSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } else { StrSN = SNSession.Value.ToString(); } if (LotNoSession == null) { LotNoSession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(LotNoSession); } try { RLotStatus = TR.GetSampleLotBySN(StrSN, Station.SFCDB); if (RLotStatus != null) { LotNoSession.Value = RLotStatus.GetDataObject(); } else { //throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000159", new string[] { })); } } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }
public static void UpdateWOKeypartID(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 1) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionWO = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionWO == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } try { int result; WorkOrder objWorkorder = new WorkOrder(); objWorkorder = (WorkOrder)sessionWO.Value; T_C_KP_LIST t_c_kp_list = new T_C_KP_LIST(Station.SFCDB, Station.DBType); T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(Station.SFCDB, Station.DBType); Row_R_WO_BASE rowWOBase; List <string> kpList = t_c_kp_list.GetListIDBySkuno(objWorkorder.SkuNO, Station.SFCDB); if (kpList.Count == 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000255", new string[] { objWorkorder.SkuNO })); } rowWOBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(objWorkorder.ID, Station.SFCDB); rowWOBase.KP_LIST_ID = kpList[0].ToString(); result = Station.SFCDB.ExecSqlNoReturn(rowWOBase.GetUpdateString(Station.DBType), null); if (result <= 0) { //報錯信息待改 throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { objWorkorder.WorkorderNo })); } Station.AddMessage("MES00000063", new string[] { objWorkorder.WorkorderNo }, StationMessageState.Pass); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根據當前工站生產新的LOTNO /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void GetLotDataloaderNew(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count <= 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession sessionLotNo = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); MESStationSession sessionLotNewFlag = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); LotNo lot = new LotNo(); string lotno = ""; if (sessionSN == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } if (sessionLotNewFlag == null) { sessionLotNewFlag = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionLotNewFlag); } try { if (sessionLotNo == null) { T_R_LOT_STATUS tLotStatus = new T_R_LOT_STATUS(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_LOT_STATUS rowLotStatus = tLotStatus.GetLotBySNNotCloesd(sessionSN.Value.ToString(), Station.SFCDB); if (rowLotStatus != null) { sessionLotNewFlag.Value = "0"; lot.Init(rowLotStatus.LOT_NO, "", Station.SFCDB); sessionLotNo = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; sessionLotNo.Value = lot; Station.StationSession.Add(sessionLotNo); } else { //新建lot號 sessionLotNo = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; sessionLotNo.Value = lot.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); sessionLotNewFlag.Value = "1"; Station.StationSession.Add(sessionLotNo); } } else { if (sessionLotNo.Value is string && sessionLotNo.Value.ToString() != "") { lotno = sessionLotNo.Value.ToString(); } else if (sessionLotNo.Value is LotNo) { lotno = ((LotNo)sessionLotNo.Value).LOT_NO.ToString(); } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY })); } try { lot.Init(lotno, "", Station.SFCDB); } catch { lot = null; } if (lot != null) { if (lot.CLOSED_FLAG.ToString() == "1") { sessionLotNo.Value = lot.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); sessionLotNewFlag.Value = "1"; Station.StationSession.Add(sessionLotNo); } else { sessionLotNewFlag.Value = "0"; lot.Init(((LotNo)lot).LOT_NO, "", Station.SFCDB); sessionLotNo.Value = lot; } } } } catch (Exception ex) { throw ex; } }