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 UIM010090 : FrmBase
{
private int OUT_TYPE = 1;//出库类型,默认为上料出库
public UIM010090()
{
InitializeComponent();
}
private void UIM010090_Load(object sender, EventArgs e)
{
this.ultraComboEditor1.SelectedIndex = 0;
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.DoQuery();
break;
case "Save":
this.DoSave();
break;
case "Export":
this.Export();
break;
case "DoQueryReturn":
this.DoQueryReturn();
break;
case "DoSaveReturn":
this.DoSaveReturn();
break;
case "Exit":
this.Close();
break;
}
}
///
/// 查询原料库库存数据
///
private void DoQuery()
{
try
{
this.dataSet1.Tables[0].Clear();
string coilNo = textBox3.Text.Trim();
string ordNo = this.textBox1.Text.Trim();
string ordSeq = this.textBox2.Text.Trim();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010090";
ccp.MethodName = "queryOutCoil";
ccp.ServerParams = new object[] { ordNo,ordSeq,coilNo };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
private void DoQueryReturn()
{
try
{
this.dataSet1.Tables[0].Clear();
string coilNo = textBox3.Text.Trim();
string ordNo = this.textBox1.Text.Trim();
string ordSeq = this.textBox2.Text.Trim();
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIB.COM.ComDBQuery";
ccp.MethodName = "doSimpleQuery";
ArrayList paramArray = new ArrayList();
paramArray.Add("UIM010090_04.SELECT");
paramArray.Add(ordNo);
paramArray.Add(ordSeq);
paramArray.Add(coilNo);
ccp.ServerParams = new object[] { paramArray };
ccp.SourceDataTable = this.dataSet1.Tables[0];
this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
///
/// 原料库出库
///
private void DoSave()
{
try
{
if (this.ultraGrid1.ActiveRow == null)
{
MessageBox.Show("请选择需要出库的钢卷!");
}
string coilNo = this.ultraGrid1.ActiveRow.Cells["OLD_SAMPL_NO"].Text;
if (MessageBox.Show("是否确定将" + coilNo + "退回热轧?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string regID = this.UserInfo.GetUserID();//出库人
string trnfShift = this.UserInfo.GetUserOrder();//出库班次
string trnfGroup = this.UserInfo.GetUserGroup();//出库班组
string trnfDtime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss") : "";//出库时间
int trnfType = int.Parse(this.ultraComboEditor1.Value.ToString());//0退实物 1退账面
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010090";
ccp.MethodName = "saveCoilOut";
ccp.ServerParams = new object[] { coilNo, regID, trnfShift, trnfGroup, trnfDtime, trnfType };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
this.DoQuery();
}
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
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 DoSaveReturn()
{
try
{
if (this.ultraGrid1.ActiveRow == null)
{
MessageBox.Show("请选择需要出库的钢卷!");
}
string coilNo = this.ultraGrid1.ActiveRow.Cells["OLD_SAMPL_NO"].Text;
if (MessageBox.Show("是否确定将" + coilNo + "撤销退回?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string regID = this.UserInfo.GetUserID();//出库人
string trnfShift = this.UserInfo.GetUserOrder();//出库班次
string trnfGroup = this.UserInfo.GetUserGroup();//出库班组
string trnfDtime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss") : "";//出库时间
int trnfType = int.Parse(this.ultraComboEditor1.Value.ToString());//0退实物 1退账面
//CoreClientParam ccp = new CoreClientParam();
//ccp.ServerName = "UIB.COM.ComDBSave";
//ccp.MethodName = "doXmlSave";
//ArrayList paramArray = new ArrayList();
//paramArray.Add("UIM010090_05.UPDATE");
//paramArray.Add(coilNo);
//ccp.ServerParams = new object[] { paramArray };
////ccp.ServerParams = new object[] { coilNo, regID, trnfShift, trnfGroup, trnfDtime, trnfType };
//this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "UIM.UIM010090";
ccp.MethodName = "deletereturn";
ccp.ServerParams = new object[] { coilNo,regID, trnfShift, trnfGroup, trnfDtime };
this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
this.DoQueryReturn();
}
}
catch (Exception EX)
{
MessageBox.Show(EX.ToString());
}
}
}
}