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 Core.StlMes.Client.Judge.Commons; using Core.StlMes.Client.Judge.Models; 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.Judge.Forms { public partial class QcmZgJugdeXs : FrmBase { public QcmZgJugdeXs() { InitializeComponent(); this.IsLoadUserView = true; //平台F1功能 } private string[] plineCodes = null; public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "update": doUpdate(); break; case "cancel": doCancel(); break; case "Save": SaveRemark(); break; case "Export": if (ultraTabControl1.SelectedTab.Key.ToString().Equals("0")) { GridHelper.ulGridToExcel(ultraGrid1, "非计划判定未确认"); } else { GridHelper.ulGridToExcel(ultraGrid2, "非计划判定已确认"); } break; } } public void SaveRemark() { try { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" cheked = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要确认的数据!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { QcmZgJugdeApplyEntity qcmZgJugdeApplyEntity = (QcmZgJugdeApplyEntity)uRow.ListObject; qcmZgJugdeApplyEntity.ConfirmName = UserInfo.GetUserName(); string entity = JSONFormat.Format(qcmZgJugdeApplyEntity); parm.Add(entity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmZgJugdeXs"; ccp.MethodName = "UpdateRemark"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); Query(); } } catch { return; } } public static string[] InitDropPlinePower(UltraComboEditor ugc, OpeBase ob) { // CoreClientParam ccp = new CoreClientParam(); //ccp.ServerName = "com.steering.pss.judge.comm.ClientQueryHelper"; //ccp.MethodName = "query"; //ccp.ServerParams = new object[] { xmlId, parms }; //ccp = _ob.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); //DataTable src = ccp.SourceDataTable; ////_dtPline = //private Dal _d = new Dal(ob); Dal _d = new Dal(ob); DataTable dt = _d.GetTableByXmlId("JudgeBaseInfo.Query", new object[] { new string[] { "D", "E", "F", "G", "H" } });//ServerHelper.GetData("com.steering.pss.judge.comm.ClientQueryHelper.query", new object[] {"D", "E", "F", "G", "H" }, ob); if (dt != null && dt.Rows.Count > 0) { ugc.DataSource = dt; ugc.ValueMember = "plineCode"; ugc.DisplayMember = "plineName"; string[] plineArr = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { plineArr[i] = dt.Rows[i]["plineName"].ToString(); } return plineArr; } else { return null; } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); plineCodes = InitDropPlinePower(cboPline, ob); } private void doCancel() { try { this.ultraGrid2.UpdateData(); IQueryable checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" cheked = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要确认的数据!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { QcmZgJugdeApplyEntity qcmZgJugdeApplyEntity = (QcmZgJugdeApplyEntity)uRow.ListObject; if (qcmZgJugdeApplyEntity.Validflag.ToString().Equals("20")) { MessageUtil.ShowTips(qcmZgJugdeApplyEntity.JudgeStoveNo+"已判定,请先撤销判定!"); return; } qcmZgJugdeApplyEntity.ConfirmName = UserInfo.GetUserName(); string entity = JSONFormat.Format(qcmZgJugdeApplyEntity); parm.Add(entity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmZgJugdeXs"; ccp.MethodName = "update"; ccp.ServerParams = new object[] { parm,"0" }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); Query(); } } catch { return; } } private void doUpdate() { try { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" cheked = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要确认的数据!"); return; } ArrayList parm = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { QcmZgJugdeApplyEntity qcmZgJugdeApplyEntity = (QcmZgJugdeApplyEntity)uRow.ListObject; qcmZgJugdeApplyEntity.ConfirmName = UserInfo.GetUserName(); string entity = JSONFormat.Format(qcmZgJugdeApplyEntity); parm.Add(entity); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.qcm.DAL.QcmZgJugdeXs"; ccp.MethodName = "update"; ccp.ServerParams = new object[] { parm,"1" }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); Query(); } } catch { return; } } private void Query() { string judgeStoveNo = labelTextBox2.Checked ? labelTextBox2.Text.Trim() : ""; string timeB = labelDateTimePicker8.Checked ? labelDateTimePicker8.Value.ToString("yyyy-MM-dd") + " 00:00:00" : ""; string timeE = labelDateTimePicker8.Checked ? labelDateTimePicker7.Value.ToString("yyyy-MM-dd") + " 23:59:59" : ""; string orderNo = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : ""; string[] pline = ucePlineCode.Checked && cboPline.CheckedItems.Count > 0 ? cboPline.CheckedItems.Select(p => p.ToString()).ToArray() : plineCodes; List listSource = EntityHelper.GetData( "com.steering.pss.qcm.DAL.QcmZgJugdeXs.query", new object[] { judgeStoveNo, timeB, timeE, pline, orderNo, ultraTabControl1.SelectedTab.Key.ToString() }, this.ob); qcmZgJugdeApplyEntityBindingSource.DataSource = listSource; } private void labelDateTimePicker8_CheckBox_CheckedChanged(object sender, EventArgs e) { labelDateTimePicker7.DateTimeEnabled = labelDateTimePicker8.Checked; } private void QcmZgJugdeXs_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid3.DisplayLayout.Bands[0]); EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "CreateName", "SaleAreaDesc", "SaleOrgDesc", "Pdl","Ypdl","Wpdl", "ChargeNum", "OrderQty", "DeliveryStatus", "ActLenAvg", "CustomerNm", "LenDesc", "LengthType", "OrderUnit", "DelvryRangeMin", "StorageName", "LocationName", "DeliveryNo", "DelvryQtyRange" }, false); EntityHelper.setColumnShowOrHidden(ultraGrid2, new string[] { "CreateName", "SaleAreaDesc", "SaleOrgDesc", "Pdl","Ypdl","Wpdl", "ChargeNum", "OrderQty", "DeliveryStatus", "ActLenAvg", "CustomerNm", "LenDesc", "LengthType", "OrderUnit", "DelvryRangeMin", "StorageName", "LocationName", "DeliveryNo", "DelvryQtyRange" }, false); } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { qcmZgJugdeApplyEntityBindingSource.Clear(); if (toolMenu == null || toolMenu.Toolbars.Count == 0) return; if (ultraTabControl1.SelectedTab.Key.ToString().Equals("0")) { if (this.toolMenu.Toolbars[0].Tools.Exists("update")) this.toolMenu.Toolbars[0].Tools["update"].SharedProps.Visible = true; if (this.toolMenu.Toolbars[0].Tools.Exists("cancel")) this.toolMenu.Toolbars[0].Tools["cancel"].SharedProps.Visible = false; label1.Text = "申判时间"; } else { if (this.toolMenu.Toolbars[0].Tools.Exists("update")) this.toolMenu.Toolbars[0].Tools["update"].SharedProps.Visible = false; if (this.toolMenu.Toolbars[0].Tools.Exists("cancel")) this.toolMenu.Toolbars[0].Tools["cancel"].SharedProps.Visible = true; label1.Text = "确认时间"; } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = ultraGrid1.ActiveRow; if (uRow == null) return; getOrderNo(uRow); } private void getOrderNo(UltraGridRow ugr) { string orderSeq = ""; string orderNm = ugr.Cells["ProOrderNo"].Text.Trim(); string orderDivePk = ugr.Cells["OrdLnDlyPk"].Text.Trim(); string orderPk = ""; if (orderNm != "") { if (!orderNm.Contains("/")) { MessageUtil.ShowTips("此判定数据合同号异常,不允许缴库!"); return; } int i = orderNm.IndexOf("/"); if (i == -1) return; orderSeq = orderNm.Substring(i + 1, orderNm.Length - i - 1).PadLeft(3, '0'); orderNm = orderNm.Substring(0, i); if (!string.IsNullOrWhiteSpace(orderDivePk)) { orderPk = orderDivePk.Substring(0, orderDivePk.Length - 3); } } else { orderPk = ""; //MessageUtil.ShowTips("判定数据合同号为空!,数据异常!"); //return; } List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmFinishAfrim.doQueryOrderNo", new object[] { orderNm, orderSeq, orderPk }, this.ob); PlnSaleordEntitybindingSource.DataSource = listSource; } private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = ultraGrid2.ActiveRow; if (uRow == null) return; getOrderNo(uRow); } } }