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 UIM010030 : FrmBase { public UIM010030() { 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; } } private void DoQuery() { try { string areaType = "1"; this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); //ccp.InvokeID = "C06010103"; ccp.ServerName = "UIM.UIM010030"; ccp.MethodName = "queryYardStd"; ccp.ServerParams = new object[] { areaType }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); Console.WriteLine(this.dataSet1.Tables[0].ToString()); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } /// /// 添加堆垛原则 /// private void DoAdd() { string yardKind = this.textBox1.Text; if (null == yardKind || "".Equals(yardKind)) { MessageBox.Show("仓库类型不能为空!"); this.textBox1.Focus(); return; } string areaKind = this.textBox2.Text; if (null == areaKind || "".Equals(areaKind)) { MessageBox.Show("区域类型不能为空!"); this.textBox2.Focus(); return; } string yardAddr = this.textBox3.Text; if (null == yardAddr || "".Equals(yardAddr)) { MessageBox.Show("堆放区域不能为空!"); this.textBox3.Focus(); return; } string fromStlGrd = this.textBox4.Text; string toStlGrd = this.textBox5.Text; string stlGrd1 = this.textBox6.Text; string stlGrd2 = this.textBox7.Text; string stlGrd3 = this.textBox8.Text; string stlGrd4 = this.textBox9.Text; string stlGrd5 = this.textBox10.Text; string stlGrd6 = this.textBox11.Text; string stlGrd7 = this.textBox12.Text; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010030"; ccp.MethodName = "addYardRule"; ccp.ServerParams = new object[] { yardKind, areaKind, yardAddr, fromStlGrd, toStlGrd, stlGrd1, stlGrd2, stlGrd3, stlGrd4, stlGrd5, stlGrd6, stlGrd7 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (0 != ccp.ReturnCode) return; DataRow dr = dataTable1.NewRow(); dr["yard_kind"] = yardKind; dr["area_kind"] = areaKind; dr["yard_addr"] = yardAddr; dr["from_stl_grd"] = fromStlGrd; dr["to_stl_grd"] = toStlGrd; dr["stl_grd1"] = stlGrd1; dr["stl_grd2"] = stlGrd2; dr["stl_grd3"] = stlGrd3; dr["stl_grd4"] = stlGrd4; dr["stl_grd5"] = stlGrd5; dr["stl_grd6"] = stlGrd6; dr["stl_grd7"] = stlGrd7; MessageBox.Show("新增成功!"); } /// /// 修改堆垛原则 /// public void DoUpdate() { //string yardKind = this.textBox1.Text; //if (null == yardKind || "".Equals(yardKind)) //{ // MessageBox.Show("仓库类型不能为空!"); // return; //} //string areaKind = this.textBox2.Text; //if (null == areaKind || "".Equals(areaKind)) //{ // MessageBox.Show("区域类型不能为空!"); // return; //} //string yardAddr = this.textBox3.Text; //if (null == yardAddr || "".Equals(yardAddr)) //{ // MessageBox.Show("堆放区域不能为空!"); //} string fromStlGrd = this.textBox4.Text; string toStlGrd = this.textBox5.Text; string stlGrd1 = this.textBox6.Text; string stlGrd2 = this.textBox7.Text; string stlGrd3 = this.textBox8.Text; string stlGrd4 = this.textBox9.Text; string stlGrd5 = this.textBox10.Text; string stlGrd6 = this.textBox11.Text; string stlGrd7 = this.textBox12.Text; Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid1.ActiveRow; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010030"; ccp.MethodName = "updateYardRule"; ccp.ServerParams = new object[] { uRow.Cells["yard_kind"].Text, uRow.Cells["area_kind"].Text, uRow.Cells["yard_addr"].Text, fromStlGrd, toStlGrd, stlGrd1, stlGrd2, stlGrd3, stlGrd4, stlGrd5, stlGrd6, stlGrd7 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (0 != ccp.ReturnCode) return; MessageBox.Show("修改成功!"); this.DoQuery(); } /// /// 删除堆垛原则 /// private void DoDelete() { try { Infragistics.Win.UltraWinGrid.SelectedRowsCollection rows = this.ultraGrid1.Selected.Rows; if (rows.Count < 1) { MessageBox.Show("请选择要删除的堆垛原则。"); return; } string yardKind = rows[0].Cells["yard_kind"].Text; string areaKind = rows[0].Cells["area_kind"].Text; string yardAddr = rows[0].Cells["yard_addr"].Text; string delParam = yardKind + "," + areaKind + "," + yardAddr; if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (!"".Equals(delParam)) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010030"; ccp.MethodName = "delYardRule"; ccp.ServerParams = new object[] { yardKind, areaKind, yardAddr }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != 0) return; } this.ultraGrid1.DeleteSelectedRows(false); MessageBox.Show("删除成功!"); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid1.ActiveRow; this.textBox1.Text = uRow.Cells["yard_kind"].Text; this.textBox2.Text = uRow.Cells["area_kind"].Text; this.textBox3.Text = uRow.Cells["yard_addr"].Text; this.textBox4.Text = uRow.Cells["from_stl_grd"].Text; this.textBox5.Text = uRow.Cells["to_stl_grd"].Text; this.textBox6.Text = uRow.Cells["stl_grd1"].Text; this.textBox7.Text = uRow.Cells["stl_grd2"].Text; this.textBox8.Text = uRow.Cells["stl_grd3"].Text; this.textBox9.Text = uRow.Cells["stl_grd4"].Text; this.textBox10.Text = uRow.Cells["stl_grd5"].Text; this.textBox11.Text = uRow.Cells["stl_grd6"].Text; this.textBox12.Text = uRow.Cells["stl_grd7"].Text; } } }