using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; 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 FrmBathYearAdjust : FrmBase { public FrmBathYearAdjust() { InitializeComponent(); } private string[] belongArr = null;//所属权 private void FrmBathYearAdjust_Load(object sender, EventArgs e) { dataYearMoth.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); belongArr = this.ValidDataPurviewIds; } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryData(); break; case "AdjustMothYear": updateMothYear(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void QueryData() { string judgeNo = ""; string bathMothYear = ""; if(chkYearMoth.Checked) { bathMothYear = dataYearMoth.Value.ToString("yyyyMM"); } if(chkFurnace.Checked && !txtFurnace.Text.Trim().Equals("")) { judgeNo = txtFurnace.Text.Trim(); } ArrayList parmList = new ArrayList(); parmList.Add(judgeNo); parmList.Add(bathMothYear); List listSource = EntityHelper.GetData( "Core.LgMes.Server.Stuffmanage.FrmBathYearAdjust.doQueryInList", new object[] { parmList, belongArr }, this.ob); YdmGpInlistEntitybindingSource.DataSource = listSource; } /// /// 调整结转年月 /// private void updateMothYear() { this.ultraGrid1.UpdateData(); string adjustType = this.adujstType.CheckedItem.DataValue.ToString(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要调整年月的信息!"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { YdmGpInlistEntity ydmInList = (YdmGpInlistEntity)uRow.ListObject; string ydmGpEntity = JSONFormat.Format(ydmInList); if (adjustType.Equals("1")) { DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmBathYearAdjust.doQueryOutListNum", new object[] { ydmGpEntity }, ob); if (int.Parse(ds.Rows[0][0].ToString()) > 0) { MessageUtil.ShowTips(ydmInList.JudgeStoveNo + "已有投料出库了,不允许调整年月!"); return; } } parmList.Add(ydmGpEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmBathYearAdjust"; ccp.MethodName = "updateMothYear"; ccp.ServerParams = new object[] { parmList, adjustType }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("调整成功!")) { QueryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } private void chkYearMoth_CheckedChanged(object sender, EventArgs e) { this.dataYearMoth.Enabled = this.chkYearMoth.Checked; } private void chkFurnace_CheckedChanged(object sender, EventArgs e) { this.txtFurnace.Enabled = this.chkFurnace.Checked; } private void txtFurnace_KeyDown(object sender, KeyEventArgs e) { this.txtFurnace.Enabled = this.chkFurnace.Checked; } private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } } } }