using Core.Mes.Client.Comm.Control; 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 FrmHandleJuge : FrmBase { public FrmHandleJuge() { InitializeComponent(); this.IsLoadUserView = true; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryApplyJudge(); break; case "Juge": doHandleJuge(); break; case"CancelJuge": doCancelHandleJuge(); break; case"Comfirm": doComfirmPipe(); break; case "CancelComfirm": doCancelComfirmPipe(); break; case"Export": exportData(); break; case "Close": this.Close(); break; } } /// /// 导出 /// private void exportData() { GridHelper.ulGridToExcel(this.ultraGrid1, "申请判定信息"); } /// /// 查询申请判定信息 /// private void doQueryApplyJudge() { string jugeNo = ""; string startTim = ""; string endTim = ""; string valueFlag = ""; 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"); } } valueFlag = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); ArrayList list = new ArrayList(); list.Add(jugeNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmHandleJuge.doQueryApplyJudge", new object[] { list, startTim, endTim, valueFlag }, this.ob); QcmZgJugdeApplyEntity1bindingSource.DataSource = listSource; } /// /// 手工判定 /// private void doHandleJuge() { this.ultraGrid1.UpdateData(); UltraGridRow Row = this.ultraGrid2.ActiveRow; UltraGridRow row = this.ultraGrid1.ActiveRow; if (Row == null) return; if (!Row.Cells["PlineCode"].Text.Equals("C065") &&!Row.Cells["PlineCode"].Text.Equals("C066")) { MessageUtil.ShowTips("不是外购管的不允许手工判定!"); return; } ArrayList parm = new ArrayList(); foreach(UltraGridRow uRow in this.ultraGrid1.Rows) { QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject; string qcmZgEntity = JSONFormat.Format(qcmZgTity); parm.Add(qcmZgEntity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认进行手工判定?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge"; ccp.MethodName = "doHandleApply"; ccp.ServerParams = new object[] { parm,UserInfo.GetUserName() }; 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 doCancelHandleJuge() { this.ultraGrid2.UpdateData(); UltraGridRow row = this.ultraGrid2.ActiveRow; if (row == null) return; if (!row.Cells["PlineCode"].Text.Equals("C065") && !row.Cells["PlineCode"].Text.Equals("C066")) { MessageUtil.ShowTips("不是外购管的不允许撤销判定!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in this.ultraGrid1.Rows) { QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject; string qcmZgEntity = JSONFormat.Format(qcmZgTity); parm.Add(qcmZgEntity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认进行撤销判定?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge"; ccp.MethodName = "doCancelHandleApply"; ccp.ServerParams = new object[] { parm }; 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 doComfirmPipe() { this.ultraGrid1.UpdateData(); this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要确认的主信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow row in this.ultraGrid1.Rows) { QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)row.ListObject; string qcmZgEntity = JSONFormat.Format(qcmZgTity); parm.Add(qcmZgEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge"; ccp.MethodName = "doComfirm"; ccp.ServerParams = new object[] { parm,this.UserInfo.GetUserName() }; 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 doCancelComfirmPipe() { this.ultraGrid1.UpdateData(); this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要撤销确认的主信息!"); return; } ArrayList parm = new ArrayList(); QcmZgJugdeApplyEntity qcmZgTity = (QcmZgJugdeApplyEntity)uRow.ListObject; string qcmZgEntity = JSONFormat.Format(qcmZgTity); parm.Add(qcmZgEntity); if (MessageUtil.ShowYesNoAndQuestion("是否撤销缴库确认?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmHandleJuge"; ccp.MethodName = "doCancelComfirm"; ccp.ServerParams = new object[] { parm,this.UserInfo.GetUserName() }; 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 FrmHandleJuge_Load(object sender, EventArgs e) { //base.isLoadStlye = false; 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(this.ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid2.DisplayLayout.Bands[0]); } private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e) { this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked; } private void chkDate_CheckedChanged(object sender, EventArgs e) { this.cmbDate.Enabled = this.cmbEndDate.Enabled = this.chkDate.Checked; } private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } } private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid2.ActiveRow; if(uRow == null) { return; } ArrayList list = new ArrayList(); list.Add(uRow.Cells["JugdeApplyCode"].Text.ToString()); list.Add(uRow.Cells["JudgeStoveNo"].Text.ToString()); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmHandleJuge.doQueryApplyData", new object[] { list }, this.ob); QcmZgJugdeApplyEntitybindingSource.DataSource = listSource; } } }