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.Server;
using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Tool;
using System.Collections;
namespace Core.StlMes.Client.YdmStuffReport
{
public partial class FrmStuffStoveStore : FrmBase
{
public FrmStuffStoveStore()
{
InitializeComponent();
}
private string[] belongArr = null;//所属权
private void FrmStuffStoveStore_Load(object sender, EventArgs e)
{
//StatTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
StatTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
endTime.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
belongArr = this.ValidDataPurviewIds;
//getStoreAll();
}
private void getStoreAll()
{
string storeNo = "800201";
//string[] arr = BaseMethod.
//DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Stuffmanage.FrmStuffBase.getStoreAll", new object[] { storeNo, arr }, this.ob);
//if (dt.Rows.Count > 0)
//{
// cmbStorgeNo.DataSource = dt;
// cmbStorgeNo.DisplayMember = "STORAGE_NAME";
// cmbStorgeNo.ValueMember = "STORAGE_NO";
//}
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
QueryData();
break;
case"InsertInal":
insertInal();
break;
case "Export":
ExportData();
break;
case "Close":
this.Close();
break;
}
}
///
/// 结转
///
private void insertInal()
{
}
///
/// 查询
///
private void QueryData()
{
//string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo,this.ValidDataPurviewIds, ob);
if (this.StatTime.Value > this.endTime.Value)
{
MessageUtil.ShowTips("起始日期不能大于结束日期!");
this.endTime.Focus();
return;
}
string strDateFrom = this.StatTime.Value.ToString("yyyyMM");
string strDateTo = this.endTime.Value.ToString("yyyyMMdd");
string time = this.StatTime.Value.ToString("yyyyMM");
string nextStartTime = this.StatTime.Value.AddMonths(1).ToString("yyyyMM");
string nextEndTime = this.endTime.Value.AddMonths(1).ToString("yyyyMMdd");
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 = this.StatTime.Value.ToString("yyyyMM");
string strOriginalLast = this.endTime.Value.ToString("yyyyMMdd");
DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.Report.FrmStuffStove.queryData", new object[] { strOriginal, strOriginalLast, time, belongArr, nextStartTime, nextEndTime,this.CustomInfo }, ob);
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");
//alist.Add("NEXTMOTH_COUNT");
//alist.Add("NEXTMOTH_WEIGHT");
//alist.Add("CNEXTMOTH_COUNT");
//alist.Add("CNEXTMOTH_WEIGHT");
CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
}
}
catch { }
}
///
/// 导出
///
private void ExportData()
{
GridHelper.ulGridToExcel(ultraGrid1, "管坯收发存汇总");
}
}
}