/// HWD PTH Allpart扣料,add by LLF 2018-02-19 /// <summary> /// 更新TR_SN數據加載,查詢R_TR_SN,R_TR_SN_WIP的數據保存到Dictionary<string_Datarow>中,key為表名 "R_TR_SN","R_TR_SN_WIP" /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void TRSNDataSessionUpdateAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.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; int LinkQty = 0; int TrSNExtQty = 0; if (Paras.Count < 0) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TRSN_Session == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } strTRSN = TRSN_Session.InputValue.ToString(); MESStationSession TRSNExtQty_Session = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (TRSNExtQty_Session == null) { TRSNExtQty_Session = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TRSNExtQty_Session); TRSNExtQty_Session.Value = 0; } MESStationSession TRSNPcbSku_Session = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (TRSNPcbSku_Session == null) { TRSNPcbSku_Session = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TRSNPcbSku_Session); TRSNPcbSku_Session.Value = ""; } MESStationSession LinkQty_Session = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (LinkQty_Session != null) { int.TryParse(LinkQty_Session.Value.ToString(), out LinkQty); } //獲取ALLPART數據 AP_DLL APDLL = new AP_DLL(); try { apdb = Station.APDB; List <DataRow> TRSNWIPlist = APDLL.R_TR_SN_WIP_GetBYTR_SN(strTRSN, apdb); if (TRSNWIPlist.Count > 0) { TRSNExtQty_Session.Value = TRSNWIPlist[0]["EXT_QTY"]; TRSNPcbSku_Session.Value = TRSNWIPlist[0]["KP_NO"]; } else { TRSNExtQty_Session.Value = 0; } //Station.DBS["APDB"].Return(apdb); int.TryParse(TRSNExtQty_Session.Value.ToString(), out TrSNExtQty); if (TrSNExtQty < LinkQty) { MESStationInput StationInput = Station.Inputs.Find(t => t.DisplayName == "TR_SN"); StationInput.Enable = true; Station.NextInput = StationInput; } } catch (Exception ex) { if (apdb != null) { //Station.DBS["APDB"].Return(apdb); } 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; } }
/// <summary> /// 檢查輸入的料號與工單的料號是否一致 /// 張官軍 2018/01/18 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void InputSkuWoSkuChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string ErrMessage = string.Empty; string SkuNo = string.Empty; //marked by LLF 2018-02-24 //MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); //if (WoSession == null) //{ // MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == "SN" && t.SessionKey == "1"); // if (SNSession != null) // { // SN Sn = ((SN)SNSession.Value); // WorkOrder WoTemp = new WorkOrder(); // WoTemp.Init(Sn.WorkorderNo, Station.SFCDB); // WoSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, SessionKey = Paras[0].SESSION_KEY, Value = WoTemp }; // Station.StationSession.Add(WoSession); // } // else // { // ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] {Paras[0].SESSION_TYPE+Paras[0].SESSION_KEY }); // throw new MESReturnMessage(ErrMessage); // } //} //WorkOrder Wo = ((WorkOrder)WoSession.Value); //SkuNo = Input.Value.ToString().ToUpper().Trim(); //if (Wo != null) //{ // if (Wo.SkuNO.Equals(SkuNo)) // { // Station.AddMessage("MES00000111", new string[] { SkuNo }, MESReturnView.Station.StationMessageState.Pass); // } // else // { // ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000110", new string[] {SkuNo,Wo.WorkorderNo }); // throw new MESReturnMessage(ErrMessage); // } //} MESStationSession InputSKUSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession SNSKUSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (InputSKUSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } if (SNSKUSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } if (InputSKUSession.Value.ToString() != SNSKUSession.Value.ToString()) { //誰把這段防呆屏蔽了?Openned by LLF 2018-03-17 ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000110", new string[] { InputSKUSession.Value.ToString(), SNSKUSession.Value.ToString() }); throw new MESReturnMessage(ErrMessage); } }
/// <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); } } } }
/// <summary> /// 通過SKU對象,獲取對應批次對象,如果批次對象為空,新增批次對象 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras">2個參數,SKU,LOTNO保存的位置</param> public static void GetLotDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string ColoumName = "skuno"; Row_R_LOT_STATUS RLotSku; 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 Ssku = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); MESStationSession Slot = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); MESStationSession SLotNewFlag = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (Ssku == null) { //throw new Exception("请输入SKU!"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } else { SKU ObjSku = (SKU)Ssku.Value; //Marked by LLF 20018-02-22 //RLotSku = TR.GetByInput(ObjSku.SkuNo, ColoumName, Station.SFCDB); //RLotSku = TR.GetLotBySku(ObjSku.SkuNo, ColoumName, Station.SFCDB); //modify by fgg get lot by sku and station name 2018.8.16 RLotSku = TR.GetLotBySkuAnd(ObjSku.SkuNo, Station.StationName, Station.SFCDB); } if (Slot == null) { Slot = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(Slot); } if (SLotNewFlag == null) { SLotNewFlag = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SLotNewFlag); } try { //Modify by LLF 2018-02-07 SLotNewFlag 為新生成Lot的標誌位 //if (LOT == null)//LOT 為空需產生新的LOTNO if (RLotSku == null) { SLotNewFlag.Value = "1"; Slot.Value = LOT.GetNewLotNo("HWD_FQCLOT", Station.SFCDB); } else { SLotNewFlag.Value = "0"; LOT.Init(RLotSku.LOT_NO, "", Station.SFCDB); Slot.Value = LOT; Station.AddMessage("MES00000029", new string[] { "LotNo", LOT.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); } } catch (Exception ex) { string msgCode = ex.Message; throw ex; } }
/// <summary> /// FQC Lot 過站 /// </summary> /// <param name="SerialNo"></param> /// <param name="LotNo"></param> /// <param name="PassOrFail"></param> /// <param name="EmpNo"></param> /// <param name="Station"></param> /// <param name="Line"></param> /// <param name="BU"></param> /// <param name="DB"></param> /// <param name="FailInfos"></param> public void LotPassStation(string SerialNo, string LotNo, string PassOrFail, string EmpNo, string Station, string DeviceName, string Line, string BU, OleExec DB, params string[] FailInfos) { bool PassedFlag = true; string sql = string.Empty; DataTable dt = new DataTable(); Row_R_LOT_STATUS StatusRow = (Row_R_LOT_STATUS)NewRow(); T_R_LOT_DETAIL DetailTable = new T_R_LOT_DETAIL(DB, this.DBType); Row_R_LOT_DETAIL DetailRow = (Row_R_LOT_DETAIL)DetailTable.NewRow(); R_LOT_STATUS Status = null; R_LOT_DETAIL Detail = null; T_R_SN SnTable = new T_R_SN(DB, this.DBType); List <string> LotsSN = new List <string>(); if (this.DBType == DB_TYPE_ENUM.Oracle) { PassedFlag = PassOrFail.ToUpper().Equals("PASS") ? true : false; //sql = $@"SELECT * FROM R_LOT_STATUS WHERE LOT_NO='{LotNo}' AND SAMPLE_STATION='{Station}' AND LINE='{Line}'"; //判斷有沒有 LOT sql = $@"SELECT * FROM R_LOT_STATUS WHERE LOT_NO='{LotNo}' AND SAMPLE_STATION='{Station}'"; //判斷有沒有 LOT dt = DB.ExecSelect(sql).Tables[0]; if (dt.Rows.Count > 0) { StatusRow.loadData(dt.Rows[0]); Status = StatusRow.GetDataObject(); sql = $@"SELECT A.* FROM R_LOT_DETAIL A,R_SN B WHERE LOT_ID='{StatusRow.ID}' AND B.SN='{SerialNo}' AND A.SN=B.SN"; //判斷Lot中有沒有這個SN並且沒有被抽檢過 dt = DB.ExecSelect(sql).Tables[0]; if (dt.Rows.Count > 0) { DetailRow.loadData(dt.Rows[0]); Detail = DetailRow.GetDataObject(); if (Detail.SAMPLING.Equals("1")) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000093", new string[] { SerialNo })); } } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000094", new string[] { SerialNo, LotNo })); } if (Status.CLOSED_FLAG == "1") //Lot 關閉 { if (PassedFlag) { //更新 R_LOT_DETAIL STATUS Detail.STATUS = "1"; //1 表示抽檢通過 Detail.SAMPLING = "1"; //1 表示被抽檢了 //更新 R_LOT_STATUS PASS_QTY Status.PASS_QTY++; } else { //更新 R_LOT_DETAIL STATUS ,FAIL_CODE,FAIL_LOCATION,DESCRIPTION Detail.STATUS = "0"; //0 表示抽檢失敗 Detail.SAMPLING = "1"; //1 表示被抽檢了 if (FailInfos != null && FailInfos.Length == 3) //記錄失敗原因 { Detail.FAIL_CODE = FailInfos[0]; Detail.FAIL_LOCATION = FailInfos[1]; Detail.DESCRIPTION = FailInfos[2]; } //更新 R_LOT_STATUS FAIL_QTY Status.FAIL_QTY++; } if (Status.FAIL_QTY >= Status.REJECT_QTY && Status.FAIL_QTY != 0) { //更新 R_LOT_STATUS 關閉,NG, //Status.CLOSED_FLAG = "1";// 1 表示關閉Lot Status.LOT_STATUS_FLAG = "2";// 2 表示整個 Lot 不良 //更新 R_LOT_DETAIL 鎖定LOT 中所有 Detail.EDIT_EMP = EmpNo; Detail.EDIT_TIME = GetDBDateTime(DB); DetailRow.ConstructRow(Detail); DB.ExecSQL(DetailRow.GetUpdateString(this.DBType)); //該批次鎖定--add by Eden 2018-05-04 sql = $@"update r_lot_detail set sampling='4' where lot_id='{Detail.LOT_ID}'"; DB.ExecSQL(sql); //DetailTable.LockLotBySn(SerialNo, EmpNo, DB); } else { if (Status.PASS_QTY + Status.FAIL_QTY >= Status.SAMPLE_QTY) { //更新 R_LOT_STATUS 關閉,OK //Status.CLOSED_FLAG = "1"; Status.LOT_STATUS_FLAG = "1"; // 1 表示整個 Lot 正常 //更新 R_LOT_DETAIL 鎖定FAIL 的,其他的正常過站 //sql = $@"SELECT * FROM R_LOT_DETAIL WHERE LOT_ID='{StatusRow.ID}' AND STATUS='0'"; sql = $@"SELECT * FROM R_LOT_DETAIL WHERE LOT_ID='{StatusRow.ID}' AND ((SAMPLING='1' AND STATUS='1') OR (SAMPLING='0'))"; dt = DB.ExecSelect(sql).Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { LotsSN.Add(dr["SN"].ToString()); } SnTable.LotsPassStation(LotsSN, Line, Station, DeviceName, BU, PassOrFail, EmpNo, DB); // 過站 } //記錄通過數 ,UPH foreach (string SN in LotsSN) { SnTable.RecordYieldRate(Detail.WORKORDERNO, 1, SN, "PASS", Line, Station, EmpNo, BU, DB); SnTable.RecordUPH(Detail.WORKORDERNO, 1, SN, "PASS", Line, Station, EmpNo, BU, DB); } } Detail.EDIT_EMP = EmpNo; Detail.EDIT_TIME = GetDBDateTime(DB); DetailRow.ConstructRow(Detail); DB.ExecSQL(DetailRow.GetUpdateString(this.DBType)); } Status.EDIT_EMP = EmpNo; Status.EDIT_TIME = GetDBDateTime(DB); StatusRow.ConstructRow(Status); DB.ExecSQL(StatusRow.GetUpdateString(this.DBType)); } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000201", new string[] { LotNo })); } } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000091", new string[] { LotNo })); } } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } }
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> /// 從輸入加載SN對象集合 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void GetSnObjectListDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 4) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057")); } 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 })); } MESStationSession sessionInputType = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionInputType == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); } if (sessionInputType.Value.ToString() == "") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE })); } MESStationSession sessionInputString = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (sessionInputString == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE })); } if (sessionInputString.Value.ToString() == "") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE })); } MESStationSession snObjectList = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_KEY && t.SessionKey == Paras[3].SESSION_KEY); if (snObjectList == null) { snObjectList = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(snObjectList); } try { WorkOrder objWorkorder = new WorkOrder(); objWorkorder = (WorkOrder)sessionWO.Value; string inputType = sessionInputType.Value.ToString(); string inputString = sessionInputString.Value.ToString(); List <R_SN> snList = new List <R_SN>(); T_R_SN_KP t_r_sn_kp = new T_R_SN_KP(Station.SFCDB, Station.DBType); if (inputType.Equals("SN")) { T_R_SN t_r_sn = new T_R_SN(Station.SFCDB, Station.DBType); snList.Add(t_r_sn.LoadSN(inputString, Station.SFCDB)); } else if (inputType.Equals("PANEL")) { T_R_PANEL_SN t_r_panel_sn = new T_R_PANEL_SN(Station.SFCDB, Station.DBType); snList = t_r_panel_sn.GetValidSnByPanel(inputString, Station.SFCDB); } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529094259")); } snObjectList.Value = snList; Station.AddMessage("MES00000001", new string[] { sessionInputString.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw ex; } }
/// <summary> /// 記錄良率 /// </summary> /// <param name="WorkOrder"></param> /// <param name="SerialNo"></param> /// <param name="Status"></param> /// <param name="Day"></param> /// <param name="Time"></param> /// <param name="Line"></param> /// <param name="Station"></param> /// <param name="EmpNo"></param> /// <param name="Bu"></param> /// <param name="DB"></param> /// <returns></returns> public string RecordTCQSYieldRate(R_TCQS_YIELD_RATE_DETAIL RTYRD, string SerialNo, string Bu, OleExec DB) { string result = string.Empty; string sql = string.Empty; DataTable dt = new DataTable(); T_R_TCQS_YIELD_RATE_DETAIL TRTYRD = null; Row_R_TCQS_YIELD_RATE_DETAIL RRTYRD = null; T_R_TMP_ATEDATA_T TRTAT = null; Row_R_TMP_ATEDATA_T RRTAT = null; T_R_SN_DETAIL TRSD = null; Row_R_SN_DETAIL RRSD = null; if (this.DBType == DB_TYPE_ENUM.Oracle) { //更新R_TCQS_YIELD_RATE_DETAIL TRTYRD = new T_R_TCQS_YIELD_RATE_DETAIL(DB, this.DBType); RRTYRD = (Row_R_TCQS_YIELD_RATE_DETAIL)TRTYRD.NewRow(); sql = $@"Select * From R_TCQS_YIELD_RATE_DETAIL Where WORK_DATE='{RTYRD.WORK_DATE}' and Work_Time='{RTYRD.WORK_TIME}' and PRODUCTION_LINE='{RTYRD.PRODUCTION_LINE}' and CLASS_NAME='{RTYRD.CLASS_NAME}' and STATION_NAME='{RTYRD.STATION_NAME}' and DEVICE_NAME='{RTYRD.DEVICE_NAME}' and WORKORDERNO='{RTYRD.WORKORDERNO}' "; dt = DB.ExecSelect(sql).Tables[0]; //如果記錄已經存在 if (dt.Rows.Count > 0) { RRTYRD.loadData(dt.Rows[0]); RRTYRD.TOTAL_FRESH_BUILD_QTY += RTYRD.TOTAL_FRESH_BUILD_QTY; RRTYRD.TOTAL_FRESH_PASS_QTY += RTYRD.TOTAL_FRESH_PASS_QTY; RRTYRD.TOTAL_FRESH_FAIL_QTY += RTYRD.TOTAL_FRESH_FAIL_QTY; RRTYRD.TOTAL_REWORK_BUILD_QTY += RTYRD.TOTAL_REWORK_BUILD_QTY; RRTYRD.TOTAL_REWORK_PASS_QTY += RTYRD.TOTAL_REWORK_PASS_QTY; RRTYRD.TOTAL_REWORK_FAIL_QTY += RTYRD.TOTAL_REWORK_FAIL_QTY; RRTYRD.TCQS_FRESH_BUILD_QTY += RTYRD.TCQS_FRESH_BUILD_QTY; RRTYRD.TCQS_FRESH_PASS_QTY += RTYRD.TCQS_FRESH_PASS_QTY; RRTYRD.TCQS_FRESH_FAIL_QTY += RTYRD.TCQS_FRESH_FAIL_QTY; RRTYRD.TCQS_REWORK_BUILD_QTY += RTYRD.TCQS_REWORK_BUILD_QTY; RRTYRD.TCQS_REWORK_PASS_QTY += RTYRD.TCQS_REWORK_PASS_QTY; RRTYRD.TCQS_REWORK_FAIL_QTY += RTYRD.TCQS_REWORK_FAIL_QTY; RRTYRD.EDIT_EMP = RTYRD.EDIT_EMP; RRTYRD.EDIT_TIME = RTYRD.EDIT_TIME; sql = RRTYRD.GetUpdateString(this.DBType); } else//記錄不存在,則Insert { RRTYRD.ID = TRTYRD.GetNewID(Bu, DB); RRTYRD.WORK_DATE = RTYRD.WORK_DATE; RRTYRD.WORK_TIME = RTYRD.WORK_TIME; RRTYRD.PRODUCTION_LINE = RTYRD.PRODUCTION_LINE; RRTYRD.CLASS_NAME = RTYRD.CLASS_NAME; RRTYRD.STATION_NAME = RTYRD.STATION_NAME; RRTYRD.DEVICE_NAME = RTYRD.DEVICE_NAME; RRTYRD.WORKORDERNO = RTYRD.WORKORDERNO; RRTYRD.SKUNO = RTYRD.SKUNO; RRTYRD.SKU_NAME = RTYRD.SKU_NAME; RRTYRD.SKU_SERIES = RTYRD.SKU_SERIES; RRTYRD.TOTAL_FRESH_BUILD_QTY = RTYRD.TOTAL_FRESH_BUILD_QTY; RRTYRD.TOTAL_FRESH_PASS_QTY = RTYRD.TOTAL_FRESH_PASS_QTY; RRTYRD.TOTAL_FRESH_FAIL_QTY = RTYRD.TOTAL_FRESH_FAIL_QTY; RRTYRD.TOTAL_REWORK_BUILD_QTY = RTYRD.TOTAL_REWORK_BUILD_QTY; RRTYRD.TOTAL_REWORK_PASS_QTY = RTYRD.TOTAL_REWORK_PASS_QTY; RRTYRD.TOTAL_REWORK_FAIL_QTY = RTYRD.TOTAL_REWORK_FAIL_QTY; RRTYRD.TCQS_FRESH_BUILD_QTY = RTYRD.TCQS_FRESH_BUILD_QTY; RRTYRD.TCQS_FRESH_PASS_QTY = RTYRD.TCQS_FRESH_PASS_QTY; RRTYRD.TCQS_FRESH_FAIL_QTY = RTYRD.TCQS_FRESH_FAIL_QTY; RRTYRD.TCQS_REWORK_BUILD_QTY = RTYRD.TCQS_REWORK_BUILD_QTY; RRTYRD.TCQS_REWORK_PASS_QTY = RTYRD.TCQS_REWORK_PASS_QTY; RRTYRD.TCQS_REWORK_FAIL_QTY = RTYRD.TCQS_REWORK_FAIL_QTY; RRTYRD.EDIT_EMP = RTYRD.EDIT_EMP; RRTYRD.EDIT_TIME = RTYRD.EDIT_TIME; sql = RRTYRD.GetInsertString(this.DBType); } try { result = DB.ExecSQL(sql); //如果數據更新成功,則返回數據更新的記錄數,如果為Begn...END返回為-1,可被 Int32.Parse 方法轉換成 int if (Int32.Parse(result) < -1) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_TCQS_YIELD_RATE_DETAIL" }); throw new MESReturnMessage(errMsg + ":" + result); } }catch (Exception ee)//執行SQL異常 { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_TCQS_YIELD_RATE_DETAIL" }); throw new MESReturnMessage(errMsg + ":" + ee.Message); } //更新R_TMP_ATEDATA_T if (RTYRD.TOTAL_FRESH_BUILD_QTY + RTYRD.TOTAL_REWORK_BUILD_QTY > 0)//如果是過站處理,則刪除臨時表記錄 { sql = $@"Delete From R_TMP_ATEDATA_T Where SN='{SerialNo}' and Station_Name='{RTYRD.STATION_NAME}' "; } else { TRTAT = new T_R_TMP_ATEDATA_T(DB, this.DBType); RRTAT = (Row_R_TMP_ATEDATA_T)TRTAT.NewRow(); sql = $@"SELECT * FROM r_tmp_atedata_t WHERE Station_Name = '{RTYRD.STATION_NAME}' AND SN = '{SerialNo}' "; dt = DB.ExecSelect(sql).Tables[0]; //如果記錄已經存在,則Update if (dt.Rows.Count > 0) { RRTAT.loadData(dt.Rows[0]); RRTAT.DEVICE_NAME = RTYRD.DEVICE_NAME; RRTAT.PASS_COUNT = RRTAT.PASS_COUNT + RTYRD.TCQS_FRESH_PASS_QTY + RTYRD.TCQS_REWORK_PASS_QTY; RRTAT.RETEST_COUNT = RRTAT.RETEST_COUNT + RTYRD.TCQS_FRESH_FAIL_QTY + RTYRD.TCQS_REWORK_FAIL_QTY; sql = RRTAT.GetUpdateString(this.DBType); } else //記錄不存在則Insert { RRTAT.ID = TRTAT.GetNewID(Bu, DB); RRTAT.WORKORDERNO = RTYRD.WORKORDERNO; RRTAT.SKUNO = RTYRD.SKUNO; RRTAT.SN = SerialNo; RRTAT.PRODUCTION_LINE = RTYRD.PRODUCTION_LINE; RRTAT.SECTION_NAME = "1"; RRTAT.STATION_NAME = RTYRD.STATION_NAME; RRTAT.DEVICE_NAME = RTYRD.DEVICE_NAME; RRTAT.PASS_COUNT = RTYRD.TCQS_FRESH_PASS_QTY + RTYRD.TCQS_REWORK_PASS_QTY; RRTAT.RETEST_COUNT = RTYRD.TCQS_FRESH_FAIL_QTY + RTYRD.TCQS_REWORK_FAIL_QTY; RRTAT.EDIT_EMP = RTYRD.EDIT_EMP; RRTAT.EDIT_TIME = RTYRD.EDIT_TIME; sql = RRTYRD.GetInsertString(this.DBType); } } try { result = DB.ExecSQL(sql); //如果數據更新成功,則返回數據更新的記錄數,如果為Begn...END返回為-1,可被 Int32.Parse 方法轉換成 int if (Int32.Parse(result) < -1) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_TMP_ATEDATA_T" }); throw new MESReturnMessage(errMsg + ":" + result); } } catch (Exception ee)//執行SQL異常 { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_TMP_ATEDATA_T" }); throw new MESReturnMessage(errMsg + ":" + ee.Message); } //更新R_SN_DETAIL TRSD = new T_R_SN_DETAIL(DB, this.DBType); RRSD = (Row_R_SN_DETAIL)TRSD.NewRow(); RRSD.ID = TRSD.GetNewID(Bu, DB); RRSD.SN = SerialNo; RRSD.SKUNO = RTYRD.SKUNO; RRSD.WORKORDERNO = RTYRD.WORKORDERNO; RRSD.LINE = RTYRD.PRODUCTION_LINE; RRSD.STATION_NAME = RTYRD.STATION_NAME; RRSD.DEVICE_NAME = RTYRD.DEVICE_NAME; RRSD.CLASS_NAME = RTYRD.CLASS_NAME; //如果以PASS過站,則Flag=1 if (RTYRD.TOTAL_FRESH_PASS_QTY + RTYRD.TOTAL_REWORK_PASS_QTY > 0) { RRSD.RESULT_FLAG = "1"; } else if (RTYRD.TOTAL_FRESH_FAIL_QTY + RTYRD.TOTAL_REWORK_FAIL_QTY > 0) //如果以Fail進維修,則Flag=0 { RRSD.RESULT_FLAG = "0"; } else if (RTYRD.TCQS_FRESH_PASS_QTY + RTYRD.TCQS_REWORK_PASS_QTY > 0)//如果PASS但不過站,則Flag=2 { RRSD.RESULT_FLAG = "2"; } else//如果FAIL但不過站,則Flag=3 { RRSD.RESULT_FLAG = "3"; } RRSD.EDIT_EMP = RTYRD.EDIT_EMP; RRSD.EDIT_TIME = RTYRD.EDIT_TIME; sql = RRSD.GetInsertString(this.DBType); try { result = DB.ExecSQL(sql); //如果數據更新成功,則返回數據更新的記錄數,如果為Begn...END返回為-1,可被 Int32.Parse 方法轉換成 int if (Int32.Parse(result) < -1) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_SN_DETAIL" }); throw new MESReturnMessage(errMsg + ":" + result); } } catch (Exception ee)//執行SQL異常 { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190", new string[] { "R_SN_DETAIL" }); throw new MESReturnMessage(errMsg + ":" + ee.Message); } return(result); } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } }
/// <summary> /// 檢查工單狀態必須Release&Start /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras">1個參數,WO保存的位置</param> public static void SkuFromWODataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { string ErrMessage = ""; if (Paras.Count != 1) { throw new Exception("參數數量不正確!"); } //marked by ZGJ 2018-03-15 //單從這個方法的功能上(這個方法的功能定義為檢查工單的狀態,但是方法名卻像是從工單加載機種)看, //沒有必要使用 SKU session //MESStationSession SKU = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); //if (SKU == null) //{ // SKU = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; // Station.StationSession.Add(SKU); //} MESStationSession TWO = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (TWO == null) { TWO = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TWO); } //CHECK Workorder是否Release&Start WorkOrder WorkorderInfo = new WorkOrder(); //string WoNum = TWO.InputValue; var obj_wo = TWO.Value; //string WoNum = TWO.Value.ToString(); try { //add by ZGJ 2018-03-15 //檢查工單時,之前的步驟中可能就已經把工單實例放在 WO1 中,所以這裡判斷,如果已經是工單實例, //那麼就直接賦值,否則進行加載 if (obj_wo is string) { WorkorderInfo.Init(obj_wo.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); } else if (obj_wo is WorkOrder) { WorkorderInfo = (WorkOrder)obj_wo; } //WorkorderInfo.Init(WoNum, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); if (string.IsNullOrEmpty(WorkorderInfo.CLOSED_FLAG) || WorkorderInfo.CLOSED_FLAG == "1") //null or 1代表工單已經關閉,0代表工單開啟 { //Modify by LLF 2018-02-02 //Station.AddMessage("MES00000041", new string[] { "WO:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail); //return; ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000041", new string[] { WorkorderInfo.WorkorderNo }); throw new MESReturnMessage(ErrMessage); } if (WorkorderInfo.RELEASE_DATE == null) { //Modify by LLF 2018-02-02 //Station.AddMessage("MES00000042", new string[] { "WO:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail); //return; ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000042", new string[] { WorkorderInfo.WorkorderNo }); throw new MESReturnMessage(ErrMessage); } } catch (Exception ex) { //Modify by LLF 2018-02-02 //ex.InnerException.Message; //string msgCode = ex.Message; //Station.AddMessage(msgCode, new string[] { "Workorder:" + WorkorderInfo.WorkorderNo }, StationMessageState.Fail); throw new MESReturnMessage(ex.Message); } }
/// <summary> /// 從第一個輸入框加載PanelSN /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> /// Add by LLF 2018-02-01 //public static void SNInputDataloader(MESStationBase Station, MESStationInput Input, List<R_Station_Action_Para> Paras) //{ // string StrSN = Input.Value.ToString(); // MESStationSession SNSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, SessionKey = Paras[0].SESSION_KEY, ResetInput = Input }; // Station.StationSession.Add(SNSession); // SNSession.InputValue = Input.Value.ToString(); // SNSession.Value = StrSN; //} public static void SNLinkKeypartDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >(); int SeqNo = 0; KPList = null; if (Paras.Count != 5) { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057"); throw new MESReturnMessage(errMsg); } string Sn = Input.Value.ToString(); 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); } MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (WOSession == null) { WOSession = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(WOSession); } MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (SubKPSession == null) { SubKPSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(SubKPSession); } MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (MainKPSession == null) { MainKPSession = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(MainKPSession); } MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (KPListSession == null) { KPListSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(KPListSession); } KPListSession.Value = KPList; //SN sn = null; //WorkOrder wo = null; SN sn = new SN(); WorkOrder wo = new WorkOrder(); wo = (WorkOrder)WOSession.Value; T_C_KEYPART tck = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle); //sn.Load(Sn,Station.SFCDB,DB_TYPE_ENUM.Oracle); //wo.Init(sn.WorkorderNo,Station.SFCDB,DB_TYPE_ENUM.Oracle); List <C_KEYPART> keyparts = tck.GetKeypartListByWOAndStation(Station.SFCDB, wo.WorkorderNo, Station.StationName); if (keyparts.Count > 0) { SeqNo = (int)((C_KEYPART)keyparts[0]).SEQ_NO; SubKPSession.Value = keyparts.Where(s => s.SEQ_NO == SeqNo).ToList(); MainKPSession.Value = keyparts.Where(s => s.SEQ_NO > SeqNo).ToList(); } else { string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190"); throw new MESReturnMessage(errMsg); } }
/// <summary> /// add by fgg 2018.05.12 /// 工單投入檢查 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void WOInputDataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { string stationName = Station.StationName; OleExec sfcdb = Station.SFCDB; if (Paras.Count != 4) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionWO = Station.StationSession.Find(s => s.MESDataType == Paras[0].SESSION_TYPE && s.SessionKey == Paras[0].SESSION_KEY); if (sessionWO == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE })); } MESStationSession sessionWOQty = Station.StationSession.Find(s => s.MESDataType == Paras[1].SESSION_TYPE && s.SessionKey == Paras[1].SESSION_TYPE); if (sessionWOQty == null) { sessionWOQty = new MESStationSession() { MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionWOQty); } MESStationSession sessionInputQty = Station.StationSession.Find(s => s.MESDataType == Paras[2].SESSION_TYPE && s.SessionKey == Paras[2].SESSION_TYPE); if (sessionInputQty == null) { sessionInputQty = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionInputQty); } MESStationSession sessionExtQty = Station.StationSession.Find(s => s.MESDataType == Paras[3].SESSION_TYPE && s.SessionKey == Paras[3].SESSION_TYPE); if (sessionExtQty == null) { sessionExtQty = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(sessionExtQty); } try { WorkOrder objWorkorder = new WorkOrder(); objWorkorder = (WorkOrder)sessionWO.Value; //投錯工站 if (!objWorkorder.START_STATION.Equals(stationName)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000246", new string[] { stationName, objWorkorder.START_STATION })); } //工單關節 if (objWorkorder.CLOSED_FLAG.Equals("1")) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000100")); } //已經投滿 if (objWorkorder.INPUT_QTY >= objWorkorder.WORKORDER_QTY) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000247", new string[] { objWorkorder.WorkorderNo })); } sessionWOQty.Value = objWorkorder.WORKORDER_QTY; sessionInputQty.Value = objWorkorder.INPUT_QTY; sessionExtQty.Value = objWorkorder.WORKORDER_QTY - objWorkorder.INPUT_QTY; Station.AddMessage("MES00000029", new string[] { "Workorder", objWorkorder.WorkorderNo }, MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
//工單狀態檢查 public static void WoStateDatachecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { ////ADD BY SDL 20180316 if (Paras.Count != 1) { throw new Exception("參數數量不正確!"); } MESStationSession WoLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoLoadPoint == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } WorkOrder ObjWO = (WorkOrder)WoLoadPoint.Value; ////ADD BY SDL 20180316 //CHECK Workorder是否存在 string ErrMessage = ""; T_R_WO_BASE TRWO = new T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); Row_R_WO_BASE ROWWO; T_R_SN rSn = new T_R_SN(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); // string WO = Input.Value.ToString(); by sdl 20180316 string WO = ObjWO.WorkorderNo; try { //List<R_SN> snList = rSn.GetRSNbyWo(WO, Station.SFCDB); ROWWO = TRWO.GetWo(WO, Station.SFCDB); R_WO_BASE woBase = ROWWO.GetDataObject(); WorkOrder ObjWorkorder = new WorkOrder(); //if (snList!=null) //{ // foreach (var item in snList) // { // if (woBase.ROUTE_ID != item.ROUTE_ID) // { // //throw new Exception("SN RouteID不唯一!"); // ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000167", new string[] { item.SN }); // throw new MESReturnMessage(ErrMessage); // } // } //} if (woBase.CLOSED_FLAG == 1.ToString()) { // throw new Exception("ClosedFlag=1!"); ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000168", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } if ((woBase.START_STATION == null || woBase.START_STATION == "N/A") && woBase.WO_TYPE == "REWORK") { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000203", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } if (woBase.FINISHED_QTY > woBase.WORKORDER_QTY) { // throw new Exception("FinishQty>WorkOrderQty!"); ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000169", new string[] { woBase.WORKORDERNO }); throw new MESReturnMessage(ErrMessage); } Station.StationSession.Add(WoLoadPoint); ObjWorkorder.Init(WO, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); WoLoadPoint.Value = ObjWorkorder; WoLoadPoint.InputValue = Input.Value.ToString(); WoLoadPoint.ResetInput = Input; WoLoadPoint.SessionKey = "1"; WoLoadPoint.MESDataType = "WO"; Station.AddMessage("MES00000029", new string[] { "Workorder", WO }, MESReturnView.Station.StationMessageState.Message); } catch (Exception ex) { throw ex; } }
/// <summary> /// 維修根據輸入的SN和Location獲取allpart信息 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void AllpartInfoDataloader(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.ToString() == "") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN" })); } MESStationSession sessionLocation = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionLocation == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "Location" })); } if (sessionLocation.Value.ToString() == "") { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "Location" })); } try { System.Data.OleDb.OleDbParameter[] paras = new System.Data.OleDb.OleDbParameter[] { new System.Data.OleDb.OleDbParameter("MYPSN", sessionSN.Value.ToString()), new System.Data.OleDb.OleDbParameter("MYLOCATION", sessionLocation.Value.ToString()), new System.Data.OleDb.OleDbParameter("G_TR_SN", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_KP_NO", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_MFR_KP_NO", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_MFR_CODE", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_MFR_NAME", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_DATE_CODE", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_LOT_CODE", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_KP_DESC", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_PROCESS_FLAG", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("G_STATION", System.Data.OleDb.OleDbType.VarChar, 200), new System.Data.OleDb.OleDbParameter("RES", System.Data.OleDb.OleDbType.VarChar, 800) }; for (int i = 2; i < paras.Length; i++) { paras[i].Direction = ParameterDirection.Output; } Dictionary <string, object> spReturnDic = Station.APDB.ExecProcedureReturnDic("MES1.GET_KP_MESSAGE", paras); if (spReturnDic["RES"].ToString().Equals("OK")) { Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value = spReturnDic["G_KP_NO"].ToString(); Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value = spReturnDic["G_MFR_NAME"].ToString(); Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = spReturnDic["G_DATE_CODE"].ToString(); Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value = spReturnDic["G_LOT_CODE"].ToString(); } else { throw new Exception(spReturnDic["RES"].ToString()); } } catch (Exception ex) { throw ex; } }
/// <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; } }
//處理SN狀態/記錄過站記錄/統計良率 public R_TCQS_YIELD_RATE_DETAIL CheckTCQSTest(string SerialNo, string SkuNo, string WorkorderNo, string Line, string StationName, string DeviceName, string Bu, string PassOrFail, string EmpNo, DateTime DT, OleExec DB) { DataTable dataTable = new DataTable(); string sql = string.Empty; string RepassModel = "", RetestModel = "", Device_Name = ""; int PassLimit = 1, RetestLimit = 1; //所有未設定的機種,默認以該參數統計TCQS int PassCount = 0, RetestCount = 0; //臨時表記錄的Pass/Retest測試次數 int PassCountFlag = 0; //標識是否有過站記錄,在Total統計時以確定Fresh/Rework狀態 int RetestCountFlag = 0, //標識是否有測試記錄,在TCQS統計時以確定Fresh/Rework狀態 RepairFlag = 0; //標識是否做過站處理 T_R_WO_BASE WoTable = null; Row_R_WO_BASE WoRow = null; WoTable = new T_R_WO_BASE(DB, this.DBType); WoRow = WoTable.GetWo(WorkorderNo, DB); //初使化R_TCQS_YIELD_RATE_DETAIL R_TCQS_YIELD_RATE_DETAIL RTYRD = new R_TCQS_YIELD_RATE_DETAIL() { WORK_DATE = DT.ToString("yyyy-MM-dd"), WORK_TIME = DT.ToString("HH"), PRODUCTION_LINE = Line, CLASS_NAME = GetWorkClass(DT.ToString("HH:mm:ss"), DB), STATION_NAME = StationName, DEVICE_NAME = DeviceName, WORKORDERNO = WorkorderNo, SKUNO = SkuNo, SKU_NAME = WoRow.SKU_NAME, SKU_SERIES = WoRow.SKU_SERIES, TOTAL_REWORK_BUILD_QTY = 0, TOTAL_REWORK_PASS_QTY = 0, TOTAL_REWORK_FAIL_QTY = 0, TOTAL_FRESH_BUILD_QTY = 0, TOTAL_FRESH_PASS_QTY = 0, TOTAL_FRESH_FAIL_QTY = 0, TCQS_REWORK_BUILD_QTY = 0, TCQS_REWORK_PASS_QTY = 0, TCQS_REWORK_FAIL_QTY = 0, TCQS_FRESH_BUILD_QTY = 0, TCQS_FRESH_PASS_QTY = 0, TCQS_FRESH_FAIL_QTY = 0, EDIT_EMP = EmpNo, EDIT_TIME = DT }; sql = $@"Select PASS_LIMIT,RETEST_LIMIT,REPASS_MODEL,RETEST_MODEL from C_MODEL_ATE_SET_T Where skuno='{SkuNo}' and station_name='{StationName}' "; dataTable = DB.ExecSelect(sql).Tables[0]; //如果有設定則取設定值,否則取默認值 if (dataTable.Rows.Count > 0) { PassLimit = Int32.Parse(dataTable.Rows[0]["PASS_LIMIT"].ToString()); RetestLimit = Int32.Parse(dataTable.Rows[0]["RETEST_MODEL"].ToString()); RepassModel = dataTable.Rows[0]["REPASS_MODEL"].ToString(); RetestModel = dataTable.Rows[0]["RETEST_MODEL"].ToString(); } //獲取臨時表的測試記錄中Pass次數/Fail次數/測試機臺名稱 sql = $@"select PASS_COUNT,RETEST_COUNT,DEVICE_NAME from R_TMP_ATEDATA_T where station_name = '{StationName}' and sn = '{SerialNo}'"; dataTable = null; dataTable = DB.ExecSelect(sql).Tables[0]; if (dataTable.Rows.Count > 0) { PassCount = Int32.Parse(dataTable.Rows[0]["PASS_COUNT"].ToString()); RetestCount = Int32.Parse(dataTable.Rows[0]["RETEST_COUNT"].ToString()); Device_Name = dataTable.Rows[0]["DEVICE_NAME"].ToString(); } //獲取產品狀態Fresh or Rework sql = $@"SELECT RESULT_FLAG FROM R_SN_DETAIL WHERE SN = '{SerialNo}' AND STATION_NAME = '{StationName}'"; dataTable = null; dataTable = DB.ExecSelect(sql).Tables[0]; if (dataTable.Rows.Count > 0) { //有記錄,代表有測試過,因此TCQS為Rework RetestCountFlag = 1; foreach (DataRow dr in dataTable.Rows) { //有過站記錄,因此總良率為Rework if (dr["RESULT_FLAG"].ToString() == "0" || dr["RESULT_FLAG"].ToString() == "1") { PassCountFlag = 1; break; } } } //統計良率統計數據 if (PassOrFail == "PASS")//測試結果為PASS { //如果有Fail記錄 if (RetestCount > 0) { //管控測試PASS次數>1 if (PassLimit > 1) { //如果有測試PASS的記錄,則需要判斷是否需切換工站,是否滿足測試次數 if (PassCount > 0) { //必須切換測試站 if (RepassModel == "0") { if (Device_Name == DeviceName) { //必須換機臺測試 string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185619"); throw new MESReturnMessage(errMsg); } } else if (RepassModel == "1") //不允許換機臺測試 { if (Device_Name != DeviceName) { //不允許換機臺測試,必須使用Device_Name機臺測試 string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185620", new string[] { Device_Name }); throw new MESReturnMessage(errMsg); } } //判斷是否滿足PASS測試次數 if (PassCount != PassLimit - 1) //不滿足測試次數 { RepairFlag = 1; //不過站,不清臨時表,過站記錄標識為非過站 } RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_PASS_QTY = 1; } else //如果沒有測試PASS的記錄,則直接增加測試PASS次數 { RepairFlag = 1; //不過站,不清臨時表,過站記錄標識為非過站 RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_PASS_QTY = 1; } } else //管控測試PASS次數=1 { RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_PASS_QTY = 1; } } else //如果臨時表沒有Fail記錄,則需要判斷是否有測試記錄,以確定是Fresh還是Rework { //如果有測試記錄,則為Rework if (RetestCountFlag == 1) { RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_PASS_QTY = 1; } else//否則為Fresh { RTYRD.TCQS_FRESH_BUILD_QTY = 1; RTYRD.TCQS_FRESH_PASS_QTY = 1; } } //如果做過站處理,則還需要統計總良率 if (RepairFlag == 0) { if (PassCountFlag == 1)//有過站記錄 { RTYRD.TOTAL_REWORK_BUILD_QTY = 1; RTYRD.TOTAL_REWORK_PASS_QTY = 1; } else//沒有過站記錄 { RTYRD.TOTAL_FRESH_BUILD_QTY = 1; RTYRD.TOTAL_FRESH_PASS_QTY = 1; } } } else//測試結果為Fail { //管控測試重測次數>1 if (RetestLimit > 1) { //有Fail記錄 if (RetestCount > 0) { //必須切換測試站 if (RepassModel == "0") { if (Device_Name == DeviceName) { //必須換機臺測試 string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185619"); throw new MESReturnMessage(errMsg); } } else if (RepassModel == "1") //不允許換機臺測試 { if (Device_Name != DeviceName) { //不允許換機臺測試,必須使用Device_Name機臺測試 string errMsg = MESReturnMessage.GetMESReturnMessage("MSGCODE20180526185620", new string[] { Device_Name }); throw new MESReturnMessage(errMsg); } } //判斷是否滿足重測次數 if (RetestCount != RetestLimit - 1) //不滿足測試次數 { RepairFlag = 1; //不過站,不清臨時表,過站記錄標識為非過站 } RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_FAIL_QTY = 1; } else //允許重測次數>1,且臨時表沒有Fail記錄 { RepairFlag = 1; //不過站,不清臨時表,過站記錄標識為非過站 //有測試記錄 if (RetestCountFlag == 1) { RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_FAIL_QTY = 1; } else//沒有測試記錄 { RTYRD.TCQS_FRESH_BUILD_QTY = 1; RTYRD.TCQS_FRESH_FAIL_QTY = 1; } } } else //管控測試重測次數=1,則需要判斷是否有測試記錄,以確定是Fresh還是Rework { //如果有測試記錄,則為Rework if (RetestCountFlag == 1) { RTYRD.TCQS_REWORK_BUILD_QTY = 1; RTYRD.TCQS_REWORK_FAIL_QTY = 1; } else//否則為Fresh { RTYRD.TCQS_FRESH_BUILD_QTY = 1; RTYRD.TCQS_FRESH_FAIL_QTY = 1; } } //如果做過站處理,則還需要統計總良率 if (RepairFlag == 0) { if (PassCountFlag == 1)//有過站記錄 { RTYRD.TOTAL_REWORK_BUILD_QTY = 1; RTYRD.TOTAL_REWORK_FAIL_QTY = 1; } else//沒有過站記錄 { RTYRD.TOTAL_FRESH_BUILD_QTY = 1; RTYRD.TOTAL_FRESH_FAIL_QTY = 1; } } } return(RTYRD); }
public void SubmitWoInfo(JObject requestValue, JObject Data, MESStationReturn StationReturn) { //wo string wo = Data["wo"].ToString(); if (string.IsNullOrEmpty(wo)) { //StationReturn.Status = StationReturnStatusValue.Fail; //StationReturn.MessageCode = "MES00000006"; //StationReturn.MessagePara = new List<object>() { "Skuno" }; //StationReturn.Data = ""; //return; throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "WO" })); } OleExec sfcdb = DBPools["SFCDB"].Borrow(); T_R_WO_BASE t_wo = new T_R_WO_BASE(sfcdb, DB_TYPE_ENUM.Oracle); if (!t_wo.CheckDataExist(wo, sfcdb)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000008", new string[] { wo })); } R_WO_HEADER wo_header = new T_R_WO_HEADER(sfcdb, DB_TYPE_ENUM.Oracle).GetDetailByWo(sfcdb, wo); //sku info string skuno = Data["skuno"].ToString();//wo_header.MATNR if (string.IsNullOrEmpty(skuno)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "SKUNO" })); } string skuver = Data["sku_ver"].ToString();//wo_header.REVLV C_SKU c_sku = new T_C_SKU(sfcdb, DB_TYPE_ENUM.Oracle).GetSku(skuno, sfcdb, DB_TYPE_ENUM.Oracle).GetDataObject(); if (c_sku == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { skuno })); } //route exchange from name string route_name = Data["route_name"].ToString(); if (string.IsNullOrEmpty(route_name)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "ROUTE" })); } C_ROUTE c_route = new T_C_ROUTE(sfcdb, DB_TYPE_ENUM.Oracle).GetByRouteName(route_name, sfcdb); if (c_route == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { route_name })); } //station route check string station_name = Data["station"].ToString(); if (string.IsNullOrEmpty(station_name)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000006", new string[] { "STATION" })); } List <C_ROUTE_DETAIL> c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, DB_TYPE_ENUM.Oracle).GetByRouteIdOrderBySEQASC(c_route.ID, sfcdb); if (c_route_detail != null && c_route_detail.Count > 0) { C_ROUTE_DETAIL check = c_route_detail.Find(t => t.STATION_NAME == station_name); if (check == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { station_name })); } } else { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { route_name })); } //data record Row_R_WO_BASE row_wobase = (Row_R_WO_BASE)t_wo.NewRow(); row_wobase.ID = t_wo.GetNewID(this.BU, sfcdb); row_wobase.WORKORDERNO = wo; row_wobase.PLANT = Data["factory"].ToString(); row_wobase.RELEASE_DATE = DateTime.Now; row_wobase.DOWNLOAD_DATE = Convert.ToDateTime(Data["date"].ToString()); row_wobase.PRODUCTION_TYPE = "BTO"; row_wobase.WO_TYPE = Data["wo_type"].ToString(); row_wobase.SKUNO = skuno; row_wobase.SKU_VER = skuver; row_wobase.SKU_NAME = c_sku.SKU_NAME; //row_wobase.SKU_SERIES = null; //row_wobase.SKU_DESC = null; row_wobase.CUST_PN = c_sku.CUST_PARTNO; row_wobase.ROUTE_ID = c_route.ID; row_wobase.START_STATION = station_name; row_wobase.KP_LIST_ID = Data["kp_list_id"].ToString(); row_wobase.CLOSED_FLAG = "0"; row_wobase.WORKORDER_QTY = Convert.ToDouble(Data["qty"].ToString()); row_wobase.STOCK_LOCATION = wo_header.LGORT; row_wobase.CUST_ORDER_NO = wo_header.ABLAD; row_wobase.EDIT_EMP = this.LoginUser.EMP_NO; row_wobase.EDIT_TIME = DateTime.Now; string sql = row_wobase.GetInsertString(DB_TYPE_ENUM.Oracle); try { int res = sfcdb.ExecSqlNoReturn(sql, null); if (res == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { wo })); } if (sfcdb != null) { DBPools["SFCDB"].Return(sfcdb); } } catch (Exception ex) { if (sfcdb != null) { DBPools["SFCDB"].Return(sfcdb); } throw ex; } }
/// <summary> /// 加載一個字符串特定格式到指定位置 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"> /// StrSavePoint:字符串保存位置; /// Change:0轉小寫,1轉大寫,2保持不變; /// Trim:0不變,1 去前空,2去后空,3前後去空; /// </param> public static void StringDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { if (Paras.Count != 3) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } for (int i = 0; i < Paras.Count; i++) { if (Paras[i].SESSION_TYPE == "Change") { if (Paras[i].VALUE == "0") { Input.Value = Input.Value.ToString().ToLower(); } else if (Paras[i].VALUE == "1") { Input.Value = Input.Value.ToString().ToUpper(); } //else if (Paras[i].VALUE != "0"&& Paras[i].VALUE != "1"&& Paras[i].VALUE != "2") //{ // Station.AddMessage("MES00000020", new string[] { "SESSION_TYPE为\"Change\"的", "0,1,2" }, MESReturnView.Station.StationMessageState.Fail); //} } else if (Paras[i].SESSION_TYPE == "Trim") { if (Paras[i].VALUE == "1") { Input.Value = Input.Value.ToString().TrimStart(); } else if (Paras[i].VALUE == "2") { Input.Value = Input.Value.ToString().TrimEnd(); } else if (Paras[i].VALUE == "3") { Input.Value = Input.Value.ToString().Trim(); } //else if (Paras[i].VALUE != "0" && Paras[i].VALUE != "1" && Paras[i].VALUE != "2" && Paras[i].VALUE != "3") //{ // Station.AddMessage("MES00000020", new string[] { "SESSION_TYPE为\"Trim\"的", "0,1,2,3" }, MESReturnView.Station.StationMessageState.Fail); //} } } for (int j = 0; j < Paras.Count; j++) { if (Paras[j].SESSION_TYPE != "Change" && Paras[j].SESSION_TYPE != "Trim") { MESStationSession StrInput = Station.StationSession.Find(t => t.MESDataType == Paras[j].SESSION_TYPE && t.SessionKey == Paras[j].SESSION_KEY); if (StrInput == null) { StrInput = new MESStationSession() { MESDataType = Paras[j].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[j].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(StrInput); } StrInput.InputValue = Input.Value.ToString(); StrInput.ResetInput = Input; StrInput.Value = Input.Value.ToString(); //Station.NextInput = Station.Inputs[0]; break; } } }
public static void SNLinkSubSNKPAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.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>(); WorkOrder WO = null; SN Sn = null; 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) { 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)SubSNSession.Value; SubKP = (List <C_KEYPART>)SubKPSession.Value; DicKP["SN"] = Sn.SerialNo; DicKP["SN_ID"] = Sn.ID; DicKP["KEYPART_SN"] = Sn.SerialNo; DicKP["KP_SN_ID"] = Sn.ID; DicKP["PART_NO"] = Sn.SkuNo; DicKP["SEQ_NO"] = SubKP[0].SEQ_NO.ToString(); DicKP["CATEGORY_NAME"] = SubKP[0].CATEGORY_NAME; DicKP["CATEGORY"] = SubKP[0].CATEGORY; DicKP["KP_TYPE"] = "SUB_SN"; KPList.Add(DicKP); KPListSession.Value = KPList; //MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); //if (SubSNSession == null) //{ // SubSNSession = new MESStationSession() { MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input }; // Station.StationSession.Add(SubSNSession); //} //wO = (WorkOrder)WOLoadPoint.Value; //snob.Load(sn,Station.SFCDB,DB_TYPE_ENUM.Oracle); //SN snob = new SN(sn, Station.SFCDB, DB_TYPE_ENUM.Oracle); //if (snob == null) //{ // throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN Point" })); //} //T_C_KEYPART tck = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle); //T_R_SN_KEYPART_DETAIL T_kd = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); //List<C_KEYPART> KEYPARTS = tck.GetKeypartListByWOAndStation(Station.SFCDB, wO.WorkorderNo, Station.StationName); //if (KEYPARTS.Count > 0) //{ // T_kd.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, snob.ID, snob.SerialNo, sn, Station.StationName, KEYPARTS[0].PART_NO, KEYPARTS[0].SEQ_NO, KEYPARTS[0].CATEGORY_NAME, Station.LoginUser.EMP_NO); // Station.AddMessage("MES00000180", new string[] { "SUB_SN", sn }, StationMessageState.Pass); //} //else //{ // ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { sn }); // throw new MESReturnMessage(ErrMessage); //} }
/// <summary> /// 加載FailList /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SNFailCollectDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; string StrSn = ""; string StrLocation = ""; string StrProcess = ""; string StrFailCode = ""; string StrFailDesc = ""; Int16 FailCount = 0; List <Dictionary <string, string> > FailList = new List <Dictionary <string, string> >(); Dictionary <string, string> FailInfo = null; if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //獲取Fail SN 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); } //StrSn = SNSession.Value.ToString(); StrSn = SNSession.InputValue.ToString(); //獲取Fail Location MESStationSession LocationSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (LocationSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrLocation = LocationSession.Value.ToString(); //獲取Fail Process MESStationSession ProcessSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (ProcessSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrProcess = ProcessSession.Value.ToString(); //獲取FailCode MESStationSession FailCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (FailCodeSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrFailCode = FailCodeSession.Value.ToString(); //獲取Fail Description MESStationSession FailDescSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (FailDescSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrFailDesc = FailDescSession.Value.ToString(); MESStationSession FailListSession = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY); if (FailListSession == null) { FailListSession = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[5].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(FailListSession); } else { FailList = (List <Dictionary <string, string> >)FailListSession.Value; } FailInfo = new Dictionary <string, string>(); //FailList=new List<Dictionary<string, string>>(); foreach (Dictionary <string, string> failure in FailList) { } // FailList.Select((dic) => { // dic["FailProcess"].Equals(StrProcess) && //dic["FailLocation"].Equals(StrLocation) && dic["FailCode"].Equals(StrFailCode); }); //add by ZGJ 2018-03-15 //檢查當前不良信息是否已經存在於已輸入中 Dictionary <string, string> ExistFailInfo = FailList.Find((dic) => { return(dic["FailProcess"].Equals(StrProcess) && dic["FailLocation"].Equals(StrLocation) && dic["FailCode"].Equals(StrFailCode)); }); if (ExistFailInfo == null) { FailInfo.Add("FailLocation", StrLocation); FailInfo.Add("FailProcess", StrProcess); FailInfo.Add("FailDesc", StrFailDesc); FailInfo.Add("FailCode", StrFailCode); FailList.Add(FailInfo); FailListSession.Value = FailList; } else { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000163", new string[] { StrProcess, StrLocation, StrFailCode }); throw new MESReturnMessage(ErrMessage); } }
public static void SNLinkPassAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string SubSn = ""; SN SubSNObj = new SN(); SN SnObj = new SN(); WorkOrder WO = new WorkOrder(); T_R_SN Table_R_SN = new T_R_SN(Station.SFCDB, Station.DBType); T_R_SN_STATION_DETAIL Table_SnDetail = new T_R_SN_STATION_DETAIL(Station.SFCDB, Station.DBType); T_R_SN_KEYPART_DETAIL Table_R_Keypart = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, Station.DBType); string ErrMessage = string.Empty; List <C_KEYPART> SubKPList = new List <C_KEYPART>(); List <C_KEYPART> MainKPList = new List <C_KEYPART>(); string StrNextStation = ""; string Status = ""; R_SN R_Sn = null; T_R_WO_BASE WoTable = null; //add by LLF List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >(); string result = ""; if (Paras.Count == 0) { throw new Exception("參數數量不正確!"); } 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 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 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 })); } MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (WOSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY })); } MESStationSession NextStationSession = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY); if (NextStationSession == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[5].SESSION_TYPE + Paras[5].SESSION_KEY })); } MESStationSession StatusSession = Station.StationSession.Find(t => t.MESDataType == Paras[6].SESSION_TYPE && t.SessionKey == Paras[6].SESSION_KEY); if (StatusSession == null) { StatusSession = new MESStationSession() { MESDataType = Paras[6].SESSION_TYPE, SessionKey = Paras[6].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(StatusSession); if (string.IsNullOrEmpty(Paras[0].VALUE)) { StatusSession.Value = "PASS"; } } Status = StatusSession.Value.ToString(); MESStationSession ClearFlagGSession = Station.StationSession.Find(t => t.MESDataType == Paras[7].SESSION_TYPE && t.SessionKey == Paras[7].SESSION_KEY); if (ClearFlagGSession == null) { ClearFlagGSession = new MESStationSession() { MESDataType = Paras[7].SESSION_TYPE, SessionKey = Paras[7].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(ClearFlagGSession); } ClearFlagGSession.Value = "false"; StrNextStation = SnObj.StringListToString((List <string>)NextStationSession.Value); //StrNextStation = NextStationSession.Value.ToString(); SubKPList = (List <C_KEYPART>)SubKPSession.Value; MainKPList = (List <C_KEYPART>)MainKPSession.Value; KPList = (List <Dictionary <string, string> >)KPListSession.Value; SubSNObj = (SN)SubSNSession.Value; WO = (WorkOrder)WOSession.Value; SubSn = SubSNObj.SerialNo; R_Sn = Table_R_SN.GetById(SubSNObj.ID, Station.SFCDB); if (SubKPList.Count + MainKPList.Count == KPList.Count) { Table_R_SN.UpdateSNKeyparStatus(SubSNObj.ID, Station.LoginUser.EMP_NO, "0", Station.SFCDB); Table_R_SN.InsertLinkSN(SubSn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, WO.KP_LIST_ID, Station.StationName, StrNextStation, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB, SubSNObj.Plant); //更新Main KP SN foreach (Dictionary <string, string> DicMainKP in KPList) { int SeqNo = Convert.ToInt16(DicMainKP["SEQ_NO"]); if (DicMainKP["KP_TYPE"] == "MAIN_SN") { Table_R_SN.UpdateSNKeyparStatus(DicMainKP["KP_SN_ID"], Station.LoginUser.EMP_NO, "1", Station.SFCDB); } //写KP Table_R_Keypart.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, SubSNObj.ID, DicMainKP["SN"], DicMainKP["KEYPART_SN"], Station.StationName, DicMainKP["PART_NO"], SeqNo, DicMainKP["CATEGORY_NAME"], DicMainKP["CATEGORY"], Station.LoginUser.EMP_NO); } //寫過站記錄 result = Table_R_SN.LinkPassStationDetail(R_Sn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, Station.Line, Station.StationName, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB); if (Convert.ToInt32(result) <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "STATION DETAIL" })); } //add by LLF WoTable = new T_R_WO_BASE(Station.SFCDB, Station.DBType); result = WoTable.AddCountToWo(WO.WorkorderNo, 1, Station.SFCDB); // 更新 R_WO_BASE 中的數據 if (Convert.ToInt32(result) <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "WO QTY" })); } //寫良率,UPH result = Table_R_SN.RecordUPH(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB); if (Convert.ToInt32(result) <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "UPH" })); } result = Table_R_SN.RecordYieldRate(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB); if (Convert.ToInt32(result) <= 0) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "YIELD" })); } KPListSession.Value = null; ClearFlagGSession.Value = "true"; Station.AddMessage("MES00000195", new string[] { SubSn, StrNextStation }, StationMessageState.Pass); } }
public static void SNSampleFailInfoDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; string StrSn = ""; string StrLocation = ""; string StrFailCode = ""; string StrFailDesc = ""; string[] FailInfo = new string[3]; if (Paras.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } //獲取Fail SN 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); } StrSn = SNSession.Value.ToString(); //獲取FailCode MESStationSession FailCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (FailCodeSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrFailCode = FailCodeSession.Value.ToString(); //獲取Fail Description MESStationSession FailDescSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (FailDescSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrFailDesc = FailDescSession.Value.ToString(); //獲取Fail Location MESStationSession LocationSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (LocationSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StrLocation = LocationSession.Value.ToString(); MESStationSession FailListSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (FailListSession == null) { FailListSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(FailListSession); } FailInfo[0] = StrFailCode; FailInfo[1] = StrLocation; FailInfo[2] = StrFailDesc; FailListSession.Value = FailInfo; }
/// <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 })); } //} } }
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 }
/// <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; } }
public void DoJobStockGT(JObject requestValue, JObject Data, MESStationReturn StationReturn) { OleExec SFCDB = DBPools["SFCDB"].Borrow(); try { ZRFC_SFC_NSG_0020 zrfc_sfc_nsg_0020 = new ZRFC_SFC_NSG_0020(this.BU); string lockIp = ""; string postDate; string o_flag = ""; string o_flag1 = ""; string o_flag2 = ""; string o_message = ""; string o_message1 = ""; string o_message2 = ""; bool IsRuning = false; Row_R_STOCK_GT rowStockGT; DataTable table = new DataTable(); SFCDB.ThrowSqlExeception = true; T_R_SYNC_LOCK t_r_sync_lock = new T_R_SYNC_LOCK(SFCDB, DB_TYPE_ENUM.Oracle); T_R_STOCK_GT t_r_stock_gt = new T_R_STOCK_GT(SFCDB, DB_TYPE_ENUM.Oracle); T_R_STOCK t_r_stock = new T_R_STOCK(SFCDB, DB_TYPE_ENUM.Oracle); if (Interface.IsMonthly(SFCDB, DB_TYPE_ENUM.Oracle)) { //月結不給拋賬 //throw new Exception("This time is monthly,can't BackFlush"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180803152122", new string[] { })); } IsRuning = t_r_sync_lock.IsLock("JOBSTOCKGT", SFCDB, DB_TYPE_ENUM.Oracle, out lockIp); if (IsRuning) { //throw new Exception("JOBSTOCKGT interface is running on " + lockIp + ",Please try again later"); throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180803152222", new string[] { lockIp })); } t_r_sync_lock.SYNC_Lock(BU, this.IP, "JOBSTOCKGT", "JOBSTOCKGT", this.LoginUser.EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); List <R_STOCK_GT> GTList = t_r_stock_gt.GetNotGTListByConfirmedFlag("0", SFCDB); postDate = Interface.GetPostDate(SFCDB); if (GTList != null && GTList.Count > 0) { foreach (R_STOCK_GT r_stock_gt in GTList) { rowStockGT = null; zrfc_sfc_nsg_0020.SetValue("I_AUFNR", r_stock_gt.WORKORDERNO); zrfc_sfc_nsg_0020.SetValue("I_BUDAT", postDate); zrfc_sfc_nsg_0020.SetValue("I_FLAG", r_stock_gt.CONFIRMED_FLAG); zrfc_sfc_nsg_0020.SetValue("I_LGORT_TO", r_stock_gt.TO_STORAGE); zrfc_sfc_nsg_0020.SetValue("I_LMNGA", r_stock_gt.TOTAL_QTY.ToString()); zrfc_sfc_nsg_0020.SetValue("I_STATION", r_stock_gt.SAP_STATION_CODE); try { // zrfc_sfc_nsg_0020 中包含三個動作101,521,轉倉,flag,flag1,flag2 一次對應這三個動作 // flag,flag1,flag2 這幾個flag 0表示OK,1表示false zrfc_sfc_nsg_0020.CallRFC(); o_flag = zrfc_sfc_nsg_0020.GetValue("O_FLAG"); o_flag1 = zrfc_sfc_nsg_0020.GetValue("O_FLAG1"); o_flag2 = zrfc_sfc_nsg_0020.GetValue("O_FLAG2"); o_message = zrfc_sfc_nsg_0020.GetValue("O_MESSAGE"); o_message1 = zrfc_sfc_nsg_0020.GetValue("O_MESSAGE1"); o_message2 = zrfc_sfc_nsg_0020.GetValue("O_MESSAGE2"); rowStockGT = (Row_R_STOCK_GT)t_r_stock_gt.GetObjByID(r_stock_gt.ID, SFCDB); rowStockGT.SAP_MESSAGE = "101:" + o_message + ";521:" + o_message1 + ";311" + o_message2; rowStockGT.BACKFLUSH_TIME = GetDBDateTime(); if (zrfc_sfc_nsg_0020.GetValue("O_FLAG") == "0") { rowStockGT.SAP_FLAG = "1"; t_r_stock.UpdateSapFlagByGTID(rowStockGT.ID, rowStockGT.SAP_FLAG, SFCDB); } else { rowStockGT.SAP_FLAG = "2"; } SFCDB.ExecSQL(rowStockGT.GetUpdateString(DB_TYPE_ENUM.Oracle)); } catch (Exception ex) { Interface.WriteIntoMESLog(SFCDB, BU, "MESStation", "MESStation.Interface.JobStockGT", "DoJobStockGT", r_stock_gt.WORKORDERNO + ";" + this.IP + ";" + ex.ToString(), "", this.LoginUser.EMP_NO); r_stock_gt.SAP_FLAG = "2"; } } } t_r_sync_lock.SYNC_UnLock(BU, this.IP, "JOBSTOCKGT", "JOBSTOCKGT", this.LoginUser.EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (SFCDB != null) { DBPools["SFCDB"].Return(SFCDB); } StationReturn.Status = StationReturnStatusValue.Pass; } catch (Exception exception) { if (SFCDB != null) { DBPools["SFCDB"].Return(SFCDB); } StationReturn.Status = StationReturnStatusValue.Fail; throw exception; } }
protected override void OnMessage(MessageEventArgs e) { MESStationReturn StationReturn = null; // new MESStationReturn(); string[] Para = null; //add by LLF 2017-1-4 try { //處理JSON //Newtonsoft.Json.Linq.JObject Request = (Newtonsoft.Json.Linq.JObject) Newtonsoft.Json.JsonConvert.DeserializeObject( //"{ TOKEN:null, CLASS: \"MESStation.ApiHelper\", FUNCTION:\"GetApiClassList\", DATA:{ } }"); //Request = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject("{ TOKEN:null, CLASS: \"MESStation.ApiHelper\", FUNCTION:\"GetApiFunctionsList\", DATA:{ CLASSNAME:\"MESStation.ApiHelper\" } }"); //Request = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject( // "{ TOKEN:null, CLASS: \"MESStation.ApiHelper\", FUNCTION:\"GetApiFunctionsList\", DATA:{ CLASSNAME:\"MESStation.UserManager\" } }"); Newtonsoft.Json.Linq.JObject Request = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(e.Data); string CLASS = Request["Class"].ToString(); string FUNCTION = Request["Function"].ToString(); string TOKEN = Request["Token"].ToString(); string MsgID = Request["MessageID"]?.ToString(); string ClientID = Request["ClientID"]?.ToString(); Request.Add("IP", Newtonsoft.Json.Linq.JToken.Parse("{Value:\"" + this.ClientIP + "\"}")); StationReturn = new MESStationReturn(MsgID, ClientID); //反射加載 //ApiHelper api = new ApiHelper(); Type APIType; //加載類庫 Assembly assembly = Assembly.Load("MESStation"); APIType = assembly.GetType(CLASS); object API_CLASS = assembly.CreateInstance(CLASS); MesAPIBase API = (MesAPIBase)API_CLASS; if (!API.DBPools.ContainsKey("SFCDB")) { API.DBPools.Add("SFCDB", SFCDBPool); } if (!API.DBPools.ContainsKey("APDB")) { API.DBPools.Add("APDB", APDBPool); } //API.BU = "HWD"; //API.BU = "VERTIV"; ((MesAPIBase)API_CLASS).IP = this.ClientIP; API.Language = "CHINESE"; //CHINESE,CHINESE_TW,ENGLISH; //初始化異常類型的數據庫連接池 MESReturnMessage.SetSFCDBPool(SFCDBPool); //獲取調用函數 MethodInfo Function = APIType.GetMethod(FUNCTION); // bool CheckLogin = false; if (LoginUsers.ContainsKey(TOKEN)) { User lu = LoginUsers[TOKEN]; ((MesAPIBase)API_CLASS).LoginUser = lu; CheckLogin = true; API.BU = lu.BU; } else { if (FUNCTION != "Login" && ((MesAPIBase)API_CLASS).MastLogin) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "No Login !"; } else { if (FUNCTION == "Login") { CheckLogin = true; } } } if (CheckLogin) { Function.Invoke(API_CLASS, new object[] { Request, Request["Data"], StationReturn }); if (FUNCTION == "Login") { if (StationReturn.Status == "Pass") { LoginReturn r = (LoginReturn)StationReturn.Data; User lu = ((MesAPIBase)API_CLASS).LoginUser; if (this.Token != null) { Report.LoginUsers.Remove(Token); MESStation.Stations.CallStation.logout(Token); } string NewToken = r.Token; Token = r.Token; if (LoginUsers.ContainsKey(NewToken)) { LoginUsers[NewToken] = lu; } else { LoginUsers.Add(NewToken, lu); } } } }//函數不要求登錄 else if (!((MesAPIBase)API_CLASS).MastLogin) { Function.Invoke(API_CLASS, new object[] { Request, Request["Data"], StationReturn }); if (FUNCTION == "Login") { if (StationReturn.Status == "Pass") { LoginReturn r = (LoginReturn)StationReturn.Data; User lu = ((MesAPIBase)API_CLASS).LoginUser; string NewToken = r.Token; if (LoginUsers.ContainsKey(NewToken)) { LoginUsers[NewToken] = lu; } else { LoginUsers.Add(NewToken, lu); } } } } //add by LLF 2017-12-27 if (StationReturn.MessageCode != null) { if (StationReturn.MessageCode.Length > 0) { if (StationReturn.MessagePara != null) { if (StationReturn.MessagePara.Count > 0) { Para = new string[StationReturn.MessagePara.Count]; for (int i = 0; i < StationReturn.MessagePara.Count; i++) { Para[i] = StationReturn.MessagePara[i].ToString(); } } } StationReturn.Message = MESReturnMessage.GetMESReturnMessage(StationReturn.MessageCode, Para); } } } catch (MESReturnMessage ee) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = ee.Message; if (ee.InnerException != null) { StationReturn.Data = ee.InnerException.Message; } } catch (Exception ee) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = ee.Message; if (ee.InnerException != null) { StationReturn.Data = ee.InnerException.Message; } } System.Web.Script.Serialization.JavaScriptSerializer JsonMaker = new System.Web.Script.Serialization.JavaScriptSerializer(); JsonMaker.MaxJsonLength = int.MaxValue; string json = JsonMaker.Serialize(StationReturn); //JavaScriptSerializer 實例在序列化對象的時候,遇到 DateTime 類型會序列化出不可讀的數據, //因此改用 Newtonsoft 的 JsonConvert 來進行序列化,序列化出來的 DateTime 形如 2017-12-06T11:14:37 //另外如果遇到無法將 System.DBNull 類型轉換成 string 類型的,可以手動檢測下值的類型, //如果是 System.DBNull,直接將值改為 null 即可。 //實在無法實現你所需要的功能,可將下面這句註釋掉。 // // modify by 張官軍 2017/12/06 //變更時間格式 modify by Wuq 2018/01/25 json = Newtonsoft.Json.JsonConvert.SerializeObject(StationReturn, Newtonsoft.Json.Formatting.Indented, new Newtonsoft.Json.Converters.IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }); //json = Newtonsoft.Json.JsonConvert.SerializeObject(StationReturn); Send(json); }
/// <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> /// 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; } }
/// HWD PTH Allpart扣料,add by LLF 2018-02-19 /// </summary> public static void APAssignMaterialPTHAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { // OleExecPool apdbPool = null; OleExec apdb = null; try { apdb = Station.APDB; string Line = Station.Line; string StationName = string.Empty; string ErrMessage = string.Empty; string StrWO = string.Empty; string StationNum = string.Empty; string TRCode = string.Empty; string SN = string.Empty; 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 = SNSession.Value.ToString(); 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); } StrWO = WOSession.Value.ToString(); MESStationSession StationNumSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (StationNumSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } StationNum = StationNumSession.Value.ToString(); StationName = Station.Line + Station.StationName + StationNum; MESStationSession PTHTRCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (PTHTRCodeSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } TRCode = PTHTRCodeSession.Value.ToString(); OleDbParameter[] AssignMaterialPTHSP = new OleDbParameter[6]; AssignMaterialPTHSP[0] = new OleDbParameter("g_type", "0010"); AssignMaterialPTHSP[1] = new OleDbParameter("g_wo", StrWO); AssignMaterialPTHSP[2] = new OleDbParameter("g_station", StationName); AssignMaterialPTHSP[3] = new OleDbParameter("g_tr_code", TRCode); AssignMaterialPTHSP[4] = new OleDbParameter("g_psn", SN); AssignMaterialPTHSP[5] = new OleDbParameter(); AssignMaterialPTHSP[5].Size = 1000; AssignMaterialPTHSP[5].ParameterName = "RES"; AssignMaterialPTHSP[5].Direction = System.Data.ParameterDirection.Output; string result = apdb.ExecProcedureNoReturn("MES1.assign_material_pth", AssignMaterialPTHSP); if (result.IndexOf("OK") >= 0) { OleDbParameter[] AssignMaterialPTH0020 = new OleDbParameter[6]; AssignMaterialPTH0020[0] = new OleDbParameter("g_type", "0020"); AssignMaterialPTH0020[1] = new OleDbParameter("g_wo", StrWO); AssignMaterialPTH0020[2] = new OleDbParameter("g_station", StationName); AssignMaterialPTH0020[3] = new OleDbParameter("g_tr_code", TRCode); AssignMaterialPTH0020[4] = new OleDbParameter("g_psn", SN); AssignMaterialPTH0020[5] = new OleDbParameter(); AssignMaterialPTH0020[5].Size = 1000; AssignMaterialPTH0020[5].ParameterName = "RES"; AssignMaterialPTH0020[5].Direction = System.Data.ParameterDirection.Output; result = apdb.ExecProcedureNoReturn("MES1.assign_material_pth", AssignMaterialPTH0020); //apdbPool.Return(apdb); if (result.IndexOf("OK") == -1) { throw new Exception(result); } } else { //apdbPool.Return(apdb); throw new Exception(result); } } catch (Exception ex) { //if (apdb != null) //{ // //apdbPool.Return(apdb); //} throw new Exception(ex.Message.ToString()); } }