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 Infragistics.Win.UltraWinGrid;
namespace Core.LZMes.Client.UIM
{
public partial class UIM010190 : FrmBase
{
private string COIL_NO = "";
public UIM010190()
{
InitializeComponent();
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.DoQuery();
break;
case "Save":
this.DoSave();
break;
case "Exit":
this.Close();
break;
}
}
///
/// 查询钢卷信息
///
private void DoQuery()
{
try
{
string coilNo = this.textBox1.Text.Trim();
this.dataSet1.Tables[0].Clear();
COIL_NO = coilNo;
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010190";
ccp.MethodName = "queryCoilInfo";
ccp.ServerParams = new object[] { coilNo };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
///
/// 盘入盘出操作
///
private void DoSave()
{
try
{
if (this.dataTable1.Rows.Count < 1)
{
MessageBox.Show("钢卷信息不能为空,请先查询出钢卷信息再进行盘入盘出操作!");
return;
}
Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
rs = this.ultraGrid1.Rows;
string wdlivno = "";
foreach (UltraGridRow ugr in rs)
{
wdlivno = rs[0].Cells["wdlivno"].Text.ToString(); //获取提货单号
}
//string yardName = "2";
string yardName = ultraComboEditor8.Text.Trim().ToUpper();
string row_fl = textBox2.Text.Trim().ToUpper();
string col = textBox3.Text.Trim();
if (checkBox1.Checked && (row_fl.Length < 2 || (!row_fl.EndsWith("A") && !row_fl.EndsWith("B") && !row_fl.EndsWith("C")) || col.Length < 1))
{
MessageBox.Show("垛位输入不正确,请按照2-01A-01的格式输入!");
this.textBox2.Focus();
return;
}
if (row_fl.Length == 2)
{
row_fl = "0" + row_fl;
}
if (col.Length == 1)
{
col = "0" + col;
}
string curLoadLoc = yardName+"-"+row_fl+"-"+col;
int type = 0;
if (checkBox2.Checked)
{
type = 1;
}
else if (checkBox3.Checked || checkBox4.Checked)
{
type = 2;//外卖或者废钢
}
else if(!checkBox1.Checked)
{
MessageBox.Show("请选择盘入盘出类型!");
return;
}
else if ("".Equals(curLoadLoc))
{
MessageBox.Show("盘入操作需要垛位信息,请输入相应的垛位信息!");
return;
}
else if ("".Equals(wdlivno) && (checkBox3.Checked || checkBox4.Checked))
{
MessageBox.Show("外卖或者废钢提货单号不能为空!");
return;
}
string coilInReg = this.UserInfo.GetUserID();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010190";
ccp.MethodName = "save";
ccp.ServerParams = new object[] { type, COIL_NO, curLoadLoc, coilInReg, UserInfo.GetUserOrder(), UserInfo.GetUserGroup(),wdlivno };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
this.DoQuery();
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox1.Checked)
{
this.checkBox2.Checked = false;
this.checkBox3.Checked = false;
this.checkBox4.Checked = false;
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox2.Checked)
{
this.checkBox1.Checked = false;
this.checkBox3.Checked = false;
this.checkBox4.Checked = false;
}
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
this.textBox3.Focus();
return;
}
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
this.DoQuery();
return;
}
}
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
this.DoSave();
return;
}
}
private void checkBox1_MouseEnter(object sender, EventArgs e)
{
this.toolTip1.Show("盘入操作需要垛位信息,请输入相应的垛位信息", this.checkBox1);
}
private void checkBox1_MouseLeave(object sender, EventArgs e)
{
this.toolTip1.Hide(this.checkBox1);
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
this.checkBox1.Checked = false;
this.checkBox2.Checked = false;
this.checkBox4.Checked = false;
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
this.checkBox1.Checked = false;
this.checkBox2.Checked = false;
this.checkBox3.Checked = false;
}
private void UIM010190_Load(object sender, EventArgs e)
{
ultraComboEditor8.SelectedIndex = 0;
}
}
}