using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.ZGMil.Common; using Core.StlMes.Client.ZGMil.Entity; using Core.StlMes.Client.ZGMil.ResultConrtrol; using Core.StlMes.Client.ZGMil.Signature; using CoreFS.CA06; using Infragistics.Win; 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.ZGMil.Report { public partial class FrmBcDateWaitingDecision : FrmBase { private string departm = ""; private string plineCode = ""; private string Process = "";//参数 private string[] arrId;//数据权限 private DataTable _dtPline = null; public FrmBcDateWaitingDecision() { InitializeComponent(); this.IsLoadUserView = true; } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Save": doSave(); break; case "Export": ExportData(); break; case "Close": this.Close(); break; } } private void doSave() { ultraGrid1.UpdateData(); ArrayList parm = new ArrayList(); IQueryable uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (uGrid.Count() == 0) { MessageUtil.ShowTips("请选择要保存的数据!"); return; } foreach (UltraGridRow uRow in uGrid) { ArrayList list = new ArrayList(); list.Add(uRow.Cells["WAITING_DECISION_MEMO"].Value.ToString()); list.Add(uRow.Cells["IS_VISIBLE"].Value.ToString()); if (Process.Equals("G")) { list.Add(uRow.Cells["MEMO2"].Value.ToString()); } list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString()); list.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString()); parm.Add(list); } int count = ServerHelper.SetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.saveFrmBcDateWaitingDecision", new object[] { parm, Process }, this.ob); MessageUtil.ShowTips("保存成功!"); doQuery(); } /// /// 查询 /// private void doQuery() { ultraGrid1.UpdateData(); dataTable2.Clear(); string date = ""; string endDate = ""; string JudgeStoveNo = ""; string LotNo = ""; string ContractNo = ""; string plineCode = ""; string VALIDFLAG = ""; string IsVisible = ""; string Factory = ""; if (chkDate.Checked) { if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0) { MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!"); return; } else { date = cmbDate.Value.ToString(); endDate = cmbEndDate.Value.ToString(); } } if (chkJudgeStoveNo.Checked) { if (uteJudgeStoveNo.Text.Trim() == "") { JudgeStoveNo = ""; } else { JudgeStoveNo = uteJudgeStoveNo.Value.ToString(); } } if (chkLotNo.Checked) { if (uteLotNo.Text.Trim() == "") { LotNo = ""; } else { LotNo = uteLotNo.Value.ToString(); } } if (chkContractNo.Checked) { if (uteContractNo.Text.Trim() == "") { ContractNo = ""; } else { ContractNo = uteContractNo.Value.ToString(); } } if (chkPlineCode.Checked) { //if (this.cobPlineCode.CheckedItems.Count > 0) //{ // plineCode = this.cobPlineCode.CheckedItems.Select(p => p.DataValue.ToString()).Aggregate((a, b) => a + (a == "" ? "" : "','") + b); //} plineCode = ultraTextEditor1.Tag.ToString().Replace(",","', '"); } if (chkVALIDFLAG.Checked) { VALIDFLAG = cobVALIDFLAG.Value.ToString(); } if (chkIsVisible.Checked) { IsVisible = cobIsVisible.Value.ToString(); } if (chkFactory.Checked) { if (this.cobFactory.CheckedItems.Count > 0) { Factory = this.cobFactory.CheckedItems.Select(p => p.DataValue.ToString()).Aggregate((a, b) => a + (a == "" ? "" : "','") + b); } } WaitingForm2 wf = new WaitingForm2("正在加载,请稍候...."); DataTable dt = ZGServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getFrmBcDateWaitingDecision", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCode, Process, VALIDFLAG, IsVisible, Factory }, this.ob); if (dt.Rows.Count > 0) { GridHelper.CopyDataToDatatable(dt, this.dataTable2, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); } wf.Close(); } /// /// 查询条件 /// /// /// private void chkDate_CheckedChanged(object sender, EventArgs e) { if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; } if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; } if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; } if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; } if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; } if (chkPlineCode.Checked) { cobPlineCode.Enabled = true; } else { cobPlineCode.Enabled = false; } if (chkVALIDFLAG.Checked) { cobVALIDFLAG.Enabled = true; } else { cobVALIDFLAG.Enabled = false; } if (chkIsVisible.Checked) { cobIsVisible.Enabled = true; } else { cobIsVisible.Enabled = false; } if (chkFactory.Checked) { cobFactory.Enabled = true; } else { cobFactory.Enabled = false; } } private void FrmBcDateWaitingDecision_Load(object sender, EventArgs e) { cmbDate.Value = DateTime.Parse(DateTime.Today.ToString()); NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); //plineCode = na.GetPCode(departm);//获取 用户 对应的产线 arrId = this.ValidDataPurviewIds;//获取数据权限 DateTime now = DateTime.Now; DateTime date = new DateTime(now.Year, now.Month, 1); cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd")); cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); Process = this.CustomInfo.ToString();//参数 _dtPline = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.JudgeBaseInfo", new object[] { Process }, ob); //_dtPline.AcceptChanges(); string strPlineNames = string.Join(",", _dtPline.Rows.Cast().Select(a => a["plineName"].ToString()).ToArray()); string strPineCodes = string.Join(",", _dtPline.Rows.Cast().Select(a => a["plineCode"].ToString()).ToArray()); ultraTextEditor1.Text = strPlineNames; ultraTextEditor1.Tag = strPineCodes; if (Process != "G") { this.chkFactory.Visible = false; this.cobFactory.Visible = false; this.ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Width = 0; ultraGrid1.DisplayLayout.Bands[0].Columns["XXZ"].Hidden = true; ultraGrid1.DisplayLayout.Bands[0].Columns["XXD"].Hidden = true; ultraGrid1.DisplayLayout.Bands[0].Columns["INSTOCK_TIME"].Hidden = true; ultraGrid1.DisplayLayout.Bands[0].Columns["LXZ"].Hidden = true; ultraGrid1.DisplayLayout.Bands[0].Columns["LXD"].Hidden = true; } //加载产线 DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryPlineCode", new object[] { Process, arrId }, ob); if (ds != null && ds.Rows.Count > 0) { cobPlineCode.DataSource = ds; cobPlineCode.ValueMember = "PLINE_CODE"; cobPlineCode.DisplayMember = "PLINE_NAME"; } //加载查加工部的厂 DataTable df = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryFactory", new object[] { }, ob); if (df != null && df.Rows.Count > 0) { cobFactory.DataSource = df; cobFactory.ValueMember = "BASECODE"; cobFactory.DisplayMember = "BASENAME"; } } /// /// 导出 /// private void ExportData() { if (Process == "E") { GridHelper.ulGridToExcel(ultraGrid1, "镦拔扩生产按炉跟踪判定情况"); } if (Process == "F") { GridHelper.ulGridToExcel(ultraGrid1, "热处理生产按炉跟踪判定情况"); } if (Process == "G") { GridHelper.ulGridToExcel(ultraGrid1, "加工线生产按炉跟踪判定情况"); } } private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraTextEditor1.Tag.ToString2(), this.ob); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ultraTextEditor1.Text = frm.ChoicePlineName; ultraTextEditor1.Tag = frm.ChoicePlineCode; } } private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { } //private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) //{ // UltraGridRow uRow = this.ultraGrid1.ActiveRow; // if (uRow == null) // { // return; // } // //doQueryJudgeBath(uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["JugdeApplyCode"].Text); //// List listSource = EntityHelper.GetData( ////"com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryQcmZgApplyData", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text }, this.ob); // DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryQcmZgApplyData", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text }, ob); // if (dt != null && dt.Rows.Count > 0) // { // ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Header.Caption = "前工序是否紧急放行"; // foreach (UltraGridRow row in this.ultraGrid1.Rows) // { // row.Cells["is_flag"].Value = "是"; // } // } // else // { // ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Header.Caption = "前工序是否紧急放行"; // foreach (UltraGridRow row in this.ultraGrid1.Rows) // { // row.Cells["is_flag"].Value = "否"; // } // } //} } }