| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- namespace Core.LZMes.Client.UIM
- {
- public partial class UIM010020 : FrmBase
- {
- private string NODE_ID = "";
- public UIM010020()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- //this.DoQuery();
- break;
- case "Add":
- this.DoAdd();
- break;
- case "Update":
- this.DoUpdate();
- break;
- case "Delete":
- this.DoDelete();
- break;
- }
- }
- /// <summary>
- /// 根据树节点查询垛位信息
- /// </summary>
- /// <param name="nodeId"></param>
- private void DoQuery(string nodeId)
- {
- try
- {
- this.dataSet1.Tables[0].Clear();
- //节点类型 0为根节点,1为区域类型节点,2为区域节点
- int nodeType = 2;
- if ("-1".Equals(nodeId))
- {
- nodeType = 0;
- }
- else if (0 <= nodeId.IndexOf("type"))
- {
- nodeType = 1;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "queryYard";
- ccp.ServerParams = new object[] { nodeType,nodeId };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
-
- /// <summary>
- /// 生成区域信息树
- /// </summary>
- protected void bindtree()
- {
- this.ultraTree1.Nodes.Clear();
- this.dataSet2.Tables[0].Clear();
- //创建根节点
- Infragistics.Win.UltraWinTree.UltraTreeNode rootNode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
- //Infragistics.WebUI.UltraWebNavigator.Node rootnode1 = new Infragistics.WebUI.UltraWebNavigator.Node();
- //添加根节点
- rootNode.Text = "区域信息";
- rootNode.Tag = "-1";
- rootNode.Expanded = true;
- ultraTree1.Nodes.Add(rootNode);
- //获取树的数据
- GetTrees();
- //调用递归方法添加树节点
- CreateChildNode(rootNode, "-1", this.dataSet2.Tables[0]);
- }
-
- /// <summary>
- /// 递归添加节点
- /// </summary>
- /// <param name="parentnode"></param>
- /// <param name="taskid"></param>
- /// <param name="dt"></param>
- public void CreateChildNode(Infragistics.Win.UltraWinTree.UltraTreeNode parentnode, string parentId, DataTable dt)
- {
- DataRow[] rows = dt.Select("parentid='" + parentId + "'");
- foreach (DataRow dr in rows)
- {
- Infragistics.Win.UltraWinTree.UltraTreeNode nd = new Infragistics.Win.UltraWinTree.UltraTreeNode();
- nd.Tag = dr["treeid"].ToString();
- nd.Text = dr["treename"].ToString();
- nd.Expanded = true;
- parentnode.Nodes.Add(nd);
-
- CreateChildNode(nd, dr["treeid"].ToString(), dt);
- }
- }
- /// <summary>
- /// 获取数据
- /// </summary>
- public void GetTrees()
- {
- CoreClientParam ccp = new CoreClientParam();
- //ccp.InvokeID = "C06010103";
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "quereAreaTree";
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- /// <summary>
- /// 删除垛位信息
- /// </summary>
- private void DoDelete()
- {
- try
- {
-
-
-
- long clfNo = -1;
- Infragistics.Win.UltraWinGrid.SelectedRowsCollection rows = this.ultraGrid1.Selected.Rows;
- string delParam = "";
- for (int i = 0; i < rows.Count; i++)
- {
- string clfNoStr = rows[i].Cells["clf_no"].Text;
- string coilNoStr = rows[i].Cells["coil_no"].Text;
- if (null != clfNoStr && !"".Equals(clfNoStr))
- {
- clfNo = long.Parse(clfNoStr);
- delParam += clfNo + "|";
- }
- if (null != coilNoStr && !"".Equals(coilNoStr))
- {
- MessageBox.Show("垛位下放置有钢卷,请先将钢卷移出。");
- return;
- }
- }
- if (rows.Count < 1)
- {
- MessageBox.Show("请选择要删除的垛位。");
- return;
- }
- if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
- {
- if (!"".Equals(delParam))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "delYard";
- ccp.ServerParams = new object[] { delParam };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != 0) return;
- }
- this.ultraGrid1.DeleteSelectedRows(false);
- MessageBox.Show("删除成功!");
- }
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- /// <summary>
- /// 添加垛位
- /// </summary>
- private void DoAdd()
- {
- try
- {
- string clfName = this.textBox1.Text;
- string clfRow = this.textBox2.Text;
- string clfCol = this.textBox3.Text;
- string clfFl = this.textBox5.Text;
- string remark = this.textBox4.Text;
- string areaNo = this.ultraComboEditor1.Value.ToString();
- string regId = this.UserInfo.GetUserID();
- if (null == clfName || "".Equals(clfName))
- {
- MessageBox.Show("请输入垛位名称!");
- this.textBox1.Focus();
- return;
- }
- if (null == clfRow || "".Equals(clfRow))
- {
- MessageBox.Show("请输入行!");
- this.textBox2.Focus();
- return;
- }
- if (null == clfCol || "".Equals(clfCol))
- {
- MessageBox.Show("请输入列!");
- this.textBox3.Focus();
- return;
- }
- if (null == clfFl || "".Equals(clfFl))
- {
- MessageBox.Show("请输入层!");
- }
- if (-1 == this.ultraComboEditor1.SelectedIndex)
- {
- MessageBox.Show("请选择所属区域!");
- this.ultraComboEditor1.Focus();
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "addYard";
- ccp.ServerParams = new object[] { clfName, clfRow, clfCol, clfFl, remark, areaNo, regId};
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (0 != ccp.ReturnCode) return;
- this.DoQuery(NODE_ID);
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- /// <summary>
- /// 修改垛位信息
- /// </summary>
- private void DoUpdate()
- {
- string clfNo = this.ultraGrid1.ActiveRow.Cells["clf_no"].Text;
- string clfName = this.textBox1.Text;
- string clfRow = this.textBox2.Text;
- string clfCol = this.textBox3.Text;
- string clfFl = this.textBox5.Text;
- string remark = this.textBox4.Text;
- string areaNo = this.ultraComboEditor1.Value.ToString();
- string regId = this.UserInfo.GetUserID();
- if (null == clfName || "".Equals(clfName))
- {
- MessageBox.Show("请输入垛位名称!");
- this.textBox1.Focus();
- return;
- }
- if (null == clfRow || "".Equals(clfRow))
- {
- MessageBox.Show("请输入行!");
- this.textBox2.Focus();
- return;
- }
- if (null == clfCol || "".Equals(clfCol))
- {
- MessageBox.Show("请输入列!");
- this.textBox3.Focus();
- return;
- }
- if (null == clfFl || "".Equals(clfFl))
- {
- MessageBox.Show("请输入层!");
- }
- if (-1 == this.ultraComboEditor1.SelectedIndex)
- {
- MessageBox.Show("请选择所属区域!");
- this.ultraComboEditor1.Focus();
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "updateYard";
- ccp.ServerParams = new object[] { clfNo, clfName, clfRow, clfCol, clfFl, remark, areaNo,regId};
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (0 != ccp.ReturnCode) return;
- this.DoQuery(NODE_ID);
- }
- /// <summary>
- /// 页面加载时获取区域树结构数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void UIM010020_Load(object sender, EventArgs e)
- {
- bindtree();
- }
- /// <summary>
- /// 选取节点查询垛位信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraTree1_AfterSelect(object sender, Infragistics.Win.UltraWinTree.SelectEventArgs e)
- {
- Infragistics.Win.UltraWinTree.UltraTree tree = (Infragistics.Win.UltraWinTree.UltraTree)sender;
- string ndId = tree.SelectedNodes[0].Tag.ToString();
- NODE_ID = ndId;
- this.DoQuery(ndId);
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- this.textBox1.Text = uRow.Cells["clf_name"].Text;
- this.textBox2.Text = uRow.Cells["clf_row"].Text;
- this.textBox3.Text = uRow.Cells["clf_col"].Text;
- this.textBox4.Text = uRow.Cells["remark"].Text;
- this.textBox5.Text = uRow.Cells["clf_fl"].Text;
- this.ultraComboEditor1.Text = uRow.Cells["area_name"].Text;
- this.getAreaInfo(uRow.Cells["area_no"].Text.Trim());
- }
- /// <summary>
- /// 获取区域信息
- /// </summary>
- private void getAreaInfo(string areaNo)
- {
- this.dataSet3.Tables[0].Clear();
- this.ultraComboEditor1.Items.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010020";
- ccp.MethodName = "queryAreaInfo";
- ccp.ServerParams = new object[] { areaNo };
- ccp.SourceDataTable = this.dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- foreach (DataRow dr in dataSet3.Tables[0].Rows)
- {
- ultraComboEditor1.Items.Add(dr["area_no"].ToString(), dr["area_name"].ToString());
- }
- }
- }
- }
|