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 UIM070050 : FrmBase
{
public UIM070050()
{
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 startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
string[] queryParams = new string[] { startTime, endTime };
List list = new List();
list.Add(queryParams);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM07.UIM070010";
ccp.MethodName = "queryHYardSpm";
ccp.ServerParams = new object[] { list };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
///
/// 导出EXCEL
///
private void Export()
{
try
{
if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
{
string fileName = this.saveFileDialog1.FileName;
this.ultraGridExcelExporter1.Export(ultraGrid3, fileName);
System.Diagnostics.Process.Start(fileName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void UIM070050_Load(object sender, EventArgs e)
{
this.ultraDateTimeEditor1.Value = "" ;
this.ultraDateTimeEditor2.Value = "";
}
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[2];
param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
list.Add(param);
}
}
ccp.ServerName = "UIM.UIM070050";
ccp.MethodName = "addLzbz";
ccp.ServerParams = new Object[] { list };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
}
}
}