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.StlMes.Client.YdmPipeManage.Tool; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Server; using System.Collections; using Core.StlMes.Client.YdmPipeManage; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.YdmBase; namespace Core.StlMes.Client.YdmPipeReport { public partial class FrmRunTimeRpt : FrmBase { public FrmRunTimeRpt() { this.IsLoadUserView = true; InitializeComponent(); } private Hashtable ShapeRelation = null; private void FrmRunTimeRpt_Load(object sender, EventArgs e) { dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")); YdmBaseClass.InitComboEditor(cmbStoreNo, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case"Query": queryData1(); break; case"Query1": queryTal(); break; case"Export": exportData(); break; case "insertTal": insertTal(); break; case "insertInital": insertInital(); break; case"Close": this.Close(); break; } } /// /// 结转 /// private void insertInital() { UltraGridRow row = this.ultraGrid1.ActiveRow; string dtNowTim = DateTime.Now.AddMonths(1).ToString("yyyyMM"); //if (row == null || row.Index < 0) //{ // MessageUtil.ShowWarning("期初中转信息,无法结转!"); // return; //} string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getIntalJZ", new object[] { dtNowTim, arr, this.CustomInfo }, ob); if (int.Parse(ds.Rows[0][0].ToString()) > 0) { MessageUtil.ShowTips("已存在结转数据,不允许重复结转!"); return; } ArrayList parm = new ArrayList(); if (MessageUtil.ShowYesNoAndQuestion("是否结转期初数据?") == DialogResult.No) return; try { this.Cursor = Cursors.WaitCursor; // 控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); Dictionary> groupedData = new Dictionary>(); // 遍历 ultraGrid1.Rows,将数据根据 JUDGE_STOVE_NO 和 BATCH_NO 分组 foreach (UltraGridRow uRow in ultraGrid1.Rows) { string key = $"{uRow.Cells["JUDGE_STOVE_NO"].Value}_{uRow.Cells["BATCH_NO"].Value}"; if (!groupedData.ContainsKey(key)) { groupedData[key] = new List(); } groupedData[key].Add(uRow); } decimal totalCountAllGroups = 0; // 总支数 decimal totalAmountAllGroups = 0; // 总重量 foreach (var group in groupedData) { decimal totalCount = 0; // 当前分组的总支数 decimal totalAmount = 0; // 当前分组的总重量 // 遍历当前分组内的所有行,累加支数和重量 foreach (var uRow in group.Value) { totalCount += decimal.Parse(uRow.Cells["END_COUNT"].Text); totalAmount += decimal.Parse(uRow.Cells["END_AMOUNT"].Text); } if (Convert.ToInt32(totalCount.ToString()) <= 0) { //System.Diagnostics.Debug.WriteLine($"炉号 {group.Key}: 支数{totalCount.ToString()}小于等于0 不计入"); continue; } // System.Diagnostics.Debug.WriteLine($"分组 {group.Key}: 支数总和 = {totalCount}, 重量总和 = {totalAmount}"); // 获取当前分组中最小的 BATCH_GROUD_NO 和 BELONG_CODE string minBatchGroupNo = group.Value.Min(gridRow => gridRow.Cells["BATCH_GROUD_NO"].Value.ToString()); string minBelongCode = group.Value.Min(gridRow => gridRow.Cells["BELONG_CODE"].Value.ToString()); // 使用 LINQ 分组,按 PRODUCNAME, STD_STYLE_DESC, STEELNAME, SPEC_NAME, MODEL_DESC 等字段进行分组 var detailedGroups = group.Value .GroupBy(gridRow => new { PRODUCNAME = gridRow.Cells["PRODUCNAME"].Value.ToString(), STD_STYLE_DESC = gridRow.Cells["STD_STYLE_DESC"].Value.ToString(), STEELNAME = gridRow.Cells["STEELNAME"].Value.ToString(), SPEC_NAME = gridRow.Cells["SPEC_NAME"].Value.ToString(), MODEL_DESC = gridRow.Cells["MODEL_DESC"].Value.ToString() }) .ToList(); // 对每一个详细分组(按字段不同的组合)生成对应的 list foreach (var detailedGroup in detailedGroups) { // 重新计算当前子组的总支数和总重量 decimal groupCount = 0; decimal groupAmount = 0; foreach (var uRow in detailedGroup) { groupCount += decimal.Parse(uRow.Cells["END_COUNT"].Text); groupAmount += decimal.Parse(uRow.Cells["END_AMOUNT"].Text); } // 如果支数小于等于0,则跳过该组 if (Convert.ToInt32(groupCount.ToString()) <= 0) { continue; } // 获取当前分组中的第一个 uRow(用作模板)来生成 `list` var firstGridRow = detailedGroup.First(); // 构建列表并添加数据 ArrayList list = new ArrayList(); System.Diagnostics.Debug.WriteLine($"炉号 {firstGridRow.Cells["JUDGE_STOVE_NO"].Value.ToString()}"); list.Add(firstGridRow.Cells["JUDGE_STOVE_NO"].Value.ToString()); // JUDGE_STOVE_NO list.Add(firstGridRow.Cells["BATCH_NO"].Value.ToString()); // BATCH_NO list.Add(minBatchGroupNo); // 取最小的 BATCH_GROUD_NO list.Add(groupCount.ToString()); // 当前子组的支数 list.Add(groupAmount.ToString()); // 当前子组的重量 list.Add(firstGridRow.Cells["PRODUCNAME"].Value.ToString()); // PRODUCNAME list.Add(firstGridRow.Cells["STD_STYLE_DESC"].Value.ToString()); // STD_STYLE_DESC list.Add(firstGridRow.Cells["STEELNAME"].Value.ToString()); // STEELNAME list.Add(firstGridRow.Cells["SPEC_NAME"].Value.ToString()); // SPEC_NAME list.Add(firstGridRow.Cells["MODEL_DESC"].Value.ToString()); // MODEL_DESC list.Add(dtNowTim); // 当前时间 list.Add(this.UserInfo.GetUserName()); // 当前用户 list.Add(minBelongCode); // 取最小的 BELONG_CODE // 将每个列表添加到最终的参数列表 parm 中 parm.Add(list); } // 累加所有分组的支数和重量 totalCountAllGroups += totalCount; totalAmountAllGroups += totalAmount; } // 输出总汇总信息 System.Diagnostics.Debug.WriteLine($"所有分组的汇总: 支数总和 = {totalCountAllGroups}, 重量总和 = {totalAmountAllGroups}"); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRpt"; ccp.MethodName = "insertInital"; ccp.ServerParams = new object[] { parm, this.dtBathYear.Value.ToString("yyyyMM"), arr, this.CustomInfo }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("期初数据结转成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } 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; // 在这里可以增加对错误的日志处理 MessageUtil.ShowError("发生错误:" + e.Message); } } /// /// 查询中转过去的数据 /// private void queryTal() { string yearMoth = this.dtBathYear.Value.ToString("yyyyMM"); string heatNo = ""; if (chkStove.Checked && string.IsNullOrEmpty(this.cmbStoveNo.Text.Trim())) { MessageUtil.ShowTips("请输入炉号!"); this.cmbStoveNo.Focus(); return; } if (chkStove.Checked) { heatNo = this.cmbStoveNo.Text.Trim(); } string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getTal", new object[] { yearMoth, heatNo, arr}, ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); this.SetStaticsInfoC(); //CommonMethod.SetGridSumArea(this.ultraGrid2); 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 SetStaticsInfoC() { //try //{ // if (this.ultraGrid2.Rows.Count == 0) // { // this.ultraGrid2.DisplayLayout.Bands[0].Summaries.Clear(); // } // else // { // ArrayList alist = new ArrayList(); // alist.Add("ACT_COUNT"); // alist.Add("Act_Weight"); // CommonMethod.SetStaticsInfoSum(ref this.ultraGrid2, alist, true); // } //} //catch { } } /// /// 插入中转数据 /// private void insertTal() { string dtYear = this.dtBathYear.Value.ToString("yyyyMM"); string dtNowTim = DateTime.Now.ToString("yyyyMM"); if (!this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM").Equals(dtNowTim)) { MessageUtil.ShowTips("所选结转年月与当前所在月往后推一月不一致,请重新选择结转年月!"); return; } string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); DataTable ds = doQueryTalCount(arr); if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0) { MessageUtil.ShowTips("已存在当前年月的中转数据了,不允许再进行中转!"); return; } UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null || row.Index < 0) { MessageUtil.ShowWarning("无库存信息,无法中转!"); return; } ArrayList parm = new ArrayList(); if (MessageUtil.ShowYesNoAndQuestion("是否中转期初数据?") == DialogResult.No) return; try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); foreach (UltraGridRow uRow in ultraGrid1.Rows) { //ArrayList ss = new ArrayList(); //ss.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString()); //ss.Add(uRow.Cells["BATCH_NO"].Value.ToString()); //ss.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString()); //ss.Add(dtNowTim); //DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getIntal", new object[] { ss }, ob); //if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0) //{ // MessageUtil.ShowTips("此数据已进行中转,不允许再次中转!"); // return; //} if (int.Parse(uRow.Cells["END_COUNT"].Value.ToString()) > 0) { ArrayList list = new ArrayList(); list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString()); list.Add(uRow.Cells["BATCH_NO"].Value.ToString()); list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString()); list.Add(uRow.Cells["END_COUNT"].Value.ToString()); list.Add(uRow.Cells["END_AMOUNT"].Value.ToString()); list.Add(this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM")); parm.Add(list); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRpt"; ccp.MethodName = "insertTal"; ccp.ServerParams = new object[] { parm, arr }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("期初数据中转成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } 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 DataTable doQueryTalCount(string[] arr) { DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.doQueryTail", new object[] { DateTime.Now.ToString("yyyyMM"), arr }, ob); return ds; } /// /// 导出 /// private void exportData() { GridHelper.ulGridToExcel(ultraGrid1, "炉批运行年月收发存汇总"); } /// /// 查询 /// private void queryData1() { string yearMothTim = ""; string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); yearMothTim = this.dtBathYear.Value.ToString("yyyyMM"); string supplyUnit = this.CustomInfo; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getQueryData", new object[] { yearMothTim, arr, supplyUnit, checkssq.Checked?"0":"1" }, ob); GridHelper.CopyDataToDatatable(ref dt, ref this.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 queryData() { string yearMothTim = ""; string stoveNo = ""; string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); if (chkStove.Checked && string.IsNullOrEmpty(this.cmbStoveNo.Text.Trim())) { MessageUtil.ShowTips("请输入炉号!"); this.cmbStoveNo.Focus(); return; } try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); yearMothTim = this.dtBathYear.Value.ToString("yyyyMM"); string strWhere1 = "", strWhere2 = "", strWhere3 = "", strWhere4 = ""; if (this.chkStove.Checked) { strWhere1 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'"; strWhere2 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'"; strWhere3 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'"; strWhere4 += " and s.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'"; } if (chkStoreNo.Checked) { strWhere1 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'"; strWhere2 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'"; strWhere3 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'"; strWhere4 += " and s.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'"; } //上期期初 DataTable table1 = null; if (!this.GetOriginalLast(yearMothTim, strWhere1, out table1, arr)) { } //本期入库量 DataTable table2 = null; if (!this.GetThisIn(yearMothTim, strWhere1, out table2, arr)) { //return; } //本期出库量 DataTable table3 = null; if (!this.GetThisOut(yearMothTim, strWhere1, out table3, arr)) { //return; } //调差 DataTable table4 = null; if (!this.GetAdjust(yearMothTim, strWhere1, out table4, arr)) { } DataTable table = new DataTable(); string[] strMergeColumns = new string[] { "JUDGE_STOVE_NO", "BATCH_NO", "BATCH_GROUD_NO" }; if (table1 != null) { 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)); } } else { if (table2 != null) { table = table2.DefaultView.ToTable(true, strMergeColumns); if (table3 != null) { table.Merge(table3.DefaultView.ToTable(true, strMergeColumns)); } } else { if (table3 != null) { table = table3.DefaultView.ToTable(true, strMergeColumns); if (table4 != null) { table.Merge(table4.DefaultView.ToTable(true, strMergeColumns)); } } else { if (table4 != null) { table = table4.DefaultView.ToTable(true, strMergeColumns); } } } } if (table != null) { table.DefaultView.Sort = "JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO"; table = table.DefaultView.ToTable(true, strMergeColumns); } else { return; } string strSort = "", strHeatNo = "", strBactchNo = "", strGroupNo = "", strPro = "", strStdStyle = "", strSteel = "",strSpec = "",strModel = "" ; DataRow newrow; DataRow[] rows; this.dataTable1.Rows.Clear(); decimal dWgt = 0.0M,dAjust = 0.0M; int dCount = 0; decimal dThisIn_Month = 0.0M, dThisOut_Month = 0.00M; int dThisIn_MonthCount = 0, dThisOut_MonthCount = 0; string strRowFilters = ""; for (int i = 0; i < table.Rows.Count; i++) { newrow = this.dataTable1.NewRow(); try { strHeatNo = Convert.ToString(table.Rows[i]["JUDGE_STOVE_NO"]);//炉号 strBactchNo = Convert.ToString(table.Rows[i]["BATCH_NO"]);//批号 strGroupNo = Convert.ToString(table.Rows[i]["BATCH_GROUD_NO"]);//组号 strPro = Convert.ToString(table.Rows[i]["PRODUCNAME"]); strStdStyle = Convert.ToString(table.Rows[i]["STD_STYLE_DESC"]); strSteel = Convert.ToString(table.Rows[i]["STEELNAME"]); strSpec = Convert.ToString(table.Rows[i]["SPEC_NAME"]); strModel = Convert.ToString(table.Rows[i]["MODEL_DESC"]); strRowFilters = string.IsNullOrEmpty(strHeatNo) ? " JUDGE_STOVE_NO is null " : " JUDGE_STOVE_NO = '" + strHeatNo + "' "; strRowFilters += string.IsNullOrEmpty(strBactchNo) ? " and BATCH_NO is null " : " and BATCH_NO = '" + strBactchNo + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and BATCH_GROUD_NO is null " : " and BATCH_GROUD_NO = '" + strGroupNo + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and PRODUCNAME is null " : " and PRODUCNAME = '" + strPro + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and STD_STYLE_DESC is null " : " and STD_STYLE_DESC = '" + strStdStyle + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and STEELNAME is null " : " and STEELNAME = '" + strSteel + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and SPEC_NAME is null " : " and SPEC_NAME = '" + strSpec + "' "; strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and MODEL_DESC is null " : " and MODEL_DESC = '" + strModel + "' "; try { table1.CaseSensitive = true; rows = table1.Select(strRowFilters); if (rows.Length > 0) { try { dWgt = decimal.Parse(Convert.ToString(rows[0]["WEIGHT"])); dCount = int.Parse(Convert.ToString(rows[0]["COUNT"])); } catch { dWgt = 0.0M; dCount = 0; } } else { dWgt = 0.0M; dCount = 0; } } catch { dWgt = 0.0M; dCount = 0; } try { table2.CaseSensitive = true; rows = table2.Select(strRowFilters); if (rows.Length > 0) { try { dThisIn_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"])); dThisIn_MonthCount = int.Parse(Convert.ToString(rows[0]["WEIGHT_MONTHCOUNT"])); } catch { dThisIn_Month = 0.0M; dThisIn_MonthCount = 0; } } else { dThisIn_Month = 0.0M; dThisIn_MonthCount = 0; } } catch { dThisIn_Month = 0.0M; dThisIn_MonthCount = 0; } try { table3.CaseSensitive = true; rows = table3.Select(strRowFilters); if (rows.Length > 0) { try { dThisOut_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"])); dThisOut_MonthCount = int.Parse(Convert.ToString(rows[0]["weight_monthcount"])); } catch { dThisOut_Month = 0.0M; dThisOut_MonthCount = 0; } } else { dThisOut_Month = 0.0M; dThisOut_MonthCount = 0; } } catch { dThisOut_Month = 0.0M; dThisOut_MonthCount = 0; } try { table4.CaseSensitive = true; rows = table4.Select(strRowFilters); if (rows.Length > 0) { try { dAjust = decimal.Parse(Convert.ToString(rows[0]["AWEIGHT"])); } catch { dAjust = 0.0M; } } else { dAjust = 0.0M; } } catch { dAjust = 0.0M; } try { newrow["JUDGE_STOVE_NO"] = strHeatNo; newrow["BATCH_NO"] = strBactchNo; newrow["BATCH_GROUD_NO"] = strGroupNo; newrow["PRODUCNAME"] = strPro; newrow["STD_STYLE_DESC"] = strStdStyle; newrow["STEELNAME"] = strSteel; newrow["SPEC_NAME"] = strSpec; newrow["MODEL_DESC"] = strModel; newrow["ORIGINAL_AMOUNT"] = Convert.ToString(dWgt).Trim(); newrow["ORIGINAL_COUNT"] = Convert.ToString(dCount).Trim(); newrow["MONTH_1"] = dThisIn_Month.ToString().Trim(); newrow["MONTH_1COUNT"] = dThisIn_MonthCount.ToString().Trim(); newrow["MONTH_2"] = dThisOut_Month.ToString().Trim(); newrow["MONTH_2COUNT"] = dThisOut_MonthCount.ToString().Trim(); newrow["END_AMOUNT"] = Convert.ToString(dWgt + dThisIn_Month - dThisOut_Month + dAjust).Trim(); newrow["END_COUNT"] = Convert.ToString(dCount + dThisIn_MonthCount - dThisOut_MonthCount).Trim(); newrow["AWEIGHT"] = Convert.ToString(dAjust).Trim(); try { if (ShapeRelation.Contains(strHeatNo)) { strSort = ShapeRelation[strHeatNo].ToString(); } else { strSort = ""; } } catch { strSort = ""; } this.dataSet1.Tables[0].Rows.Add(newrow); } catch { } } catch { } } 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("MONTH_1"); alist.Add("MONTH_1COUNT"); alist.Add("MONTH_2"); alist.Add("MONTH_2COUNT"); alist.Add("END_AMOUNT"); alist.Add("END_COUNT"); alist.Add("AWEIGHT"); CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true); } } catch { } } //本期调差量 private bool GetAdjust(string yearMothTim, string strWhere, out DataTable table, string[] arr) { table = null; DataSet set = new DataSet(); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getAdjust", new object[] { yearMothTim, strWhere, arr }, this.ob); if (ds != null && ds.Rows.Count > 0) { set.Tables.Add(ds); table = set.Tables[0]; return true; } return false; } //本期出库量 private bool GetThisOut(string yearMothTim, string strWhere, out DataTable table, string[] arr) { table = null; DataSet set = new DataSet(); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getThisOut", new object[] { yearMothTim, strWhere, arr }, this.ob); if (ds != null && ds.Rows.Count > 0) { set.Tables.Add(ds); table = set.Tables[0]; return true; } return false; } //本期入库量 private bool GetThisIn(string yearMothTim,string strWhere, out DataTable table, string[] arr) { table = null; DataSet set = new DataSet(); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getThisIn", new object[] { yearMothTim, strWhere, arr }, this.ob); if (ds != null && ds.Rows.Count > 0) { set.Tables.Add(ds); table = set.Tables[0]; return true; } return false; } //期初 private bool GetOriginalLast(string yearMothTim, string strWhere, out DataTable table, string[] arr) { table = null; DataSet set = new DataSet(); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRpt.getOriginalLast", new object[] { yearMothTim, strWhere, arr }, this.ob); if (ds != null && ds.Rows.Count > 0) { set.Tables.Add(ds); table = set.Tables[0]; return true; } return false; } private void cmbStoveNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { queryData(); } } private void chkStove_CheckedChanged(object sender, EventArgs e) { this.cmbStoveNo.Enabled = chkStove.Checked; } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (toolMenu == null) { return; } if (ultraTabControl1.SelectedTab.Key == "0") { if (toolMenu.Toolbars[0].Tools.Exists("Query1")) { toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("insertInital")) { toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("insertTal")) { toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Export")) { toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True; } this.chkStoreNo.Visible = true; this.cmbStoreNo.Visible = true; } if (ultraTabControl1.SelectedTab.Key == "1") { if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("insertTal")) { toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Export")) { toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Query1")) { toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("insertInital")) { toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.True; } this.chkStoreNo.Visible = false; this.cmbStoreNo.Visible = false; } } private void FrmRunTimeRpt_Shown(object sender, EventArgs e) { if (toolMenu == null) { return; } if (toolMenu.Toolbars[0].Tools.Exists("Query1")) { toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False; } //if (toolMenu.Toolbars[0].Tools.Exists("insertInital")) //{ // toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.False; //} if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("insertTal")) { toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Export")) { toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True; } } private void chkStoreNo_CheckedChanged(object sender, EventArgs e) { this.cmbStoreNo.Enabled = this.chkStoreNo.Checked; } } }