using com.steering.mes.mcp.entity; 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 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.Mcp.Mch.MchResult { public partial class FrmMchHandleJuge : FrmBase { public FrmMchHandleJuge() { InitializeComponent(); this.IsLoadUserView = true; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryApplyData(); 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 doQueryApplyData() { 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"); } } if (this.ultraOptionSet1.CheckedItem.DataValue.ToString().Equals("00")) { valueFlag = "00"; } else if (this.ultraOptionSet1.CheckedItem.DataValue.ToString().Equals("20")) { valueFlag = "20"; } else { valueFlag = ""; } ArrayList list = new ArrayList(); list.Add(jugeNo); List listSource = EntityHelper.GetData( "com.steering.mes.mcp.Mch.FrmMchHandleJuge.doQueryApplyData", new object[] { list, startTim, endTim, valueFlag,"G" }, this.ob); QcmZgJugdeApplyEntitybindingSource.DataSource = listSource; } /// /// 手工判定 /// private void doHandleJuge() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要手工判定的主信息!"); return; } ArrayList parm = new ArrayList(); foreach(UltraGridRow uRow in checkMagRows) { 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.mes.mcp.Mch.FrmMchHandleJuge"; ccp.MethodName = "doHandleApply"; ccp.ServerParams = new object[] { parm,this.UserInfo.GetUserName() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("判定成功!")) { doQueryApplyData(); } } } /// /// 撤销手工判定 /// private void doCancelHandleJuge() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要撤销的主信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { 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.mes.mcp.Mch.FrmMchHandleJuge"; ccp.MethodName = "doCancelHandleApply"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销判定成功!")) { doQueryApplyData(); } } } /// /// 确认缴库 /// private void doComfirmPipe() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要确认的主信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { 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.mes.mcp.Mch.FrmMchHandleJuge"; ccp.MethodName = "doComfirm"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("确认成功!")) { doQueryApplyData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销缴库确认 /// private void doCancelComfirmPipe() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要撤销确认的主信息!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { 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.mes.mcp.Mch.FrmMchHandleJuge"; ccp.MethodName = "doCancelComfirm"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryApplyData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void FrmMchHandleJuge_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]); } 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; } } }