using Core.Mes.Client.Comm.Format;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.YdmBcPipeManage.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.YdmBcPipeManage
{
public partial class FrmSplit : FrmBase
{
OpeBase _ob;
public string disOk = "";
MatBcMEntity2 matBcEntity = null;
private string _userName = "";
public FrmSplit(OpeBase ob,MatBcMEntity2 matBctity,string userName)
{
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
InitializeComponent();
_ob = ob;
_userName = userName;
matBcEntity = matBctity;
}
///
/// 重写基类方法
///
///
///
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "ComFrim":
doFrim();
break;
case "Close":
this.Close();
break;
}
}
private void doFrim()
{
this.ultraGrid1.UpdateData();
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMagRows.Count() == 0)
{
return;
}
string matBcEntityZ = JSONFormat.Format(matBcEntity);
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
MatBcMEntity matBc = (MatBcMEntity)row.ListObject;
if (!StringUtil.IsInt(matBc.ActCount.ToString3()) || int.Parse(matBc.ActCount.ToString3()) <= 0)
{
MessageUtil.ShowTips("分切支数需为整数并且分切支数需大于0!");
return;
}
if (!StringUtil.IsDouble(matBc.ActLen.ToString3()) || double.Parse(matBc.ActLen.ToString3()) <= 0)
{
MessageUtil.ShowTips("分切后长度需为数字型并且分切后长度需大于0!");
return;
}
string matBcEntityS = JSONFormat.Format(matBc);
parmList.Add(matBcEntityS);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.ydm.bc.FrmSplittingManage";
ccp.MethodName = "doSpliting";
ccp.ServerParams = new object[] {matBcEntityZ,parmList,_userName };
ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("分切成功!"))
{
disOk = "1";
this.Close();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
private void FrmSplit_Load(object sender, EventArgs e)
{
EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]);
}
}
}