using Core.Mes.Client.Comm.Format;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.YdmStuffManage.Entity;
using CoreFS.CA06;
using Infragistics.Win.UltraWinGrid;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Core.StlMes.Client.YdmStuffManage
{
public partial class WasteFrom : FrmBase
{
ArrayList parm = new ArrayList();
private OpeBase _ob = null;
public WasteFrom(ArrayList parmList,OpeBase ob)
{
InitializeComponent();
parm = parmList;
_ob = ob;
doQueryRack(parmList);
}
///
/// 查询管坯队列
///
private void doQueryRack(ArrayList parm)
{
List listSource = EntityHelper.GetData(
"Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryRack", new object[] { parm }, _ob);
StlLgProgrrssEntitybindingSource.DataSource = listSource;
}
///
/// 基类方法
///
///
///
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "ScrapNum":
scrapNum();
break;
case "CancelScrapNum":
cancelScrapNum();
break;
case "Close":
CloseFrm();
break;
}
}
///
/// 剔除管坯
///
private void scrapNum()
{
this.ultraGrid1.UpdateData();
IQueryable checkMag = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMag.Count() == 0)
{
return;
}
ArrayList list = new ArrayList();
foreach (UltraGridRow uRow in checkMag)
{
StlLgProgrrssEntity stlLgProes = (StlLgProgrrssEntity)uRow.ListObject;
string stlLgProcessTity = JSONFormat.Format(stlLgProes);
list.Add(stlLgProcessTity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffInputStore";
ccp.MethodName = "doScrapNum";
ccp.ServerParams = new object[] { list,UserInfo.GetUserName() };
ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("剔除成功!"))
{
doQueryRack(parm);
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
///
/// 撤销管坯剔除
///
private void cancelScrapNum()
{
this.ultraGrid1.UpdateData();
IQueryable checkMag = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMag.Count() == 0)
{
return;
}
ArrayList list = new ArrayList();
foreach (UltraGridRow uRow in checkMag)
{
StlLgProgrrssEntity stlLgProes = (StlLgProgrrssEntity)uRow.ListObject;
string stlLgProcessTity = JSONFormat.Format(stlLgProes);
list.Add(stlLgProcessTity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffInputStore";
ccp.MethodName = "cancelDoScrapNum";
ccp.ServerParams = new object[] { list };
ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("撤销成功!"))
{
doQueryRack(parm);
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
///
/// 关闭
///
private void CloseFrm()
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void WasteFrom_Load(object sender, EventArgs e)
{
EntityHelper.ShowGridCaption(this.ultraGrid1.DisplayLayout.Bands[0]);
}
}
}