| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Mch.Report
- {
- public partial class FrmUnLoadReport : FrmBase
- {
- private string[] _plineCodes = {};
- public FrmUnLoadReport()
- {
- InitializeComponent();
- IsLoadUserView = true;
- }
- /// <summary>
- /// 合同信息
- /// </summary>
- protected List<string> ViewList = new List<string>
- {
- "JudgeStoveNo",
- "BatchNo",
- "PlineName",
- "Producname",
- "Steelname",
- "Gradename",
- "Outdiameter",
- "Wallthick",
- "ModelDesc",
- "OrderNoSeq",
- "PlanIndoubleNum",
- "PlanIndoubleWt",
- "ProCount",
- "ProWeight",
- "ActCount",
- "ActWeight"
- };
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- Query();
- break;
- case "Export":
- Export();
- break;
- case "DoClose":
- Close();
- break;
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- protected virtual void Export()
- {
- GridHelper.ulGridToExcel(CrackDetectGrid, Text);
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void Query()
- {
- var Message = "";
- var wf = new WaitingForm2("正在查询,请稍候....");
- try
- {
- Cursor = Cursors.WaitCursor;
- DataBindingSource.DataSource = EntityHelper.GetData<PlnZyJgxCEntity>(
- "com.steering.mes.mcp.Mch.FrmJgxReport.doQueryUnLoadReport",
- GetQueryCondition(),
- ob);
- GridHelper.RefreshAndAutoSizeExceptColumns(CrackDetectGrid, "ReportPath");
- }
- catch (Exception ex)
- {
- if (ex.Message.ToString2() != "")
- MessageBox.Show(ex.Message);
- }
- finally
- {
- wf.Close();
- Cursor = Cursors.Default;
- }
-
- }
- /// <summary>
- /// 按照区域重新排序
- /// </summary>
- private void Resort()
- {
- SortBand(ViewList, CrackDetectGrid.DisplayLayout.Bands[0]);
- }
- /// <summary>
- /// Band重新排序
- /// </summary>
- /// <param name="ColumnSeq"></param>
- /// <param name="band"></param>
- private void SortBand(List<string> ColumnSeq, UltraGridBand band)
- {
- foreach (var Columns in band.Columns)
- ResetColumns(Columns);
- var ColumnX = 0;
- for (var i = 0; i < ColumnSeq.Count; i++)
- {
- var Key = ColumnSeq[i];
- if (band.Columns.Exists(Key))
- {
- band.Columns[Key].Hidden = false;
- band.Columns[Key].RowLayoutColumnInfo.OriginX = 2 * ColumnX++;
- band.Columns[Key].RowLayoutColumnInfo.OriginY = 0;
- }
- }
- }
- /// <summary>
- /// 重置字段属性,或绑定
- /// </summary>
- /// <param name="Columns"></param>
- protected virtual void ResetColumns(UltraGridColumn Columns)
- {
- Columns.Hidden = true;
- Columns.CellActivation = Activation.ActivateOnly;
-
- }
- /// <summary>
- /// 获取查询区域参数
- /// </summary>
- /// <returns></returns>
- protected object[] GetQueryCondition()
- {
-
-
- var OrderNo = "";
- var JudgeStoveNo = "";
- var BatchNo = "";
- if (chkOrderNo.Checked)
- OrderNo = txtOrderNo.Text;
- if (chkJudgeStove.Checked)
- JudgeStoveNo = txtJudgeStove.Text;
- if (chkBatchNo.Checked)
- BatchNo = txtBatchNo.Text;
- return new object[]
- {
- chkPlineCode.Checked && (cboPline.CheckedItems.Count > 0)
- ? cboPline.CheckedItems.Select(p => p.DataValue.ToString()).ToArray()
- : _plineCodes,OrderNo, JudgeStoveNo, BatchNo,chkExitsC.Checked?"1":"0",chkExitsL.Checked?"1":"0"
- };
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- EntityHelper.ShowGridCaption<PlnZyJgxCEntity>(CrackDetectGrid.DisplayLayout.Bands[0]);
- Resort();
- SetStaticsInfoSum( ref CrackDetectGrid, new List<string>()
- {
- "PlanIndoubleNum",
- "PlanIndoubleWt",
- "ProCount",
- "ProWeight",
- "ActCount",
- "ActWeight"
- }, true, true);
- if (ob == null) return;
- _plineCodes = comm.InitDropPlineCodePower("G", cboPline, ValidDataPurviewIds, ob);
- Query();
- }
- private void chkStarts_CheckedChanged(object sender, EventArgs e)
- {
-
- txtOrderNo.Enabled = chkOrderNo.Checked;
- txtJudgeStove.Enabled = chkJudgeStove.Checked;
- txtBatchNo.Enabled = chkBatchNo.Checked;
-
- txtOrderNo.Visible = chkOrderNo.Checked;
- txtJudgeStove.Visible = chkJudgeStove.Checked;
- txtBatchNo.Visible = chkBatchNo.Checked;
- cboPline.Visible = chkPlineCode.Checked;
- }
- /// <summary>
- /// 汇总方法
- /// </summary>
- /// <param name="myGrid1"></param>
- /// <param name="alistColumns"></param>
- /// <param name="clearExists"></param>
- protected void SetStaticsInfoSum(ref UltraGrid myGrid1, List<string> alistColumns, bool clearExists,bool ShowCount)
- {
- try
- {
- var band = myGrid1.DisplayLayout.Bands[0];
- if (clearExists)
- band.Summaries.Clear();
- band.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
- for (var i = 0; i < alistColumns.Count; i++)
- {
- try
- {
- if (!band.Columns.Exists(alistColumns[i])) continue;
- var summary = band.Summaries.Add(SummaryType.Sum, band.Columns[alistColumns[i]]);
- summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
- summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
- summary.DisplayFormat = "{0}";
- summary.Appearance.TextHAlign = HAlign.Right;
- summary.Appearance.TextVAlign = VAlign.Middle;
- summary.Appearance.FontData.Bold = DefaultableBoolean.True;
- }
- catch
- {
- // ignored
- }
- }
- if (ShowCount )
- {
- var summary = band.Summaries.Add(SummaryType.Count, band.Columns[0]);
- summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
- summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
- summary.DisplayFormat = "共{0}条记录";
- summary.Appearance.TextHAlign = HAlign.Left;
- summary.Appearance.TextVAlign = VAlign.Middle;
- summary.Appearance.FontData.Bold = DefaultableBoolean.True;
- }
- }
- catch
- {
- }
- }
-
- }
- }
|