| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- 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;
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- 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 = "";//入库简码
- /// <summary>
- /// 批量调差
- /// </summary>
- 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();
- }
- }
- }
- /// <summary>
- /// 查询1
- /// </summary>
- 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 { }
- }
-
-
- /// <summary>
- /// 导出
- /// </summary>
- 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);
- //}
- }
- }
- }
|