| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- 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.Tool;
- using System.Collections;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win.UltraWinMaskedEdit;
- using Core.Mes.Client.Comm.Control;
- namespace Core.StlMes.Client.SaleOrder.ReviewForm
- {
- public partial class frmSchedulingInfomation : FrmBase
- {
- public frmSchedulingInfomation()
- {
- IsLoadUserView = true;
- InitializeComponent();
- }
- private string flag = "0";
- public frmSchedulingInfomation(OpeBase _ob)
- {
- IsLoadUserView = true;
- InitializeComponent();
- this.ob = _ob;
- flag = "1";
- }
- private void frmSchedulingInfomation_Load(object sender, EventArgs e)
- {
- ultraCheckEditor2.Checked = true;
- EntityHelper.ShowGridCaption<SchedulingInfomationEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- InitDate();
- InitOrdNo();
- setOtherColumnReadOnly(ultraGrid1, new string[] { "" });
- InitCellPosition(ultraGrid1, new string[] { "OrderQty", "PlanedCount", "PlanedWeight", "AmountCount", "AmountWeight", "BillCount", "BillWeight", "OutCount", "OutWeight", "ZtCount", "ZtWeight" });
- GridColumnSum(ultraGrid1, new string[] { "OrderQty", "PlanedCount", "PlanedWeight", "AmountCount", "AmountWeight", "BillCount", "BillWeight", "OutCount", "OutWeight", "ZtCount", "ZtWeight" });
- setUltraGridColumnMaxInput(ultraGrid1, new string[] { "OrderQty", "PlanedWeight", "AmountWeight", "BillWeight", "OutWeight", "ZtWeight" });
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- DoQuery();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGrid1, "排产信息");
- break;
- case "Close":
- this.Close();
- break;
- case "Refresh":
- InitOrdNo();
- break;
- default:
- break;
- }
- }
- private void DoQuery()
- {
- string orderNo = "";
- if (ultraCheckEditor1.Checked)
- {
- orderNo = ultraComboEditor1.Text.Trim();
- }
- string begintime = "";
- string endtime = "";
- if (ultraCheckEditor2.Checked && udtStart.Value != null && udtEnd.Value != null)
- {
- begintime = udtStart.Value.ToString();
- endtime = udtEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
- }
- List<SchedulingInfomationEntity> listSource = EntityHelper.GetData<SchedulingInfomationEntity>(
- "com.steering.pss.sale.order.CoreSchedulingInfomation.getSchedulingInfo", new object[] { orderNo, begintime, endtime, this.ValidDataPurviewIds }, ob);
- schedulingInfomationEntityBindingSource.DataSource = listSource;
- }
- public void DoQueryByLnPk(string ordLnPk)
- {
- List<SchedulingInfomationEntity> listSource = EntityHelper.GetData<SchedulingInfomationEntity>(
- "com.steering.pss.sale.order.CoreSchedulingInfomation.getSchedulingInfoByLnPk", new object[] { ordLnPk }, ob);
- schedulingInfomationEntityBindingSource.DataSource = listSource;
- }
- private void InitOrdNo()
- {
- ultraComboEditor1.DataSource = null;
- String beginTime = udtStart.Value.ToString();
- String endTime = udtEnd.Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreConReviewInfo.getOrdNoByTime", new Object[] { beginTime, endTime }, this.ob);
- ultraComboEditor1.DataSource = dt;
- }
- /// <summary>
- /// 初始时间
- /// </summary>
- private void InitDate()
- {
- udtStart.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
- udtEnd.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1);
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckEditor1.Checked)
- {
- ultraComboEditor1.ReadOnly = false;
- }
- else
- {
- ultraComboEditor1.ReadOnly = true;
- }
- }
- private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckEditor2.Checked)
- {
- udtStart.ReadOnly = false;
- udtEnd.ReadOnly = false;
- }
- else
- {
- udtStart.ReadOnly = true;
- udtEnd.ReadOnly = true;
- }
- }
- /// <summary>
- /// UltraGrid可读
- /// </summary>
- /// <param name="ugr">UltraGrid</param>
- /// <param name="keys">可编辑列</param>
- private void setOtherColumnReadOnly(UltraGrid ugr, string[] keys)
- {
- keys.ToArray();
- foreach (UltraGridColumn ugc in ugr.DisplayLayout.Bands[0].Columns)
- {
- if (!keys.Contains(ugc.Key))
- {
- ugc.CellActivation = Activation.ActivateOnly;
- }
- }
- }
- /// <summary>
- /// 设置列字段显示位置在右
- /// </summary>
- /// <param name="ug">UltraGrid</param>
- /// <param name="columnsKeys">要设置的列</param>
- private void InitCellPosition(UltraGrid ug, string[] columnsKeys)
- {
- columnsKeys.ToArray();
- foreach (UltraGridColumn ugc in ug.DisplayLayout.Bands[0].Columns)
- {
- if (columnsKeys.Contains(ugc.Key.ToString()))
- {
- ugc.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
- }
- }
- }
- /// <summary>
- /// 列求和
- /// </summary>
- /// <param name="ug">UltraGrid</param>
- /// <param name="columnKeys">列数组</param>
- private void GridColumnSum(UltraGrid ug, string[] columnKeys)
- {
- if (columnKeys.Length == 0)
- {
- return;
- }
- for (int i = 0; i < columnKeys.Length; i++)
- {
- SummarySettings summary = ug.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, ug.DisplayLayout.Bands[0].Columns[columnKeys[i]], SummaryPosition.UseSummaryPositionColumn);
- summary.DisplayFormat = "{0}";
- summary.Appearance.TextHAlign = Infragistics.Win.HAlign.Right;
- }
- }
- /// <summary>
- /// 设置列显示位数
- /// </summary>
- /// <param name="ug"></param>
- /// <param name="arr"></param>
- private void setUltraGridColumnMaxInput(UltraGrid ug, string[] arr)
- {
- if (ug == null || arr == null || arr.Length == 0)
- {
- return;
- }
- arr.ToArray();
- foreach (UltraGridColumn ugc in ug.DisplayLayout.Bands[0].Columns)
- {
- if (arr.Contains(ugc.Key.ToString()))
- {
- ugc.MaskDisplayMode = MaskMode.IncludeLiterals;
- ugc.MaskInput = "{LOC}n,nnn,nnn.nnn";
- }
- }
- }
- private void ultraComboEditor1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- {
- DoQuery();
- }
- }
- }
- }
|