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;
using System.Collections;
namespace Core.LZMes.Client.UIM
{
public partial class UIM070042 : FrmBase
{
public UIM070042()
{
InitializeComponent();
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.DoQuery();
break;
case "Export":
this.Export();
break;
case "Save":
this.DoSave();
break;
}
}
///
/// 查询原料库库存数据
///
private void DoQuery()
{
try
{
this.dataSet1.Tables[0].Clear();
string coilno = this.textBox9.Text.ToString();
ArrayList al = new ArrayList();
al.Add("UIM070021_02.SELECT");
al.Add(coilno);
al.Add(coilno);
al.Add(coilno);
this.dataSet1.Tables[0].Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBQuery";
ccp.MethodName = "doSimpleQuery";
ccp.ServerParams = new object[] { al };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
public string OrderSEQ
{
set
{
textBox9.Text = value;
DoQuery();
}
}
///
/// 导出EXCEL
///
private void Export()
{
try
{
if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
{
string fileName = this.saveFileDialog1.FileName;
this.ultraGridExcelExporter1.Export(ultraGrid1, fileName);
System.Diagnostics.Process.Start(fileName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void DoSave()
{
Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
ArrayList list = new ArrayList();
string[] param = null;
CoreClientParam ccp = new CoreClientParam();
rs = this.ultraGrid1.Rows;
for (int i = 0; i < rs.Count; i++)
{
if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
{
param = new string[1];
param[0] = rs[i].Cells["PRIGUID"].Value.ToString().Trim();
list.Add(param);
}
}
ccp.ServerName = "UIM.UIM07.UIM070020";
ccp.MethodName = "deleteyard";
ccp.ServerParams = new Object[] { list };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
}
private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
{
try
{
if (this.ultraGrid1.ActiveRow != null)
{
string COIL_NO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.ActiveRow.Cells["H_COIL_NO"].Value));
UIM010081C frm = new UIM010081C();
frm.ob = this.ob;
frm.Condition = COIL_NO;
frm.ShowDialog();
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
private void button4_Click(object sender, EventArgs e)
{
this.DoSave();
}
private void button5_Click(object sender, EventArgs e)
{
this.DoQuery();
}
private void button6_Click(object sender, EventArgs e)
{
///
try
{
this.dataSet1.Tables[0].Clear();
string coilno = this.textBox9.Text.ToString();
ArrayList al = new ArrayList();
al.Add("UIM070021_04.SELECT");
al.Add(coilno);
this.dataSet1.Tables[0].Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBQuery";
ccp.MethodName = "doSimpleQuery";
ccp.ServerParams = new object[] { al };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
private void button1_Click(object sender, EventArgs e)
{
this.dataSet2.Tables[0].Clear();
string coilno = this.textBox9.Text.ToString();
ArrayList al = new ArrayList();
al.Add("UIM070021_05.SELECT");
al.Add(coilno);
al.Add(coilno);
this.dataSet1.Tables[0].Clear();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBQuery";
ccp.MethodName = "doSimpleQuery";
ccp.ServerParams = new object[] { al };
ccp.SourceDataTable = this.dataSet2.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
private void button2_Click(object sender, EventArgs e)
{
Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
ArrayList list = new ArrayList();
string[] param = null;
CoreClientParam ccp = new CoreClientParam();
rs = this.ultraGrid2.Rows;
for (int i = 0; i < rs.Count; i++)
{
if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
{
param = new string[1];
param[0] = rs[i].Cells["PRIGUID"].Value.ToString().Trim();
list.Add(param);
}
}
ccp.ServerName = "UIM.UIM07.UIM070020";
ccp.MethodName = "returnyard";
ccp.ServerParams = new Object[] { list };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
}
private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (this.TabControl1.SelectedIndex)
{
case 0:
this.button1.Visible = false;
this.button2.Visible = false;
this.button4.Visible = true;
this.button5.Visible = true;
this.button6.Visible = true;
break;
case 1:
this.button1.Visible = true;
this.button2.Visible = true;
this.button4.Visible = false;
this.button5.Visible = false;
this.button6.Visible = false;
break;
}
}
}
}