private void OnSaveCfg() { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); if (!sysCfgBll.Exists(SysCfg.SysCfgModel.SysCfgFileName)) { CtlDBAccess.Model.SysCfgDBModel cfgModel = new CtlDBAccess.Model.SysCfgDBModel(); cfgModel.sysCfgName = SysCfg.SysCfgModel.SysCfgFileName; cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Add(cfgModel); } else { CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Update(cfgModel); } string reStr = ""; string xmlCfgFile = System.AppDomain.CurrentDomain.BaseDirectory + @"data/AcCfg.xml"; SysCfg.SysCfgModel.LoadCfg(xmlCfgFile, ref reStr); MessageBox.Show("配置文件已保存!"); }
private void OnSaveCfg() { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); if (!sysCfgBll.Exists(SysCfg.SysCfgModel.SysCfgFileName)) { CtlDBAccess.Model.SysCfgDBModel cfgModel = new CtlDBAccess.Model.SysCfgDBModel(); cfgModel.sysCfgName = SysCfg.SysCfgModel.SysCfgFileName; cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Add(cfgModel); } else { CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); cfgModel.cfgFile = this.richTextBox1.Text; cfgModel.modifyTime = System.DateTime.Now; sysCfgBll.Update(cfgModel); } string reStr = ""; XElement root = null; SysCfg.SysCfgModel.LoadCfg(ref root, ref reStr); MessageBox.Show("配置文件已保存!"); }
private void OnDispCfg() { this.richTextBox1.Text = ""; CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); if (cfgModel != null) { this.richTextBox1.Text = cfgModel.cfgFile; } }
// public static bool HouseEnabledA { get; set; } // public static bool HouseEnabledB { get; set; } public static bool SaveCfg(ref string reStr) { try { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); XElement root = rootXE; // string xmlCfgFile = SysCfgModel.CfgFile;// System.AppDomain.CurrentDomain.BaseDirectory + @"data/NBssCfg.xml"; //if (cfgModel == null) //{ // reStr = "系统配置不存在!"; // return false; //} //root = XElement.Parse(cfgModel.cfgFile); //if (root == null) //{ // reStr = "系统配置不存在!"; // return false; //} // XElement runModeXE = root.Element("sysSet").Element("RunMode"); //if(runModeXE.Attribute("UnBindedMode") != null) //{ // runModeXE.Attribute("UnBindedMode").Value = SysCfg.SysCfgModel.UnbindMode.ToString(); //} //XElement root = XElement.Load(xmlCfgFile); XElement asrsStoreCfgXE = root.Element("sysSet").Element("AsrsStoreCfg"); asrsStoreCfgXE.Attribute("StoreTime").Value = AsrsStoreTime.ToString(); // XElement asrsBatchCfgXE = root.Element("sysSet").Element("AsrsBatchCfg"); //asrsBatchCfgXE.Attribute("HouseACheckin").Value = CheckinBatchDic["A1库房"]; //asrsBatchCfgXE.Attribute("HouseACheckout").Value = CheckoutBatchDic["A1库房"]; //asrsBatchCfgXE.Attribute("HouseBCheckin").Value = CheckinBatchDic["B1库房"]; //asrsBatchCfgXE.Attribute("HouseBCheckout").Value = CheckoutBatchDic["B1库房"]; //asrsBatchCfgXE.Attribute("HouseC1Checkout").Value = CheckoutBatchDic["C1库房"]; //asrsBatchCfgXE.Attribute("HouseC2Checkout").Value = CheckoutBatchDic["C2库房"]; // XElement asrsEnableXE = root.Element("sysSet").Element("AsrsEnableSet"); // asrsEnableXE.Attribute("HouseEnabledA").Value = HouseEnabledA.ToString(); // asrsEnableXE.Attribute("HouseEnabledB").Value = HouseEnabledB.ToString(); // root.Save(xmlCfgFile); if (cfgModel != null) { cfgModel.cfgFile = root.ToString(); sysCfgBll.Update(cfgModel); } return(true); } catch (Exception ex) { reStr = ex.ToString(); return(false); } }
private bool LoadAreaColorCfg(ref string reStr) { try { CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); XElement root = null; if (cfgModel == null) { reStr = "系统配置不存在!"; return(false); } root = XElement.Parse(cfgModel.cfgFile); if (root == null) { reStr = "系统配置不存在!"; return(false); } IEnumerable <XElement> houseArea = root.Element("sysSet").Element("HouseAreaColorSet").Elements("HouseArea"); if (houseArea == null) { reStr = "系统逻辑库存颜色信息不存在!"; return(false); } foreach (XElement element in houseArea) { string houseAreaID = element.Attribute("houseAreaID").Value; string areaName = element.Attribute("areaName").Value; string[] rgbArr = element.Value.Split(','); //if (this.areaColor.Keys.Contains(long.Parse(houseAreaID))==true) //{ // continue; //} this.areaColor[long.Parse(houseAreaID)] = Color.FromArgb(int.Parse(rgbArr[0]), int.Parse(rgbArr[1]), int.Parse(rgbArr[2])); } ShowAreaColor(); return(true); } catch (Exception ex) { reStr = ex.ToString(); return(false); } }
public static bool LoadCfgDB(ref XElement root, ref string reStr) { try { CheckinBatchDic = new Dictionary <string, string>(); CheckoutBatchDic = new Dictionary <string, string>(); stepSeqs.Clear(); //投产绑定,一次高温,OCV1,二次绑定,二次高温,冷却,OCV2,OCV3,常温老化,OCV4,下线入库 stepSeqs.AddRange(new string[] { "PS-1", "PS-2", "PS-3", "PS-4", "PS-5", "PS-6", "PS-7", "PS-8", "PS-9", "PS-10", "PS-11" }); CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); //SysCfgModel.CfgFile = cfgFile; if (cfgModel == null) { reStr = "系统配置不存在"; return(false); } root = XElement.Parse(cfgModel.cfgFile); if (root == null) { reStr = "系统配置不存在!"; return(false); } XElement asrsStoreCfgXE = root.Element("sysSet").Element("AsrsStoreCfg"); AsrsStoreTime = float.Parse(asrsStoreCfgXE.Attribute("StoreTime").Value); XElement runModeXE = root.Element("sysSet").Element("RunMode"); string simStr = runModeXE.Attribute("sim").Value.ToString().ToUpper(); if (simStr == "TRUE") { SimMode = true; } else { SimMode = false; } if (runModeXE.Attribute("RfidSimMode") != null) { string strRfidSim = runModeXE.Attribute("RfidSimMode").Value.ToString().ToUpper(); if (strRfidSim == "TRUE") { RfidSimMode = true; } else { RfidSimMode = false; } } if (runModeXE.Attribute("UnBindedMode") != null) { string unbindedStr = runModeXE.Attribute("UnBindedMode").Value.ToString().ToUpper(); if (unbindedStr == "TRUE") { UnbindMode = true; } else { UnbindMode = false; } } //if(root.Element("sysSet").Element("AsrsBatchSet") != null && // root.Element("sysSet").Element("AsrsBatchSet").Element("CheckInBatch") != null) //{ //} XElement asrsBatchCfgXE = root.Element("sysSet").Element("AsrsBatchCfg"); CheckinBatchDic["A1库房"] = asrsBatchCfgXE.Attribute("HouseACheckin").Value.ToString(); CheckinBatchDic["B1库房"] = asrsBatchCfgXE.Attribute("HouseBCheckin").Value.ToString(); //CheckinBatchDic["C1库房"] = asrsBatchCfgXE.Attribute("HouseC1Checkin").Value.ToString(); //CheckinBatchDic["C2库房"] = asrsBatchCfgXE.Attribute("HouseC2Checkin").Value.ToString(); ; CheckoutBatchDic["A1库房"] = asrsBatchCfgXE.Attribute("HouseACheckout").Value.ToString(); CheckoutBatchDic["B1库房"] = asrsBatchCfgXE.Attribute("HouseBCheckout").Value.ToString(); //CheckoutBatchDic["C1库房"] = asrsBatchCfgXE.Attribute("HouseC1Checkout").Value.ToString(); //CheckoutBatchDic["C2库房"] = asrsBatchCfgXE.Attribute("HouseC2Checkout").Value.ToString(); //CheckinBatchHouseA = asrsBatchCfgXE.Attribute("HouseACheckin").Value.ToString(); //CheckoutBatchHouseA = asrsBatchCfgXE.Attribute("HouseACheckout").Value.ToString(); //CheckinBatchHouseB = asrsBatchCfgXE.Attribute("HouseBCheckin").Value.ToString(); //CheckoutBatchHouseB = asrsBatchCfgXE.Attribute("HouseBCheckout").Value.ToString(); //XElement asrsEnableXE = root.Element("sysSet").Element("AsrsEnableSet"); //string str= asrsEnableXE.Attribute("HouseEnabledA").Value.ToString().ToUpper(); //if(str == "TRUE") //{ // HouseEnabledA = true; //} //else //{ // HouseEnabledA = false; //} //str = asrsEnableXE.Attribute("HouseEnabledB").Value.ToString().ToUpper(); //if (str == "TRUE") //{ // HouseEnabledB = true; //} //else //{ // HouseEnabledB = false; //} return(true); } catch (Exception ex) { reStr = ex.ToString(); return(false); } }
public bool SetAreaColorCfg(string logicAreaName, Color color, ref string reStr) { StoreHouseLogicAreaModel logicArea = bllLogicArea.GetModelByName(logicAreaName); if (logicArea == null) { return(false); } if (this.areaColor.Keys.Contains(logicArea.StoreHouseLogicAreaID) == true) { foreach (Color col in this.areaColor.Values) { if (col == color) { reStr = "已经存在相同库区颜色!"; return(false); } } } this.areaColor[logicArea.StoreHouseLogicAreaID] = color; CtlDBAccess.BLL.SysCfgBll sysCfgBll = new CtlDBAccess.BLL.SysCfgBll(); CtlDBAccess.Model.SysCfgDBModel cfgModel = sysCfgBll.GetModel(SysCfg.SysCfgModel.SysCfgFileName); XElement root = null; if (cfgModel == null) { reStr = "系统配置不存在!"; return(false); } root = XElement.Parse(cfgModel.cfgFile); if (root == null) { reStr = "系统配置不存在!"; return(false); } XElement houseAreaColorSet = root.Element("sysSet").Element("HouseAreaColorSet"); if (houseAreaColorSet == null) { reStr = "系统逻辑库存颜色信息不存在!"; return(false); } houseAreaColorSet.Elements().Remove();//移除所有节点 foreach (KeyValuePair <long, Color> kv in this.areaColor) { long logicID = kv.Key; StoreHouseLogicAreaModel logicAreaModel = bllLogicArea.GetModel(logicID); if (logicAreaModel == null) { continue; } string rgb = kv.Value.R + "," + kv.Value.G + "," + kv.Value.B; XElement element = new XElement("HouseArea", new XAttribute("houseAreaID", logicID), new XAttribute("areaName", logicAreaModel.StoreHouseAreaName)); element.Value = rgb; houseAreaColorSet.Add(element); } if (cfgModel != null) { cfgModel.cfgFile = root.ToString(); sysCfgBll.Update(cfgModel); } ShowAreaColor(); RefreshPos(this.currHouseName, currRowth); return(true); }