using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Judge.Commons; using Core.StlMes.Client.Judge.Models; using Core.StlMes.Client.YdmPipeReport.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; 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; namespace Core.StlMes.Client.Judge.Forms { public partial class QcmProblemHandlingFrm : FrmBase { public QcmProblemHandlingFrm() { InitializeComponent(); } private Dal _d; private DataTable _dtPline = null; public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "Add": doAdd(); break; case "Update": doUpdate(); break; break; case "Delete": doDelete(); break; case "Confirm": doConfirm(); break; } } private void doConfirm() { ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { return; } QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity; entity.ConfirmName = this.UserInfo.GetUserName(); JSONFormat.Format(entity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling"; ccp.MethodName = "updateConfirm"; ccp.ServerParams = new object[] { JSONFormat.Format(entity) }; ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("确认成功!"); Query(); } } private void doDelete() { ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { return; } if (!string.IsNullOrEmpty(row.Cells["HandleName"].Value.ToString2())) { MessageUtil.ShowWarning("已有处理措施,无法撤销!"); return; } QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity; entity.HandleName = this.UserInfo.GetUserName(); JSONFormat.Format(entity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling"; ccp.MethodName = "delete"; ccp.ServerParams = new object[] { JSONFormat.Format(entity) }; ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("撤销成功!"); Query(); } } private void doUpdate() { ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { return; } if (!string.IsNullOrEmpty(row.Cells["ConfirmName"].Value.ToString2())) { MessageUtil.ShowWarning("已确认,无法修改!"); return; } QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity; entity.HandleName = this.UserInfo.GetUserName(); JSONFormat.Format(entity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling"; ccp.MethodName = "update"; ccp.ServerParams = new object[] { JSONFormat.Format(entity) }; ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("修改成功!"); Query(); } } private void doAdd() { ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { return; } QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity; entity.ApplyName = this.UserInfo.GetUserName(); JSONFormat.Format(entity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling"; ccp.MethodName = "add"; ccp.ServerParams = new object[] { JSONFormat.Format(entity) }; ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("提交成功!"); Query(); } } private void Query() { string judgeStoveNo = labelTextBox2.Checked ? labelTextBox2.Text.Trim() : ""; string plines = ultraTextEditor3.Tag.ToString2(); string timeB = labelDateTimePicker8.Checked ? labelDateTimePicker8.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; string timeE = labelDateTimePicker8.Checked ? labelDateTimePicker7.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; List listSource = null; if (this.CustomInfo.Equals("1")) { listSource = EntityHelper.GetData( "com.steering.pss.qcm.DAL.QcmProblemHandling.query1", new object[] { judgeStoveNo, plines, timeB, timeE }, this.ob); } else { listSource = EntityHelper.GetData( "com.steering.pss.qcm.DAL.QcmProblemHandling.query", new object[] { judgeStoveNo, plines, timeB, timeE }, this.ob); } qcmProblemHandlingEntityBindingSource.DataSource = listSource; } private void QcmProblemHandlingFrm_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); labelDateTimePicker8.DateTimePicker.Value = DateTime.Now.Date.AddDays(-3); labelDateTimePicker7.DateTimePicker.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1); _d = new Dal(ob); string[] datePurviewIds = this.ValidDataPurviewIds; _dtPline = _d.GetTableByXmlId("ComBaseQuery.COMBASEPLINE", new object[] { new string[] { } }); DataTable dtDeptPline = _d.GetTableByXmlId("JdgComBasePline.getPlineByDept", new object[] { datePurviewIds }); for (int i = _dtPline.Rows.Count - 1; i >= 0; i--) { if (dtDeptPline.Select("plinecode = '" + _dtPline.Rows[i]["plinecode"].ToString() + "'").Length == 0) { _dtPline.Rows[i].Delete(); } } _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()); ultraTextEditor3.Text = strPlineNames; ultraTextEditor3.Tag = strPineCodes; if (this.CustomInfo.Equals("1")) { label1.Text = "提出时间"; EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "HandleName", "HandleTime", "HandleDesc", "HandleResult", "ConfirmName", "ConfirmTime" }, false); EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "ProcessCodeNext" }, true); BaseHelper.setOtherColumnReadOnly(ultraGrid1, new string[] { "HandleDesc", "HandleResult" }); ultraLabel4.Visible = false; ultraTextEditor3.Visible = false; } else { EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "HandleName", "HandleTime", "HandleDesc", "HandleResult", "ConfirmName", "ConfirmTime" }, true); ultraGrid1.DisplayLayout.Bands[0].Columns["processNextFlag"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128); ultraGrid1.DisplayLayout.Bands[0].Columns["ApplyDesc"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128); } } private void labelDateTimePicker8_CheckBox_CheckedChanged(object sender, EventArgs e) { labelDateTimePicker7.DateTimeEnabled = labelDateTimePicker8.Checked; } private void ultraTextEditor3_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraTextEditor3.Tag.ToString2(), _d.Ob); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ultraTextEditor3.Text = frm.ChoicePlineName; ultraTextEditor3.Tag = frm.ChoicePlineCode; } } } }