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 Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeReport.Entity; using Core.StlMes.Client.YdmPipeReport.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.YdmPipeReport { public partial class FrmOrderStock : FrmBase { private static string[] saleCodes = null; public FrmOrderStock() { IsLoadUserView = true; InitializeComponent(); } /// /// 初始化时间 /// private void InitTime() { BeginTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1); EndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1); } private void FrmOrderStock_Load(object sender, EventArgs e) { saleCodes = BaseHelper.InitPermissions(this.ValidDataPurviewIds,this.ob); InitTime(); EntityHelper.ShowGridCaption(GridStorge.DisplayLayout.Bands[0]); BaseHelper.setOtherColumnReadOnly(GridStorge, new string[] { "" }); BaseHelper.InitCellPosition(GridStorge, new string[] { "ActCount", "ActWeight", "BillCount", "BillWeight", "TallCount", "TallWeight", "LoadCount", "LoadWeight", "OnBillCount", "OnBillWeight", "OnTallCount", "OnTallWeight" }); BaseHelper.GridColumnSum(GridStorge, new string[] { "ActCount", "ActWeight", "BillCount", "BillWeight", "TallCount", "TallWeight", "LoadCount", "LoadWeight", "OnBillCount", "OnBillWeight", "OnTallCount", "OnTallWeight" }); BaseHelper.setUltraGridColumnMaxInput(GridStorge, new string[] { "ActWeight", "BillWeight", "TallWeight", "LoadWeight", "OnBillWeight", "OnTallWeight" }); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "Export": GridHelper.ulGridToExcel(GridStorge, "出库跟踪信息"); break; case "Close": this.Close(); break; default: break; } } private void DoQuery() { string orderNo = ""; if (ChcOrderNo.Checked) { orderNo = TxtOrderNo.Text.Trim(); } string beginTime = ""; string endTime = ""; if (ChcTime.Checked && BeginTime.Value != null && EndTime.Value != null) { beginTime = BeginTime.Value.ToString(); endTime = EndTime.Value.ToString(); } List listSource = EntityHelper.GetData( "com.steering.pss.ydm.Report.FrmOrderStock.getOrderStockInfo", new object[] { orderNo, beginTime, endTime, saleCodes }, this.ob); orderStockEntityBindingSource.DataSource = listSource; setValue(); } private void ChcOrderNo_CheckedChanged(object sender, EventArgs e) { if (ChcOrderNo.Checked) { TxtOrderNo.ReadOnly = false; } else { TxtOrderNo.ReadOnly = true; } if (ChcTime.Checked) { BeginTime.Enabled = true; EndTime.Enabled = true; } else { BeginTime.Enabled = false; EndTime.Enabled = false; } } private void setValue() { foreach (UltraGridRow ugr in GridStorge.Rows) { ugr.Cells["OnBillCount"].Value = Convert.ToDouble(ugr.Cells["BillCount"].Text) - Convert.ToDouble(ugr.Cells["LoadCount"].Text); ugr.Cells["OnBillWeight"].Value = Convert.ToDouble(ugr.Cells["BillWeight"].Text) - Convert.ToDouble(ugr.Cells["LoadWeight"].Text); ugr.Cells["OnTallCount"].Value = Convert.ToDouble(ugr.Cells["TallCount"].Text) - Convert.ToDouble(ugr.Cells["LoadCount"].Text); ugr.Cells["OnTallWeight"].Value = Convert.ToDouble(ugr.Cells["TallWeight"].Text) - Convert.ToDouble(ugr.Cells["LoadWeight"].Text); } } } }