/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PrintManager_Load(object sender, EventArgs e) { DataTable dt = AsmPlan_BLL.GetPlanObjectByConditionToPrint(); LoadSource(dt); dic_year = SetYearRule(); dic_month = SetMonthRule(); lb_LINE_ID.DataSource = AsmLine_BLL.GetAllLines(); lb_LINE_ID.DisplayMember = "NAME"; lb_LINE_ID.ValueMember = "ID"; lb_LINE_ID.SelectedIndex = -1; }
public void RefishLineAndProduction() { productionDt = null; productionDt = AsmProduction_BLL.GetAllAsmProduction(); CB_ProductionType.DataSource = productionDt; CB_ProductionType.DisplayMember = "PRODUCTION_VR"; CB_ProductionType.ValueMember = "PRODUCTION_ID"; CB_ProductionType.SelectedItem = null; stationDt = null; stationDt = AsmLine_BLL.GetAllLines(); CB_Line.DataSource = stationDt; CB_Line.DisplayMember = "NAME"; CB_Line.ValueMember = "ID"; CB_Line.SelectedItem = null; }
private void btnAdd_Click(object sender, EventArgs e) { XmlNode rootNode = ClsCommon.InfoRootNode.SelectSingleNode(nodeItemName + "[@name='" + configForm.listBox.Text + "']"); XmlNode parentNode = ClsCommon.InfoRootNode; XmlElement element; int index = 0; string stName; XmlNodeList stationNodes = parentNode.SelectNodes(nodeItemName);///////DELETE foreach (XmlNode node in stationNodes) { if (int.Parse(node.Attributes["index"].Value) > index) { index = int.Parse(node.Attributes["index"].Value); } } index++; stName = nodeItemName + index.ToString(); element = ClsCommon.xml.CreateElement(nodeItemName); element.SetAttribute("index", index.ToString()); element.SetAttribute("name", stName); element.SetAttribute("plcIP", ""); element.SetAttribute("threaCount", "0"); element.SetAttribute("updateRate", "0"); element.SetAttribute("heartBeatAddr", ""); // element.SetAttribute("packOrNot", "1"); // element.SetAttribute("plcAgvIP", ""); // element.SetAttribute("agvBeatAddr", ""); // element.SetAttribute("sparePlcIp", ""); // element.SetAttribute("sparePlcBeatAddr", ""); parentNode.AppendChild(element); ClsCommon.saveXml(); AsmLineObject ao = new AsmLineObject(); ao.DT = DateTime.Now; ao.NAME = stName; AsmLine_BLL.AddLineByObject(ao); configForm.listBox.Items.Add(stName); configForm.listBox.SelectedIndex = configForm.listBox.Items.Count - 1; if (configForm.listBox.Items.Count > 0) { configForm.btnRemove.Enabled = true; configForm.btnPrevious.Enabled = true; configForm.btnNext.Enabled = true; } }
private void btnRemove_Click(object sender, EventArgs e) { XmlNode parentNode = ClsCommon.InfoRootNode; DialogResult result = MessageBox.Show("确定删除" + configForm.listBox.Text + "站?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result != DialogResult.OK) { return; } XmlNode stationNode; int selectIndex = configForm.listBox.SelectedIndex; stationNode = parentNode.SelectSingleNode(nodeItemName + "[@name='" + configForm.listBox.Text + "']"); parentNode.RemoveChild(stationNode); ClsCommon.saveXml(); AsmLine_BLL.DeleteLineByCondition(" NAME='" + configForm.listBox.Text + "'"); configForm.listBox.Items.Remove(configForm.listBox.Text); if (parentNode.ChildNodes.Count > 0) { if (selectIndex > 0) { configForm.listBox.SelectedIndex = selectIndex - 1; } else { configForm.listBox.SelectedIndex = 0; } } else { configForm.propertyGrid.SelectedObject = null; configForm.btnRemove.Enabled = false; configForm.btnPrevious.Enabled = false; configForm.btnNext.Enabled = false; } }
public void reflsh() { allo = AsmLine_BLL.GetLineByCondition(" NAME='" + LineName + "'"); }