using com.steering.pss.ydm.entity;
using Core.Mes.Client.Comm.Format;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.YdmPipeManage.Dialog;
using Core.StlMes.Client.YdmPipeManage.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.YdmPipeManage
{
public partial class FrmMonerSeq : FrmBase
{
OpeBase _ob;
public string disOk = "";
MatZcMEntity2 matZcEntity = new MatZcMEntity2();
string _userName = "";
string _deptId = "";
string[] _arr = null;
string _acount = "";
public FrmMonerSeq(OpeBase ob, MatZcMEntity matZctity, string userName, string deptId, string[] arr)
{
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
InitializeComponent();
_ob = ob;
_deptId = deptId;
_userName = userName;
_arr = arr;
_acount = matZctity.ActCount.ToString3();
matZcEntity.JudgeStoveNo = matZctity.JudgeStoveNo;
matZcEntity.BatchNo = matZctity.BatchNo;
matZcEntity.BatchGroudNo = matZctity.BatchGroudNo;
matZcEntity.ProductFlag = matZctity.ProductFlag;
matZcEntity.MatStatus = matZctity.MatStatus;
matZcEntity.ActLenMin = matZctity.ActLenMin;
matZcEntity.ActLenMax = matZctity.ActLenMax;
matZcEntity.BelongCode = matZctity.BelongCode;
matZcEntity.JudgeResult = matZctity.JudgeResult;
matZcEntity.FixNum = matZctity.FixNum.ToString2();
matZcEntity.Pipmemo = matZctity.Pipmemo;
matZcEntity.StorageNo = matZctity.StorageNo;
matZcEntity.LocationNo = matZctity.LocationNo;
}
///
/// 重写基类方法
///
///
///
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "OK":
doFrim();
break;
case "Close":
this.Close();
break;
}
}
private void doQuery(MatZcMEntity2 matZcEntity2)
{
string matZcTity = JSONFormat.Format(matZcEntity2);
List listSource = EntityHelper.GetData(
"com.steering.pss.ydm.pipemanage.FrmPipeMagement.doQueryGoods", new object[] { matZcTity }, this._ob);
matZcMEntity2BindingSource.DataSource = listSource;
}
///
/// 确认
///
private void doFrim()
{
this.ultraGrid1.UpdateData();
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMagRows.Count() == 0)
{
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
MatZcMEntity2 matZcTity = (MatZcMEntity2)row.ListObject;
string matZcEntity = JSONFormat.Format(matZcTity);
parmList.Add(matZcEntity);
}
MonomerDialog monomerDialog = new MonomerDialog(_ob);
monomerDialog.ShowDialog();
string monomerExplain = monomerDialog.monomerExplain;
string monomerFinishedProduct = monomerDialog.momomerFinishedProduct;
if (monomerExplain.Length == 0)
{
return;
}
string isRolling = monomerDialog.isRolling;
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeMagement";
ccp.MethodName = "seqMoner";
ccp.ServerParams = new object[] { parmList, monomerExplain, isRolling, _userName, _deptId, _arr, monomerFinishedProduct, _acount };
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 FrmLikuSeq_Load(object sender, EventArgs e)
{
EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]);
doQuery(matZcEntity);
}
private void ultraGrid1_CellChange(object sender, CellEventArgs e)
{
this.ultraGrid1.UpdateData();
if (e.Cell.Column.Key == "CHK")
{
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMagRows.Count() == 0)
{
this.ultraLabel1.Text = "";
return;
}
int acount = 0;
double len = 0.0;
double wgt = 0.0;
foreach (UltraGridRow row in checkMagRows)
{
acount = acount + int.Parse(row.Cells["ActCount"].Text);
wgt = wgt + double.Parse(row.Cells["ActWeight"].Text);
len = len + double.Parse(row.Cells["ActLen"].Text);
}
this.ultraLabel1.Text = "已选信息:" + acount.ToString3() + "支" + " " + wgt.ToString3() + "吨" + " " + len.ToString3() + "米";
}
}
}
}