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 UIM010340 : FrmBase
{
public UIM010340()
{
InitializeComponent();
}
//工具栏事件处理
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.DoQuery();
break;
case "Save":
this.DoSave();
break;
}
}
///
/// 查询待入库钢卷
///
private void DoQuery()
{
try
{
this.dataSet1.Tables[0].Clear();
string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
string coilNo = this.ultraTextEditor1.Text.Trim();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010340";
ccp.MethodName = "query";
ccp.ServerParams = new object[] { procuctedTime, coilNo, "1" };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
//textBox1.Text = "";
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
//选框点击事件处理
private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{
if (e.Cell.Column.Key == "CHK")
{
if (!Convert.ToBoolean(e.Cell.Value))
{
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
ultraGrid1.Rows[i].Cells["CHK"].Value = false;
}
e.Cell.Value = true;
this.ultraTextEditor2.Text = e.Cell.Row.Cells["COIL_NO"].Value.ToString();
yardControl1.Layer = "";
yardControl1.Stock = "";
yardControl1.Focus();
}
else
{
e.Cell.Value = false;
this.ultraTextEditor2.Text = "";
}
}
}
///
/// 废次品钢卷入库
///
private void DoSave()
{
bool flag = false;
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value))
{
flag = true;
break;
}
}
if (!flag)
{
MessageBox.Show("请选择需要入库的钢卷!");
return;
}
string yardAddr = yardControl1.GetYardFlag();//垛位
if (string.IsNullOrEmpty(yardAddr))
{
MessageBox.Show("请选择需要入库的垛位!");
yardControl1.Focus();
return;
}
string entryShift = UserInfo.GetUserOrder();//入库班次
string entryGroup = UserInfo.GetUserGroup();//入库班组
string entryDtime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddHHmmss");//入库时间
string reg_id = UserInfo.GetUserID();//操作人
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010340";
ccp.MethodName = "saveCoilYard";
ccp.ServerParams = new object[] { this.ultraTextEditor2.Text,yardAddr, entryShift, entryGroup, entryDtime, reg_id };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (0 == ccp.ReturnCode)
{
MessageBox.Show("入库成功!");
}
DoQuery();
}
}
}