using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Control; namespace Core.StlMes.Client.YdmPipeManage { public partial class FrmFirmInList : FrmBase { public FrmFirmInList() { this.IsLoadUserView = true; InitializeComponent(); } private void FrmFirmInList_Load(object sender, EventArgs e) { this.StartTime.Enabled = false; this.EndTime.Enabled = false; StartTime.Value = DateTime.Parse(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString()); DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59"); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case"Query": queryData(); break; case"Confim": confimData(); break; case"cancelComfim": cancelConfim(); break; case"Export": exportData(); break; case"Close": this.Close(); break; } } /// /// 导出 /// private void exportData() { GridHelper.ulGridToExcel(ultraGrid4, "缴库实绩"); } /// /// 查询 /// private void queryData() { string heatNo = ""; string orderNo = ""; string startTim = ""; string endTim = ""; ArrayList list = new ArrayList(); if (ultraCheckEditor5.Checked) { startTim = StartTime.Value.ToString(); endTim = EndTime.Value.ToString(); } if (this.chkStove.Checked) { if (this.cmbStoveNo.Text == "") { MessageUtil.ShowTips("请选择炉号!"); return; } else { heatNo = this.cmbStoveNo.Text.Trim(); } } if (chkOrder.Checked) { if (this.cmbOrder.Text == "") { MessageUtil.ShowTips("请选择合同号!"); return; } else { orderNo = this.cmbOrder.Text.Trim(); } } string coustom = this.CustomInfo; string[] arr = getPlinCode(coustom); list.Add(heatNo); list.Add(orderNo); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmFirmInList.queryInListData", new object[] { list, arr, startTim, endTim }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable4, true); } /// /// 获取产线代码 /// /// /// private string[] getPlinCode(string coustom) { string[] arr = null; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmFirmInList.getPline", new object[] { coustom }, ob); arr = new string[dt.Rows.Count]; if(dt.Rows.Count>0) { for (int i = 0; i < dt.Rows.Count;i++ ) { arr[i] = dt.Rows[i]["PLINE_CODE"].ToString(); } } return arr; } /// /// 审核 /// private void confimData() { this.ultraGrid4.UpdateData(); int m = 0; ArrayList parm = new ArrayList(); foreach(UltraGridRow row in ultraGrid4.Rows) { if (Convert.ToBoolean(row.Cells["CHK"].Text) == true) { m++; } } if (m < 1) { MessageUtil.ShowTips("请选择需要审核的数据!"); return; } foreach (UltraGridRow uRow in ultraGrid4.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList list = new ArrayList(); list.Add(uRow.Cells["INSTOCK_DOC"].Value.ToString()); parm.Add(list); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmFirmInList"; ccp.MethodName = "updateAffimLog"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("审核成功!")) { queryData(); MessageUtil.ShowTips("审核成功"); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 取消审核 /// private void cancelConfim() { this.ultraGrid4.UpdateData(); int m = 0; ArrayList parm = new ArrayList(); foreach (UltraGridRow row in ultraGrid4.Rows) { if (Convert.ToBoolean(row.Cells["CHK"].Text) == true) { m++; } } if (m < 1) { MessageUtil.ShowTips("请选择需要审核的数据!"); return; } foreach (UltraGridRow uRow in ultraGrid4.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList list = new ArrayList(); list.Add(uRow.Cells["INSTOCK_DOC"].Value.ToString()); parm.Add(list); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmFirmInList"; ccp.MethodName = "cancelUpdateAffimLog"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("反审成功!")) { queryData(); MessageUtil.ShowTips("撤销成功!"); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkOrder_CheckedChanged(object sender, EventArgs e) { this.cmbOrder.Enabled = chkOrder.Checked; } private void chkStove_CheckedChanged(object sender, EventArgs e) { this.cmbStoveNo.Enabled = this.chkStove.Checked; } private void cmbOrder_KeyDown(object sender, KeyEventArgs e) { if(e.KeyValue == 13) { queryData(); } } private void cmbStoveNo_KeyDown(object sender, KeyEventArgs e) { if(e.KeyValue == 13) { queryData(); } } /// /// 托选 /// /// /// private void ultraGrid4_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { try { ultraGrid4.UpdateData(); foreach (UltraGridRow r in ultraGrid4.Rows) { r.Cells["CHK"].Value = r.Selected; } } catch { } } private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e) { StartTime.Enabled = this.ultraCheckEditor5.Checked; this.EndTime.Enabled = this.ultraCheckEditor5.Checked; } } }