using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeManage.Entity; using CoreFS.CA06; using Infragistics.Win.UltraWinEditors; 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.YdmPipeManage { public partial class FrmUpdateMemo : FrmBase { public FrmUpdateMemo() { InitializeComponent(); } private void FrmUpdateMemo_Load(object sender, EventArgs e) { DateTime now = DateTime.Now; DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天 DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天 this.cmbDate.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.cmbEndDate.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryJudge(); break; case "Update": updateMemo(); break; case "Close": this.Close(); break; } } /// /// 查询质保书数据 /// private void doQueryJudge() { string startTim = ""; string endTim = ""; string orderNo = ""; if (this.chkOrderNo.Checked && this.txtOrderNo.Text.Trim() != "") { orderNo = this.txtOrderNo.Text.Trim(); } if (this.chkDate.Checked) { if (DateTime.Parse(cmbDate.Value.ToString()) > DateTime.Parse(this.cmbEndDate.Value.ToString())) { MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!"); return; } else { startTim = this.cmbDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); endTim = this.cmbEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss"); } } ArrayList list = new ArrayList(); list.Add(orderNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmUpdateMemo.doQueryZbs", new object[] { list, startTim, endTim }, this.ob); qcmZbsInfoEntityBindingSource.DataSource = listSource; } /// /// 修改备注 /// private void updateMemo() { 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) { QcmZbsInfoEntity ydmTity = (QcmZbsInfoEntity)row.ListObject; string ydmEntity = JSONFormat.Format(ydmTity); parmList.Add(ydmEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmUpdateMemo"; ccp.MethodName = "updateMemo"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { doQueryJudge(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkDate_CheckedChanged(object sender, EventArgs e) { this.cmbDate.Enabled = this.cmbEndDate.Enabled = this.chkDate.Checked; } private void chkOrderNo_CheckedChanged(object sender, EventArgs e) { this.txtOrderNo.Enabled = this.chkOrderNo.Checked; } private void txtMemo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraTextEditor textEditor = (UltraTextEditor)sender; PopupTextBox popupText = new PopupTextBox(textEditor.Text, 4000); if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK) { textEditor.Text = popupText.TextInfo.Trim(); } this.ultraGrid1.ActiveCell.Value = textEditor.Text; this.ultraGrid1.ActiveRow.Update(); } } }