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.Server;
using Core.Mes.Client.Comm.Control;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using System.Collections;
using Core.Mes.Client.Comm.Tool;
using Core.Mes.Client.Comm.Format;
using Core.StlMes.Client.Mcp.Entity;
namespace Core.StlMes.Client.Mcp.Coupling
{
public partial class FrmQcmJgWt : FrmBase
{
private string _JugdeApplyCode = "";
private string User = "";
private DataTable _dtMatList = null;
private OpeBase _ob = null;
private ComMscJgEntity slmEntity = null;
private string _woid;
internal ComMscJgEntity SlmEntity
{
get { return slmEntity; }
set { slmEntity = value; }
}
public FrmQcmJgWt(string jugdeApplyCode,string woid, OpeBase ob)
{
InitializeComponent();
_JugdeApplyCode = jugdeApplyCode;
_woid = woid;
_ob = ob;
InitCol();
}
///
/// 初始化控件
///
private void InitCol()
{
QueryQcmAddAsk();
}
///
/// 查询接箍单个重
///
///
private void QueryQcmAddAsk()
{
List listSource = null;
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJgWt", new object[] { _JugdeApplyCode }, this._ob);
if (dt.Rows.Count > 0 && dt != null)
{
listSource = EntityHelper.GetData(
"com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJgWt", new object[] { _JugdeApplyCode }, this._ob);
qcmAddAskEntityBindingSource.DataSource = listSource;
}
}
///
/// 确认
///
///
///
private void btnOK_Click(object sender, EventArgs e)
{
this.ultraGrid3.UpdateData();
UltraGridRow ugrP = this.ultraGrid3.ActiveRow;
if (ugrP == null)
{
MessageUtil.ShowTips("请选择相应合同信息!");
return;
}
ArrayList arrayList = new ArrayList();
for (int i = 0; i < ultraGrid3.Rows.Count; i++)
{
ComMscJgEntity ParmEntity = new ComMscJgEntity();
ParmEntity = (ComMscJgEntity)this.ultraGrid3.Rows[i].ListObject;
ParmEntity.CodeJg = _JugdeApplyCode;
arrayList.Add(JSONFormat.Format(ParmEntity));
}
int count2 = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmCouplingAppl.doUpdateJgWt", new object[] { arrayList,_woid }, this._ob);
if (count2 > 0)
{
slmEntity = (ComMscJgEntity)ugrP.ListObject;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
MessageUtil.ShowTips("确认成功!");
this.Close();
}
///
/// 取消
///
///
///
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmQcmJgWt_Load(object sender, EventArgs e)
{
EntityHelper.ShowGridCaption(ultraGrid3.DisplayLayout.Bands[0]);
}
private void ultraGrid3_CellChange(object sender, CellEventArgs e)
{
string minD = "";//接箍坯料外径
string minH = "";//壁厚
string weightJg = "";//接箍单重
UltraGridRow urg = ultraGrid3.ActiveRow;
if (urg == null)
{
return;
}
else
{
minD = urg.Cells["MinD"].Value.ToString();
minH = urg.Cells["MinH"].Value.ToString();
weightJg = urg.Cells["WeightJg"].Value.ToString();
}
ultraGrid3.UpdateData();
if (e.Cell.Column.Key.Equals("WeightJg") && urg.Cells["WeightJg"].Text != "")
{
if(0.02466*(Convert.ToDouble(minD) - Convert.ToDouble(minH))*Convert.ToDouble(minH)*0.95