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(ultraGridSaleOrder.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(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"; } /// /// 接箍料编制查询 /// 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( "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(); } /// /// 查询备料接箍对应关系表 /// /// 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); } /// /// 接箍订单关联合同 /// /// private void DoQueryJgMOrd(string jgMId) { List listSource = EntityHelper.GetData ("com.steering.pss.plnsaleord.jggxpln.CoreJgMBlOrd.querySaleOrder", new object[] { jgMId }, _ob); bindingSourceSaleOrd.DataSource = listSource; } /// /// 新建接箍料需求信息 /// public void DoAddJgBlReq() { ultraGridJgEdit.UpdateData(); ArrayList list = new ArrayList(); IQueryable 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(); } } /// /// 加入现有接箍料需求 /// public void DoAddJgAndBl() { ultraGridJgEdit.UpdateData(); ultraGridBl.UpdateData(); ArrayList list = new ArrayList(); string blOrdNo = "";//备料需求编号 string codeBl = "";//备料码 IQueryable checkRows = ultraGridJgEdit.Rows.AsQueryable().Where(" CHC = 'True' "); IQueryable 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 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(); } } /// /// 删除接箍料需求 /// public void DoDelete() { ultraGridBl.UpdateData(); ArrayList list = new ArrayList(); IQueryable 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(); } } /// /// 删除接箍料需求明细项 /// public void DoDeleteOne() { ultraGridJgBl.UpdateData(); ArrayList list = new ArrayList(); IQueryable 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(); } } /// /// 备料确认 /// public void DoConfirmJgl() { ultraGridBl.UpdateData(); ArrayList list = new ArrayList(); IQueryable 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(); } } /// /// 备料取消确认 /// public void CanCelConfirmBl() { ultraGridBl.UpdateData(); ArrayList list = new ArrayList(); IQueryable 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(); } } /// /// 输入要做备料需求的接箍个数 /// /// /// 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(); } } } /// /// 根据接箍个数,算接箍料长度,重量 /// /// 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; } } /// /// 选择接箍合同备料 /// /// /// 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); } /// /// 接箍料编辑表勾选时的操作 /// /// 勾选行 private void setJgleditNum(UltraGridRow cRow) { if (Convert.ToBoolean(cRow.Cells["CHC"].Text)) { ultraGridJgEdit.UpdateData(); IQueryable 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 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 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 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()); } /// /// 修改万只废品数,修改产线 /// /// /// 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(); } } } } }