| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909 |
- using System;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Control;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using com.steering.pss.plnsaleord.order.model;
- using Core.StlMes.Client.PlnSaleOrd.JGGXPln.Entity;
- using com.steering.pss.plnsaleord.jggxpln.model;
- using System.Collections.Generic;
- using System.Drawing;
- namespace Core.StlMes.Client.PlnSaleOrd
- {
- public partial class ComJgMBlOrd : UserControl
- {
- public OpeBase _ob = null;
- //用于计算可分离容器的大小。
- private int _splitterDistance2 = 0;
- private int _splitterDistance3 = 0;
- private int _splitterDistance1 = 0;
- private bool _groupBox2ExpandedChanged = false;
- private bool _groupBox3ExpandedChanged = false;
- private bool _groupBox4ExpandedChanged = false;
- private bool _groupBox5ExpandedChanged = false;
- public ComJgMBlOrd()
- {
- InitializeComponent();
- Init();
- }
- public void Init()
- {
- EntityHelper.ShowGridCaption<PlnSaleordEntity>(ultraGridSaleOrder.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<FrmPlnGxJgMEntity>(ultraGridJgGxM.DisplayLayout.Bands[0]);
- PlanComm.setGridActivation(ultraGridJgGxM.DisplayLayout.Bands[0], "CHC");
- PlanComm.setGridActivation(ultraGridJgEdit.DisplayLayout.Bands[0], "CHC");//"NUM_JG", "SINGLE_ADDLEN"
- PlanComm.setGridActivation(ultraGridBl.DisplayLayout.Bands[0], "CHC");
- PlanComm.setGridActivation(ultraGridJgBl.DisplayLayout.Bands[0], "CHC");
- PlanComm.setGridActivation(ultraGridSaleOrder.DisplayLayout.Bands[0]);
- PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 2,
- "Outdiameter", "Wallthick", "Aimlength", "Singleweight", "Diameter", "DiameterJg",
- "CheckJVal", "MinD", "MinH", "BlMinDOut", "BlMaxDIn", "AimlengthBl", "HeightJg",
- "DiameterPl", "HeightPl", "LengthMin", "LengthMax", "LengthJg", "WeightJg",
- "MinDCp", "MaxDCp", "LengthMin", "LengthMax", "MinHCp","MaxHCp", "MinDJg", "MaxDJg");
- PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 3, "BlWeight");
- PlanComm.setGridDigitalCol(ultraGridJgGxM.DisplayLayout.Bands[0], 5, 0,
- "ProducedNum", "ZyplanNum", "BlNum", "PlanNum", "JgwtBlreq", "Buyplannum", "Matchnum");
- PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 2,
- "OUTDIAMETER", "WALLTHICK", "AIMWALLTHICK", "LENGTHMAX", "LENGTHMIN", "AIMLENGTH");
- PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 3,
- "SINGLEWEIGHT", "JGBL_REQ_WEIGHT", "MATCHWEIGHT");
- PlanComm.setGridDigitalCol(ultraGridBl.DisplayLayout.Bands[0], 5, 0,
- "JGBL_REQ_NUM", "MATCHNUM");
- PlanComm.setGridDigitalCol(ultraGridJgBl.DisplayLayout.Bands[0], 5, 2,
- "OUTDIAMETER", "WALLTHICK", "AIMLENGTH", "SINGLEWEIGHT", "SINGLEWEIGHT2",
- "AIMLENGTH_BL", "JGBL_REQ_WEIGHT", "GETRATE", "WEIGHT_JG", "SINGLE_ADDLEN");
- PlanComm.setGridDigitalCol(ultraGridJgBl.DisplayLayout.Bands[0], 5, 0,
- "JGPLAN_NUM", "NUM_JG", "JGBL_REQ_NUM" );
- ultraGridJgEdit.DisplayLayout.Bands[0].Columns["PLINE_NAME"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
- }
- public void RefresDate()
- {
- DataTable dtDd = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgGxMNo",
- new object[] { }, _ob);
- if (dtDd != null && dtDd.Rows.Count > 0)
- {
- DataRow dr = dtDd.NewRow();
- dtDd.Rows.InsertAt(dr, 0);
- }
- ultraComboJgDdNo.DataSource = dtDd;
- ultraComboJgDdNo.DisplayMember = "PRO_PLAN_ID";
- ultraComboJgDdNo.ValueMember = "PRO_PLAN_ID";
- DataTable dtReq = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJglRelNo",
- new object[] { }, _ob);
- if (dtReq != null && dtReq.Rows.Count > 0)
- {
- DataRow dr = dtReq.NewRow();
- dtReq.Rows.InsertAt(dr, 0);
- }
- ultraComboJglReqNo.DataSource = dtReq;
- ultraComboJglReqNo.DisplayMember = "REQ_BL_ID";
- ultraComboJglReqNo.ValueMember = "REQ_BL_ID";
- }
- /// <summary>
- /// 接箍料编制查询
- /// </summary>
- public void Query()
- {
- string strJglReqNo = "";
- string strJgDdNo = "";
- string strInFinished = "0";//包含完成配料的订单
- if (checkBoxJglReqNo.Checked)
- {
- strJglReqNo = ultraComboJglReqNo.Text;
- }
- if (checkBoxJgDdNo.Checked)
- {
- strJgDdNo = this.ultraComboJgDdNo.Text;
- }
- if (this.checkBoxFinish.Checked)
- {
- strInFinished = "1";
- }
- bindingSourcePlnGxJgMEntity.DataSource = EntityHelper.GetData<FrmPlnGxJgMEntity>(
- "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryGxJgM", new object[] { strJgDdNo, strInFinished }, _ob);
- DataTable dtEdit = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgDealedit",
- new object[] { strJgDdNo, strInFinished }, _ob);
- GridHelper.CopyDataToDatatable(dtEdit, dataTableEdit, true);
- //foreach (UltraGridRow uRow in ultraGridJgEdit.Rows)
- //{
- // uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
- // uRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
- // uRow.Cells["NUM_JG"].Appearance.BackColor = Color.;
- // uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
- // uRow.Cells["SINGLE_ADDLEN"].Activation = Activation.ActivateOnly;
- //}
- DataTable dtJgl = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgBlNeed",
- new object[] { strJglReqNo }, _ob);
- GridHelper.CopyDataToDatatable(dtJgl, dataTableBl, true);
- this.dataTableRel.Clear();
- }
- /// <summary>
- /// 查询备料接箍对应关系表
- /// </summary>
- /// <param name="blReqId"></param>
- private void DoQueryJAndB(string blReqId)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryRelation",
- new object[] { blReqId }, _ob);
- GridHelper.CopyDataToDatatable(dt, dataTableRel, true);
- }
- /// <summary>
- /// 接箍订单关联合同
- /// </summary>
- /// <param name="jgMId"></param>
- private void DoQueryJgMOrd(string jgMId)
- {
- List<PlnSaleordEntity> listSource = EntityHelper.GetData<PlnSaleordEntity>
- ("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.querySaleOrder",
- new object[] { jgMId }, _ob);
- bindingSourceSaleOrd.DataSource = listSource;
- }
- /// <summary>
- /// 新建接箍料需求信息
- /// </summary>
- public void DoAddJgBlReq()
- {
- ultraGridJgEdit.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True' ");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("未勾选新建行。");
- return;
- }
- foreach (UltraGridRow uRow in checkRows)
- {
- PlnOrdJgMEditEntity editEntiy = new PlnOrdJgMEditEntity();
- if (uRow.Cells["JGBL_SUMLENTH"].Value.Equals("0") ||
- uRow.Cells["JGBL_SUMLENTH"].Value.Equals(""))
- {
- MessageUtil.ShowTips("合同:" + uRow.Cells["PRO_PLAN_ID"].Value.ToString()
- + ",备料:" + uRow.Cells["CODE_JG_BL"].Value.ToString() + "的项未知备料需求量!");
- return;
- }
- editEntiy.ProPlanId = uRow.Cells["PRO_PLAN_ID"].Value.ToString();
- editEntiy.CodeJg = uRow.Cells["CODE_JG"].Value.ToString();
- editEntiy.CodeJgBl = uRow.Cells["CODE_JG_BL"].Value.ToString();
- editEntiy.WeightJg = uRow.Cells["WEIGHT_JG"].Value.ToString();
- editEntiy.NumJg = uRow.Cells["NUM_JG"].Value.ToString();
- editEntiy.SingleAddlen = uRow.Cells["SINGLE_ADDLEN"].Value.ToString();
- editEntiy.JgblSumlenth = uRow.Cells["JGBL_SUMLENTH"].Value.ToString();
- editEntiy.NumJgbl = uRow.Cells["NUM_JGBL"].Value.ToString();
- editEntiy.JgblReqWeight = uRow.Cells["JGBL_REQ_WEIGHT"].Value.ToString();
- editEntiy.PrdcrNo = uRow.Cells["PRDCR_NO"].Value.ToString();
- editEntiy.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- list.Add(editEntiy);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
- ccp.MethodName = "addJgBlReq";
- ccp.ServerParams = new object[] { list };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- MessageUtil.ShowError("服务端处理失败!");
- return;
- }
- if (ccp.ReturnCode < 0)
- {
- MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
- return;
- }
- if (ccp.ReturnObject != null)
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- Query();
- }
- }
- /// <summary>
- /// 加入现有接箍料需求
- /// </summary>
- public void DoAddJgAndBl()
- {
- ultraGridJgEdit.UpdateData();
- ultraGridBl.UpdateData();
- ArrayList list = new ArrayList();
- string blOrdNo = "";//备料需求编号
- string codeBl = "";//备料码
- IQueryable<UltraGridRow> checkRows = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True' ");
- IQueryable<UltraGridRow> checkRows1 = ultraGridBl.Rows.AsQueryable().Where(" CHC = 'True' ");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("未勾选加入需求的行。");
- return;
- }
- if (checkRows1.Count() != 1)
- {
- MessageUtil.ShowTips("请选择一条已有的备料需求。");
- return;
- }
- codeBl = checkRows1.First().Cells["CODE_JG_BL"].Value.ToString();
- blOrdNo = checkRows1.First().Cells["REQ_BL_ID"].Value.ToString();
- IQueryable<UltraGridRow> outRows = checkRows.Where(" CODE_JG_BL != '" + codeBl + "' ");
- if (outRows.Count() > 0)
- {
- MessageUtil.ShowTips("接箍合同:" + outRows.First().Cells["PRO_PLAN_ID"].Value.ToString()
- + "、备料码:" + outRows.First().Cells["CODE_JG_BL"].Value.ToString()
- + ",不能加入备料需求:" + blOrdNo + "中。(备料码不一致!)");
- return;
- }
- foreach (UltraGridRow uRow in checkRows)
- {
- PlnOrdJgMEditEntity editEntiy = new PlnOrdJgMEditEntity();
- if (uRow.Cells["JGBL_SUMLENTH"].Value.Equals("0") ||
- uRow.Cells["JGBL_SUMLENTH"].Value.Equals(""))
- {
- MessageUtil.ShowTips("合同:" + uRow.Cells["PRO_PLAN_ID"].Value.ToString()
- + ",备料:" + uRow.Cells["CODE_JG_BL"].Value.ToString() + "的项未知备料需求量!");
- return;
- }
- editEntiy.ProPlanId = uRow.Cells["PRO_PLAN_ID"].Value.ToString();
- editEntiy.CodeJg = uRow.Cells["CODE_JG"].Value.ToString();
- editEntiy.CodeJgBl = uRow.Cells["CODE_JG_BL"].Value.ToString();
- editEntiy.WeightJg = uRow.Cells["WEIGHT_JG"].Value.ToString();
- editEntiy.NumJg = uRow.Cells["NUM_JG"].Value.ToString();
- editEntiy.SingleAddlen = uRow.Cells["SINGLE_ADDLEN"].Value.ToString();
- editEntiy.JgblSumlenth = uRow.Cells["JGBL_SUMLENTH"].Value.ToString();
- editEntiy.NumJgbl = uRow.Cells["NUM_JGBL"].Value.ToString();
- editEntiy.JgblReqWeight = uRow.Cells["JGBL_REQ_WEIGHT"].Value.ToString();
- editEntiy.PrdcrNo = uRow.Cells["PRDCR_NO"].Value.ToString();
- editEntiy.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- list.Add(editEntiy);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
- ccp.MethodName = "addJgAndBl";
- ccp.ServerParams = new object[] { list, blOrdNo };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- MessageUtil.ShowError("服务端处理失败!");
- return;
- }
- if (ccp.ReturnCode < 0)
- {
- MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
- return;
- }
- if (ccp.ReturnObject != null)
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- Query();
- }
- }
- /// <summary>
- /// 删除接箍料需求
- /// </summary>
- public void DoDelete()
- {
- ultraGridBl.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = ultraGridBl.Rows.AsQueryable().Where(" CHC = 'True' ");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要删除的备料需求。");
- return;
- }
- foreach (UltraGridRow uRow in checkRows)
- {
- list.Add(uRow.Cells["REQ_BL_ID"].Value.ToString());
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
- ccp.MethodName = "deleteReq";
- ccp.ServerParams = new object[] { list };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- MessageUtil.ShowError("服务端处理失败!");
- return;
- }
- if (ccp.ReturnCode < 0)
- {
- MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
- return;
- }
- if (ccp.ReturnObject != null)
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- Query();
- }
- }
- /// <summary>
- /// 删除接箍料需求明细项
- /// </summary>
- public void DoDeleteOne()
- {
- ultraGridJgBl.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = ultraGridJgBl.Rows.AsQueryable().Where(" CHC = 'True' ");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要删除的备料需求。");
- return;
- }
- string ReqBlId = checkRows.First().Cells["REQ_BL_ID"].Value.ToString();
- foreach (UltraGridRow uRow in checkRows)
- {
- list.Add(uRow.Cells["PRO_PLAN_ID"].Value.ToString());
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
- ccp.MethodName = "deleteRelation";
- ccp.ServerParams = new object[] { list, ReqBlId,
- CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- {
- MessageUtil.ShowError("服务端处理失败!");
- return;
- }
- if (ccp.ReturnCode < 0)
- {
- MessageUtil.ShowError("服务端处理失败!\n" + ccp.ReturnInfo);
- return;
- }
- if (ccp.ReturnObject != null)
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- Query();
- }
- }
- /// <summary>
- /// 备料确认
- /// </summary>
- public void DoConfirmJgl()
- {
- ultraGridBl.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> ugrs = ultraGridBl.Rows.AsQueryable().Where("CHC = 'True'");
- if (ugrs.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选需要确认的备料需求。");
- return;
- }
- foreach (UltraGridRow ugr in ugrs)
- {
- PlnPorderBlReqEntity blReqEntity = new PlnPorderBlReqEntity();
- blReqEntity.ReqBlId = ugr.Cells["REQ_BL_ID"].Value.ToString();
- list.Add(blReqEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.order.CorePlnOrdJgDjDeal";
- ccp.MethodName = "doConfirmBl";
- ccp.ServerParams = new object[] { list, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnObject != null && !ccp.ReturnObject.ToString().Equals(""))
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- }
- Query();
- }
- }
- /// <summary>
- /// 备料取消确认
- /// </summary>
- public void CanCelConfirmBl()
- {
- ultraGridBl.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> ugrs = ultraGridBl.Rows.AsQueryable().Where("CHC = 'True'");
- if (ugrs.Count() == 0)
- {
- MessageUtil.ShowTips("未勾选备料需求。");
- return;
- }
- foreach (UltraGridRow ugr in ugrs)
- {
- list.Add(ugr.Cells["REQ_BL_ID"].Value.ToString());
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.order.CorePlnOrdJgDjDeal";
- ccp.MethodName = "canCelConfirmBl";
- ccp.ServerParams = new object[] { list };
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnObject != null && !ccp.ReturnObject.ToString().Equals(""))
- {
- MessageUtil.ShowTips(ccp.ReturnObject.ToString());
- }
- Query();
- }
- }
- /// <summary>
- /// 输入要做备料需求的接箍个数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridJgEdit_AfterCellUpdate(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "CHC")
- {
- if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
- {
- computJglLen(e.Cell.Row);
- e.Cell.Row.Update();
- }
- }
- if (e.Cell.Column.Key == "NUM_JG")
- {
- if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
- {
- computJglLen(e.Cell.Row);
- e.Cell.Row.Update();
- }
- }
- if (e.Cell.Column.Key.Equals("SINGLE_ADDLEN"))
- {
- double addlen = 0;
- if (!double.TryParse(e.Cell.Row.Cells["SINGLE_ADDLEN"].Value.ToString(), out addlen))
- {
- e.Cell.Row.Cells["SINGLE_ADDLEN"].Value = 0;
- }
- if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text))
- {
- computJglLen(e.Cell.Row);
- e.Cell.Row.Update();
- }
- }
- }
- /// <summary>
- /// 根据接箍个数,算接箍料长度,重量
- /// </summary>
- /// <param name="uRow"></param>
- private void computJglLen(UltraGridRow uRow)
- {
- int Num_Jg = 0;
- if (int.TryParse(uRow.Cells["NUM_JG"].Value.ToString(), out Num_Jg))
- {
- //接箍料长度=接箍个数*(接箍长度+单个接箍切损长度)
- double jgbl_sumlenth = Num_Jg * (Convert.ToDouble(uRow.Cells["AIMLENGTH"].Value)
- + Convert.ToDouble(uRow.Cells["SINGLE_ADDLEN"].Value)) / 1000;
- double singleweight_jg = Convert.ToDouble(uRow.Cells["SINGLEWEIGHT"].Value);//接箍单重(kg)
- //接箍料目标长度取长度上下限中间值
- double JglAimlenth = (Convert.ToDouble(uRow.Cells["MIN_L"].Value.ToString3())
- + Convert.ToDouble(uRow.Cells["MAX_L"].Value.ToString3())) / 2;
- int numJgl = 0; //接箍料支数
- double weight_jg = singleweight_jg * Num_Jg / 1000;//接箍重量
- double min_d = Convert.ToDouble(uRow.Cells["MIN_D"].Value.ToString3()); //备料外径
- double min_h = Convert.ToDouble(uRow.Cells["MIN_H"].Value.ToString3()); //备料壁厚
- double Weight_One = PlanComm.WeightOfMi(min_d, min_h); //接箍料米单重
- if ((jgbl_sumlenth % JglAimlenth) == 0)
- {
- numJgl = (int)(jgbl_sumlenth / JglAimlenth);
- }
- else
- {
- numJgl = (int)(jgbl_sumlenth / JglAimlenth) + 1;
- }
- uRow.Cells["NUM_JGBL"].Value = numJgl;
- uRow.Cells["JGBL_SUMLENTH"].Value = Math.Round(jgbl_sumlenth, 2);
- uRow.Cells["WEIGHT_JG"].Value = Math.Round(weight_jg, 3);
- uRow.Cells["JGBL_REQ_WEIGHT"].Value = Math.Round(Weight_One * jgbl_sumlenth, 3);
- }
- else
- {
- uRow.Cells["NUM_JG"].Value = 0;
- }
- }
- /// <summary>
- /// 选择接箍合同备料
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridJgEdit_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "CHC")
- {
- setJgleditNum(e.Cell.Row);
- }
- if (e.Cell.Column.Key.Equals("NUM_JG"))
- {
- ultraGridJgEdit.UpdateData();
- ultraGridJgGxM.UpdateData();
- }
- if (e.Cell.Column.Key.Equals("SINGLE_ADDLEN"))
- {
- ultraGridJgEdit.UpdateData();
- ultraGridJgGxM.UpdateData();
- }
- //computJglLen(e.Cell.Row);
- }
- /// <summary>
- /// 接箍料编辑表勾选时的操作
- /// </summary>
- /// <param name="uRow">勾选行</param>
- private void setJgleditNum(UltraGridRow cRow)
- {
- if (Convert.ToBoolean(cRow.Cells["CHC"].Text))
- {
- ultraGridJgEdit.UpdateData();
- IQueryable<UltraGridRow> listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True'");
- listRow = listRow.Where(" PRO_PLAN_ID = '"
- + cRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
- listRow = listRow.Where(" CODE_JG_BL != '"
- + cRow.Cells["CODE_JG_BL"].Value.ToString() + "'");
- //foreach (UltraGridRow uRow in listRow.ToArray())
- //{
- //cRow.Cells["CHC"].Value = false;
- //cRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
- ////uRow.Cells["NUM_JG"].Value = 0;
- //cRow.Cells["WEIGHT_JG"].Value = 0;
- //cRow.Cells["NUM_JGBL"].Value = 0;
- //cRow.Cells["JGBL_SUMLENTH"].Value = 0;
- //cRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
- //}
- ultraGridJgGxM.UpdateData();
- listRow = ultraGridJgGxM.Rows.AsQueryable().Where(" ProPlanId = '"
- + cRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
- //foreach (UltraGridRow uRow in listRow.ToArray())
- //{
- // int num_jg = Convert.ToInt32(uRow.Cells["PlanNum"].Value) -
- // Convert.ToInt32(uRow.Cells["Matchnum"].Value) -
- // Convert.ToInt32(uRow.Cells["JgwtBlreq"].Value);
- // if (num_jg < 0)
- // {
- // num_jg = 0;
- // }
- // cRow.Cells["NUM_JG"].Value = num_jg;
- // break;
- //}
- cRow.Cells["NUM_JG"].Activation = Activation.AllowEdit;
- cRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
- cRow.Cells["NUM_JG"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
- cRow.Cells["SINGLE_ADDLEN"].Activation = Activation.AllowEdit;
- cRow.Cells["SINGLE_ADDLEN"].IgnoreRowColActivation = true;
- cRow.Cells["SINGLE_ADDLEN"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
- cRow.Update();
- }
- if (!Convert.ToBoolean(cRow.Cells["CHC"].Text))
- {
- cRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
- cRow.Cells["NUM_JG"].IgnoreRowColActivation = true;
- cRow.Cells["NUM_JG"].Appearance.BackColor = Color.Transparent;
- cRow.Cells["SINGLE_ADDLEN"].Activation = Activation.ActivateOnly;
- cRow.Cells["SINGLE_ADDLEN"].IgnoreRowColActivation = true;
- cRow.Cells["SINGLE_ADDLEN"].Appearance.BackColor = Color.Transparent;
- //cRow.Cells["NUM_JG"].Value = 0;
- cRow.Cells["WEIGHT_JG"].Value = 0;
- cRow.Cells["NUM_JGBL"].Value = 0;
- cRow.Cells["JGBL_SUMLENTH"].Value = 0;
- cRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
- cRow.Update();
- }
- ultraGridJgEdit.UpdateData();
- ultraGridJgGxM.UpdateData();
- }
- private void splitContainer2_SplitterMoved(object sender, SplitterEventArgs e)
- {
- if (_groupBox2ExpandedChanged == false)
- {
- _splitterDistance2 = splitContainer2.SplitterDistance;
- if (splitContainer2.SplitterDistance < splitContainer2.Parent.Width - 30)
- {
- ultraExpandableGroupBox2.Expanded = true;
- }
- else
- {
- ultraExpandableGroupBox2.Expanded = false;
- }
- }
- }
- private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
- {
- _groupBox2ExpandedChanged = true;
- if (ultraExpandableGroupBox2.Expanded == false)
- {
- splitContainer2.SplitterDistance = this.Width;
- }
- else
- {
- splitContainer2.SplitterDistance = _splitterDistance2;
- }
- _groupBox2ExpandedChanged = false;
- }
- private void ultraGridBl_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = this.ultraGridBl.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- DoQueryJAndB(ugr.Cells["REQ_BL_ID"].Value.ToString());
- }
- private void ultraGridJgEdit_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
- {
- ultraGridJgGxM.UpdateData();
- ultraGridJgEdit.UpdateData();
- IQueryable<UltraGridRow> listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CODE_JG_BL = '"
- + e.Row.Cells["CODE_JG_BL"].Value.ToString() + "'");
- foreach (UltraGridRow uRow in listRow.ToArray())
- {
- uRow.Cells["CHC"].Value = true;
- IQueryable<UltraGridRow> rows = ultraGridJgGxM.Rows.AsQueryable().Where(" ProPlanId = '"
- + uRow.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
- uRow.Cells["NUM_JG"].Activation = Activation.AllowEdit;
- //foreach (UltraGridRow cRow in rows)
- //{
- // int num_jg = Convert.ToInt32(cRow.Cells["PlanNum"].Value) -
- // Convert.ToInt32(cRow.Cells["Matchnum"].Value) -
- // Convert.ToInt32(cRow.Cells["JgwtBlreq"].Value);
- // if (num_jg < 0)
- // {
- // num_jg = 0;
- // }
- // uRow.Cells["NUM_JG"].Value = num_jg;
- // break;
- //}
- }
- listRow = ultraGridJgEdit.Rows.AsQueryable().Where(" CODE_JG_BL != '"
- + e.Row.Cells["CODE_JG_BL"].Value.ToString() + "'");
- foreach (UltraGridRow uRow in listRow.ToArray())
- {
- uRow.Cells["CHC"].Value = false;
- uRow.Cells["NUM_JG"].Activation = Activation.ActivateOnly;
- //uRow.Cells["NUM_JG"].Value = 0;
- uRow.Cells["WEIGHT_JG"].Value = 0;
- uRow.Cells["NUM_JGBL"].Value = 0;
- uRow.Cells["JGBL_SUMLENTH"].Value = 0;
- uRow.Cells["JGBL_REQ_WEIGHT"].Value = 0;
- }
- }
- private void ultraGridJg_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridJgGxM.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- foreach (UltraGridRow uRow in ultraGridJgEdit.Rows)
- {
- if (uRow.Cells["PRO_PLAN_ID"].Value.ToString().Equals(
- ugr.Cells["ProPlanId"].Value.ToString()))
- {
- ultraGridJgEdit.ActiveRow = uRow;
- uRow.Appearance.ForeColor = System.Drawing.Color.DarkBlue;
- }
- else
- {
- uRow.Appearance.ForeColor = System.Drawing.Color.Black;
- }
- }
- //string strInFinished = "";
- //if (this.checkBoxFinish.Checked)
- //{
- // strInFinished = "1";
- //}
- //string strJgDdNo = ugr.Cells["ProPlanId"].Value.ToString();
- //DataTable dtEdit = ServerHelper.GetData("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.queryJgDealedit",
- // new object[] { strJgDdNo, strInFinished }, _ob);
- //GridHelper.CopyDataToDatatable(dtEdit, dataTableEdit, true);
- }
- private void splitContainer3_SplitterMoved(object sender, SplitterEventArgs e)
- {
- if (_groupBox3ExpandedChanged == false || _groupBox4ExpandedChanged == false)
- {
- _splitterDistance3 = splitContainer3.SplitterDistance;
- if (splitContainer3.SplitterDistance > 25)
- {
- ultraExpandableGroupBox3.Expanded = true;
- }
- else
- {
- ultraExpandableGroupBox3.Expanded = false;
- }
- if (splitContainer3.SplitterDistance < splitContainer3.Parent.Height - 30)
- {
- ultraExpandableGroupBox4.Expanded = true;
- }
- else
- {
- ultraExpandableGroupBox4.Expanded = false;
- }
- }
- }
- private void ultraExpandableGroupBox3_ExpandedStateChanged(object sender, EventArgs e)
- {
- _groupBox3ExpandedChanged = true;
- if (ultraExpandableGroupBox3.Expanded == false)
- {
- _groupBox4ExpandedChanged = true;
- ultraExpandableGroupBox4.Expanded = true;
- splitContainer3.SplitterDistance = 0;
- _groupBox4ExpandedChanged = false;
- }
- else
- {
- splitContainer3.SplitterDistance = _splitterDistance3;
- }
- _groupBox3ExpandedChanged = false;
- }
- private void ultraExpandableGroupBox4_ExpandedStateChanged(object sender, EventArgs e)
- {
- _groupBox4ExpandedChanged = true;
- if (ultraExpandableGroupBox4.Expanded == false)
- {
- _groupBox3ExpandedChanged = true;
- ultraExpandableGroupBox3.Expanded = true;
- splitContainer3.SplitterDistance = this.Height;
- _groupBox3ExpandedChanged = false;
- }
- else
- {
- splitContainer3.SplitterDistance = _splitterDistance3;
- }
- _groupBox4ExpandedChanged = false;
- }
- private void checkBoxJgDdNo_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBoxJgDdNo.Checked)
- {
- ultraComboJgDdNo.Enabled = true;
- }
- else
- {
- ultraComboJgDdNo.Enabled = false;
- }
- }
- private void checkBoxJglReqNo_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBoxJglReqNo.Checked)
- {
- ultraComboJglReqNo.Enabled = true;
- }
- else
- {
- ultraComboJglReqNo.Enabled = false;
- }
- }
- private void ultraGridJgEdit_AfterCellActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- ultraGridJgGxM.UpdateData();
- IQueryable<UltraGridRow> urow = ultraGridJgGxM.Rows.AsQueryable().Where(
- "ProPlanId = '" + ugr.Cells["PRO_PLAN_ID"].Value.ToString() + "'");
- if (urow.Count() > 0)
- {
- ultraGridJgGxM.ActiveRow = urow.First();
- }
- }
- private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
- {
- if (_groupBox5ExpandedChanged == false)
- {
- _splitterDistance1 = splitContainer1.SplitterDistance;
- if (splitContainer1.SplitterDistance < splitContainer1.Parent.Height - 30)
- {
- ultraExpandableGroupBox5.Expanded = true;
- }
- else
- {
- ultraExpandableGroupBox5.Expanded = false;
- }
- }
- }
- private void ultraExpandableGroupBox5_ExpandedStateChanged(object sender, EventArgs e)
- {
- _groupBox5ExpandedChanged = true;
- if (ultraExpandableGroupBox5.Expanded == false)
- {
- splitContainer1.SplitterDistance = this.Height;
- }
- else
- {
- splitContainer1.SplitterDistance = _splitterDistance1;
- }
- _groupBox5ExpandedChanged = false;
- }
- private void ultraGridJgEdit_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- DoQueryJgMOrd(ugr.Cells["PRO_PLAN_ID"].Value.ToString());
- }
- /// <summary>
- /// 修改万只废品数,修改产线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridJgEdit_ClickCellButton(object sender, CellEventArgs e)
- {
- UltraGridRow ugr = ultraGridJgEdit.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- string proPlanId = ugr.Cells["PRO_PLAN_ID"].Text;
- string inMaterialNo = ugr.Cells["BL_WL_ID"].Text;
- string outMaterialNo = ugr.Cells["CODE_JG"].Text;
- string plineCode = ugr.Cells["PLINE_CODE"].Value.ToString();
- int numJg = int.Parse(ugr.Cells["NUM_JG"].Text);
- FrmBaseMaterialHPl frmBase = new FrmBaseMaterialHPl(inMaterialNo, outMaterialNo, plineCode, _ob, proPlanId);
- frmBase.ShowDialog();
- bool flag = frmBase.Flag;
- if (flag)
- {
- //修改接箍订单接箍个数
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd";
- ccp.MethodName = "updatePlanGxJgM";
- ccp.ServerParams = new object[] { proPlanId};
- ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- //MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- Query();
- }
- }
- }
- }
- }
|