| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmBcPipeManage.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.YdmBcPipeManage
- {
- public partial class FrmApplyCode : FrmBase
- {
- public FrmApplyCode()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmApplyCode_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<QcmZgJugdeApplyEntity>(this.ultraGrid1.DisplayLayout.Bands[0]);
- initJudgeResult();
- }
- /// <summary>
- /// 加载判定结果
- /// </summary>
- private void initJudgeResult()
- {
- BaseMethod.InitJudgeResult(utlJudgeResult,ob);
- BaseMethod.InitJudgeResult(utlJudgeToResult, ob);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQueryApplyJudge();
- break;
- case "Scrap":
- scrap();
- break;
- case "CancelScrap":
- cancelScrap();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void doQueryApplyJudge()
- {
- string jugeNo = "";
- string startTim = "";
- string endTim = "";
- if (this.chkJudgeStoveNo.Checked && this.uteJudgeStoveNo.Text.Trim() != "")
- {
- jugeNo = this.uteJudgeStoveNo.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");
- }
- }
- string judgeResult = utlJudgeResult.Value.ToString2();
- string judgeToResult = utlJudgeToResult.Value.ToString2();
- ArrayList list = new ArrayList();
- list.Add(jugeNo);
- list.Add(judgeResult);
- list.Add(judgeToResult);
- List<QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity>(
- "com.steering.ydm.bc.FrmApplyCode.doQueryApplyJudge", new object[] { list, startTim, endTim }, this.ob);
- qcmZgJugdeApplyEntityBindingSource.DataSource = listSource;
- }
- private void scrap()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要作废的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)row.ListObject;
- string qcmTity = JSONFormat.Format(qcmEntity);
- parmList.Add(qcmTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmApplyCode";
- ccp.MethodName = "scrap";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("作废成功!"))
- {
- doQueryApplyJudge();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void cancelScrap()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要作废的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)row.ListObject;
- string qcmTity = JSONFormat.Format(qcmEntity);
- parmList.Add(qcmTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmApplyCode";
- ccp.MethodName = "cancelScrap";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("恢复成功!"))
- {
- doQueryApplyJudge();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- this.cmbDate.Enabled = this.cmbEndDate.Enabled = chkDate.Checked;
- }
- private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
- {
- uteJudgeStoveNo.Enabled = chkJudgeStoveNo.Checked;
- }
- private void ultraGrid1_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- }
- }
|