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 Core.Mes.Client.Comm.Control;
using Core.StlMes.Client.YdmBase;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win.UltraWinGrid;
using System.Collections;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.YdmPipeManage.Tool;
namespace Core.StlMes.Client.YdmPipeManage
{
public partial class frmPipeMoveStoreButress : FrmBase
{
public frmPipeMoveStoreButress(OpeBase ob)
{
this.ob = ob;
InitializeComponent();
}
UltraComboEditor uceReson = new UltraComboEditor();
public string buttonValue = "";
private DataTable dt;
public DataTable Dt
{
get { return dt; }
set { dt = value; }
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case"OK":
updateStoreButress();
break;
case"Close":
this.Close();
break;
}
}
///
/// 确认
///
private void updateStoreButress()
{
this.ultraGrid3.UpdateData();
int numCount = int.Parse(this.ultraGrid1.ActiveRow.Cells["UNIT"].Value.ToString());//总支数
int num = 0;
foreach (UltraGridRow row in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
{
num += int.Parse(row.Cells["COUNT"].Value.ToString());
}
}
if (num > numCount)
{
MessageUtil.ShowTips("调整支数不能大于库存支数!");
return;
}
ArrayList parm = new ArrayList();
foreach (UltraGridRow row in ultraGrid3.Rows)
{
if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
{
if (row.Cells["COUNT"].Value.ToString() == "" || row.Cells["COUNT"].Value.ToString() == "0")
{
MessageUtil.ShowTips("请输入正确的支数!");
return;
}
if (row.Cells["STORENO"].Value.ToString() == "")
{
MessageUtil.ShowTips("目标仓库不能为空!");
return;
}
ArrayList list = new ArrayList();
list.Add(this.ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString());//炉批组
list.Add(this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString());
list.Add(this.ultraGrid1.ActiveRow.Cells["BATCH_GROUD_NO"].Value.ToString());
if (this.ultraGrid1.ActiveRow.Cells["PRODUCT_FLAG"].Value.ToString() == "商品")
{
list.Add("801403");
}
else if (this.ultraGrid1.ActiveRow.Cells["PRODUCT_FLAG"].Value.ToString() == "成品")
{
list.Add("801402");
}
else if (this.ultraGrid1.ActiveRow.Cells["PRODUCT_FLAG"].Value.ToString() == "在制品")
{
list.Add("801401");
}
list.Add(this.ultraGrid1.ActiveRow.Cells["STORAGE_NO"].Value.ToString());//原仓库
list.Add(row.Cells["COUNT"].Value.ToString());//支数
list.Add(row.Cells["STORENO"].Value.ToString());//目标仓库
list.Add(this.ultraGrid1.ActiveRow.Cells["FINISHPRO_MOLD"].Value.ToString());
list.Add(this.ultraGrid1.ActiveRow.Cells["IN_MOLD"].Value.ToString());
parm.Add(list);
}
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipupdateStoreButress";
ccp.MethodName = "updateStore";
ccp.ServerParams = new object[] { parm };
ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
if(ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
buttonValue = "1";
this.Close();
}
}
}
///
/// 获取目标仓库
///
UltraComboEditor storeNo = new UltraComboEditor();
private void InintStoreNo()
{
YdmBaseClass.InitComboEditor(storeNo, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, true);
YdmBaseClass.BindColumn(storeNo, "STORENO", this.Controls, this.ultraGrid3, 0);
}
private void frmPipeMoveStoreButress_Load(object sender, EventArgs e)
{
InintStoreNo();
YdmBaseClass.InitComboEditor(uceReson, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
YdmBaseClass.BindColumn(uceReson, "STORAGE_NO", this.Controls, this.ultraGrid1, 0);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable2,true);
}
//private void ultraGrid3_CellChange(object sender, CellEventArgs e)
//{
// if (e.Cell.Row.Cells["COUNT"].Value == "")
// {
// e.Cell.Row.Cells["WEIGHT"].Value = "0";
// }
// else
// {
// ArrayList list = new ArrayList();
// list.Add(this.ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
// list.Add(this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString());
// list.Add(this.ultraGrid1.ActiveRow.Cells["BATCH_GROUD_NO"].Value.ToString());
// list.Add(this.ultraGrid1.ActiveRow.Cells["PRODUCT_FLAG"].Value.ToString());
// DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.checkMatWeight", new object[] { list }, this.ob);
// if (dt != null && dt.Rows.Count > 0)
// {
// e.Cell.Row.Cells["WEIGHT"].Value = dt.Rows[0][1].ToString();
// }
// else
// {
// e.Cell.Row.Cells["WEIGHT"].Value = "0";
// }
// }
//}
}
}