using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; 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 FrmMatGpM : FrmBase { public FrmMatGpM() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmMatGpM_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 "Query": doQuery(); break; case "TakeBill": takeBill(); break; case "Export": exportData(); break; case "Close": this.Close(); break; } } /// /// 查询 /// private void doQuery() { string bathYear = ""; string judgeNo = ""; string belongCode = ""; if (this.chkTim.Checked) { bathYear = this.StartTime.Value.ToString("yyyyMM"); } if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "") { judgeNo = this.txtJugeNo.Text.Trim(); } //if (this.chkBelong.Checked && this.cmbBelong.Text != "") //{ // belongCode = this.cmbBelong.Value.ToString(); //} ArrayList parmList = new ArrayList(); parmList.Add(bathYear); parmList.Add(judgeNo); parmList.Add(belongCode); ArrayList scrapList = new ArrayList(); scrapList.Add(bathYear); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.Stuffmanage.FrmMatGpM.doQuery", new object[] { parmList }, this.ob); bindingSource1.DataSource = listSource; } /// /// 置余材 /// private void takeBill() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要置余材的库存信息!"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow row in checkMagRows) { MatGpMEntity matGpTity = (MatGpMEntity)row.ListObject; if (matGpTity.QcmStaus.Equals("判废") || matGpTity.QcmStaus.Equals("待处理")) { MessageUtil.ShowTips("只有合格品才能置余材!"); return; } string matGpEntity = JSONFormat.Format(matGpTity); parmList.Add(matGpEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.FrmMatGpM"; ccp.MethodName = "takeBill"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("置余材成功!")) { doQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 导出 /// private void exportData() { GridHelper.ulGridToExcel(ultraGrid1, "管坯库存数据"); } private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e) { this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked; } private void chkTim_CheckedChanged(object sender, EventArgs e) { this.StartTime.Enabled = this.chkTim.Checked; } } }