/// <summary> /// 绑定(重量、水分)检测项目 /// </summary> private void BindCboxTestItems() { List <TestItems> list = TestItemsDAL.GetListWhereTestItemName("", "启动"); TestItems ti = new TestItems(); ti.TestItems_ID = 0; ti.TestItems_NAME = "全部"; TestItems t = list[0]; list[0] = ti; list.Add(t); List <TestItems> list2 = list; cboxTestItems2.DataSource = list; cboxTestItems2.DisplayMember = "TestItems_NAME"; cboxTestItems2.ValueMember = "TestItems_ID"; if (cboxTestItems2.DataSource != null) { cboxTestItems2.SelectedValue = 0; } cboxTestItems.DataSource = list2;// TestItemsDAL.GetListWhereTestItemName("", "启动"); cboxTestItems.DisplayMember = "TestItems_NAME"; cboxTestItems.ValueMember = "TestItems_ID"; if (cboxTestItems.DataSource != null) { // cboxTestItems.SelectedIndex =-1; cboxTestItems.SelectedValue = 0; } }
/// <summary> /// 绑定检测项目上级(水分检测和重量检测) /// </summary> private void BindcbxTestItemsID() { cbxTes_TestItems_ID.DataSource = TestItemsDAL.GetListWhereTestItemName("", "启动"); cbxTes_TestItems_ID.DisplayMember = "TestItems_NAME"; cbxTes_TestItems_ID.ValueMember = "TestItems_ID"; if (cbxTes_TestItems_ID.DataSource != null) { cbxTes_TestItems_ID.SelectedIndex = 0; } }
/// <summary> /// 获得系统设置信息 /// </summary> private void GetSystemSet() { string filepath = System.IO.Directory.GetCurrentDirectory() + "\\SystemSet.xml"; try { string version = ""; string DVRIP = ""; string DVRServerPort = ""; string DVRLoginName = ""; string DVRPwd = ""; string SaveFiel = ""; int Channel1 = 0; int Channel2 = 0; int Channel3 = 0; string MOISTURECOM = ""; string MOISTURENAME = ""; string platformScaleName = ""; string MOISTURECOMTwo = ""; string MOISTURENAMETwo = ""; string platformScaleNameTwo = ""; string WEIGHTCOM = ""; string WEIGHTCOMTwo = ""; // string NTCODE = ""; // string LEDFROMX = ""; string LEDFROMY = ""; string LEDX = ""; string LEDY = ""; string CLIENTID = ""; string CLIENTNAME = ""; string CollectionID = ""; string CollectionNAME = ""; string SFYCOUNT = ""; string MOISTUREMAX = ""; string MOISTUREMIN = ""; string waterManSelect = ""; string waterManSelectTwo = ""; string OrganizationID = ""; string SourceID = ""; string GainURL = ""; string SendURL = ""; // string LEDTabTime = ""; // string LEDEndTime = ""; string ISPackets = ""; int removePackage = 0; //string itemmoist = "0"; //string itemmoistcount = "8"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNode xn = xmlDoc.SelectSingleNode("param");//查找<bookstore> XmlNodeList xnl = xn.ChildNodes; if (xnl.Count > 0) { foreach (XmlNode xnf in xnl) { XmlElement xe = (XmlElement)xnf; version = xe.GetAttribute("Version").ToString(); MOISTURECOM = xe.GetAttribute("MOISTURECOM").ToString(); MOISTURENAME = xe.GetAttribute("MOISTURENAME").ToString(); platformScaleName = xe.GetAttribute("platformScaleName").ToString(); MOISTURECOMTwo = xe.GetAttribute("MOISTURECOMTwo").ToString(); MOISTURENAMETwo = xe.GetAttribute("MOISTURENAMETwo").ToString(); platformScaleNameTwo = xe.GetAttribute("platformScaleNameTwo").ToString(); WEIGHTCOM = xe.GetAttribute("WEIGHTCOM").ToString(); WEIGHTCOMTwo = xe.GetAttribute("WEIGHTCOMTwo").ToString(); //LEDFROMX = xe.GetAttribute("LEDFROMX").ToString(); //LEDFROMY = xe.GetAttribute("LEDFROMY").ToString(); //LEDX = xe.GetAttribute("LEDX").ToString(); //LEDY = xe.GetAttribute("LEDY").ToString(); CLIENTID = xe.GetAttribute("CLIENTID").ToString(); CLIENTNAME = xe.GetAttribute("CLIENTNAME").ToString(); CollectionID = xe.GetAttribute("CollectionID").ToString(); CollectionNAME = xe.GetAttribute("CollectionNAME").ToString(); SFYCOUNT = xe.GetAttribute("SFYCOUNT").ToString(); MOISTUREMAX = xe.GetAttribute("MOISTUREMAX").ToString(); MOISTUREMIN = xe.GetAttribute("MOISTUREMIN").ToString(); waterManSelect = xe.GetAttribute("waterManSelect").ToString(); waterManSelectTwo = xe.GetAttribute("waterManSelectTwo").ToString(); OrganizationID = xe.GetAttribute("OrganizationID").ToString(); SourceID = xe.GetAttribute("SourceID").ToString(); GainURL = xe.GetAttribute("GainURL").ToString(); SendURL = xe.GetAttribute("SendURL").ToString(); removePackage = Convert.ToInt32(xe.GetAttribute("removePackage")); //LEDTabTime = xe.GetAttribute("LEDTabTime").ToString(); //LEDEndTime = xe.GetAttribute("LEDEndTime").ToString(); ISPackets = xe.GetAttribute("ISPackets").ToString(); DVRIP = xe.GetAttribute("DVRIP").ToString(); DVRServerPort = xe.GetAttribute("DVRServerPort").ToString(); DVRLoginName = xe.GetAttribute("DVRLoginName").ToString(); DVRPwd = xe.GetAttribute("DVRPwd").ToString(); SaveFiel = xe.GetAttribute("SaveFiel").ToString(); Channel1 = Common.GetInt(xe.GetAttribute("Channel1").ToString()); Channel2 = Common.GetInt(xe.GetAttribute("Channel2").ToString()); Channel3 = Common.GetInt(xe.GetAttribute("Channel3").ToString()); //itemmoist = xe.GetAttribute("ItemMoist").ToString(); //itemmoistcount = xe.GetAttribute("ItemMoistCount").ToString(); } if (!string.IsNullOrEmpty(version)) { Common.Version = version; } if (!string.IsNullOrEmpty(waterManSelect)) { Common.waterManSelect = Convert.ToInt32(waterManSelect); } if (!string.IsNullOrEmpty(waterManSelectTwo)) { Common.waterManSelectTwo = Convert.ToInt32(waterManSelectTwo); } if (!string.IsNullOrEmpty(MOISTURECOM)) { Common.MOISTURECOM = Converter.ToInt(MOISTURECOM, 1); } if (!string.IsNullOrEmpty(MOISTURENAME)) { Common.MOISTURENAME = MOISTURENAME; } if (!string.IsNullOrEmpty(platformScaleName)) { Common.platformScaleName = platformScaleName; Common.WEIGHTCOMBaudRate = Common.GetComBaudrate(platformScaleName); } if (!string.IsNullOrEmpty(platformScaleNameTwo)) { Common.platformScaleNameTwo = platformScaleNameTwo; Common.WEIGHTCOMTwoBaudRate = Common.GetComBaudrate(platformScaleNameTwo); } if (!string.IsNullOrEmpty(MOISTURECOMTwo)) { Common.MOISTURECOMTwo = Converter.ToInt(MOISTURECOMTwo, 1); } if (!string.IsNullOrEmpty(MOISTURENAMETwo)) { Common.MOISTURENAMETwo = MOISTURENAMETwo; } if (!string.IsNullOrEmpty(WEIGHTCOM)) { Common.WEIGHTCOM = Converter.ToInt(WEIGHTCOM, 2); } if (!string.IsNullOrEmpty(WEIGHTCOMTwo)) { Common.WEIGHTCOMTwo = Converter.ToInt(WEIGHTCOMTwo, 2); } //if (!string.IsNullOrEmpty(LEDFROMX)) //{ // Common.LEDFROMX = Converter.ToInt(LEDFROMX); //} //if (!string.IsNullOrEmpty(LEDFROMY)) //{ // Common.LEDFROMY = Converter.ToInt(LEDFROMY); //} if (!string.IsNullOrEmpty(LEDX)) //{ // Common.LEDX = Converter.ToInt(LEDX); //} //if (!string.IsNullOrEmpty(LEDY)) //{ // Common.LEDY = Converter.ToInt(LEDY); //} if (!string.IsNullOrEmpty(CLIENTID)) { Common.CLIENTID = Converter.ToInt(CLIENTID); } if (!string.IsNullOrEmpty(SFYCOUNT)) { Common.SFYCOUNT = Converter.ToInt(SFYCOUNT); } if (!string.IsNullOrEmpty(CLIENTNAME)) { Common.CLIENT_NAME = CLIENTNAME; } if (!string.IsNullOrEmpty(CollectionID)) { Common.CollectionID = Converter.ToInt(CollectionID); } if (!string.IsNullOrEmpty(CollectionNAME)) { Common.CollectionNAME = CollectionNAME; } if (!string.IsNullOrEmpty(MOISTUREMAX)) { Common.MOISTUREMAX = Converter.ToInt(MOISTUREMAX); } if (!string.IsNullOrEmpty(MOISTUREMIN)) { Common.MOISTUREMIN = Converter.ToInt(MOISTUREMIN); } Common.OrganizationID = OrganizationID; Common.SourceID = SourceID; Common.GainURL = GainURL; Common.SendURL = SendURL; Common.removePackage = removePackage; //Common.LEDTabTime = LEDTabTime; //Common.LEDEndTime = LEDEndTime; Common.DVRIP = DVRIP; Common.DVRServerPort = DVRServerPort; Common.DVRLoginName = DVRLoginName; Common.DVRPwd = DVRPwd; Common.SaveFiel = SaveFiel; Common.Channel = Channel1; Common.Channel2 = Channel2; Common.Channel3 = Channel3; Common.ISPackets = ISPackets; //Common.ItemMoist = Common.GetInt(itemmoist); //Common.ItemMoistCount = Common.GetInt(itemmoistcount); } #region 2012-07-10 水分检测次数配置 List <TestItems> listitem = TestItemsDAL.GetListWhereTestItemName("水分检测", "启动"); if (listitem.Count > 0) { foreach (TestItems ti in listitem) { if (ti.TestItems_NAME.Trim() == "拆包后水分检测") { Common.BAGWATE = ti.TestItems_COUNT.Value; } else if (ti.TestItems_NAME.Trim() == "拆包前水分检测") { Common.TOTALCARWATE = ti.TestItems_COUNT.Value; } } } #endregion } catch (Exception ex) { MessageBox.Show("获得系统设置失败!", "运行信息", MessageBoxButtons.OK, MessageBoxIcon.Error);; } }