public void GetLabelConfigBySkuno(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec db = DBPools["SFCDB"].Borrow(); try { List <C_SKU_Label> ret = new List <C_SKU_Label>(); string strSkuno = Data["Skuno"].ToString(); T_C_SKU_Label TCSL = new T_C_SKU_Label(db, DB_TYPE_ENUM.Oracle); List <Row_C_SKU_Label> RCSLS = TCSL.GetLabelConfigBySku(strSkuno, db); for (int i = 0; i < RCSLS.Count; i++) { ret.Add(RCSLS[i].GetDataObject()); } StationReturn.Data = ret; } catch (Exception e) { throw e; } finally { DBPools["SFCDB"].Return(db); } }
public void RemoveLabelConfig(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec db = DBPools["SFCDB"].Borrow(); try { JToken OBJ = Data["ID_LIST"]; //T_C_PACKING TCP = new T_C_PACKING(db, DB_TYPE_ENUM.Oracle); T_C_SKU_Label TCSL = new T_C_SKU_Label(db, DB_TYPE_ENUM.Oracle); for (int i = 0; i < OBJ.Count(); i++) { Row_C_SKU_Label RCKL = (Row_C_SKU_Label)TCSL.GetObjByID(OBJ[i].ToString(), db); db.ExecSQL(RCKL.GetDeleteString(DB_TYPE_ENUM.Oracle)); } StationReturn.Status = StationReturnStatusValue.Pass; } catch { } finally { DBPools["SFCDB"].Return(db); } }
public void AlertLabelConfig(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec db = DBPools["SFCDB"].Borrow(); try { JToken OBJ = Data["LabelObject"]; //T_C_PACKING TCP = new T_C_PACKING(db, DB_TYPE_ENUM.Oracle); T_C_SKU_Label TCSL = new T_C_SKU_Label(db, DB_TYPE_ENUM.Oracle); //判斷ID如果為空則插入,如果不為空則更新 if (OBJ["ID"].ToString() == "") { Row_C_SKU_Label RCKL = (Row_C_SKU_Label)TCSL.NewRow(); RCKL.SKUNO = OBJ["SKUNO"].ToString(); RCKL.STATION = OBJ["STATION"].ToString(); RCKL.SEQ = double.Parse(OBJ["SEQ"].ToString()); RCKL.QTY = double.Parse(OBJ["QTY"].ToString()); RCKL.LABELNAME = OBJ["LABELNAME"].ToString(); RCKL.LABELTYPE = OBJ["LABELTYPE"].ToString(); RCKL.EDIT_EMP = LoginUser.EMP_NO; RCKL.EDIT_TIME = DateTime.Now; RCKL.ID = TCSL.GetNewID(BU, db); db.ExecSQL(RCKL.GetInsertString(DB_TYPE_ENUM.Oracle)); } else { Row_C_SKU_Label RCKL = (Row_C_SKU_Label)TCSL.GetObjByID(OBJ["ID"].ToString(), db); RCKL.SKUNO = OBJ["SKUNO"].ToString(); RCKL.STATION = OBJ["STATION"].ToString(); RCKL.SEQ = double.Parse(OBJ["SEQ"].ToString()); RCKL.QTY = double.Parse(OBJ["QTY"].ToString()); RCKL.LABELNAME = OBJ["LABELNAME"].ToString(); RCKL.LABELTYPE = OBJ["LABELTYPE"].ToString(); RCKL.EDIT_EMP = LoginUser.EMP_NO; RCKL.EDIT_TIME = DateTime.Now; RCKL.ID = TCSL.GetNewID(BU, db); db.ExecSQL(RCKL.GetUpdateString(DB_TYPE_ENUM.Oracle)); } } catch { } finally { DBPools["SFCDB"].Return(db); } }
/// <summary> /// 提供工站打印本站 /// </summary> /// <param name="Station"></param> /// <param name="Input"></param> /// <param name="Paras"></param> public static void PrintStationLabelAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras) { OleExec SFCDB = Station.SFCDB; string Run = ""; try { Run = (Station.StationSession.Find(T => T.MESDataType == Paras[0].SESSION_TYPE && T.SessionKey == Paras[0].SESSION_KEY).Value).ToString(); if (Run.ToUpper() == "FALSE") { return; } } catch { } SKU SKU = (SKU)(Station.StationSession.Find(T => T.MESDataType == Paras[1].SESSION_TYPE && T.SessionKey == Paras[1].SESSION_KEY).Value); List <string> ProcessLabType = new List <string>(); if (Paras.Count > 1) { for (int i = 2; i < Paras.Count; i++) { ProcessLabType.Add(Paras[i].VALUE.ToString()); } } T_C_SKU_Label TCSL = new T_C_SKU_Label(SFCDB, DB_TYPE_ENUM.Oracle); //獲取label配置 List <Row_C_SKU_Label> labs = TCSL.GetLabelConfigBySkuStation(SKU.SkuBase.SKUNO, Station.StationName, SFCDB); List <Label.LabelBase> PrintLabs = new List <Label.LabelBase>(); T_R_Label TRL = new T_R_Label(SFCDB, DB_TYPE_ENUM.Oracle); T_C_Label_Type TCLT = new T_C_Label_Type(SFCDB, DB_TYPE_ENUM.Oracle); for (int i = 0; i < labs.Count; i++) { if (ProcessLabType.Count > 0) { if (!ProcessLabType.Contains(labs[i].LABELTYPE)) { continue; } } Row_R_Label RL = TRL.GetLabelConfigByLabelName(labs[i].LABELNAME, SFCDB); Row_C_Label_Type RC = TCLT.GetConfigByName(labs[i].LABELTYPE, SFCDB); string path = System.AppDomain.CurrentDomain.BaseDirectory; Assembly assembly = Assembly.LoadFile(path + RC.DLL); System.Type APIType = assembly.GetType(RC.CLASS); object API_CLASS = assembly.CreateInstance(RC.CLASS); LabelBase Lab = (LabelBase)API_CLASS; //給label的輸入變量加載值 for (int j = 0; j < Lab.Inputs.Count; j++) { if (Lab.Inputs[j].Name.ToUpper() == "STATION") { Lab.Inputs[j].Value = Station.StationName; } MESStationSession S = Station.StationSession.Find(T => T.MESDataType == Lab.Inputs[j].StationSessionType && T.SessionKey == Lab.Inputs[j].StationSessionKey); if (S != null) { Lab.Inputs[i].Value = S.Value; } } Lab.LabelName = RL.LABELNAME; Lab.FileName = RL.R_FILE_NAME; Lab.PrintQTY = (int)labs[i].QTY; Lab.MakeLabel(SFCDB); List <LabelBase> pages = MakePrintPage(Lab, RL); for (int k = 0; k < pages.Count; k++) { pages[k].ALLPAGE = pages.Count; Station.LabelPrint.Add(pages[k]); } } }