using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeManage.Entity; using Core.StlMes.Client.YdmPipeManage.Tool; 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; using Core.StlMes.Client.YdmPipeManage; using Core.Mes.Client.Comm.Control; namespace Core.StlMes.Client.YdmPipeManage { public partial class FrmLikuExamine : FrmBase { public FrmLikuExamine() { InitializeComponent(); this.IsLoadUserView = true; } string[] arr = null; private void txtMemo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraTextEditor textEditor = (UltraTextEditor)sender; PopupTextBox popupText = new PopupTextBox(textEditor.Text, 500); if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK) { textEditor.Text = popupText.TextInfo.Trim(); } this.ultraGrid1.ActiveCell.Value = textEditor.Text; this.ultraGrid1.ActiveRow.Update(); } private void FrmLikuExamine_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(this.ultraGrid1.DisplayLayout.Bands[0]); arr = this.CustomInfo.Contains("XS")?new string[]{}:this.ValidDataPurviewIds; } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryApply(); break; case "Audit": auditCross(); break; case"AuditNo": auditNoCross(); break; case"CancelAudit": cancelAudit(); break; case "Export": GridHelper.ulGridToExcel(ultraGrid1, "成品利库申请信息");; break; case "Close": this.Close(); break; } } /// /// 查询 /// private void doQueryApply() { string startTim = ""; string endTim = ""; string judgeNo = ""; string orderNo = ""; string valueFlag = ""; if (this.chkJudgeStoveNo.Checked && this.uteJudgeStoveNo.Text.Trim() != "") { judgeNo = this.uteJudgeStoveNo.Text.Trim(); } if(this.chkOrderNo.Checked && this.cmbOrderNo.Text.Trim() != "") { orderNo = this.cmbOrderNo.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 parmList = new ArrayList(); parmList.Add(startTim); parmList.Add(endTim); parmList.Add(judgeNo); parmList.Add(orderNo); parmList.Add(valueFlag); String supp = this.CustomInfo.Contains("120504") ? "120504" : ""; List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryApply", new object[] { parmList, arr, supp }, this.ob); qcmLkJudgeChangeEntityBindingSource.DataSource = listSource; } /// /// 审批通过 /// private void auditCross() { 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 uRow in checkMagRows) { QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject; qcmTity.AgreeName = UserInfo.GetUserName(); if (qcmTity.IndexSeq.Equals("")) { MessageUtil.ShowTips("审批通过时请选择制程号!"); return; } if(qcmTity.Cic.Equals("")) { MessageUtil.ShowTips("审批时请选择CIC!"); return; } string qcmLkEntity = JSONFormat.Format(qcmTity); parmList.Add(qcmLkEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine"; ccp.MethodName = "auditCross"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("审批成功!")) { doQueryApply(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 审批不通过 /// private void auditNoCross() { 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 uRow in checkMagRows) { QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject; qcmTity.AgreeName = UserInfo.GetUserName(); string qcmLkEntity = JSONFormat.Format(qcmTity); parmList.Add(qcmLkEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine"; ccp.MethodName = "auditNoCross"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("审批成功!")) { doQueryApply(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销审批 /// private void cancelAudit() { 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 uRow in checkMagRows) { QcmLkJudgeChangeEntity qcmTity = (QcmLkJudgeChangeEntity)uRow.ListObject; string qcmLkEntity = JSONFormat.Format(qcmTity); parmList.Add(qcmLkEntity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmLikuExamine"; ccp.MethodName = "cancelAudit"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryApply(); 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 chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e) { this.uteJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked; } private void chkOrderNo_CheckedChanged(object sender, EventArgs e) { cmbOrderNo.Enabled = this.chkOrderNo.Checked; } private void cmbIndexSeq_EditorButtonClick(object sender, EditorButtonEventArgs e) { this.ultraGrid1.UpdateData(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryIndexSeq", new object[] { this.ultraGrid1.ActiveRow.Cells["OrdLnPk"].Text }, ob); dt.Columns["INDEX_SEQ"].Caption = "制程号"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "INDEX_SEQ", "INDEX_CODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("INDEX_CODE") == this.cmbIndexSeq.Tag.ToString2() ).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.ultraGrid1.ActiveCell.Value = baseInfo.ChoicedRow.GetValue("INDEX_SEQ"); this.ultraGrid1.ActiveCell.Row.Cells["IndexSeq"].Value = baseInfo.ChoicedRow.GetValue("INDEX_CODE"); } } private void cmbCic_EditorButtonClick(object sender, EditorButtonEventArgs e) { this.ultraGrid1.UpdateData(); if (this.ultraGrid1.ActiveRow.Cells["IndexSeq"].Text == "") { MessageUtil.ShowTips("选择CIC索引码时请先选择制程号!"); return; } DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmLikuExamine.doQueryCic", new object[] { this.ultraGrid1.ActiveRow.Cells["CraftSeq"].Text, this.ultraGrid1.ActiveRow.Cells["OrdLnPk"].Text, this.ultraGrid1.ActiveRow.Cells["IndexSeq"].Text }, ob); dt.Columns["CIC"].Caption = "CIC"; BaseInfoPopup1 baseInfo = new BaseInfoPopup1(dt, "CIC", "CIC_CODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("CIC_CODE") == this.cmbCic.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.ultraGrid1.ActiveCell.Value = baseInfo.ChoicedRow.GetValue("CIC"); this.ultraGrid1.ActiveCell.Row.Cells["Cic"].Value = baseInfo.ChoicedRow.GetValue("CIC_CODE"); } } private void ultraTextEditor5_EditorButtonClick(object sender, EditorButtonEventArgs e) { UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow.Cells["CraftNo"].Text.Trim() == "" || uRow.Cells["CraftPath"].Text.Trim() == "") { return; } BaseMethod.ViewCarft_No(uRow.Cells["CraftPath"].Text.Trim()); } } }