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.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using System.Collections; using Core.Mes.Client.Comm.Server; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.YdmPipeManage; using Core.StlMes.Client.YdmPipeManage.Tool; namespace Core.StlMes.Client.YdmPipeReport { public partial class rptStoveBatchStorageZg : FrmBase { public rptStoveBatchStorageZg() { this.IsLoadUserView = true; InitializeComponent(); } private Hashtable ShapeRelation = null; private string departm = ""; private string plineCode = ""; private string departId = ""; private string[] arr = null; /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": Querydata(); break; case "Export": ExportData(); break; case "Close": this.Close(); break; } } private string strOutbound = "800603";//出库类型编码 private string strInMemo = "";//入库简码 /// /// 批量调差 /// private void adjustData() { UltraGridRow row = this.ultraGrid1.ActiveRow; ArrayList parm = new ArrayList(); if (row == null || row.Index < 0) { MessageUtil.ShowTips("无调差数据!"); return; } if (!chkGl.Checked) { MessageUtil.ShowTips("请先筛选出0支非0吨的数据,再进行调差!"); return; } int days = DateTime.DaysInMonth(int.Parse(endTime.Value.ToString("yyyy")), int.Parse(endTime.Value.ToString("MM"))); //DataTable dtMemo = ClsLoad.getComTypeInfo(strOutbound, ob); //if (dtMemo.Rows.Count >= 1) //{ // strInMemo = dtMemo.Rows[0]["MEMO"].ToString(); //} string manNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob); string manName = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob); foreach (UltraGridRow uRow in this.ultraGrid1.Rows) { ArrayList list = new ArrayList(); list.Add(uRow.Cells["JUDGE_STOVE_NO"].Text); list.Add(uRow.Cells["BATCH_NO"].Text); list.Add(uRow.Cells["BATCH_GROUD_NO"].Text); list.Add(uRow.Cells["QUANTITYWGT"].Value.ToString()); list.Add(strOutbound); list.Add(strInMemo); list.Add(manNo); list.Add(manName); list.Add(this.UserInfo.GetDeptid()); list.Add(this.UserInfo.GetDepartment()); list.Add(this.UserInfo.GetUserName()); parm.Add(list); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.Report.FrmrptStoveBatchStorage"; ccp.MethodName = "insertAdjustData"; ccp.ServerParams = new object[] { parm}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("调差成功!")) { Querydata(); } } } /// /// 查询1 /// private void Querydata() { //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); if (this.StatTime.Value > this.endTime.Value) { MessageUtil.ShowTips("起始日期不能大于结束日期!"); this.endTime.Focus(); return; } //if (this.StatTime.Value.ToString().Substring(5, 2) != this.endTime.Value.ToString().Substring(5, 2)) //{ // MessageUtil.ShowTips("起始日期和结束日期需在同月!"); // return; //} if (chkStorge.Checked && string.IsNullOrEmpty(this.cmbStorgeNo.Text.Trim())) { MessageUtil.ShowTips("请输入仓库名称!"); this.cmbStorgeNo.Focus(); return; } string strDateFrom = this.StatTime.Value.ToString("yyyyMMdd"); string strDateTo = this.endTime.Value.ToString("yyyyMMdd"); string time = this.StatTime.Value.ToString("yyyyMM"); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); //string strOriginal = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-DateTime.Now.Day + 1)); //string strOriginalLast = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-DateTime.Now.Day + 1)); string strOriginal = this.StatTime.Value.ToString("yyyyMMdd"); string strOriginalLast = this.endTime.Value.ToString("yyyyMMdd"); string strWhere1 = "", strWhere2 = "", strWhere3 = "", strWhere4 = ""; DataTable dt = new DataTable(); switch (this.CustomInfo) { case"STORAGE_NO": dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptStoveBatchStorageZg.getTestStore", new object[] { strOriginal, strOriginalLast, time,arr }, ob); break; case"BELONG_CODE": dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptStoveBatchStorageZg.getTest", new object[] { strOriginal, strOriginalLast, time, departId }, ob); break; } GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); this.SetStaticsInfo(); CommonMethod.SetGridSumArea(this.ultraGrid1); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception e) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } } private void SetStaticsInfo() { try { if (this.ultraGrid1.Rows.Count == 0) { this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear(); } else { ArrayList alist = new ArrayList(); alist.Add("ORIGINAL_AMOUNT"); alist.Add("ORIGINAL_COUNT"); alist.Add("DAY_1"); alist.Add("DAY_1COUNT"); alist.Add("MONTH_1"); alist.Add("MONTH_1COUNT"); //alist.Add("YEAR_1"); alist.Add("DAY_2"); alist.Add("DAY_2COUNT"); alist.Add("MONTH_2"); alist.Add("MONTH_2COUNT"); //alist.Add("YEAR_2"); alist.Add("AWEIGHT"); alist.Add("END_AMOUNT"); alist.Add("END_COUNT"); alist.Add("MATWGT"); alist.Add("MATCOUNT"); alist.Add("QUANTITYCOUNT"); alist.Add("QUANTITYWGT"); CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true); } } catch { } } /// /// 导出 /// private void ExportData() { GridHelper.ulGridToExcel(ultraGrid1,"炉批收发存汇总"); } private void chkStorge_CheckedChanged(object sender, EventArgs e) { this.cmbStorgeNo.Enabled = this.chkStorge.Checked; } private void rptProductStorageZg_Load(object sender, EventArgs e) { StatTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00"); endTime.Value = DateTime.Today.AddDays(1).AddSeconds(-1); departId = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob); switch (this.CustomInfo) { case "STORAGE_NO": arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob); break; } //DateTime.Parse(DateTime.Now.AddMonths(1).AddDays(1 - DateTime.Now.Day).AddHours(-24).ToString("yyyy-MM-dd") + " 23:59:59"); //YdmBaseClass.InitComboEditor(cmbStorgeNo, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); } private void cmbStorgeNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { Querydata(); } } private void cmbGj_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { Querydata(); } } private void cmbMertailName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { Querydata(); } } private void cmbGg_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { Querydata(); } } private void chkGl_CheckedChanged(object sender, EventArgs e) { ultraGrid1.DataSource = dataTable1.DefaultView; if (chkGl.Checked) { dataTable1.DefaultView.RowFilter = "QUANTITYCOUNT <> 0"; } else { dataTable1.DefaultView.RowFilter = ""; } ultraGrid1.Refresh(); ultraGrid1.Update(); //DataRow[] drs = dataTable1.Select("QUANTITYCOUNT != '0' and QUANTITYWGT !='0.000'"); //foreach (DataRow dr in drs) //{ // dataTable1.Rows.Remove(dr); //} } } }