| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838 |
- 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;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
- using Core.StlMes.Client.PlnSaleOrd.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.PlnSaleOrd
- {
- public partial class FrmProcessOrder : FrmBase
- {
- public FrmProcessOrder()
- {
- this.IsLoadUserView = true;
- InitializeComponent();
- System.Threading.Thread t = new System.Threading.Thread(setGridColunmName);
- t.Start();
- }
- private void setGridColunmName()
- {
- System.Threading.Thread.Sleep(3000);
- if (!this.IsDisposed)
- {
- EntityHelper.ShowGridCaption<PlnReqinfGpEntity>(ultraGridGP.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderDzEntity>(ultraGridDZ.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderZgEntity>(ultraGridZG.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderDbkEntity>(ultraGridDBK.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderRclEntity>(ultraGridRCL.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderJgxEntity>(ultraGridJG.DisplayLayout.Bands[0]);
- }
- }
- private void FrmProcessOrder_Load(object sender, EventArgs e)
- {
- ultraComboFinishEditor.SelectedIndex = 0;
- EntityHelper.ShowGridCaption<PlnReqinfGpEntity>(ultraGridGP.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderDzEntity>(ultraGridDZ.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderZgEntity>(ultraGridZG.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderDbkEntity>(ultraGridDBK.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderRclEntity>(ultraGridRCL.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnOrderJgxEntity>(ultraGridJG.DisplayLayout.Bands[0]);
- //设置可读
- BaseHelper.setOtherColumnReadOnly(ultraGridGP, new string[] { "CHC" });
- BaseHelper.setOtherColumnReadOnly(ultraGridDZ, new string[] { "CHC" });
- BaseHelper.setOtherColumnReadOnly(ultraGridZG, new string[] { "CHC" });
- BaseHelper.setOtherColumnReadOnly(ultraGridDBK, new string[] { "CHC" });
- BaseHelper.setOtherColumnReadOnly(ultraGridRCL, new string[] { "CHC" });
- BaseHelper.setOtherColumnReadOnly(ultraGridJG, new string[] { "CHC" });
- InitUpTime();
- userControlSaleordProc1.UltraGridSaleordProc1.AfterRowActivate += UltraGridSaleordProc1_AfterRowActivate;
- PlanComm.setGridDigitalCol(ultraGridZG.DisplayLayout.Bands[0], 5, 0, "BacklogSeq",
- "OutnumSingle", "Ordernum", "MatchNum", "ReqProdNum");
- PlanComm.setGridDigitalCol(ultraGridZG.DisplayLayout.Bands[0], 5, 2, "Outdiameter",
- "Wallthick", "Aimwallthick", "Lengthmax", "Lengthmin", "Aimlength", "RollLength",
- "OutLength", "DiameterGp", "LengthGp");
- PlanComm.setGridDigitalCol(ultraGridZG.DisplayLayout.Bands[0], 7, 3, "Finishweight",
- "ReqProdWt", "BuyplanWt", "MatchWt", "Orderweight", "WeightGpOne", "Getrate");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 5, 0, "BacklogSeq",
- "OutnumSingle", "Ordernum", "MatchNum", "ReqProdNum");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 5, 2, "Outdiameter",
- "Wallthick", "Aimwallthick", "Lengthmax", "Lengthmin", "Aimlength");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 7, 3, "Finishweight",
- "ReqProdWt", "BuyplanWt", "MatchWt", "Orderweight", "Getrate");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 5, 0, "BacklogSeq",
- "OutnumSingle", "Ordernum", "MatchNum", "ReqProdNum");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 5, 2, "Outdiameter",
- "Wallthick", "Aimwallthick", "Lengthmax", "Lengthmin", "Aimlength", "LengthmaxIn", "LengthminIn");
- PlanComm.setGridDigitalCol(ultraGridJG.DisplayLayout.Bands[0], 7, 3, "Finishweight",
- "ReqProdWt", "BuyplanWt", "MatchWt", "Orderweight", "Getrate");
- }
- /// <summary>
- /// 初始化时间
- /// </summary>
- private void InitUpTime()
- {
- BeginTime.Value = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString());
- EndTime.Value = DateTime.Parse(DateTime.Now.AddDays(1).AddSeconds(-1).ToString());
- }
- private void Chc_CheckedChanged(object sender, EventArgs e)
- {
- if (ChcTime.Checked)
- { BeginTime.Enabled = true; EndTime.Enabled = true; }
- else
- { BeginTime.Enabled = false; EndTime.Enabled = false; }
- if (ChcOrderNo.Checked)
- { TxtOrderNo.ReadOnly = false; }
- else
- { TxtOrderNo.ReadOnly = true; }
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- DoQuery();
- break;
- case "Export":
- if (TabControl1.SelectedTab.Key.Equals("1"))
- {
- userControlSaleordProc1.Export();
- }
- else
- {
- GridHelper.ulGridToExcel(UltraGirdBLInfo, "备料需求");
- }
- break;
- case "Close":
- this.Close();
- break;
- case "PLINECHANGE":
- MscPlineChange();
- break;
- }
- }
- private void DoQuery()
- {
- QueryOrderInfo();
- }
- /// <summary>
- /// 查询销售合同
- /// </summary>
- private void QueryOrderInfo()
- {
- String orderNo = "";
- String beginTime = "";
- String endTime = "";
- String isFinish = "";
- if (ChcOrderNo.Checked)
- {
- orderNo = TxtOrderNo.Text.Trim();
- }
- if (ChcTime.Checked && BeginTime.Value != null && EndTime.Value != null)
- {
- beginTime = BeginTime.Value.ToString();
- endTime = EndTime.Value.ToString();
- }
- if (checkBoxFinish.Checked)
- {
- isFinish = ultraComboFinishEditor.Value.ToString();
- }
- userControlSaleordProc1.Query(orderNo, beginTime, endTime, isFinish, this.ob);
- UltraGridRow ugr = userControlSaleordProc1.getActiveRow();
- if (ugr == null)
- {
- plnReqinfGpEntityBindingSource.Clear();
- plnOrderDzEntityBindingSource.Clear();
- plnOrderZgEntityBindingSource.Clear();
- plnOrderDbkEntityBindingSource.Clear();
- plnOrderRclEntityBindingSource.Clear();
- plnOrderJgxEntityBindingSource.Clear();
- }
- }
- /// <summary>
- /// 查询铸造工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- //private void QueryGP(string ordLnDlyPk, string plnDivideId, string orderSource)
- //{
- // ArrayList param = new ArrayList();
- // param.Add(ordLnDlyPk);
- // param.Add(plnDivideId);
- // param.Add(orderSource);
- // //List<PlnOrderZgEntity> listZG = EntityHelper.GetData<PlnOrderZgEntity>
- // // ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryGP", new object[] { param }, this.ob);
- // //plnReqinfGpEntityBindingSource.DataSource = listZG;
- //}
- /// <summary>
- /// 查询锻造工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- //private void QueryDZ(string ordLnDlyPk, string plnDivideId, string orderSource)
- //{
- // ArrayList param = new ArrayList();
- // param.Add(ordLnDlyPk);
- // param.Add(plnDivideId);
- // param.Add(orderSource);
- // List<PlnOrderZgEntity> listZG = EntityHelper.GetData<PlnOrderZgEntity>
- // ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryDZ", new object[] { param }, this.ob);
- // plnOrderDzEntityBindingSource.DataSource = listZG;
- //}
- /// <summary>
- /// 查询轧管工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- private void QueryZG(string ordLnDlyPk, string plnDivideId, string orderSource)
- {
- ArrayList param = new ArrayList();
- param.Add(ordLnDlyPk);
- param.Add(plnDivideId);
- param.Add(orderSource);
- List<PlnOrderZgEntity> listZG = EntityHelper.GetData<PlnOrderZgEntity>
- ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryZG", new object[] { param }, this.ob);
- plnOrderZgEntityBindingSource.DataSource = listZG;
- }
- /// <summary>
- /// 查询墩拔扩工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- private void QueryDBK(string ordLnDlyPk, string plnDivideId, string orderSource)
- {
- ArrayList param = new ArrayList();
- param.Add(ordLnDlyPk);
- param.Add(plnDivideId);
- param.Add(orderSource);
- List<PlnOrderDbkEntity> listDBK = EntityHelper.GetData<PlnOrderDbkEntity>
- ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryDBK", new object[] { param }, this.ob);
- plnOrderDbkEntityBindingSource.DataSource = listDBK;
- }
- /// <summary>
- /// 查询热处理工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- private void QueryRCL(string ordLnDlyPk, string plnDivideId, string orderSource)
- {
- ArrayList param = new ArrayList();
- param.Add(ordLnDlyPk);
- param.Add(plnDivideId);
- param.Add(orderSource);
- List<PlnOrderRclEntity> listRCL = EntityHelper.GetData<PlnOrderRclEntity>
- ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryRCL", new object[] { param }, this.ob);
- plnOrderRclEntityBindingSource.DataSource = listRCL;
- }
- /// <summary>
- /// 查询加工工序
- /// </summary>
- /// <param name="ordLnDlyPk">交货行号</param>
- /// <param name="plnDivideId">排产流水号</param>
- private void QueryJG(string ordLnDlyPk, string plnDivideId, string orderSource)
- {
- ArrayList param = new ArrayList();
- param.Add(ordLnDlyPk);
- param.Add(plnDivideId);
- param.Add(orderSource);
- List<PlnOrderJgxEntity> listJG = EntityHelper.GetData<PlnOrderJgxEntity>
- ("com.steering.pss.plnsaleord.processOrder.CoreProcessOrder.queryJG", new object[] { param }, this.ob);
- plnOrderJgxEntityBindingSource.DataSource = listJG;
- }
- private void checkBoxFinish_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBoxFinish.Checked)
- {
- ultraComboFinishEditor.Enabled = true;
- }
- else
- {
- ultraComboFinishEditor.Enabled = false;
- }
- }
- /// <summary>
- /// 销售合同
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void UltraGridSaleordProc1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = userControlSaleordProc1.getActiveRow();
- if (ugr == null)
- {
- return;
- }
- string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text.Trim();
- string plnDivideId = ugr.Cells["PlnDivideId"].Text.Trim();
- string orderSource = "销售合同";
- #region 显示经过的工序
- string processSeq = ugr.Cells["ProcessSeq"].Value.ToString();
- if (processSeq.Contains("A") || processSeq.Contains("B"))
- {
- TabControl2.Tabs["1"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["1"].Enabled = false;
- }
- if (processSeq.Contains("C"))
- {
- TabControl2.Tabs["2"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["2"].Enabled = false;
- }
- if (processSeq.Contains("D"))
- {
- TabControl2.Tabs["3"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["3"].Enabled = false;
- }
- if (processSeq.Contains("E"))
- {
- TabControl2.Tabs["4"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["4"].Enabled = false;
- }
- if (processSeq.Contains("F"))
- {
- TabControl2.Tabs["5"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["5"].Enabled = false;
- }
- if (processSeq.Contains("G"))
- {
- TabControl2.Tabs["6"].Enabled = true;
- }
- else
- {
- TabControl2.Tabs["6"].Enabled = false;
- }
- #endregion
- //if (TabControl2.ActiveTab.Key.Equals("1"))
- //{
- // QueryGP(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else if (TabControl2.ActiveTab.Key.Equals("2"))
- //{
- // QueryDZ(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else
-
- if (TabControl2.ActiveTab.Key.Equals("3"))
- {
- QueryZG(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (TabControl2.ActiveTab.Key.Equals("4"))
- {
- QueryDBK(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (TabControl2.ActiveTab.Key.Equals("5"))
- {
- QueryRCL(ordLnDlyPk, plnDivideId, orderSource);
- }
- else
- {
- QueryJG(ordLnDlyPk, plnDivideId, orderSource);
- }
- }
- /// <summary>
- /// 备料需求
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void UltraGirdBLInfo_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = UltraGirdBLInfo.ActiveRow;
- if (ugr == null)
- { return; }
- string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text.Trim();
- string plnDivideId = ugr.Cells["PlnDivideId"].Text.Trim();
- string orderSource = "备料需求";
- //if (TabControl2.ActiveTab.Key.Equals("1"))
- //{
- // QueryGP(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else if (TabControl2.ActiveTab.Key.Equals("2"))
- //{
- // QueryDZ(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else
- if (TabControl2.ActiveTab.Key.Equals("3"))
- {
- QueryZG(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (TabControl2.ActiveTab.Key.Equals("4"))
- {
- QueryDBK(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (TabControl2.ActiveTab.Key.Equals("5"))
- {
- QueryRCL(ordLnDlyPk, plnDivideId, orderSource);
- }
- else
- {
- QueryJG(ordLnDlyPk, plnDivideId, orderSource);
- }
- }
- /// <summary>
- /// TAB页切换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void TabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- UltraGridRow ugr = null;
- string orderSource = "";
- if (TabControl1.SelectedTab.Key.Equals("1"))
- {
- ugr = userControlSaleordProc1.getActiveRow();
- orderSource = "销售合同";
- }
- else
- {
- ugr = UltraGirdBLInfo.ActiveRow;
- orderSource = "备料需求";
- }
- if (ugr == null)
- { return; }
- string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text.Trim();
- string plnDivideId = ugr.Cells["PlnDivideId"].Text.Trim();
- //if (e.Tab.Key.Equals("1"))
- //{
- // QueryGP(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else if (e.Tab.Key.Equals("2"))
- //{
- // QueryDZ(ordLnDlyPk, plnDivideId, orderSource);
- //}
- //else
- if (e.Tab.Key.Equals("3"))
- {
- QueryZG(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (e.Tab.Key.Equals("4"))
- {
- QueryDBK(ordLnDlyPk, plnDivideId, orderSource);
- }
- else if (e.Tab.Key.Equals("5"))
- {
- QueryRCL(ordLnDlyPk, plnDivideId, orderSource);
- }
- else
- {
- QueryJG(ordLnDlyPk, plnDivideId, orderSource);
- }
- }
- /// <summary>
- /// 制程变更
- /// </summary>
- private void MscPlineChange()
- {
- //当前工序选择行
- IQueryable<UltraGridRow> ugrs = null;
- //当前工序
- string nowProcess = "";
- if (TabControl2.ActiveTab.Key.Equals("1"))
- {
- ultraGridGP.UpdateData();
- ugrs = ultraGridGP.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "B";
- }
- else if (TabControl2.ActiveTab.Key.Equals("2"))
- {
- ultraGridDZ.UpdateData();
- ugrs = ultraGridDZ.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "C";
- }
- else if (TabControl2.ActiveTab.Key.Equals("3"))
- {
- ultraGridZG.UpdateData();
- ugrs = ultraGridZG.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "D";
- }
- else if (TabControl2.ActiveTab.Key.Equals("4"))
- {
- ultraGridDBK.UpdateData();
- ugrs = ultraGridDBK.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "E";
- }
- else if (TabControl2.ActiveTab.Key.Equals("5"))
- {
- ultraGridRCL.UpdateData();
- ugrs = ultraGridRCL.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "F";
- }
- else
- {
- ultraGridJG.UpdateData();
- ugrs = ultraGridJG.Rows.AsQueryable().Where(" CHC = 'True' ");
- nowProcess = "G";
- }
- if (ugrs == null || ugrs.Count() == 0)
- {
- MessageUtil.ShowWarning("请选择一条工序记录进行制程变更!");
- return;
- }
- UltraGridRow ugr = ugrs.First();
- //交货行主键
- string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text;
- //排产流水号
- string plnDivideId = ugr.Cells["PlnDivideId"].Text;
- //联动组号
- string planGroupId = ugr.Cells["PlanGroupId"].Text;
-
- //工序完成量
- double finishWgtB = Convert.ToDouble(finishWeight.Value.ToString());
- UltraGridRow ugrProduc = userControlSaleordProc1.getActiveRow();
- //成品排产量
- double planWgt = double.Parse(ugrProduc.Cells["PlanWtD"].Text);
- string mscPline = ugrProduc.Cells["ProcessSeq"].Text;
- //合同行
- string orderNoSeq = ugrProduc.Cells["OrderNoSeq"].Text;
- //合同来源
- string orderSource = ugrProduc.Cells["OrderSource"].Text;
- //成品完成量
- double finishWgtE = 0;
- //判断是否为制程最后一道工序
- if (mscPline.Substring(mscPline.Length - 1).Equals(nowProcess))
- {
- finishWgtE = finishWgtB;
- }
- else
- {
- finishWgtE = finishWgtB;
- string[] processes = mscPline.Split('-');
- //标识(用于判断是否当前工序,如果还没有到当前工序,则继续循环,否则直接计划成品完成量)
- Boolean flag = false;
- for (int i = 0; i < processes.Length; i++)
- {
- if (!flag)
- {
- if (processes[i].Equals(nowProcess))
- {
- flag = true;
- }
- }
- else
- {
- double getRate = GetRate(processes[i], ordLnDlyPk, plnDivideId, planGroupId);
- finishWgtE = finishWgtE * getRate;
- }
- }
- }
- if (finishWgtE > planWgt)
- {
- MessageUtil.ShowWarning("工序成品完成量:" + finishWgtE + "吨大于排产分配量:" + planWgt + "吨");
- return;
- }
- FrmMscPlineChange frmMscPlineChange = new FrmMscPlineChange(ordLnDlyPk, nowProcess, plnDivideId,
- planGroupId, finishWgtB, finishWgtE, this.ob, orderNoSeq, orderSource);
- if (!getOrdFistProFinishWt(ordLnDlyPk, plnDivideId, this.ob) && finishWgtB <= 0)
- {
- frmMscPlineChange.ultraToolbarsManager1.Tools["修改"].SharedProps.Visible = true;
- frmMscPlineChange.ultraToolbarsManager1.Tools["新增"].SharedProps.Visible = false;
- frmMscPlineChange.ultraToolbarsManager1.Tools["下发"].SharedProps.Visible = false;
- frmMscPlineChange.ultraToolbarsManager1.Tools["删除"].SharedProps.Visible = false;
- }
- frmMscPlineChange.ShowDialog();
- DoQuery();
- ugrs = userControlSaleordProc1.UltraGridSaleordProc1.Rows.AsQueryable().Where(" OrdLnDlyPk = '" + ordLnDlyPk + "' ");
- ugrs = ugrs.AsQueryable().Where(" PlnDivideId = '" + plnDivideId + "' ");
- if (ugrs != null && ugrs.Count() > 0)
- {
- userControlSaleordProc1.UltraGridSaleordProc1.ActiveRow = ugrs.First();
- }
- }
- private void ultraGrid_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugrActive = null;
- UltraGrid ug = null;
- if (TabControl2.ActiveTab.Key.Equals("1"))
- {
- ug = ultraGridGP;
- ugrActive = ultraGridGP.ActiveRow;
- }
- else if (TabControl2.ActiveTab.Key.Equals("2"))
- {
- ug = ultraGridDZ;
- ugrActive = ultraGridDZ.ActiveRow;
- }
- else if (TabControl2.ActiveTab.Key.Equals("3"))
- {
- ug = ultraGridZG;
- ugrActive = ultraGridZG.ActiveRow;
- }
- else if (TabControl2.ActiveTab.Key.Equals("4"))
- {
- ug = ultraGridDBK;
- ugrActive = ultraGridDBK.ActiveRow;
- }
- else if (TabControl2.ActiveTab.Key.Equals("5"))
- {
- ug = ultraGridRCL;
- ugrActive = ultraGridRCL.ActiveRow;
- }
- else
- {
- ug = ultraGridJG;
- ugrActive = ultraGridJG.ActiveRow;
- }
- if (ugrActive == null)
- {
- return;
- }
- else
- {
- foreach (UltraGridRow ugr in ug.Rows)
- {
- ugr.Cells["CHC"].Value = false;
- }
- ugrActive.Cells["CHC"].Value = true;
- finishWeight.Value = ugrActive.Cells["FINISHWEIGHT"].Text == "" ? 0 : Convert.ToDouble(ugrActive.Cells["FINISHWEIGHT"].Text);
- }
- }
- private void ultraButton1_Click(object sender, EventArgs e)
- {
- MscPlineChange();
- }
- /// <summary>
- /// 控制工序完成量的输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void finishWeight_ValueChanged(object sender, EventArgs e)
- {
- IQueryable<UltraGridRow> ugrs = null;
- if (TabControl2.ActiveTab.Key.Equals("1"))
- {
- ugrs = ultraGridGP.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- else if (TabControl2.ActiveTab.Key.Equals("2"))
- {
- ugrs = ultraGridDZ.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- else if (TabControl2.ActiveTab.Key.Equals("3"))
- {
- ugrs = ultraGridZG.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- else if (TabControl2.ActiveTab.Key.Equals("4"))
- {
- ugrs = ultraGridDBK.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- else if (TabControl2.ActiveTab.Key.Equals("5"))
- {
- ugrs = ultraGridRCL.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- else
- {
- ugrs = ultraGridJG.Rows.AsQueryable().Where(" CHC = 'True' ");
- }
- UltraGridRow ugr = ugrs.First();
- //如果工序存在激活行,则工序完成量不能小于激活行的完成量
- if (ugr != null)
- {
- double finishWgt = ugr.Cells["FINISHWEIGHT"].Text == "" ? 0 : Convert.ToDouble(ugr.Cells["FINISHWEIGHT"].Text);
- double inWgt = finishWeight.Value == null ? 0 : Convert.ToDouble(finishWeight.Value.ToString());
- if (inWgt < finishWgt)
- {
- finishWeight.Value = finishWgt;
- }
- }
- }
- /// <summary>
- /// 查询成材率
- /// </summary>
- /// <param name="process">工序</param>
- /// <param name="ordLnDlyPk">交货行主键</param>
- /// <param name="plnDivideId">排产流水号</param>
- /// <param name="planGroupId">联动主号</param>
- /// <returns></returns>
- private double GetRate(string process, string ordLnDlyPk, string plnDivideId, string planGroupId)
- {
- double getRate = 1;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.CoreProcessOrder";
- ccp.MethodName = "getGetRate";
- ccp.ServerParams = new object[] { process, ordLnDlyPk, plnDivideId, planGroupId };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- getRate = Double.Parse(ccp.ReturnInfo);
- }
- return getRate;
- }
- private void ultraButton2_Click(object sender, EventArgs e)
- {
- //DoReqProcOrd();
- }
- /// <summary>
- /// 工序 补量
- /// </summary>
- //private void DoReqProcOrd()
- //{
- // //当前工序选择行
- // IQueryable<UltraGridRow> ugrs = null;
- // //当前工序
- // string nowProcess = "";
- // if (TabControl2.ActiveTab.Key.Equals("2"))
- // {
- // ultraGridDZ.UpdateData();
- // ugrs = ultraGridDZ.Rows.AsQueryable().Where(" CHC = 'True' ");
- // nowProcess = "C";
- // }
- // else if (TabControl2.ActiveTab.Key.Equals("3"))
- // {
- // ultraGridZG.UpdateData();
- // ugrs = ultraGridZG.Rows.AsQueryable().Where(" CHC = 'True' ");
- // nowProcess = "D";
- // }
- // else if (TabControl2.ActiveTab.Key.Equals("4"))
- // {
- // ultraGridDBK.UpdateData();
- // ugrs = ultraGridDBK.Rows.AsQueryable().Where(" CHC = 'True' ");
- // nowProcess = "E";
- // }
- // else if (TabControl2.ActiveTab.Key.Equals("5"))
- // {
- // ultraGridRCL.UpdateData();
- // ugrs = ultraGridRCL.Rows.AsQueryable().Where(" CHC = 'True' ");
- // nowProcess = "F";
- // }
- // else
- // {
- // ultraGridJG.UpdateData();
- // ugrs = ultraGridJG.Rows.AsQueryable().Where(" CHC = 'True' ");
- // nowProcess = "G";
- // }
- // if (ugrs == null || ugrs.Count() == 0)
- // {
- // MessageUtil.ShowWarning("请选择一条工序记录进行制程变更!");
- // return;
- // }
- // if (ultraNumericReq.Value == null || (double)ultraNumericReq.Value == 0)
- // {
- // MessageUtil.ShowWarning("申请量有误!");
- // return;
- // }
- // UltraGridRow ugr = ugrs.First();
- // //交货行主键
- // string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text;
- // //排产流水号
- // string plnDivideId = ugr.Cells["PlnDivideId"].Text;
- // //联动组号
- // string planGroupId = ugr.Cells["PlanGroupId"].Text;
- // //工序合同号
- // string proOrderNo = ugr.Cells["ProOrderNo"].Text;
- // //补量申请量
- // double reqOrdQty = (double)ultraNumericReq.Value;
- // string createName = UserInfo.GetUserName();
- // if (MessageUtil.ShowQuestion("确认补投料" + reqOrdQty + "吨?") == DialogResult.No)
- // {
- // return;
- // }
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.CoreProcessOrder";
- // ccp.MethodName = "addReqOrder";
- // ccp.ServerParams = new object[] { nowProcess, ordLnDlyPk, plnDivideId,
- // planGroupId, reqOrdQty, createName };
- // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode != -1)
- // {
- // MessageUtil.ShowTips("操作成功!");
- // return;
- // }
- //}
- /// <summary>
- /// 获取首个工序完成量
- /// </summary>
- /// <returns></returns>
- public static bool getOrdFistProFinishWt(string ordLnDlyPk, string plnDivideId, OpeBase _ob)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.CorePlnProcOrdFinish";
- ccp.MethodName = "getOrdFistProFinishWt";
- ccp.ServerParams = new object[] { ordLnDlyPk, plnDivideId };
- ccp = _ob.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (ccp == null || ccp.ReturnObject == null)
- {
- return false;
- }
- return (bool)ccp.ReturnObject;
- }
- }
- }
|