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 CoreFS.CA06; using Core.StlMes.Client.YdmPipeManage.Tool; using System.Collections; using Core.StlMes.Client.YdmPipeManage.Entity; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Server; namespace Core.StlMes.Client.YdmPipeManage { public partial class FrmOutList : FrmBase { public FrmOutList() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmOutList_Load(object sender, EventArgs e) { //StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00"); //EndTime.Value = DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).AddHours(-24).ToString("yyyy-MM-dd") + " 23:59:59"); 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"); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryOutLst(); break; case "updateYear": updateYear(); break; case "Close": this.Close(); break; } } /// /// 销售出库查询 /// private void QueryOutLst() { string heatNo = ""; string orderNo = ""; string beginTim = ""; string endTim = ""; string outType = ""; string supplyUnit = this.CustomInfo; ArrayList parm = new ArrayList(); if (ultraCheckEditor5.Checked) { beginTim = StartTime.Value.ToString(); endTim = EndTime.Value.ToString(); } if (chkJudge.Checked) { heatNo = this.cmbJudge.Text.Trim(); } if (chkOrder.Checked) { orderNo = this.cmbOrder.Text.Trim(); } if (chkOutType.Checked) { outType = this.txtOutType.Value.ToString(); } string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob); parm.Add(heatNo); parm.Add(orderNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmOutList.getOutList", new object[] { beginTim, endTim, parm, arr, outType ,supplyUnit}, this.ob); YdmZcOutlistEntitybindingSource.DataSource = listSource; } /// /// 调整结转年月 /// private void updateYear() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要操作的数据!"); return; } string yearMoth = ""; string adjustDoc = ""; string heatNo = ""; string bacthNo = ""; string bacthGroupNo = ""; string carNo = ""; string moth = ""; string outCode = ""; string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob); ArrayList newParm = new ArrayList(); foreach (UltraGridRow row in checkMagRows) { ArrayList list = new ArrayList(); ArrayList parm = new ArrayList(); yearMoth = row.Cells["balYearMonth"].Text.Substring(0, 4) + row.Cells["balYearMonth"].Text.Substring(5, 2); adjustDoc = row.Cells["OutstockDoc"].Value.ToString(); heatNo = row.Cells["judgeStoveNo"].Value.ToString(); bacthNo = row.Cells["batchNo"].Value.ToString(); bacthGroupNo = row.Cells["batchGroudNo"].Value.ToString(); carNo = row.Cells["VehicleNo"].Value.ToString(); outCode = row.Cells["OutstockTypeCode"].Value.ToString(); moth = DateTime.Parse(row.Cells["balYearMonth"].Text).AddMonths(1).ToString("yyyyMM"); parm.Add(moth); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { parm, arr,this.CustomInfo }, ob); if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0) { MessageUtil.ShowTips("此炉【" + heatNo + "】已进行结转,不允许调整结转年月!"); return; } list.Add(yearMoth); list.Add(yearMoth + "02 12:00:00"); list.Add(adjustDoc); list.Add(heatNo); list.Add(bacthNo); list.Add(bacthGroupNo); list.Add(carNo); list.Add(outCode); newParm.Add(list); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmOutList"; ccp.MethodName = "updateYear"; ccp.ServerParams = new object[] { newParm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { QueryOutLst(); MessageUtil.ShowTips("修改成功!"); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void chkJudge_CheckedChanged(object sender, EventArgs e) { cmbJudge.Enabled = this.chkJudge.Checked; } private void chkOrder_CheckedChanged(object sender, EventArgs e) { cmbOrder.Enabled = this.chkOrder.Checked; } private void cmbJudge_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryOutLst(); } } private void cmbOrder_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryOutLst(); } } private void chkOutType_CheckedChanged(object sender, EventArgs e) { this.txtOutType.Enabled = this.chkOutType.Checked; } private void txtOutType_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryOutLst(); } } 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 ultraGrid1_KeyUp(object sender, KeyEventArgs e) { BaseMethod.setGridCopyActColumn(ultraGrid1, e, "BalYearMonth"); } private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e) { StartTime.Enabled = this.ultraCheckEditor5.Checked; EndTime.Enabled = this.ultraCheckEditor5.Checked; } } }