public override void MakeLabel(OleExec DB) { //base.MakeLabel(DB); t_r_sn = new T_R_SN(DB, MESDataObject.DB_TYPE_ENUM.Oracle); C_SKU_Label labelName = null; LogicObject.SN snObj; R_SN r_sn; if (I_SN.Value is string) { r_sn = t_r_sn.LoadSN(I_SN.Value.ToString(), DB); } else if (typeof(LogicObject.SN) == I_SN.Value.GetType()) { snObj = (LogicObject.SN)I_SN.Value; r_sn = t_r_sn.LoadSN(snObj.SerialNo, DB); } else if (typeof(R_SN) == I_SN.Value.GetType()) { r_sn = (R_SN)I_SN.Value; } else { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180607163531", new string[] { I_SN.Value.ToString() })); } labelName = DB.ORM.Queryable <C_SKU_Label>().Where(l => l.SKUNO == r_sn.SKUNO && l.STATION == I_STATION.Value.ToString()).ToList().FirstOrDefault(); if (labelName.LABELNAME == "2000E3_CARTON") { Get2000E3CartonValue(r_sn, DB); } }
public int RecordPanelStationDetail(string PanelNo, string Line, string StationName, string DeviceName, string Bu, OleExec DB, DB_TYPE_ENUM DBType) { int result = 0; string strSql = string.Empty; DataTable dt = new DataTable(); string errMsg = string.Empty; T_R_SN RSN = new T_R_SN(DB, DBType); if (DBType.Equals(DB_TYPE_ENUM.Oracle)) { strSql = $@"SELECT * FROM R_SN WHERE ID IN (SELECT SN FROM R_PANEL_SN WHERE PANEL='{PanelNo}')"; dt = DB.ExecSelect(strSql, null).Tables[0]; foreach (DataRow dr in dt.Rows) { RSN.RecordPassStationDetail(dr["SN"].ToString(), Line, StationName, DeviceName, Bu, DB); } } else { errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() }); throw new MESReturnMessage(errMsg); } return(result); }
public static void OutLot(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { OleExec DB = Station.SFCDB; string strSql = ""; var SN_Session = Station.StationSession.Find(t => t.MESDataType == "SN" && t.SessionKey == "1"); SN sn = (SN)SN_Session.Value; var LotStates = DB.ORM.Queryable <R_LOT_STATUS, R_LOT_DETAIL> ((lot, detail) => lot.LOT_NO == detail.LOT_ID) .Where((lot, detail) => detail.SN == sn.SerialNo && detail.STATUS == "0" && SqlFunc.StartsWith(lot.LOT_NO, "LOT-")) .Select((lot, detail) => new { LOT = lot, Detail = detail }).ToList(); if (LotStates.Count == 0) { throw new Exception($@"{sn.SerialNo } not in Lot"); } T_R_SN TRS = new T_R_SN(DB, DB_TYPE_ENUM.Oracle); for (int i = 0; i < LotStates.Count; i++) { var LS = LotStates[i]; LS.Detail.STATUS = "1"; LS.Detail.EDIT_EMP = Station.LoginUser.EMP_NO; LS.Detail.EDIT_TIME = DateTime.Now; DB.ORM.Updateable <R_LOT_DETAIL>(LS.Detail).Where(t => t.ID == LS.Detail.ID).ExecuteCommand(); TRS.RecordPassStationDetail(sn.SerialNo, Station.Line, Station.StationName, LS.LOT.SAMPLE_STATION, Station.BU, DB); Station.StationMessages.Add(new StationMessage() { Message = $@"'{sn.SerialNo}' Scanout Lot'{LS.LOT.LOT_NO}','{LS.LOT.SAMPLE_STATION}'", State = StationMessageState.Message }); } }
/// <summary> // /check if the last station of the SN in the route is PASS /// </summary> /// <param name="sn"></param> /// <param name="station"></param> /// <param name="sfcdb"></param> /// <returns></returns> public bool TheLastStationIsPass(string sn, string station, OleExec sfcdb) { bool bPass = true; C_ROUTE_DETAIL lastSation = null; R_SN_STATION_DETAIL r_sn_station_detail = null; T_R_SN t_r_sn = new T_R_SN(sfcdb, this.DBType); T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, this.DBType); R_SN snObject = t_r_sn.LoadSN(sn, sfcdb); if (snObject != null) { if (!t_c_route_detail.StationInRoute(snObject.ROUTE_ID, station, sfcdb)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000156", new string[] { sn, station })); } C_ROUTE_DETAIL currentStation = t_c_route_detail.GetByRouteIdOrderBySEQASC(snObject.ROUTE_ID, sfcdb).Find(s => s.STATION_NAME == station); List <C_ROUTE_DETAIL> routeList = t_c_route_detail.GetByRouteIdOrderBySEQASC(snObject.ROUTE_ID, sfcdb).FindAll(s => s.SEQ_NO < currentStation.SEQ_NO); if (routeList.Count > 0) { lastSation = routeList.OrderBy(t => t.SEQ_NO).LastOrDefault(); if (lastSation != null) { r_sn_station_detail = sfcdb.ORM.Queryable <R_SN_STATION_DETAIL>().Where(p => p.STATION_NAME == lastSation.STATION_NAME && p.ROUTE_ID == lastSation.ROUTE_ID && p.SN == snObject.SN && p.R_SN_ID == snObject.ID).ToList().FirstOrDefault(); if (r_sn_station_detail == null) { bPass = false; } } } } return(bPass); }
public static void LoadPanelWaitReplaceSn(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras) { if (Paras.Count != 2) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } MESStationSession sessionPanel = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (sessionPanel == null || sessionPanel.Value == null) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY })); } MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (sessionSN == null) { sessionSN = new MESStationSession { MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY, Value = "", InputValue = "", ResetInput = Input }; Station.StationSession.Add(sessionSN); } T_R_SN r_sn = new T_R_SN(Station.SFCDB, Station.DBType); sessionSN.Value = r_sn.GetPanelWaitReplaceSn(sessionPanel.InputValue.ToString(), Station.SFCDB); Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message); }
//Add by LLF 2017-01-26 Begin public static void TrCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string Process = ""; string Message = ""; string StrWO = ""; string StrCode = ""; string IP = string.Empty; OleExec APDB = null; Dictionary <string, DataRow> TrSnTable = null; T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType); MESStationSession WoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WoSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(Message); } StrWO = WoSession.Value.ToString(); //獲取 TRSN 對象 MESStationSession TrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (TrSnSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(Message); } TrSnTable = (Dictionary <string, DataRow>)TrSnSession.Value; Process = Paras[2].VALUE.ToString(); IP = Paras[3].VALUE.ToString(); try { APDB = Station.APDB; StrCode = Table.GetAPTrCode(StrWO, TrSnTable["R_TR_SN"]["TR_SN"].ToString(), Process, Station.LoginUser.EMP_NO, IP, APDB); MESStationSession TrCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (TrCodeSession == null) { TrCodeSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(TrCodeSession); } TrCodeSession.Value = StrCode; Station.AddMessage("MES00000001", new string[] { TrCodeSession.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw (ex); } }
//Add by LLF 2018-02-01 end //public bool CheckSNExist(string StrSN,OleExec sfcdb, MESDataObject.DB_TYPE_ENUM _DBType) //{ // bool CheckFlag = false; // T_R_SN R_SN = new T_R_SN(sfcdb, DBType); // CheckFlag = R_SN.CheckSNExists(StrSN,sfcdb); // return CheckFlag; //} public R_SN LoadSN(string SerialNo, OleExec DB) { R_SN RSN = null; T_R_SN R_Sn = new T_R_SN(DB, DBType); RSN = R_Sn.LoadSN(SerialNo, DB); return(RSN); }
public void unstartWO(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec Sfcdb = this.DBPools["SFCDB"].Borrow(); string WO = Data["WO"].ToString(); T_R_SN t_r_sn = new T_R_SN(Sfcdb, this.DBTYPE); t_r_sn.deleteSNByWO(WO, Sfcdb); StationReturn.Status = StationReturnStatusValue.Pass; }
public void DataLoad(string packNo, string bu, OleExec sfcdb, DB_TYPE_ENUM DBType) { List <string> itemList = new List <string>(); T_C_SKU t_c_sku = new T_C_SKU(sfcdb, DBType); T_R_PACKING t_r_packing = new T_R_PACKING(sfcdb, DBType); T_R_SN_PACKING t_r_sn_packing = new T_R_SN_PACKING(sfcdb, DBType); T_R_SN t_r_sn = new T_R_SN(sfcdb, DBType); T_C_PACKING t_c_packing = new T_C_PACKING(sfcdb, DBType); R_PACKING packing = new R_PACKING(); C_SKU sku = new C_SKU(); Packing packObject = new Packing(); C_PACKING c_packing = new C_PACKING(); packing = t_r_packing.GetRPackingByPackNo(sfcdb, packNo).GetDataObject(); sku = t_c_sku.GetSku(packing.SKUNO, sfcdb, DBType).GetDataObject(); if (packing.PACK_TYPE == LogicObject.PackType.PALLET.ToString().ToUpper()) { c_packing = t_c_packing.GetPackingBySkuAndType(sku.SKUNO, LogicObject.PackType.CARTON.ToString().ToUpper(), sfcdb); if (c_packing.MAX_QTY == 1 && bu.ToUpper().Equals("VERTIV")) { //VERTIV 當卡通包規為1時,調棧板顯示卡通內的SN itemList = t_r_packing.GetPakcingSNList(packing.ID, sfcdb); } else { List <R_PACKING> packingList = t_r_packing.GetListPackByParentPackId(packing.ID, sfcdb); foreach (R_PACKING pack in packingList) { itemList.Add(pack.PACK_NO); } } } else if (packing.PACK_TYPE == LogicObject.PackType.CARTON.ToString().ToUpper()) { List <Row_R_SN_PACKING> snPackingList = t_r_sn_packing.GetPackItem(packing.ID, sfcdb); foreach (Row_R_SN_PACKING sn in snPackingList) { itemList.Add(t_r_sn.GetById(sn.SN_ID, sfcdb).SN); } } this.PackID = packing.ID; this.PackNo = packing.PACK_NO; this.PackType = packing.PACK_TYPE; this.ParentPackID = packing.PARENT_PACK_ID; this.Skuno = packing.SKUNO; this.SkunoVer = sku.VERSION; this.MaxQty = packing.MAX_QTY; this.Qty = packing.QTY; this.ClosedFlag = packing.CLOSED_FLAG; this.CreatTime = packing.CREATE_TIME; this.EditTime = packing.EDIT_TIME; this.EditEmp = packing.EDIT_EMP; this.Line = packing.LINE; this.Station = packing.STATION; this.IP = packing.IP; this.PackList = itemList; }
//Add by LLF 2018-02-19 Begin public static void PTHTrCodeDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { string Message = ""; string StrWO = ""; string StrCode = ""; string StationName = string.Empty; string StrStationNum = string.Empty; OleExec APDB = null; T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType); MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (WOSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(Message); } StrWO = WOSession.Value.ToString(); //獲取 TRSN 對象 MESStationSession StationNumSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (StationNumSession == null) { Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(Message); } StrStationNum = StationNumSession.Value.ToString(); StationName = Station.Line + Station.StationName + StrStationNum; try { APDB = Station.APDB; StrCode = Table.GetAPPTHTrCode(StrWO, StationName, APDB); MESStationSession PTHTrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (PTHTrSnSession == null) { PTHTrSnSession = new MESStationSession() { MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(PTHTrSnSession); } PTHTrSnSession.Value = StrCode; Station.AddMessage("MES00000001", new string[] { PTHTrSnSession.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass); } catch (Exception ex) { throw (ex); } }
//Add by LLF 2018-02-22 begin public void PanelAndSNLoad(string Sn, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM _DBType) { this.sfcdb = sfcdb; this.DBType = _DBType; T_R_SN trsn = new T_R_SN(sfcdb, DBType); if (!string.IsNullOrEmpty(Sn)) { baseSN = trsn.GetDetailByPanelAndSN(Sn, sfcdb); } }
public List <R_SN> GetPanel(string PanelSN, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType) { try { T_R_SN trs = new T_R_SN(SFCDB, DBType); List <R_SN> sn = trs.GetRSNbyPsn(PanelSN, SFCDB); return(sn); } catch (Exception e) { throw e; } }
private void getBySN(string sn, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM dbtype) { //get sn route_id T_R_SN TR_SN = new T_R_SN(sfcdb, dbtype); R_SN getSN = TR_SN.GetDetailBySN(sn, sfcdb); string routeid = ""; if (getSN != null && getSN.ROUTE_ID != null) { routeid = getSN.ROUTE_ID.Trim(); } getByIdOrRouteName("ID", routeid, sfcdb, dbtype); }
//Add by LLF 2018-02-22 end public void Load(string Sn, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM _DBType) { this.sfcdb = sfcdb; this.DBType = _DBType; T_R_SN trsn = new T_R_SN(sfcdb, DBType); if (!string.IsNullOrEmpty(Sn)) { baseSN = trsn.GetDetailBySN(Sn, sfcdb); } T_C_KEYPART tKeyPart = new T_C_KEYPART(sfcdb, DBType); if (!string.IsNullOrEmpty(baseSN.KP_LIST_ID)) { _keyPartList = tKeyPart.GetKeyPartList(sfcdb, baseSN.KP_LIST_ID); } }
/// <summary> /// get sn object list by carton ID /// </summary> /// <param name="cartonID">carton ID</param> /// <param name="sfcdb"></param> /// <returns></returns> public List <R_SN> GetSnListByCartonID(string cartonID, OleExec sfcdb) { string sql = $@" select b.* from r_sn_packing a,r_sn b where a.pack_id='{cartonID}' and a.sn_id = b.id and b.shipped_flag='1'"; List <R_SN> snList = new List <R_SN>(); T_R_SN t_r_sn = new T_R_SN(sfcdb, this.DBType); DataSet ds = sfcdb.ExecSelect(sql); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { Row_R_SN rowSN = (Row_R_SN)t_r_sn.NewRow(); rowSN.loadData(row); snList.Add(rowSN.GetDataObject()); } } return(snList); }
/// <summary> /// 栈板出货 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void PalletShipOut(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { string packNo = Input.Value.ToString(), dnNo = Station.DisplayOutput.Find(t => t.Name == "DN_NO").Value.ToString(), dnLine = Station.DisplayOutput.Find(t => t.Name == "DN_ITEM").Value.ToString(); T_R_SN rSn = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle); var rDnStatus = Station.SFCDB.ORM.Queryable <R_DN_STATUS>() .Where(x => x.DN_NO == dnNo && x.DN_LINE == dnLine && x.DN_FLAG == "0").ToList().FirstOrDefault(); rSn.PalletShipOutRecord(packNo, Station.LoginUser.EMP_NO, Station.Line, Station.BU, Station.StationName, rDnStatus, Station.SFCDB); if (rDnStatus.DN_FLAG == "1") { Station.StationMessages.Add(new StationMessage() { Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180802154903", new string[] { dnNo, dnLine }) }); } }
/// <summary> /// 獲取實際連板數量 /// </summary> /// <param name="Sn"></param> /// <param name="PanelFlag"></param> /// <param name="sfcdb"></param> /// <returns></returns> //Add by LLF 2018-01-27 Begin public int GetLinkQty(string Sn, OleExec sfcdb, MESDataObject.DB_TYPE_ENUM _DBType) { int LinkQty = 1; this.sfcdb = sfcdb; this.DBType = _DBType; List <R_SN> ListSN = new List <R_SN>(); T_R_SN R_SN = new T_R_SN(sfcdb, DBType); if (!string.IsNullOrEmpty(Sn)) { ListSN = R_SN.GetRSNbySN(Sn, sfcdb); if (ListSN == null) { ListSN = R_SN.GetRSNbyPsn(Sn, sfcdb); LinkQty = ListSN.Count; } } return(LinkQty); }
public void startWO(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec Sfcdb = this.DBPools["SFCDB"].Borrow(); string WO = Data["WO"].ToString(); T_R_WO_HEADER_TJ t_R_WO_HEADER_TJ = new T_R_WO_HEADER_TJ(Sfcdb, this.DBTYPE); Row_R_WO_HEADER_TJ row_R_WO_HEADER = t_R_WO_HEADER_TJ.GetWo(WO, Sfcdb); float qty = float.Parse(row_R_WO_HEADER.GAMNG); qty = 5; for (int i = 0; i < qty; i++) { String nextSN = SNmaker.GetNextSN("TEST", Sfcdb, WO); Console.Out.WriteLine(nextSN); T_R_SN t_r_sn = new T_R_SN(Sfcdb, this.DBTYPE); t_r_sn.addStartSNRecords(WO, nextSN, Sfcdb); } StationReturn.Data = qty; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180801141046"); }
/// <summary> /// 檢查當前工單的錫膏是否上線: ///HWD CHECK&補Allparts錫膏資料(連板&非連板均調用該SP) ///MES1.CHECK_SOLDER_INSERTDATA(Panelno,Nextevent,L_tmp_line,) ///var_message返回 OK則OK, 反之,throw(ErrorMessage) /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void SMTSolderDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { //Marked by LLF 2018-01-29 //if (Paras.Count == 0) //{ // throw new Exception("參數數量不正確!"); //} OleExec apdb = Station.APDB; string PsnInsert = Input.Value.ToString(); string Line = Station.Line; List <R_SN> ListRsn = new List <R_SN>(); T_R_SN RSn = new T_R_SN(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); ListRsn = RSn.GetRSNbyPsn(PsnInsert, Station.SFCDB); //Modify BY LLF 20108-01-29,應該是獲取當前工站 //string Next_Station = ListRsn[0].NEXT_STATION; string StationName = Station.StationName; OleDbParameter[] SolderSP = new OleDbParameter[4]; SolderSP[0] = new OleDbParameter("G_PSN", PsnInsert); SolderSP[1] = new OleDbParameter("G_EVENTNAME", StationName); SolderSP[2] = new OleDbParameter("G_LINE", Line); SolderSP[3] = new OleDbParameter(); SolderSP[3].Size = 1000; SolderSP[3].ParameterName = "RES"; SolderSP[3].Direction = System.Data.ParameterDirection.Output; SolderSP[3].Size = 200; string result = apdb.ExecProcedureNoReturn("MES1.CHECK_SOLDER_INSERTDATA", SolderSP); if (result == "OK") { Station.AddMessage("MES00000062", new string[] { PsnInsert }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass); } else { throw new Exception(result); } }
public static void SNLinkPassAction_Old(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras) { SN SN = null; string ErrMessage = string.Empty; string wo = Station.Inputs.Find(s => s.DisplayName == "WO").Value.ToString(); string sn = Station.Inputs.Find(s => s.DisplayName == "SUB_SN").Value.ToString(); if (Paras.Count == 0) { throw new Exception("參數數量不正確!"); } MESStationSession SNLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY); if (SNLoadPoint == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } SN = (SN)SNLoadPoint.Value; T_R_SN TRS = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_SN RRS = (Row_R_SN)TRS.NewRow(); T_R_SN_STATION_DETAIL tr_sd = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_SN_STATION_DETAIL rr_sd = (Row_R_SN_STATION_DETAIL)tr_sd.NewRow(); RRS = TRS.getR_SNbySN(sn, Station.SFCDB); RRS.CURRENT_STATION = Station.StationName; RRS.NEXT_STATION = TRS.GetNextStation(SN.RouteID, Station.StationName, Station.SFCDB); RRS.VALID_FLAG = "0"; RRS.EDIT_EMP = Station.LoginUser.EMP_NO; RRS.EDIT_TIME = DateTime.Now; if (RRS.NEXT_STATION.ToUpper() == "JOBFINISH") { RRS.COMPLETED_FLAG = "1"; RRS.COMPLETED_TIME = DateTime.Now; } Station.SFCDB.ExecSQL(RRS.GetUpdateString(DB_TYPE_ENUM.Oracle)); TRS.RecordPassStationDetail(sn, Station.Line, Station.StationName, Station.StationName, Station.BU, Station.SFCDB); }
public static void PackPassStation(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { MESStationSession packSesseion = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == "1"); T_R_SN tRSn = new T_R_SN(Station.SFCDB, Station.DBType); List <R_SN> rSnList = new List <R_SN>(); rSnList = tRSn.GetSnListByPack(packSesseion.Value.ToString(), Station.SFCDB); if (rSnList.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180602102010", new string[] { packSesseion.Value.ToString() })); } tRSn.LotsPassStation(rSnList, Station.Line, rSnList[0].NEXT_STATION, rSnList[0].NEXT_STATION, Station.BU, "PASS", Station.LoginUser.EMP_NO, Station.SFCDB); // 過站 //記錄通過數 ,UPH foreach (var snobj in rSnList) { tRSn.RecordUPH(snobj.WORKORDERNO, 1, snobj.SN, "PASS", Station.Line, snobj.NEXT_STATION, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB); } Station.StationMessages.Add(new StationMessage() { Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180602102159", new string[] { rSnList[0].SKUNO, packSesseion.Value.ToString(), rSnList.Count.ToString(), rSnList[0].NEXT_STATION }), State = StationMessageState.Pass }); }
public void GetSNDetailByWo(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { OleExec sfcdb = null; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE); R_WO_BASE r_wo_base = t_r_wo_base.GetWoByWoNo(Data["WO"].ToString().ToUpper().Trim(), sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { Data["WO"].ToString().ToUpper().Trim() })); } T_R_SN t_r_sn = new T_R_SN(sfcdb, DBTYPE); List <R_SN> snList = t_r_sn.GetRSNbyWo(Data["WO"].ToString().ToUpper().Trim(), sfcdb).FindAll(sn => sn.CURRENT_STATION.IndexOf("LOADING") >= 0); if (snList.Count == 0) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180731133844", new string[] { Data["WO"].ToString().ToUpper().Trim() })); } this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = snList; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000001"; } catch (Exception exception) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000037"; StationReturn.MessagePara.Add(exception.Message); StationReturn.Data = exception.Message; if (sfcdb != null) { this.DBPools["SFCDB"].Return(sfcdb); } } }
/// <summary> // /check if the sn is write into r_sn_station_detail /// </summary> /// <param name="sn"></param> /// <param name="station"></param> /// <param name="sfcdb"></param> /// <returns></returns> public bool HadWriteIntoDetail(string sn, string station, OleExec sfcdb) { bool bPass = true; R_SN_STATION_DETAIL r_sn_station_detail = null; T_R_SN t_r_sn = new T_R_SN(sfcdb, this.DBType); T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(sfcdb, this.DBType); R_SN snObject = t_r_sn.LoadSN(sn, sfcdb); if (snObject != null) { if (!t_c_route_detail.StationInRoute(snObject.ROUTE_ID, station, sfcdb)) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000156", new string[] { sn, station })); } r_sn_station_detail = sfcdb.ORM.Queryable <R_SN_STATION_DETAIL>().Where(p => p.STATION_NAME == station && p.ROUTE_ID == snObject.ROUTE_ID && p.SN == snObject.SN && p.R_SN_ID == snObject.ID).ToList().FirstOrDefault(); if (r_sn_station_detail == null) { bPass = false; } } return(bPass); }
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); } }
/// <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 void ScanKPItem(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = this.DBPools["SFCDB"].Borrow(); SFCDB.BeginTrain(); try { /* * new APIInputInfo() {InputName = "SN", InputType = "STRING", DefaultValue = ""}, * new APIInputInfo() {InputName = "STATION", InputType = "STRING", DefaultValue = ""}, * new APIInputInfo() {InputName = "KPITEM", InputType = "STRING", DefaultValue = ""} */ string strSN = Data["SN"].ToString(); string station = Data["STATION"].ToString(); JToken _ItemData = Data["KPITEM"]; T_R_SN_KP TRKP = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle); T_R_SN t_r_sn = new T_R_SN(SFCDB, DB_TYPE_ENUM.Oracle); List <R_SN_KP> ItemData = new List <R_SN_KP>(); for (int i = 0; i < _ItemData.Count(); i++) { //已被綁定的就不能重複綁定 if (TRKP.CheckLinkByValue(_ItemData[i]["VALUE"].ToString(), SFCDB)) { throw new Exception(_ItemData[i]["VALUE"].ToString() + " has been link on other sn!"); } R_SN r_sn = new R_SN(); r_sn = t_r_sn.LoadSN(_ItemData[i]["VALUE"].ToString(), SFCDB); //如果KEYPART是本廠做的條碼則必須是完工狀態 if (r_sn != null && r_sn.COMPLETED_FLAG != "1") { throw new Exception(_ItemData[i]["VALUE"].ToString() + " is on " + r_sn.NEXT_STATION + ",can't completed!"); } R_SN_KP I = new R_SN_KP(); I.ID = _ItemData[i]["ID"].ToString(); I.VALUE = _ItemData[i]["VALUE"].ToString(); I.MPN = _ItemData[i]["MPN"].ToString(); I.PARTNO = _ItemData[i]["PARTNO"].ToString(); I.SCANTYPE = _ItemData[i]["SCANTYPE"].ToString(); I.ITEMSEQ = double.Parse(_ItemData[i]["ITEMSEQ"].ToString()); I.SCANSEQ = double.Parse(_ItemData[i]["SCANSEQ"].ToString()); I.DETAILSEQ = double.Parse(_ItemData[i]["DETAILSEQ"].ToString()); ItemData.Add(I); } if (ItemData.Count == 0) { StationReturn.Status = StationReturnStatusValue.Pass; } LogicObject.SN SN = new LogicObject.SN(); SN.Load(strSN, SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.T_R_WO_BASE TWO = new T_R_WO_BASE(SFCDB, DB_TYPE_ENUM.Oracle); Row_R_WO_BASE RWO = TWO.GetWo(SN.WorkorderNo, SFCDB); List <R_SN_KP> snkp = TRKP.GetKPRecordBySnIDStation(SN.ID, station, SFCDB); SN_KP KPCONFIG = new SN_KP(snkp, SN.WorkorderNo, SN.SkuNo, SFCDB); R_SN_KP kpItem = KPCONFIG.KPS.Find(T => T.ID == ItemData[0].ID); if (kpItem == null) { throw new Exception("Data Error!"); } List <R_SN_KP> ConfigItem = KPCONFIG.KPS.FindAll(T => T.PARTNO == kpItem.PARTNO && T.ITEMSEQ == kpItem.ITEMSEQ && T.SCANSEQ == kpItem.SCANSEQ ); if (ConfigItem.Count != ItemData.Count) { throw new Exception("Data Error! ConfigItem.Count != ItemData.Count"); } List <Row_R_SN_KP> items = new List <Row_R_SN_KP>(); for (int i = 0; i < ItemData.Count; i++) { Row_R_SN_KP item = (Row_R_SN_KP)TRKP.GetObjByID(ItemData[i].ID, SFCDB); if (item.ITEMSEQ == ItemData[i].ITEMSEQ && item.SCANSEQ == ItemData[i].SCANSEQ && item.DETAILSEQ == ItemData[i].DETAILSEQ) { item.VALUE = ItemData[i].VALUE; item.MPN = ItemData[i].MPN; item.PARTNO = ItemData[i].PARTNO; item.EDIT_TIME = DateTime.Now; item.EDIT_EMP = LoginUser.EMP_NO; SFCDB.ExecSQL(item.GetUpdateString(DB_TYPE_ENUM.Oracle)); item.AcceptChange(); items.Add(item); } else { throw new Exception("Data Error! 1"); } } for (int i = 0; i < items.Count; i++) { var ScanTypes = SFCDB.ORM.Queryable <C_KP_Check>().Where(t => t.TYPENAME == items[i].SCANTYPE).ToList(); if (ScanTypes.Count > 0) { Assembly assembly = Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + ScanTypes[0].DLL); Type APIType = assembly.GetType(ScanTypes[0].CLASS); object API_CLASS = assembly.CreateInstance(ScanTypes[0].CLASS); var Methods = APIType.GetMethods(); var Funs = Methods.Where <MethodInfo>(t => t.Name == ScanTypes[0].FUNCTION); if (Funs.Count() > 0) { Funs.ElementAt(0).Invoke(API_CLASS, new object[] { KPCONFIG, SN, items[i], items, this, SFCDB }); } } } StationReturn.Status = StationReturnStatusValue.Pass; SFCDB.CommitTrain(); } catch (Exception ee) { SFCDB.RollbackTrain(); //this.DBPools["SFCDB"].Return(SFCDB); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000037"; if (ee.InnerException != null) { StationReturn.MessagePara.Add(ee.InnerException.Message); } else { StationReturn.MessagePara.Add(ee.Message); } } this.DBPools["SFCDB"].Return(SFCDB); }
/// <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; } }
//工單狀態檢查 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; } }
public static void HWDBIPSNFailAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras) { string ErrMessage = ""; string StrSn = ""; string APVirtualSn = ""; string VirtualSn = ""; AP_DLL APObj = new AP_DLL(); OleExec APDB = null; R_PANEL_SN PANELObj = null; Int16 FailCount = 0; List <Dictionary <string, string> > FailList = null; string R_SN_STATION_DETAIL_ID = ""; StringBuilder ReturnMessage = new StringBuilder(); string RepairmainID = "";//add by LLF 2018-04-12 if (Paras.Count < 5) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050")); } 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); } MESStationSession FailCountSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY); if (FailCountSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } MESStationSession FailListSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY); if (FailListSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } MESStationSession PanelVitualSNSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY); if (PanelVitualSNSession == null) { ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }); throw new MESReturnMessage(ErrMessage); } MESStationSession StatusSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY); if (StatusSession == null) { StatusSession = new MESStationSession() { MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), Value = Paras[4].VALUE, SessionKey = Paras[4].SESSION_KEY, ResetInput = Input }; Station.StationSession.Add(StatusSession); if (StatusSession.Value.ToString() == "") { StatusSession.Value = "FAIL"; } } MESStationSession ClearInputSession = null; if (Paras.Count >= 6) { ClearInputSession = Station.StationSession.Find(t => t.MESDataType.Equals(Paras[5].SESSION_TYPE) && t.SessionKey.Equals(Paras[5].SESSION_KEY)); if (ClearInputSession == null) { ClearInputSession = new MESStationSession() { MESDataType = Paras[5].SESSION_TYPE, SessionKey = Paras[5].SESSION_KEY }; Station.StationSession.Add(ClearInputSession); } } FailCount = Convert.ToInt16(FailCountSession.Value.ToString()); FailList = (List <Dictionary <string, string> >)FailListSession.Value; T_R_SN rSn = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle); DateTime FailTime = rSn.GetDBDateTime(Station.SFCDB); StrSn = SNSession.Value.ToString(); if (FailList.Count >= FailCount && FailCount != 0) //允許掃描多個Fail { #region 業務邏輯 OleExec oleDB = null; oleDB = Station.SFCDB; //oleDB = this.DBPools["SFCDB"].Borrow(); //oleDB.BeginTrain(); //OleExecPool APDBPool = Station.DBS["APDB"]; //APDB = APDBPool.Borrow(); //APDB.BeginTrain(); APDB = Station.APDB; try { Row_R_SN rrSn = (Row_R_SN)rSn.NewRow(); for (int i = 0; i < FailList.Count; i++) { //獲取頁面傳過來的數據 string failCode = FailList[i]["FailCode"].ToString(); string failLocation = FailList[i]["FailLocation"].ToString(); string failProcess = FailList[i]["FailProcess"].ToString(); string failDescription = FailList[i]["FailDesc"].ToString(); //黃楊盛 2018年4月24日14:14:28 模擬自動做維修的動作,修正時間 //更新R_SN REPAIR_FAILED_FLAG=’1’ //modify by ZGJ 2018-03-22 BIP Fail 的產品自動清除待維修狀態,但是記錄不良 PANELObj = (R_PANEL_SN)PanelVitualSNSession.Value; if (i == 0) { VirtualSn = PANELObj.SN.ToString(); R_SN r = rSn.GetDetailBySN(VirtualSn, Station.SFCDB); rrSn = (Row_R_SN)rSn.GetObjByID(r.ID, Station.SFCDB); //rrSn.REPAIR_FAILED_FLAG = "0"; rrSn.REPAIR_FAILED_FLAG = "1"; rrSn.SN = StrSn; rrSn.EDIT_EMP = Station.LoginUser.EMP_NO; //add by LLF 2018-03-17 rrSn.EDIT_TIME = FailTime; //add by LLF 2018-03-17 string strRet = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle)); if (!(Convert.ToInt32(strRet) > 0)) { throw new MESReturnMessage("update repair failed flag error!"); } // Update R_PANEL_SN T_R_PANEL_SN RPanelSN = new T_R_PANEL_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_PANEL_SN Row_Panel = (Row_R_PANEL_SN)RPanelSN.NewRow(); Row_Panel = (Row_R_PANEL_SN)RPanelSN.GetObjByID(PANELObj.ID, Station.SFCDB); Row_Panel.SN = StrSn; strRet = (Station.SFCDB).ExecSQL(Row_Panel.GetUpdateString(DB_TYPE_ENUM.Oracle)); if (!(Convert.ToInt32(strRet) > 0)) { throw new MESReturnMessage("update r_panel_sn error!"); } //Update AP //黄杨盛 2018年4月14日09:10:50 修正不能超过9连板的情况.同时加上不支持3位数连板的约束 //APVirtualSn = PANELObj.PANEL + "0" + PANELObj.SEQ_NO.ToString(); if (PANELObj.SEQ_NO > 99) { throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000226", new string[] { DB_TYPE_ENUM.Oracle.ToString() })); } APVirtualSn = PANELObj.PANEL + Convert.ToInt16(PANELObj.SEQ_NO).ToString("00"); string result = APObj.APUpdatePanlSN(APVirtualSn, StrSn, APDB); //APDBPool.Return(APDB); if (!result.Equals("OK")) { //2018年4月24日13:56:14 黃楊盛 //throw new MESReturnMessage("already be binded to other serial number"); throw new MESReturnMessage(result); } //新增一筆FAIL記錄到R_SN_STATION_DETAIL T_R_SN_STATION_DETAIL rSnStationDetail = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); //Add by LLF 2018-03-19 R_SN_STATION_DETAIL_ID = rSnStationDetail.GetNewID(Station.BU, Station.SFCDB); //string detailResult = rSnStationDetail.AddDetailToRSnStationDetail(R_SN_STATION_DETAIL_ID,rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB); string detailResult = rSnStationDetail.AddDetailToBipStationFailDetail( R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB, "1"); if (!(Convert.ToInt32(detailResult) > 0)) { throw new MESReturnMessage("Insert sn station detail error!"); } //update R_SN_STATION_DETAIL rSnStationDetail.UpdateRSnStationDetailBySNID(StrSn, PANELObj.SN, Station.SFCDB); //新增一筆到R_REPAIR_MAIN T_R_REPAIR_MAIN tRepairMain = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_REPAIR_MAIN rRepairMain = (Row_R_REPAIR_MAIN)tRepairMain.NewRow(); RepairmainID = tRepairMain.GetNewID(Station.BU, Station.SFCDB); //rRepairMain.ID = tRepairMain.GetNewID(Station.BU, Station.SFCDB); rRepairMain.ID = RepairmainID; rRepairMain.SN = StrSn; rRepairMain.WORKORDERNO = rrSn.WORKORDERNO; rRepairMain.SKUNO = rrSn.SKUNO; rRepairMain.FAIL_LINE = Station.Line; rRepairMain.FAIL_STATION = Station.StationName; rRepairMain.FAIL_EMP = Station.LoginUser.EMP_NO; //rRepairMain.FAIL_TIME = Station.GetDBDateTime();//Modify by LLF 2018-03-17 rRepairMain.FAIL_TIME = FailTime; //Modify by LLF 2018-03-17 rRepairMain.EDIT_EMP = Station.LoginUser.EMP_NO; rRepairMain.EDIT_TIME = Station.GetDBDateTime(); rRepairMain.CLOSED_FLAG = "1"; string insertResult = (Station.SFCDB).ExecSQL(rRepairMain.GetInsertString(DB_TYPE_ENUM.Oracle)); if (!(Convert.ToInt32(insertResult) > 0)) { throw new Exception("Insert repair main error!"); } } //新增一筆到R_REPAIR_FAILCODE T_R_REPAIR_FAILCODE tRepairFailCode = new T_R_REPAIR_FAILCODE(Station.SFCDB, DB_TYPE_ENUM.Oracle); Row_R_REPAIR_FAILCODE rRepairFailCode = (Row_R_REPAIR_FAILCODE)tRepairFailCode.NewRow(); rRepairFailCode.ID = tRepairFailCode.GetNewID(Station.BU, Station.SFCDB); //rRepairFailCode.REPAIR_MAIN_ID = rRepairMain.ID; //Modify by LLF 2018-04-11 多筆FAIL 取1一個RepairMainID rRepairFailCode.REPAIR_MAIN_ID = RepairmainID; rRepairFailCode.SN = StrSn; rRepairFailCode.FAIL_CODE = failCode; rRepairFailCode.FAIL_EMP = Station.LoginUser.EMP_NO; rRepairFailCode.FAIL_TIME = FailTime; rRepairFailCode.FAIL_CATEGORY = "SYMPTOM"; rRepairFailCode.FAIL_LOCATION = failLocation; rRepairFailCode.FAIL_PROCESS = failProcess; rRepairFailCode.DESCRIPTION = failDescription; rRepairFailCode.REPAIR_FLAG = "1"; rRepairFailCode.EDIT_EMP = Station.LoginUser.EMP_NO; rRepairFailCode.EDIT_TIME = Station.GetDBDateTime(); string strResult = (Station.SFCDB).ExecSQL(rRepairFailCode.GetInsertString(DB_TYPE_ENUM.Oracle)); if (!(Convert.ToInt32(strResult) > 0)) { throw new MESReturnMessage("Insert repair failcode error!"); } //oleDB.CommitTrain(); ReturnMessage.Append(failDescription).Append("|"); } //黃楊盛 2018年4月24日14:11:42 做一筆出來的記錄 R_SN snOut = rSn.GetDetailBySN(StrSn, Station.SFCDB); rrSn = (Row_R_SN)rSn.GetObjByID(snOut.ID, Station.SFCDB); rrSn.CURRENT_STATION = rrSn.NEXT_STATION; rrSn.NEXT_STATION = rSn.GetNextStation(snOut.ROUTE_ID, snOut.NEXT_STATION, oleDB); rrSn.REPAIR_FAILED_FLAG = "0"; rrSn.SN = StrSn; rrSn.EDIT_EMP = Station.LoginUser.EMP_NO; rrSn.EDIT_TIME = FailTime; var count = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle)); if (!(Convert.ToInt32(count) > 0)) { throw new MESReturnMessage("update rsn failed flag error!"); } // 方國剛 2018.05.02 11:45:30 // 因拋賬計算過站數量時,不計算REPAIR_FAILED_FLAG=1的數量,故BIP Fail 的產品自動清除待維修狀態后再在過站記錄表記錄一筆REPAIR_FAILED_FLAG=0的記錄 T_R_SN_STATION_DETAIL rSnStationDetailRepaired = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle); R_SN_STATION_DETAIL_ID = rSnStationDetailRepaired.GetNewID(Station.BU, Station.SFCDB); string detailResultRepaired = rSnStationDetailRepaired.AddDetailToBipStationFailDetail( R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB, "0"); if (!(Convert.ToInt32(detailResultRepaired) > 0)) { throw new MESReturnMessage("Insert sn station detail error!"); } } catch (Exception e) { try { //APDB.RollbackTrain(); //oleDB.RollbackTrain(); } catch (Exception x) { ; } throw new MESReturnMessage(e.Message + e.StackTrace); } finally { //APDBPool.Return(APDB); } #endregion //add by zgj 2018-03-14 //當記錄完當前 SN 不良後,清除保存在 session 中的不良信息 //((List<Dictionary<string, string>>)FailListSession.Value).Clear(); if (ClearInputSession != null) { ClearInputSession.Value = "true"; } ReturnMessage.Remove(ReturnMessage.Length - 1, 1); Station.NextInput = Station.FindInputByName("PanelSn"); Station.AddMessage("MES00000158", new string[] { StrSn, ReturnMessage.ToString() }, MESReturnView.Station.StationMessageState.Pass); } else { Station.NextInput = Station.FindInputByName("Location"); Station.AddMessage("MES00000162", new string[] { StrSn, FailCount.ToString(), FailList.Count.ToString() }, MESReturnView.Station.StationMessageState.Message); } }
public void CutWoBySNId(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JToken Data, MESStationReturn StationReturn) { OleExec sfcdb = null; try { string wo = Data["WO"].ToString().ToUpper().Trim(); string closeFlag = Data["CLOSEFLAG"].ToString().ToUpper().Trim(); Newtonsoft.Json.Linq.JArray arrayId = (Newtonsoft.Json.Linq.JArray)Data["ID"]; sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.ThrowSqlExeception = true; T_R_WO_BASE t_r_wo_base = new T_R_WO_BASE(sfcdb, DBTYPE); R_WO_BASE r_wo_base = t_r_wo_base.GetWoByWoNo(wo, sfcdb); if (r_wo_base == null) { throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000164", new string[] { wo })); } T_R_SN t_r_sn = new T_R_SN(sfcdb, DBTYPE); Row_R_SN rowSN; for (int i = 0; i < arrayId.Count; i++) { rowSN = (Row_R_SN)t_r_sn.GetObjByID(arrayId[i].ToString(), sfcdb); rowSN.SN = "CUT_" + rowSN.SN; rowSN.WORKORDERNO = "CUT_" + rowSN.WORKORDERNO; rowSN.SKUNO = "CUT_" + rowSN.SKUNO; rowSN.EDIT_EMP = LoginUser.EMP_NO; rowSN.EDIT_TIME = GetDBDateTime(); sfcdb.ExecSQL(rowSN.GetUpdateString(DBTYPE)); } Row_R_WO_BASE rowWoBase = (Row_R_WO_BASE)t_r_wo_base.GetObjByID(r_wo_base.ID, sfcdb); rowWoBase.WORKORDER_QTY = r_wo_base.WORKORDER_QTY - Convert.ToDouble(arrayId.Count); rowWoBase.INPUT_QTY = r_wo_base.INPUT_QTY - Convert.ToDouble(arrayId.Count); rowWoBase.EDIT_EMP = LoginUser.EMP_NO; rowWoBase.EDIT_TIME = GetDBDateTime(); if (closeFlag == "1") { rowWoBase.CLOSED_FLAG = closeFlag; rowWoBase.CLOSE_DATE = GetDBDateTime(); } sfcdb.ExecSQL(rowWoBase.GetUpdateString(DBTYPE)); this.DBPools["SFCDB"].Return(sfcdb); StationReturn.Data = r_wo_base; StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000210"; StationReturn.MessagePara.Add(wo); StationReturn.MessagePara.Add(arrayId.Count); } catch (Exception exception) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000037"; StationReturn.MessagePara.Add(exception.Message); StationReturn.Data = exception.Message; if (sfcdb != null) { this.DBPools["SFCDB"].Return(sfcdb); } } }