| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578 |
- 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 System.Collections;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Core.StlMes.Client.YdmPipeManage.Tool;
- namespace Core.StlMes.Client.YdmPipeReport
- {
- public partial class rptSendClosing : FrmBase
- {
- public rptSendClosing()
- {
- this.IsLoadUserView = true;
- InitializeComponent();
- }
- private void rptSendClosing_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);
- DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- this.StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
- }
- private Hashtable ShapeRelation = null;
- 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;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void QueryData()
- {
- //if (this.StatTime.Value > this.endTime.Value)
- //{
- // MessageUtil.ShowTips("起始日期不能大于结束日期!");
- // this.endTime.Focus();
- // return;
- //}
- string bathYear = this.StartTime.Value.ToString("yyyyMM");
- string strDateFrom = "";
- string strDateTo = "";
- string beglogCode = this.ComBeglog.Value.ToString2();
- arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
- string[] strMergeColumns = new string[] { "BILL_NO", "JUDGE_STOVE_NO", "BATCH_NO", "BATCH_GROUD_NO", "PRODUCNAME", "STD_STYLE_DESC", "STEELNAME", "SPEC_NAME", "MODEL_DESC" };
- //出库实单量
- DataTable table1 = null;
- if (!this.GetSOutWgt(strDateFrom, strDateTo, bathYear, out table1))
- {
- return;
- }
- //出库虚单量
- DataTable table2 = null;
- if (!this.GetXOutWgt(strDateFrom, strDateTo, bathYear, out table2))
- {
- }
- //已结算实单量
- DataTable table3 = null;
- if (!this.GetSClosingWgt(strDateFrom, strDateTo, bathYear, out table3))
- {
- }
- //已结算虚单量
- DataTable table4 = null;
- if (!this.GetXClosingWgt(strDateFrom, strDateTo, bathYear, out table4))
- {
- }
- //实时未结算量
- DataTable table5 = null;
- if (!this.GetRealNoClosingWgt(strDateFrom, strDateTo, bathYear, out table5))
- {
- }
- //票据未对齐
- DataTable table6 = null;
- if (!this.GetReaggedWgt(strDateFrom, strDateTo, bathYear, out table6))
- {
- }
- DataTable table = table1.DefaultView.ToTable(true, strMergeColumns);
- if (table2 != null)
- {
- table.Merge(table2.DefaultView.ToTable(true, strMergeColumns));
- }
- if (table3 != null)
- {
- table.Merge(table3.DefaultView.ToTable(true, strMergeColumns));
- }
- if (table4 != null)
- {
- table.Merge(table4.DefaultView.ToTable(true, strMergeColumns));
- }
- if (table5 != null)
- {
- table.Merge(table5.DefaultView.ToTable(true, strMergeColumns));
- }
- if(table6 != null)
- {
- table.Merge(table6.DefaultView.ToTable(true, strMergeColumns));
- }
- table.DefaultView.Sort = "BILL_NO,JUDGE_STOVE_NO,BATCH_NO,BATCH_GROUD_NO,PRODUCNAME,STD_STYLE_DESC,STEELNAME,SPEC_NAME,MODEL_DESC";
- table = table.DefaultView.ToTable(true, strMergeColumns);
- string strSort = "", strBillNo = "", strJudgeNo = "", strBatchNo = "",strGroupNo = "",strPro = "",strStyle = "",strSte = "",strSpec = "",strMode = "" ;
- DataRow newrow;
- DataRow[] rows;
- this.dataTable1.Rows.Clear();
- int dSOutCount = 0, dXOutCount = 0, dSdClosingCount = 0, dXdClosingCount = 0, dNoClosingCount = 0, dReaggedCount = 0, dCzCount = 0;
- decimal dSOutWgt = 0.0M, dXOutWgt = 0.0M, dSdClosingWgt = 0.0M, dXdClosingWgt = 0.0M, dNoClosingWgt = 0.0M, dReaggedWgt = 0.0M,dCzWgt = 0.0M;
-
- string strRowFilters = "";
- for (int i = 0; i < table.Rows.Count; i++)
- {
- newrow = this.dataTable1.NewRow();
- try
- {
- strBillNo = Convert.ToString(table.Rows[i]["BILL_NO"]);//提单号
- strJudgeNo = Convert.ToString(table.Rows[i]["JUDGE_STOVE_NO"]);
- strBatchNo = Convert.ToString(table.Rows[i]["BATCH_NO"]);
- strGroupNo = Convert.ToString(table.Rows[i]["BATCH_GROUD_NO"]);
- strPro = Convert.ToString(table.Rows[i]["PRODUCNAME"]);
- strStyle = Convert.ToString(table.Rows[i]["STD_STYLE_DESC"]);
- strSte = Convert.ToString(table.Rows[i]["STEELNAME"]);
- strSpec = Convert.ToString(table.Rows[i]["SPEC_NAME"]);
- strMode = Convert.ToString(table.Rows[i]["MODEL_DESC"]);
- strRowFilters = string.IsNullOrEmpty(strBillNo) ? " BILL_NO is null " : " BILL_NO = '" + strBillNo + "' ";
- strRowFilters += string.IsNullOrEmpty(strJudgeNo) ? " and JUDGE_STOVE_NO is null " : " and JUDGE_STOVE_NO = '" + strJudgeNo + "' ";
- strRowFilters += string.IsNullOrEmpty(strBatchNo) ? " and BATCH_NO is null " : " and BATCH_NO = '" + strBatchNo + "' ";
- strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and BATCH_GROUD_NO is null " : " and BATCH_GROUD_NO = '" + strGroupNo + "' ";
- strRowFilters += string.IsNullOrEmpty(strPro) ? " and PRODUCNAME is null " : " and PRODUCNAME = '" + strPro + "' ";
- strRowFilters += string.IsNullOrEmpty(strStyle) ? " and STD_STYLE_DESC is null " : " and STD_STYLE_DESC = '" + strStyle + "' ";
- strRowFilters += string.IsNullOrEmpty(strSte) ? " and STEELNAME is null " : " and STEELNAME = '" + strSte + "' ";
- strRowFilters += string.IsNullOrEmpty(strSpec) ? " and SPEC_NAME is null " : " and SPEC_NAME = '" + strSpec + "' ";
- strRowFilters += string.IsNullOrEmpty(strMode) ? " and MODEL_DESC is null " : " and MODEL_DESC = '" + strMode + "' ";
- try
- {
- table1.CaseSensitive = true;
- rows = table1.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dSOutCount = int.Parse(Convert.ToString(rows[0]["SOUTCOUNT"]));
- dSOutWgt = decimal.Parse(Convert.ToString(rows[0]["SOUTWEIGHT"]));
- }
- catch
- {
- dSOutCount = 0;
- dSOutWgt = 0.0M;
- }
- }
- else
- {
- dSOutCount = 0;
- dSOutWgt = 0.0M;
- }
- }
- catch
- {
- dSOutCount = 0;
- dSOutWgt = 0.0M;
- }
- try
- {
- table2.CaseSensitive = true;
- rows = table2.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dXOutCount = int.Parse(Convert.ToString(rows[0]["XOUTCOUNT"]));
- dXOutWgt = decimal.Parse(Convert.ToString(rows[0]["XOUTWEIGHT"]));
- }
- catch
- {
- dXOutCount = 0;
- dXOutWgt = 0.0M;
- }
- }
- else
- {
- dXOutCount = 0;
- dXOutWgt = 0.0M;
- }
- }
- catch
- {
- dXOutCount = 0;
- dXOutWgt = 0.0M;
- }
- try
- {
- table3.CaseSensitive = true;
- rows = table3.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dSdClosingCount = int.Parse(Convert.ToString(rows[0]["SCLOSINGCOUNT"]));
- dSdClosingWgt = decimal.Parse(Convert.ToString(rows[0]["SCLOSINGWEIGHT"]));
- }
- catch
- {
- dSdClosingCount = 0;
- dSdClosingWgt = 0.0M;
- }
- }
- else
- {
- dSdClosingCount = 0;
- dSdClosingWgt = 0.0M;
- }
- }
- catch
- {
- dSdClosingCount = 0;
- dSdClosingWgt = 0.0M;
- }
- try
- {
- table4.CaseSensitive = true;
- rows = table4.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dXdClosingCount = int.Parse(Convert.ToString(rows[0]["XCLOSINGCOUNT"]));
- dXdClosingWgt = decimal.Parse(Convert.ToString(rows[0]["XCLOSINGWEIGHT"]));
- }
- catch
- {
- dXdClosingCount = 0;
- dXdClosingWgt = 0.0M;
- }
- }
- else
- {
- dXdClosingCount = 0;
- dXdClosingWgt = 0.0M;
- }
- }
- catch
- {
- dXdClosingCount = 0;
- dXdClosingWgt = 0.0M;
- }
- try
- {
- table5.CaseSensitive = true;
- rows = table5.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dNoClosingCount = int.Parse(Convert.ToString(rows[0]["TIMEPOINTCOUNT"]));
- dNoClosingWgt = decimal.Parse(Convert.ToString(rows[0]["TIMEPOINTWEIGHT"]));
- }
- catch
- {
- dNoClosingCount = 0;
- dNoClosingWgt = 0.0M;
- }
- }
- else
- {
- dNoClosingCount = 0;
- dNoClosingWgt = 0.0M;
- }
- }
- catch
- {
- dNoClosingCount = 0;
- dNoClosingWgt = 0.0M;
- }
- try
- {
- table6.CaseSensitive = true;
- rows = table6.Select(strRowFilters);
- if (rows.Length > 0)
- {
- try
- {
- dReaggedCount = int.Parse(Convert.ToString(rows[0]["RAGGEDCOUNT"]));
- dReaggedWgt = decimal.Parse(Convert.ToString(rows[0]["RAGGEDWEIGHT"]));
- }
- catch
- {
- dReaggedCount = 0;
- dReaggedWgt = 0.0M;
- }
- }
- else
- {
- dReaggedCount = 0;
- dReaggedWgt = 0.0M;
- }
- }
- catch
- {
- dReaggedCount = 0;
- dReaggedWgt = 0.0M;
- }
- try
- {
- newrow["BILL_NO"] = strBillNo;
- newrow["JUDGE_STOVE_NO"] = strJudgeNo;
- newrow["BATCH_NO"] = strBatchNo;
- newrow["BATCH_GROUD_NO"] = strGroupNo;
- newrow["PRODUCNAME"] = strPro;
- newrow["STD_STYLE_DESC"] = strStyle;
- newrow["STEELNAME"] = strSte;
- newrow["SPEC_NAME"] = strSpec;
- newrow["MODEL_DESC"] = strMode;
- newrow["SOUTCOUNT"] = dSOutCount.ToString();
- newrow["SOUTWEIGHT"] = dSOutWgt.ToString();
- newrow["XOUTCOUNT"] = dXOutCount.ToString();
- newrow["XOUTWEIGHT"] = dXOutWgt.ToString();
- newrow["SCLOSINGCOUNT"] = dSdClosingCount.ToString();
- newrow["SCLOSINGWEIGHT"] = dSdClosingWgt.ToString();
- newrow["XCLOSINGCOUNT"] = dXdClosingCount.ToString();
- newrow["XCLOSINGWEIGHT"] = dXdClosingWgt.ToString();
- //newrow["TIMEPOINTCOUNT"] = Convert.ToString(dSOutCount + dXOutCount - dSdClosingCount - dXdClosingCount).Trim();
- //newrow["TIMEPOINTWEIGHT"] = Convert.ToString(dSOutWgt + dXOutWgt - dSdClosingWgt - dXdClosingWgt).Trim();
- newrow["REALTIMECOUNT"] = dNoClosingCount.ToString();
- newrow["REALTIMEWEIGHT"] = dNoClosingWgt.ToString();
- newrow["RAGGEDCOUNT"] = dReaggedCount.ToString();
- newrow["RAGGEDWEIGHT"] = dReaggedWgt.ToString();
- newrow["DIFCOUNT"] = Convert.ToString(dSOutCount + dXOutCount - dReaggedCount - dSdClosingCount - dXdClosingCount - dNoClosingCount).Trim();
- newrow["DIFWEIGHT"] = Convert.ToString(dSOutWgt + dXOutWgt - dReaggedWgt - dSdClosingWgt - dXdClosingWgt - dNoClosingWgt).Trim();
- try
- {
- if (ShapeRelation.Contains(strBillNo))
- {
- strSort = ShapeRelation[strBillNo].ToString();
- }
- else
- {
- strSort = "";
- }
- }
- catch
- {
- strSort = "";
- }
- //newrow["PRODUCT_SORT"] = strSort;
- this.dataSet1.Tables[0].Rows.Add(newrow);
- }
- catch { }
- }
- catch { }
- }
- this.SetStaticsInfo();
- CommonMethod.SetGridSumArea(this.ultraGrid1);
- }
-
- private void SetStaticsInfo()
- {
- try
- {
- if (this.ultraGrid1.Rows.Count == 0)
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
- }
- else
- {
-
- ArrayList alist = new ArrayList();
- alist.Add("SOUTCOUNT");
- alist.Add("SOUTWEIGHT");
- alist.Add("XOUTCOUNT");
- alist.Add("XOUTWEIGHT");
- alist.Add("SCLOSINGCOUNT");
- alist.Add("SCLOSINGWEIGHT");
- alist.Add("XCLOSINGCOUNT");
- alist.Add("XCLOSINGWEIGHT");
- //alist.Add("TIMEPOINTCOUNT");
- //alist.Add("TIMEPOINTWEIGHT");
- alist.Add("REALTIMECOUNT");
- alist.Add("REALTIMEWEIGHT");
- alist.Add("DIFCOUNT");
- alist.Add("DIFWEIGHT");
- alist.Add("RAGGEDCOUNT");
- alist.Add("RAGGEDWEIGHT");
- CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
- }
- }
- catch { }
- }
- /// <summary>
- /// 票据未对齐
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table3"></param>
- /// <returns></returns>
- private bool GetReaggedWgt(string strDateFrom, string strDateTo,string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getReaggedWgt", new object[] { strDateFrom, strDateTo,beglogCode, arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
-
- /// <summary>
- /// 实时未结算
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table3"></param>
- /// <returns></returns>
- private bool GetRealNoClosingWgt(string strDateFrom, string strDateTo,string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getRealNoClosingWgt", new object[] { strDateFrom, strDateTo,beglogCode,arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
- /// <summary>
- /// 已结算虚单量
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table2"></param>
- /// <returns></returns>
- private bool GetXClosingWgt(string strDateFrom, string strDateTo,string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getXClosingWgt", new object[] { strDateFrom, strDateTo,beglogCode, arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
- /// <summary>
- /// 已结算实单量
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table2"></param>
- /// <returns></returns>
- private bool GetSClosingWgt(string strDateFrom, string strDateTo,string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getSClosingWgt", new object[] { strDateFrom, strDateTo ,beglogCode,arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
- /// <summary>
- /// 出库虚单量
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table1"></param>
- /// <returns></returns>
- private bool GetXOutWgt(string strDateFrom, string strDateTo, string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getXOutWgt", new object[] { strDateFrom, strDateTo,beglogCode, arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
- /// <summary>
- /// 出库实单量
- /// </summary>
- /// <param name="strDateFrom"></param>
- /// <param name="strDateTo"></param>
- /// <param name="table1"></param>
- /// <returns></returns>
- private bool GetSOutWgt(string strDateFrom, string strDateTo,string beglogCode, out DataTable table)
- {
- table = null;
- DataSet set = new DataSet();
- DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmrptSendClosing.getSOutWgt", new object[] { strDateFrom, strDateTo,beglogCode, arr }, this.ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- set.Tables.Add(ds);
- table = set.Tables[0];
- return true;
- }
- return false;
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
-
- GridHelper.ulGridToExcel(ultraGrid1, "出库结算汇总");
- }
- }
- }
|