using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.StlMes.Client.YdmBase; using System.Collections; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.YdmPipeManage.Controls; using Infragistics.Win; using Core.StlMes.Client.YdmPipeManage.Tool; namespace Core.StlMes.Client.YdmPipeManage { public partial class frmPipeMoveOut : FrmBase { private string strOutbound = "800803";//出库类型编码 private string strOutname = "";//出库类型名称 private string strInMemo = "";//入库简码 DataTable dtStorager = new DataTable(); private int isSelect = 0;//新增 private int isDelete = 0;//废除 public frmPipeMoveOut() { InitializeComponent(); } //初始化 private void frmPipeMoveOut_Load(object sender, EventArgs e) { StorInfo(); //Init(); getStoreAll(); ClsBaseInfo.SetComboItemHeight(cmbProvin);//车号 RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00"); //DateTime.Parse(DateTime.Now.ToString("yyyy年MM月dd日") + " 00:00:00"); RegEndTime.Value =DateTime.Parse(DateTime.Today.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd") + " 23:59:59"); //DateTime.Parse(DateTime.Now.ToString("yyyy年MM月dd日") + " 23:59:59"); ProEndTime.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy年MM月dd日") + " 23:59:59"); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Add": doAdd(); break; case "Delete": doDelete(); break; case "Refresh": doRefresh(); break; case "Export": if (ultraTabControl1.SelectedTab.Key.Equals("Library1")) { GridHelper.ulGridToExcel(ultraGrid1, "库存实绩表"); } else { GridHelper.ulGridToExcel(ultraGrid2, "倒库实绩表"); } break; case "Close": this.Close(); break; } } private void StorInfo() { //ArrayList arList = new ArrayList(); ////获取用户对应科室ID //string User = this.UserInfo.GetDeptid(); //string StorageType = "";//根据传递的参数获取仓库类别 //string StorageAttr = "";////根据传递的参数获取仓库类型 //if (CustomInfo != "") //{ // string[] strflg = CustomInfo.ToString().Split(new char[] { ',' }); // StorageType = strflg[0]; // StorageAttr = strflg[1]; //} //pram.Clear(); //pram.Add(StorageType); //pram.Add(StorageAttr); //pram.Add(User); //PipeManageClass.BindComBaseInfo(pram, cmbWarehous, ob); //dtStorager = PipeManageClass.getComBaseInfo(pram, ob); //cmbWareEdi.DataSource = dtStorager; //cmbWareEdi.DisplayMember = "STORAGE_NAME"; //cmbWareEdi.ValueMember = "STORAGE_NO"; string[] str = this.ValidDataPurviewIds; ArrayList arList = new ArrayList(); //获取用户对应科室ID string User = this.UserInfo.GetDeptid(); string StorageType = "";//根据传递的参数获取仓库类别 string StorageAttr = "";////根据传递的参数获取仓库类型 if (CustomInfo != "A") { if (CustomInfo != "") { string[] strflg = CustomInfo.ToString().Split(new char[] { ',' }); StorageType = strflg[0]; StorageAttr = strflg[1]; } DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.PipeManageClassInfo.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob); if (dt.Rows.Count > 0) { cmbWarehous.DataSource = dt; cmbWarehous.DisplayMember = "STORAGE_NAME"; cmbWarehous.ValueMember = "STORAGE_NO"; } } else { BaseMethod.InitStorage(cmbWarehous, str, ob); } } /// /// 获取所有的目标库 /// private void getStoreAll() { string storeNo = "800202"; //string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo,this.ValidDataPurviewIds,this.ob); string[] arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, this.ob); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.getStoreAll", new object[] { arr }, this.ob); if (dt.Rows.Count > 0) { cmbWareEdi.DataSource = dt; cmbWareEdi.DisplayMember = "STORAGE_NAME"; cmbWareEdi.ValueMember = "STORAGE_NO"; } } /// /// 绑定下拉框 /// private void Init() { ////绑定料位号 // string strStorage=""; // if (cmbWarehous.SelectedIndex != -1) // { // strStorage = cmbWarehous.Value.ToString(); // } // pram.Clear(); // pram.Add(strStorage); // PipeManageClass.BindLocationInfo(pram, cmbMaterial, ob); //绑定料位号 string strStorage = ""; strStorage = cmbWarehous.Value.ToString(); ArrayList pram = new ArrayList(); pram.Add(strStorage); PipeManageClass.BindLocationInfo(pram, cmbMaterial, ob); } /// /// 根据仓库号绑定料位号 /// /// /// private void cmbWarehous_TextChanged(object sender, EventArgs e) { Init(); //string strWar = ""; //if (cmbWarehous.SelectedIndex == -1) //{ // strWar = ""; //} //else //{ // strWar = cmbWarehous.Value.ToString(); //} //PipeManageClass.RowFilterDataTable(dtStorager, " storage_no NOT IN('" + strWar + "')"); } /// /// 查询 /// private void doQuery() { if (!CheckQuery()) return; string strRegStart = "1999-01-01 00:00:00"; string strRegEnd = "2100-01-01 00:00:00"; string strProStart = ""; string strProEnd = ""; string strWare = "";//仓库号 string strMat = "";//料位号 string strFurnace = ""; string strBatch = ""; if (chkWarehous.Checked) { strWare = cmbWarehous.Value.ToString(); } if (chkMaterial.Checked) { strMat = cmbMaterial.Value.ToString(); } if (chkRegTime.Checked) { strRegStart = RegStartTime.Value.ToString(); strRegEnd = RegEndTime.Value.ToString(); } if (chkProTime.Checked) { strProStart = ProStartTime.Value.ToString(); strProEnd = ProEndTime.Value.ToString(); } if (chkFurnace.Checked) { strFurnace = txtFurnace.Text.Trim(); } if (chkBatch.Checked) { strBatch = txtBatch.Text.Trim(); } ArrayList pram = new ArrayList(); pram.Add(strWare); pram.Add(strMat); pram.Add(strFurnace); //pram.Add(strBatch); //pram.Add(txtGroup.Text.Trim()); pram.Add(strRegStart); pram.Add(strRegStart); pram.Add(strRegStart); pram.Add(strRegEnd); pram.Add(strRegEnd); //pram.Add(strProStart); //pram.Add(strProStart); //pram.Add(strProStart); //pram.Add(strProEnd); //pram.Add(strProEnd); //pram.Add(this.UserInfo.GetUserName()); string[] str = this.ValidDataPurviewIds; //获取用户对应科室ID string User = this.UserInfo.GetDeptid(); string userPartMent = BaseMethod.GetDepartIdBySectionId(UserInfo.GetDeptid(), ob); string StorageType = "";//根据传递的参数获取仓库类别 string StorageAttr = "";////根据传递的参数获取仓库类型 string[] arr = null; if (CustomInfo != "A") { if (CustomInfo != "") { string[] strflg = CustomInfo.ToString().Split(new char[] { ',' }); StorageType = strflg[0]; StorageAttr = strflg[1]; } //pram.Clear(); //pram.Add(StorageType); //pram.Add(StorageAttr); //pram.Add(str); DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.PipeManageClassInfo.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob); if (ds.Rows.Count > 0) { arr = new string[ds.Rows.Count]; for (int i = 0; i < ds.Rows.Count; i++) { arr[i] = ds.Rows[i][0].ToString(); } } if (arr == null) { MessageUtil.ShowTips("无仓库权限!"); return; } if (arr.Length < 1) { return; } if (ultraTabControl1.SelectedTab.Key.Equals("Library1")) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryInventory", new object[] { pram, arr }, ob); GridHelper.CopyDataToDatatable(dt, this.dataStorage, true); //UltraGridBand ugb = this.ultraGrid1.DisplayLayout.Bands[0]; //UltraGridColumn[] col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"]}; //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col); //this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter; } else { pram.Add(strOutbound); DataTable dtOut = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryOutPerfo", new object[] { pram, arr }, ob); GridHelper.CopyDataToDatatable(dtOut, this.dataMove, true); //ugb = this.ultraGrid2.DisplayLayout.Bands[0]; //col = new UltraGridColumn[] { ugb.Columns["STD_NAME"], ugb.Columns["MODEL_DESC"], ugb.Columns["PLINE_NAME"] }; //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col); //this.ultraGrid2.DisplayLayout.Override.CellAppearance.TextTrimming = TextTrimming.EllipsisCharacter; } } else { arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds,ob); if (ultraTabControl1.SelectedTab.Key.Equals("Library1")) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryInventory1", new object[] { pram, arr,"0" }, ob); GridHelper.CopyDataToDatatable(dt, this.dataStorage, true); } else { pram.Add(strOutbound); DataTable dtOut = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryOutPerfo1", new object[] { pram, arr,"0" }, ob); GridHelper.CopyDataToDatatable(dtOut, this.dataMove, true); } } } /// /// 新增倒库 /// private void doAdd() { this.ultraGrid1.UpdateData(); ArrayList list = new ArrayList(); if (!AddInfo()) return; string strProFlag = ""; string strCar = cmbProvin.Text.Trim() + txtCar.Text.Trim(); //查询出库类型 DataTable dt = PipeManageClass.getComTypeInfo(strOutbound, ob); if (dt.Rows.Count >= 1) { strOutname = dt.Rows[0]["BASENAME"].ToString(); } else { MessageUtil.ShowTips("出库类型不能空,请确认基础信息是否有对应出库类型信息!"); return; } int num = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true) { num++; DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveIn.queryOutCount", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text.Trim(), uRow.Cells["BATCH_NO"].Text.Trim(), uRow.Cells["BATCH_GROUD_NO"].Text.Trim() }, ob); if (dt1.Rows.Count <= 0) { MessageUtil.ShowTips("该炉已不在库,不能作废!"); return; } else { for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[0]["MAT_STATUS"].ToString().Equals("80150302")) { MessageUtil.ShowTips("该炉已编提单,不能作废!"); return; } } //if (dt.Rows[0]["act_count"].ToString() == "") //{ // MessageUtil.ShowTips("该入库单号支数与出库支数不匹配,不能作废!"); // return; } ArrayList pram = new ArrayList(); pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim()); pram.Add(uRow.Cells["BATCH_NO"].Text.Trim()); pram.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim()); pram.Add(uRow.Cells["RPO_TIME"].Text.Trim()); pram.Add(uRow.Cells["CREATE_TIME"].Text.Trim()); if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("在制品")) { strProFlag = "1"; } else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("成品")) { strProFlag = "2"; } else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("商品")) { strProFlag = "3"; } else { strProFlag = ""; } pram.Add(strProFlag); pram.Add(txtOutList.Text.Trim()); pram.Add(strCar); pram.Add(uRow.Cells["STORAGE_NO"].Text.Trim()); pram.Add(uRow.Cells["LOCATION_NO"].Text.Trim()); pram.Add(cmbWareEdi.Value.ToString()); pram.Add(this.UserInfo.GetUserOrder()); pram.Add(this.UserInfo.GetUserGroup()); pram.Add(this.UserInfo.GetUserName()); pram.Add(uRow.Cells["ACT_COUNT"].Value.ToString()); pram.Add(strOutbound); pram.Add(strOutname); list.Add(pram); } } if (num < 1) { MessageUtil.ShowTips("请选择需要操作的数据!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认倒库?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeMoveOut"; ccp.MethodName = "addMoveOut"; ccp.ServerParams = new object[] { list, cmbWareEdi.Value.ToString() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception e) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("倒库出库成功!")) { doQuery(); } } } /// /// 作废 /// private void doDelete() { UltraGridRow ugr = this.ultraGrid2.ActiveRow; int count = 0; if (ugr == null) return; ArrayList list = new ArrayList(); string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows) { if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true) { if (uRow.Cells["TAR_REC_FLAG"].Text.Trim().Equals("已接受")) { MessageUtil.ShowTips("您选择的记录已接受,请重新选择!"); return; } count += 1; ArrayList pram = new ArrayList(); pram.Add(uRow.Cells["OUTSTOCK_DOC"].Text.Trim()); pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim()); pram.Add(uRow.Cells["BATCH_NO"].Text.Trim()); pram.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim()); pram.Add(uRow.Cells["ACT_COUNT"].Value.ToString()); pram.Add(this.UserInfo.GetUserName()); pram.Add(time); list.Add(pram); } } if (count == 0) { MessageUtil.ShowTips("请选择您要撤销的倒库记录!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeMoveOut"; ccp.MethodName = "upDateInfo"; ccp.ServerParams = new object[] { list}; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception e) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销倒库成功!")) { doQuery(); } } } /// /// 刷新 /// private void doRefresh() { cmbWarehous.SelectedIndex = -1; //Init(); getStoreAll(); txtOutList.Text = ""; cmbProvin.Text = ""; txtCar.Text = ""; cmbWareEdi.Text = ""; } ///查询时验证必填项 private bool CheckQuery() { if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0) { MessageUtil.ShowTips("登记开始时间不能大于结束时间!"); return false; } if (DataTimeUtil.JudgeTime(DateTime.Parse(ProStartTime.Value.ToString()), DateTime.Parse(ProEndTime.Value.ToString())) == 0) { MessageUtil.ShowTips("生产开始时间不能大于结束时间!"); return false; } if (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim())) { MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim())) { MessageBox.Show("请选择料位号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim())) { MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkBatch.Checked && string.IsNullOrEmpty(txtBatch.Text.Trim())) { MessageBox.Show("请输入批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } /// /// 新增时验证 /// /// private bool AddInfo() { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null )return false; if (isSelect==0) { MessageUtil.ShowTips("请选择您要操作的记录!"); return false; } if (txtOutList.Text.Trim() == "") { MessageUtil.ShowTips("没有单号、请输入倒库单号!"); return false; } if(txtCar.Text.Trim()==""){ MessageUtil.ShowTips("请输入车号!"); return false; } if(cmbWareEdi.SelectedIndex==-1){ MessageUtil.ShowTips("请选择目标库号!"); return false; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true) { if (uRow.Cells["ACT_COUNT"].Value.ToString() == "0" || uRow.Cells["ACT_COUNT"].Value.ToString() == "") { MessageUtil.ShowTips("倒库支数不能为零或为空!"); return false; } ArrayList pram = new ArrayList(); pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.Trim()); pram.Add(uRow.Cells["BATCH_NO"].Text.Trim()); //pram.Add(uRow.Cells["BATCH_GROUD_NO"].Text.Trim()); //if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("在制品")) { strProFlag = "0"; } //else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("半成品")) { strProFlag = "1"; } //else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("成品")) { strProFlag = "2"; } //else if (uRow.Cells["PRODUCT_FLAG"].Text.Trim().Equals("商品")) { strProFlag = "3"; } //else { strProFlag = ""; } //pram.Add(strProFlag); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryCount", new object[] { pram }, ob); if (dt.Rows.Count < 1) { MessageUtil.ShowTips("您选择的倒库炉批信息已不在库,支数不足!"); return false; } else { if (double.Parse(dt.Rows[0]["ACT_COUNT"].ToString()) < double.Parse( uRow.Cells["ACT_COUNT"].Value.ToString())) { MessageUtil.ShowTips("您选择的倒库炉批信息已不在库,支数不足!"); return false; } } } } return true; } /// /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑 /// /// /// private void chk_CheckedChanged(object sender, EventArgs e) { if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; } if (chkMaterial.Checked) { cmbMaterial.Enabled = true; } else { cmbMaterial.Enabled = false; } if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; } if (chkBatch.Checked) { txtBatch.Enabled = true; } else { txtBatch.Enabled = false; } if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; } if (chkProTime.Checked) { ProStartTime.Enabled = true; ProEndTime.Enabled = true; } else { ProStartTime.Enabled = false; ProEndTime.Enabled = false; } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { ultraGrid1.UpdateData(); UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (this.ultraGrid1.Rows.Count <= 0) return; if (ugr == null) return; if (ugr.IsFilterRow) return; if (ugr.HasParent() == true) return; } /// /// 点击单号自动生产倒库单号 /// /// /// private void txtOutList_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dtMemo = PipeManageClass.getComTypeInfo(strOutbound, ob); if (dtMemo.Rows.Count >= 1) { strInMemo = dtMemo.Rows[0]["MEMO"].ToString(); } ArrayList pram = new ArrayList(); pram.Add(strInMemo+DateTime.Now.ToString("yyMMdd")); pram.Add(DateTime.Now.ToString("yyyy-MM-dd")); pram.Add(strOutbound); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeMoveOut.queryOutBillList", new object[] { pram }, ob); string str = ""; if (dt.Rows.Count >= 1) { str = dt.Rows[0]["OUTSTOCK_DOC"].ToString(); } txtOutList.Text = str; //txtOutList.Text = PipeManageClass.NextNumber(str, strInMemo, "00000"); } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { ultraGrid1.UpdateData(); UltraGridRow ugr = this.ultraGrid1.ActiveRow; string actcount = ugr.Cells["ACT_COUNT"].Value.ToString(); //string planNum = ""; string plannum = ugr.Cells["PLA_COUNT"].Value.ToString(); double nvlWgt = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (!StringUtil.IsInt(uRow.Cells["ACT_COUNT"].Text.Trim())) { MessageUtil.ShowTips("支数需为整数,请输入正确支数!"); return; } nvlWgt = double.Parse(uRow.Cells["PLA_WEIGHT"].Value.ToString()) / int.Parse(uRow.Cells["PLA_COUNT"].Value.ToString()); uRow.Cells["ACT_WEIGHT"].Value = (int.Parse(uRow.Cells["ACT_COUNT"].Value.ToString()) * nvlWgt).ToString(); } if (e.Cell.Column.Key.Equals("CHOOSE")) { if (Convert.ToBoolean(e.Cell.Value)) { isSelect += 1; } else isSelect -= 1; double strCount = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true) { if (uRow.Cells["ACT_COUNT"].Value.ToString() == "" || uRow.Cells["ACT_COUNT"].Value.ToString() == "0") { MessageUtil.ShowTips("目标支数不能为空或为零,请重新输入!"); uRow.Cells["ACT_COUNT"].Value = uRow.Cells["PLA_COUNT"].Value; return; } strCount += double.Parse(uRow.Cells["ACT_COUNT"].Value.ToString()); } } txtCount.Value = strCount.ToString(); } if (e.Cell.Column.Key.Equals("ACT_COUNT")) { if (actcount != "" && actcount != "0") { if (Convert.ToInt32(actcount) > Convert.ToInt32(plannum)) { MessageUtil.ShowWarning("倒库支数不能大于库存支数!"); ugr.Cells["ACT_COUNT"].Value = double.Parse(plannum); return; } } double strCount = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true) { if (uRow.Cells["ACT_COUNT"].Value.ToString() == "" || uRow.Cells["ACT_COUNT"].Value.ToString() == "0") { MessageUtil.ShowTips("目标支数不能为空或为零,请重新输入!"); uRow.Cells["ACT_COUNT"].Value = uRow.Cells["PLA_COUNT"].Value; return; } strCount += double.Parse(uRow.Cells["ACT_COUNT"].Value.ToString()); } } txtCount.Value = strCount.ToString(); } } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { if (e.Cell.Column.Key.Equals("CHOOSE")) { if (Convert.ToBoolean(e.Cell.Text) == true) { isDelete += 1; } else isDelete -= 1; } } private void frmPipeMoveOut_Shown(object sender, EventArgs e) { toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False; } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (toolMenu == null) return; if (ultraTabControl1.SelectedTab.Key.Equals("Library1")) { this.chkRegTime.Text = "入库时间"; toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.False; toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True; //chkMaterial.Visible = true; //cmbMaterial.Visible = true; } else { this.chkRegTime.Text = "倒库时间"; toolMenu.Toolbars[0].Tools["Delete"].InstanceProps.Visible = DefaultableBoolean.True; toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; //chkMaterial.Visible = false; //cmbMaterial.Visible = false; } } private void txtFurnace_KeyDown(object sender, KeyEventArgs e) { if(e.KeyValue == 13) { doQuery(); } } private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { //foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows) //{ // if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) // { // uRow.Cells["CHOOSE"].Value = true; // } //} } } }