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 FrmSplittingManage : FrmBase { public FrmSplittingManage() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmSplittingManage_Load(object sender, EventArgs e) { DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); this.StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": doQuery(); break; case "DoSplit": doSplitting(); break; case"ScrapToOk": scrapToOk(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void doQuery() { string bathYear = ""; string judgeNo = ""; if (this.chkTim.Checked) { bathYear = this.StartTime.Value.ToString("yyyyMM"); } if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "") { judgeNo = this.txtJugeNo.Text.Trim(); } ArrayList parmList = new ArrayList(); parmList.Add(bathYear); parmList.Add(judgeNo); List listSource = EntityHelper.GetData( "com.steering.ydm.bc.FrmSplittingManage.doQuery", new object[] { parmList }, this.ob); matBcMEntity2BindingSource.DataSource = listSource; } /// /// 分切 /// private void doSplitting() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if(uRow == null) { return; } MatBcMEntity2 matBcTity = (MatBcMEntity2)uRow.ListObject; if(!StringUtil.IsInt(matBcTity.ActCount.ToString3()) || int.Parse(matBcTity.ActCount.ToString3()) <= 0) { MessageUtil.ShowTips("分切原料支数输入必须为正整数!"); return; } FrmSplit frmSp = new FrmSplit(ob, matBcTity,UserInfo.GetUserName()); frmSp.ShowDialog(); if (frmSp.disOk.Equals("1")) { frmSp.Close(); doQuery(); } } /// /// 不合转合 /// private void scrapToOk() { this.ultraGrid1.UpdateData(); string plineCode = "";//指定产线代码 string plineName = ""; IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { return; } FrmPlineCode frmP = new FrmPlineCode(ob); frmP.ShowDialog(); if (!frmP.isOk.Equals("1")) { return; } plineCode = frmP.plineCode; plineName = frmP.plineName; ArrayList parmList = new ArrayList(); foreach(UltraGridRow ugr in checkMagRows) { MatBcMEntity2 matBcTity = (MatBcMEntity2)ugr.ListObject; string matBcEntity = JSONFormat.Format(matBcTity); parmList.Add(matBcEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.FrmSplittingManage"; ccp.MethodName = "scrapToOk"; ccp.ServerParams = new object[] { parmList, plineCode, plineName }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("转换成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkTim_CheckedChanged(object sender, EventArgs e) { this.StartTime.Enabled = this.chkTim.Checked; } private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e) { this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked; } } }