| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
- using Core.StlMes.Client.PlnSaleOrd.工序排产;
- using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
- using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.PlnSaleOrd.炉计划
- {
- public partial class FrmPlanStoveH : FrmBase
- {
- private ArrayList _EntityList = null;
- private string[] plineCode = null;//获取产线代码
- /// <summary>
- /// 虚拟炉计划id
- /// </summary>
- private string _heatPlanNo = "";
- /// <summary>
- /// 行首背景色
- /// </summary>
- private Color _backColor = new Color();
- public FrmPlanStoveH()
- {
- this.IsLoadUserView = true;
- InitializeComponent();
- }
- private void FrmPlanStoveG_Load(object sender, EventArgs e)
- {
- //订单排产
- EntityHelper.ShowGridCaption<PlnZyJgMEntity>(ultraGridZy.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnZyJgReadyEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- BaseHelper.setOtherColumnReadOnly(ultraGridZy, new string[] { "CHC" });
- BaseHelper.setUltraGridColumnMaxInput(ultraGridZy, new string[] { "PlanBlWt","Singleweight" });
- BaseHelper.setUltraGridColumnBits(ultraGridZy, new string[] { "SingleCutNun", "PlanBlNum", "PlanJgNum"});
- BaseHelper.InitCellPosition(ultraGridZy, new string[] { "GxProSeq", "GxPlanNo","PlanBlWt", "Diameter", "SingleCutNun","PlanBlNum","PlanJgNum","Aimlength","CheckJVal","Outdiameter","Wallthick",
- "LengthMax","LengthMin","AimCutLen","AimlengthBl","MinH","MinD"});
- BaseHelper.GridColumnSum(ultraGridZy, new string[] { "PlanBlWt" });
- BaseHelper.GridColumnCount(ultraGridZy, new string[] { "PlanBlNum", "PlanJgNum"});
- plineCode = PlanHelper.InitDropPlinePower("H", txtLine, this.ValidDataPurviewIds, this.ob);
- StoveHelper.ForbidSort(ultraGridZy);
- BaseHelper.setOtherColumnReadOnly(ultraGrid1, new string[] { "CHC" });
- BaseHelper.setUltraGridColumnMaxInput(ultraGrid1, new string[] { "PlanBlWt", "Singleweight", "UseBlWt" });
- BaseHelper.setUltraGridColumnBits(ultraGrid1, new string[] { "SingleCutNun", "PlanBlNum", "PlanJgNum", "UseBlNum", "OutJgNum" });
- BaseHelper.InitCellPosition(ultraGrid1, new string[] { "GxProSeq", "GxPlanNo","PlanBlWt", "Diameter", "SingleCutNun","PlanBlNum","PlanJgNum","Aimlength","CheckJVal","Outdiameter","Wallthick",
- "LengthMax","LengthMin","AimCutLen","AimlengthBl","MinH","MinD","UseBlNum", "UseBlWt", "OutJgNum"});
- BaseHelper.GridColumnSum(ultraGrid1, new string[] { "UseBlWt"});
- BaseHelper.GridColumnCount(ultraGrid1, new string[] { "OutJgNum", "UseBlNum" });
- StoveHelper.ForbidSort(ultraGrid1);
- InitDate();
- BaseHelper.SetGroupBySum(ultraGrid1, new string[] { "PlanBlWt", "PlanBlNum", "PlanJgNum" }, "HeatPlanNo");
- }
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- StoveHelper.CustomMergedCellEvaluator merge = new StoveHelper.CustomMergedCellEvaluator("HeatPlanNo");
- e.Layout.Bands[0].Columns["HeatPlanNo"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["HeatPlanNo"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["JudgeStoveNo"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["JudgeStoveNo"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["StoveNo"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["StoveNo"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["PlanBlNum"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["PlanBlNum"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["PlanBlWt"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["PlanBlWt"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["PlanJgNum"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["PlanJgNum"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["FlagStoveNo"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["FlagStoveNo"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["GxProSeq"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["GxProSeq"].MergedCellEvaluator = merge;
- e.Layout.Bands[0].Columns["Planstatus"].MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["Planstatus"].MergedCellEvaluator = merge;
-
- }
- /// <summary>
- /// 初始时间
- /// </summary>
- private void InitDate()
- {
- DateTime datetime = DateTime.Now;
- dateBegin.Value = datetime.AddDays(1 - datetime.Day);
- dateEnd.Value = datetime.AddDays(1 - datetime.Day).AddMonths(1).AddDays(-1);
- }
- private void chcLine_CheckedChanged(object sender, EventArgs e)
- {
- if (chcLine.Checked) { txtLine.Enabled = true; } else { txtLine.Enabled = false; }
- if (chcProPlanId.Checked) { txtProPlanId.Enabled = true; } else { txtProPlanId.Enabled = false; }
- if (chcOrderNo.Checked) { txtOrderNo.Enabled = true; } else { txtOrderNo.Enabled = false; }
- if (chcId.Checked) { txtId.Enabled = true; } else { txtId.Enabled = false; }
- if (chcTime.Checked) { dateBegin.Enabled = true; dateEnd.Enabled = true; } else { dateBegin.Enabled = false; dateEnd.Enabled = false; }
- if (chcJudgeNo.Checked) { txtJudgeNo.Enabled = true; } else { txtJudgeNo.Enabled = false; }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query"://查询
- Query();
- break;
- case "Export": //导出
- Export();
- break;
- case "UpdateLoadFlag":
- updateLoadFlag();
- break;
- case "Close": //关闭
- this.Close();
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 标识库位不变
- /// </summary>
- private void updateLoadFlag()
- {
- this.ultraGridZy.UpdateData();
- UltraGridRow row = this.ultraGridZy.ActiveRow;
- if (row == null)
- {
- return;
- }
- ArrayList parmList = new ArrayList();
- PlnZyJgMEntity plnDbkTity = (PlnZyJgMEntity)row.ListObject;
- string plnZgEntity = JSONFormat.Format(plnDbkTity);
- parmList.Add(plnZgEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveH";
- ccp.MethodName = "updateLoadFlag";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QueryM();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void Query()
- {
- if (ultraExpandableGroupBox1.Expanded == false)
- {
- QueryC();
- }
- else
- {
- QueryM();
- }
- }
- private int activation = 0;
- /// <summary>
- /// 导出
- /// </summary>
- private void Export()
- {
- if (activation < 2)
- {
- GridHelper.ulGridToExcel(ultraGridZy, "接箍炉计划主信息");
- }
- else
- {
- GridHelper.ulGridToExcel(ultraGrid1, "接箍炉计划详情");
- }
- }
- /// <summary>
- /// 查询接箍虚拟炉计划
- /// </summary>
- private void QueryM()
- { //产线
- string plineCode = "";
- if (chcLine.Checked)
- {
- plineCode = txtLine.Value == null ? "" : txtLine.Value.ToString();
- }
- //if (txtLine.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("请选择产线!");
- // return;
- //}
- string timeBegin = "";
- string timeEnd = "";
- if (chcTime.Checked && dateBegin.Value != null && dateEnd.Value != null)
- {
- timeBegin = DateTime.Parse(dateBegin.Value.ToString()).ToString("yyyy-MM-dd");
- timeEnd = DateTime.Parse(dateEnd.Value.ToString()).ToString("yyyy-MM-dd");
- }
- string orderNo = "";
- if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
- string proPlanId = "";
- if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
- string heatId = "";
- if (chcId.Checked) { heatId = txtId.Text.Trim(); }
- string judgeNo = "";
- if (chcJudgeNo.Checked) { judgeNo = txtJudgeNo.Text.Trim(); }
- //执行状态
- string[] statusArr = contorlPlanStatusZy1.statusArr;
- List<PlnZyJgMEntity> listSource = EntityHelper.GetData<PlnZyJgMEntity>
- ("com.steering.pss.plnsaleord.planStove.FrmPlanStoveH.queryPlanStoveYzH", new object[] { timeBegin, timeEnd, plineCode, orderNo, proPlanId, heatId, statusArr, judgeNo, "" }, this.ob);
- plnZyJgMEntityBindingSource.DataSource = listSource;
- foreach (UltraGridRow ugr in ultraGridZy.Rows)
- {
- int countMess = 0;
- if (!_heatPlanNo.Equals(""))
- {
- if (ugr.Cells["HeatPlanNo"].Text.Trim().Equals(_heatPlanNo))
- {
- ugr.Activate();
- break;
- }
- }
- if (_EntityList != null)
- {
- for (int i = 0; i < _EntityList.Count; i++)
- {
- PlnZyJgxMEntity entity = (PlnZyJgxMEntity)_EntityList[i];
- if (ugr.Cells["HeatPlanNo"].Text.Trim().Equals(entity.HeatPlanNo))
- {
- ugr.Appearance.BackColor = Color.Wheat;
- ugr.Activate();
- }
- }
- }
- }
- _EntityList = null;
- _heatPlanNo = "";
- }
- /// <summary>
- /// 查询镦拔扩实际炉计划
- /// </summary>
- private void QueryC()
- {
- //产线
- string plineCode = "";
- if (chcLine.Checked)
- {
- plineCode = txtLine.Value == null ? "" : txtLine.Value.ToString();
- }
- //if (txtLine.Text.Equals(""))
- //{
- // MessageUtil.ShowTips("请选择产线!");
- // return;
- //}
- string timeBegin = "";
- string timeEnd = "";
- if (chcTime.Checked && dateBegin.Value != null && dateEnd.Value != null)
- {
- timeBegin = DateTime.Parse(dateBegin.Value.ToString()).ToString("yyyy-MM-dd");
- timeEnd = DateTime.Parse(dateEnd.Value.ToString()).ToString("yyyy-MM-dd");
- }
- string orderNo = "";
- if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
- string proPlanId = "";
- if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
- string heatId = "";
- if (chcId.Checked) { heatId = txtId.Text.Trim(); }
- string judgeNo = "";
- if (chcJudgeNo.Checked) { judgeNo = txtJudgeNo.Text.Trim(); }
- string feedNo = "";
- //执行状态
- string[] statusArr = contorlPlanStatusZy1.statusArr;
- List<PlnZyJgReadyEntity> listSource = EntityHelper.GetData<PlnZyJgReadyEntity>
- ("com.steering.pss.plnsaleord.planStove.FrmPlanStoveH.queryPlnZyDbkReadyById", new object[] { timeBegin, timeEnd, plineCode, orderNo, proPlanId, heatId, statusArr, judgeNo, "" }, this.ob);
- plnZyJgReadyEntityBindingSource.DataSource = listSource;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- //没有实际炉计划,主炉计划变颜色
- if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
- {
- ugr.Appearance.BackColor = Color.Orange;
- }
- }
- }
- private void ultraGridZy_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow row = ultraGridZy.ActiveRow;
- if (row == null) return;
- QueryMRow(row.Cells["HeatPlanNo"].Text.ToString().Trim());
- }
- private void QueryMRow(string heatPlanNo)
- {
- List<PlnZyJgReadyEntity> listSourceM = EntityHelper.GetData<PlnZyJgReadyEntity>
- ("com.steering.pss.plnsaleord.planStove.FrmPlanStoveH.queryPlanStoveRow", new object[] { heatPlanNo }, ob);
- plnZyJgReadyEntityBindingSource.DataSource = listSourceM;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- //没有实际炉计划,主炉计划变颜色
- if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
- {
- //ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
- ugr.Appearance.BackColor = Color.Orange;
- }
- }
- }
- private int splitterDistance = 0;
- int count1 = 0;
- int count2 = 0;
- private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (ultraExpandableGroupBox1.Expanded == false)
- {
- this.splitContainer1.SplitterDistance = 26;
- count1 = 26;
- }
- else
- {
- if (ultraExpandableGroupBox2.Expanded == false)
- {
- this.splitContainer1.SplitterDistance = splitContainer1.Size.Height - 26;
- }
- else
- {
- this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
- }
- count1 = splitContainer1.Size.Height - 26;
- }
- }
- private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (ultraExpandableGroupBox2.Expanded == false)
- {
- if (count1 == 0) { count1 = splitContainer1.Size.Height - 26; }
- this.splitContainer1.SplitterDistance = count1;
- }
- else
- {
- if (ultraExpandableGroupBox1.Expanded == false)
- {
- this.splitContainer1.SplitterDistance = 26;
- }
- else
- {
- //this.splitContainer1.SplitterDistance = count1;
- this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
- }
- }
- }
- private void ultraGridZy_Click(object sender, EventArgs e)
- {
- activation = 1;
- }
- private void ultraGridZy_ClickCell(object sender, ClickCellEventArgs e)
- {
- activation = 1;
- }
- private void ultraGrid1_Click(object sender, EventArgs e)
- {
- activation = 2;
- }
- private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
- {
- activation = 2;
- }
-
-
- }
- }
|