| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmJGCodeManage : FrmBase
- {
- private string _stdName = "";
- public string StdName
- {
- get { return _stdName; }
- set { _stdName = value; }
- }
- private ArrayList _choiceSpecs = new ArrayList();
- public FrmJGCodeManage()
- {
- //base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
- //base.UpdateStyles();
- //this.SetStyle(ControlStyles.DoubleBuffer, true);
- //this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- //this.SetStyle(ControlStyles.UserPaint, true);
- //this.SetStyle(ControlStyles.ResizeRedraw, true);
- InitializeComponent();
- this.IsLoadUserView = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "");
- //ultraPanel2.GetType().GetProperty("DoubleBuffered",
- // System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
- // .SetValue(ultraPanel2, true, null);
- }
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams cp = base.CreateParams;
- cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
- return cp;
- }
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- ultraComboEditor3.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- ultraComboEditor4.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- ultraComboEditor6.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- }
- public void PopupLoad(string customInfo, OpeBase ob)
- {
- this.CustomInfo = customInfo;
- this.ob = ob;
- this.OnLoad(EventArgs.Empty);
- }
- private void FrmJGCodeManage_Load(object sender, EventArgs e)
- {
- InitCombo();
- }
- ArrayList list = new ArrayList(); //全局变量 存储修改或添加的数据
- ArrayList jgDescList = new ArrayList(); //接箍描述决定一个接箍码
- /// <summary>
- /// 初始化下拉框
- /// </summary>
- private void InitCombo()
- {
- //initJGDropDown(ultraComboEditor2, "com.steering.pss.qcm.JGCodeManage.GetJGProduct", "BASECODE", false);
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getProductName", new object[] { }, ob);
- dt.DefaultView.RowFilter = "PRODUCCODE = 'S000012'";
- ultraComboEditor2.DataSource = dt.DefaultView;
- ultraComboEditor2.ValueMember = "PRODUCCODE";
- ultraComboEditor2.DisplayMember = "PRODUCNAME";
- if (ultraComboEditor2.Items.Count > 0)
- {
- ultraComboEditor2.Value = "S000012";
- }
- initJGDropDown(ultraComboEditor3, "com.steering.pss.qcm.JGCodeManage.GetJGSteel", "STEELCODE", false);
- initJGDropDown(ultraComboEditor4, "com.steering.pss.qcm.JGCodeManage.GetJGModel", "MODEL_CODE", false);
- initJGDropDown(ultraComboEditor5, "com.steering.pss.qcm.JGCodeManage.GetJGType", "BASECODE", true);
- initJGDropDown(ultraComboEditor6, "com.steering.pss.qcm.JGCodeManage.GetCPProduct", "PRODUCCODE", false);
- initJGDropDown(ultraComboEditor10, "com.steering.pss.qcm.JGCodeManage.GetJGType", "BASECODE", true);
- initJGDropDown(ultraComboEditor11, "com.steering.pss.qcm.JGCodeManage.GetJGAlpha", "STD_CODE", true);
- //QcmBaseQuery.NitializeJgStdStyle(ultraComboEditor8, true, ob);
- initJGDropDown(ultraComboEditor8, "com.steering.pss.qcm.JGCodeManage.getStdStyleName", "STD_STYLE", true);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor2);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor3);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor4);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor5);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor6);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor10);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor11);
- ValueList plnStatusList = new ValueList();
- plnStatusList.ValueListItems.Add("0", "计划");
- plnStatusList.ValueListItems.Add("1", "生产中");
- plnStatusList.ValueListItems.Add("2", "完成");
- plnStatusList.ValueListItems.Add("3", "关闭");
- plnStatusList.ValueListItems.Add("4", "关闭");
- ultraGrid1.DisplayLayout.Bands[0].Columns["JG_PLN_STATUS"].ValueList = plnStatusList;
- }
- /// <summary>
- /// 初始化下拉框
- /// </summary>
- /// <param name="uce">下拉框名字</param>
- /// <param name="MethodId">服务请求:包名+类名+方法名</param>
- /// <param name="memberValue">下拉框的值成员</param>
- private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue, bool isEmpty)
- {
- //初始化编辑区域下拉框
- DataTable dt = ServerHelper.GetData(MethodId, null, this.ob);
- if (isEmpty)
- {
- DataRow dr = dt.NewRow();
- object[] obj = { "", "" };
- dr.ItemArray = obj;
- dt.Rows.Add(dr);
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- uce.DataSource = dt;
- uce.ValueMember = memberValue;
- }
- }
- private void doRefresh()
- {
- InitCombo();
- }
- /// <summary>
- /// 重载平台的工具栏函数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- #if !DEBUG
- try
- {
- #endif
- switch (ToolbarKey)
- {
- case "Query":
- try
- {
- this.Cursor = Cursors.WaitCursor;
- this.doQuery();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- break;
- case "Add":
- this.doAdd();
- break;
- case "Update":
- this.doUpdate();
- break;
- case "Delete":
- this.DoDeleteOrResume(true);
- break;
- case "Resume":
- this.DoDeleteOrResume(false);
- break;
- case "Refresh":
- this.doRefresh();
- break;
- case "Export":
- Export();
- break;
- case "Close":
- this.Close();
- break;
- }
- #if !DEBUG
- }
- catch (Exception ex) { }
- #endif
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "接箍基础信息");
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string jg_desc = ""; //接箍规格描述
- string jgproduct = ""; //接箍品种描述
- string steelname = ""; //接箍钢级名称
- string modelname = ""; //接箍扣型名称
- string dimaterJg = "";
- string stype = ""; //接箍类别
- if (this.ultraCheckEditor1.Checked)
- {
- jg_desc = this.ultraTextEditor1.Text.ToString().Trim();
- }
- if (this.ultraCheckEditor2.Checked)
- {
- jgproduct = this.ultraTextEditor3.Text.ToString().Trim();
- }
- if (this.ultraCheckEditor3.Checked)
- {
- steelname = this.ultraTextEditor4.Text.ToString().Trim();
- }
- if (this.ultraCheckEditor4.Checked)
- {
- modelname = this.ultraTextEditor5.Text.ToString().Trim();
- }
- if (this.ultraCheckEditor6.Checked)
- {
- dimaterJg = ultraTextEditor17.Text.Trim();
- }
- if (this.ultraCheckEditor5.Checked)
- {
- if (this.ultraComboEditor10.SelectedItem == null)
- {
- MessageBox.Show("请选择查询类别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- stype = this.ultraComboEditor10.Text.ToString();
- }
- }
- else
- {
- stype = "%";
- }
- ArrayList parm = new ArrayList();
- parm.Add(jg_desc);
- parm.Add(jgproduct);
- parm.Add(steelname);
- parm.Add(steelname);
- parm.Add(steelname);
- parm.Add(modelname);
- parm.Add(dimaterJg);
- parm.Add(dimaterJg);
- parm.Add(stype);
- parm.Add(_stdName);
- parm.Add(_stdName);
- parm.Add(_stdName);
- if (numDimaterCp.CheckBox.Checked && numDimaterCp.Value != null)
- {
- parm.Add(numDimaterCp.Value.ToString());
- parm.Add(numDimaterCp.Value.ToString());
- parm.Add(numDimaterCp.Value.ToString());
- parm.Add(numDimaterCp.Value.ToString());
- parm.Add(numDimaterCp.Value.ToString());
- parm.Add(numDimaterCp.Value.ToString());
- }
- else
- {
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- }
- if (numHeightCp.CheckBox.Checked && numHeightCp.Value != null)
- {
- parm.Add(numHeightCp.Value.ToString());
- parm.Add(numHeightCp.Value.ToString());
- parm.Add(numHeightCp.Value.ToString());
- parm.Add(numHeightCp.Value.ToString());
- parm.Add(numHeightCp.Value.ToString());
- parm.Add(numHeightCp.Value.ToString());
- }
- else
- {
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- parm.Add("");
- }
- bool validFlag = chkValid.Checked;
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.doQuery", new Object[] { validFlag, parm }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- UltraGridColumn[] col = new UltraGridColumn[]{this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"],
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["REP_STEELCODE"],this.ultraGrid1.DisplayLayout.Bands[0].Columns["REP_STEELNAME"]};
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1,col); 数据多,速度慢。
- //不同颜色区分是否有效数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效"))
- {
- row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- ultraGrid1.Rows[0].Activate();
- }
- }
- /// <summary>
- /// 获取界面编辑区数据
- /// </summary>
- /// <returns>成功返回0,失败返回-1</returns>
- private int GetData()
- {
- list = new ArrayList();
- jgDescList = new ArrayList();
- if (ultraTextEditor10.Text == "")
- {
- MessageBox.Show("请选择规格描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor10.Focus();
- return -1;
- }
- if (ultraComboEditor2.SelectedItem == null)
- {
- MessageBox.Show("请选择品种描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraComboEditor2.Focus();
- return -1;
- }
- if (ultraComboEditor3.SelectedItem == null)
- {
- if (ultraComboEditor3.Text != "")
- {
- MessageUtil.ShowWarning("输入的钢级名称不存在,请重新选择钢级名称!");
- ultraComboEditor3.Focus();
- return -1;
- }
- else
- {
- MessageBox.Show("请选择钢级名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraComboEditor3.Focus();
- return -1;
- }
- }
- //if (ultraTextEditor9.Text == "")
- //{
- // MessageBox.Show("请选择标准名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // ultraTextEditor9.Focus();
- // return -1;
- //}
- if (ultraComboEditor4.SelectedItem == null)
- {
- if (ultraComboEditor4.Text != "")
- {
- MessageUtil.ShowWarning("输入的扣型描述不存在,请重新选择扣型描述!");
- ultraComboEditor4.Focus();
- return -1;
- }
- else
- {
- MessageBox.Show("请选择扣型描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraComboEditor4.Focus();
- return -1;
- }
- }
- if (ultraComboEditor5.SelectedItem == null)
- {
- MessageUtil.ShowWarning("请选择中孔类别");
- ultraComboEditor5.Focus();
- return -1;
- }
- if (ultraTextEditor9.Tag.ToString2() != "")
- {
- MessageUtil.ShowWarning("不能选择标准名称");
- ultraTextEditor9.Focus();
- return -1;
- }
- if (ultraComboEditor8.Value.ToString2() != "")
- {
- MessageUtil.ShowWarning("不能选择标准类别");
- ultraComboEditor8.Focus();
- return -1;
- }
- string type = "";
- if (ultraComboEditor5.SelectedItem != null)
- {
- type = this.ultraComboEditor5.Text; //接箍类别
- }
- if (ultraNumericEditor9.Value == null || ultraNumericEditor9.Value.ToString() == "")
- {
- MessageBox.Show("请输入接箍外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor9.Focus();
- return -1;
- }
- string height = "";
- if (ultraNumericEditor10.Value != null)
- {
- height = ultraNumericEditor10.Value.ToString().Trim();
- }
- string radio = "";
- if (ultraNumericEditor8.Value != null)
- {
- radio = ultraNumericEditor8.Value.ToString().Trim();
- }
- if (ultraNumericEditor11.Value.ToString2() == "")
- {
- MessageBox.Show("请输入接箍长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor11.Focus();
- return -1;
- }
- if (ultraNumericEditor5.Value.ToString2() == "")
- {
- MessageBox.Show("请输入单个重", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor5.Focus();
- return -1;
- }
- else if (decimal.Parse(ultraNumericEditor5.Value.ToString()) <= 0)
- {
- MessageBox.Show("单个重必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor5.Focus();
- return -1;
- }
- if (ultraNumericEditor10.Value.ToString2() == "")
- {
- MessageBox.Show("请输入临界壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor10.Focus();
- return -1;
- }
- //else if (decimal.Parse(ultraNumericEditor10.Value.ToString()) <= 0)
- //{
- // MessageBox.Show("临界壁厚必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // ultraNumericEditor10.Focus();
- // return -1;
- //}
- if (ultraNumericEditor16.Value.ToString2() == "")
- {
- MessageBox.Show("请输入测量J值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor16.Focus();
- return -1;
- }
- else if (decimal.Parse(ultraNumericEditor16.Value.ToString()) <= 0)
- {
- MessageBox.Show("测量J值必须大于0", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor16.Focus();
- return -1;
- }
- if (ultraNumericEditor6.Value.ToString2() == "")
- {
- MessageBox.Show("请输入接箍料外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor6.Focus();
- return -1;
- }
- if (ultraNumericEditor7.Value.ToString2() == "")
- {
- MessageBox.Show("请输入接箍料壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor7.Focus();
- return -1;
- }
- if (ultraNumericEditor1.Value.ToString2() == "")
- {
- MessageBox.Show("请输入坯料外径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor1.Focus();
- return -1;
- }
- if (ultraNumericEditor2.Value.ToString2() == "")
- {
- MessageBox.Show("请输入坯料壁厚", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor2.Focus();
- return -1;
- }
- if (ultraNumericEditor3.Value.ToString2() == "")
- {
- MessageBox.Show("请输入坯料最小长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor3.Focus();
- return -1;
- }
- if (ultraNumericEditor4.Value.ToString2() == "")
- {
- MessageBox.Show("请输入坯料最大长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor4.Focus();
- return -1;
- }
- if (Convert.ToDouble(ultraNumericEditor3.Value.ToString()) > Convert.ToDouble(ultraNumericEditor4.Value.ToString()))
- {
- MessageBox.Show("您输入的接箍坯料长度最小值不能大于接箍坯料长度最大值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return -1;
- }
- if (ultraComboEditor6.SelectedItem == null)
- {
- if (ultraComboEditor6.Text != "")
- {
- MessageUtil.ShowWarning("输入的品名描述不存在,请重新选择品名描述!");
- ultraComboEditor6.Focus();
- return -1;
- }
- else
- {
- MessageBox.Show("请选择品名描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraComboEditor6.Focus();
- return -1;
- }
- }
- if (ultraNumericEditor14.Value == DBNull.Value)
- {
- MessageBox.Show("请输入最小外径值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor14.Focus();
- return -1;
- }
- if (ultraNumericEditor15.Value == DBNull.Value)
- {
- MessageBox.Show("请输入最大内径值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor15.Focus();
- return -1;
- }
- if (Convert.ToDouble(ultraNumericEditor15.Value.ToString()) < 0)
- {
- MessageBox.Show("输入的接箍料壁厚和最小外径不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraNumericEditor15.Focus();
- return -1;
- }
- if (ultraNumericEditor12.Value.ToString2() != "" && ultraNumericEditor13.Value.ToString2() != "")
- {
- if (Convert.ToDouble(ultraNumericEditor13.Value) < Convert.ToDouble(ultraNumericEditor12.Value))
- {
- MessageUtil.ShowWarning("适用成品壁厚最大值不能小于最小值!");
- ultraNumericEditor13.Focus();
- return -1;
- }
- }
- if (ultraNumericEditor18.Value.ToString2() != "" && ultraNumericEditor17.Value.ToString2() != "")
- {
- if (Convert.ToDouble(ultraNumericEditor17.Value) < Convert.ToDouble(ultraNumericEditor18.Value))
- {
- MessageUtil.ShowWarning("适用成品外径最大值不能小于最小值!");
- ultraNumericEditor17.Focus();
- return -1;
- }
- }
- string testJVal = "";
- if (ultraNumericEditor16.Value != null)
- testJVal = ultraNumericEditor16.Value.ToString();
- list.Add(ultraTextEditor10.Tag.ToString2());
- list.Add(ultraTextEditor10.Text);
- list.Add(ultraComboEditor2.Value.ToString().Trim());
- list.Add(ultraComboEditor2.Text.Trim());
- list.Add(ultraComboEditor3.Value.ToString().Trim());
- list.Add(ultraComboEditor3.Text.Trim());
- list.Add(ultraComboEditor4.Value.ToString().Trim());
- list.Add(ultraComboEditor4.Text.Trim());
- list.Add(ultraComboEditor5.Value.ToString());
- list.Add(ultraNumericEditor6.Value.ToString().Trim());
- list.Add(ultraNumericEditor7.Value.ToString().Trim());
- list.Add(ultraNumericEditor9.Value.ToString().Trim());
- list.Add(height);
- list.Add(ultraNumericEditor11.Value.ToString().Trim());
- list.Add(ultraNumericEditor5.Value.ToString().Trim());
- list.Add(radio);
- list.Add(ultraComboEditor11.Text.Trim());
- list.Add(ultraNumericEditor1.Value.ToString().Trim());
- list.Add(ultraNumericEditor2.Value.ToString().Trim());
- list.Add(ultraNumericEditor3.Value.ToString().Trim());
- list.Add(ultraNumericEditor4.Value.ToString().Trim());
- list.Add(this.UserInfo.GetUserName());
- list.Add(ultraTextEditor2.Text.Trim());
- list.Add(ultraComboEditor6.Value.ToString());
- list.Add(ultraComboEditor6.Text);
- list.Add(ultraNumericEditor14.Value.ToString().Trim());
- list.Add(ultraNumericEditor15.Value.ToString().Trim());
- if (ultraNumericEditor12.Value != null)
- list.Add(ultraNumericEditor12.Value.ToString().Trim());
- else
- list.Add("");
- if (ultraNumericEditor13.Value != null)
- list.Add(ultraNumericEditor13.Value.ToString2().Trim());
- else
- list.Add("");
- list.Add(ultraTextEditor9.Tag.ToString2());
- list.Add(ultraTextEditor9.Text);
- list.Add(testJVal);
- list.Add(ultraComboEditor8.Value.ToString2());
- list.Add(ultraComboEditor8.Text);
- list.Add(ultraTextEditor7.Text.Trim());
- if (ultraNumericEditor18.Value != null)
- list.Add(ultraNumericEditor18.Value.ToString2().Trim());
- else
- list.Add("");
- if (ultraNumericEditor17.Value != null)
- list.Add(ultraNumericEditor17.Value.ToString2().Trim());
- else
- list.Add("");
- list.Add(ultraTextEditor11.Text.Trim());
- list.Add(ultraTextEditor12.Text.Trim());
- list.Add(ultraTextEditor13.Text.Trim());
- list.Add(ultraTextEditor14.Text.Trim());
- list.Add(ultraTextEditor15.Tag.ToString2());
- list.Add(textBox1.Text.Trim() == "" ? "0" : textBox1.Text.Trim());
- list.Add(textBox2.Text.Trim() == "" ? "0" : textBox2.Text.Trim());
- list.Add(textBox3.Text.Trim() == "" ? "0" : textBox3.Text.Trim());
- list.Add(textBox4.Text.Trim() == "" ? "0" : textBox4.Text.Trim());
- jgDescList.Add(ultraTextEditor10.Tag.ToString2());
- jgDescList.Add(ultraComboEditor2.Value.ToString2());
- jgDescList.Add(ultraComboEditor3.Value.ToString2());
- jgDescList.Add(ultraTextEditor9.Tag.ToString2());
- jgDescList.Add(ultraComboEditor4.Value.ToString2());
- jgDescList.Add(ultraComboEditor5.Value.ToString2());
- jgDescList.Add(ultraComboEditor8.Value.ToString2());
- return 0;
- }
- /// <summary>
- /// 新增记录
- /// </summary>
- private void doAdd()
- {
- if (GetData() == 0)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.isExistJGCode", new Object[] { jgDescList }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- MessageBox.Show("当前接箍描述所约束的接箍码已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认新增?") == DialogResult.No)
- {
- return;
- }
- ArrayList steelList = new ArrayList();
- string code = ultraComboEditor3.Value.ToString(); //钢级代码
- string desc = ultraComboEditor3.Text.Trim(); //钢级描述
- string repcode = txtRepSteelCode.Text.Trim(); //替代钢级代码集合
- string repdesc = ultraTextEditor6.Text.Trim(); //替代钢级名称集合
- string[] arrcode = repcode.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
- string[] arrdesc = repdesc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < arrcode.Length; i++)
- {
- ArrayList tempList = new ArrayList();
- tempList.Add(code);
- tempList.Add(desc);
- tempList.Add(arrcode[i]);
- tempList.Add(arrdesc[i]);
- tempList.Add(this.UserInfo.GetUserName());
- steelList.Add(tempList);
- }
- int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doAdd", new Object[] { list, steelList, code, _choiceSpecs }, this.ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("新增成功!");
- doQuery();
- //高亮显示新增的数据
- ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear();
- ultraGrid1.DisplayLayout.Bands[0].Columns["CODE_JG"].SortIndicator = SortIndicator.Ascending;
- this.ultraGrid1.Rows[ultraGrid1.Rows.Count - 1].Activate();
- }
- }
- }
- /// <summary>
- /// 修改数据
- /// </summary>
- private void doUpdate()
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageBox.Show("请选择需要操作的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效")
- {
- MessageBox.Show("您选择的数据已经无效,无法修改", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- list = new ArrayList();
- jgDescList = new ArrayList();
- if (GetData() == 0)
- {
- if (MessageBox.Show("是否确认修改该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- string getjgcode = ugr.Cells["CODE_JG"].Value.ToString();
- list.Add(getjgcode);
- jgDescList.Add(getjgcode);
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.isExistJGDescUpdate", new Object[] { jgDescList }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- MessageBox.Show("当前接箍描述所约束的接箍码已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- ArrayList steelList = new ArrayList();
- string code = ultraComboEditor3.Value.ToString(); //钢级代码
- string desc = ultraComboEditor3.Text.Trim(); //钢级描述
- string repcode = txtRepSteelCode.Text.Trim(); //替代钢级代码集合
- string repdesc = ultraTextEditor6.Text.Trim(); //替代钢级名称集合
- string[] arrcode = repcode.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
- string[] arrdesc = repdesc.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < arrcode.Length; i++)
- {
- ArrayList tempList = new ArrayList();
- tempList.Add(code);
- tempList.Add(desc);
- tempList.Add(arrcode[i]);
- tempList.Add(arrdesc[i]);
- tempList.Add(this.UserInfo.GetUserName());
- steelList.Add(tempList);
- }
- int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doUpdate", new Object[] { list, steelList, code, _choiceSpecs }, this.ob);
- MessageUtil.ShowTips("修改成功!");
- if (count > 0)
- {
- doQuery();
- //高亮显示修改的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["CODE_JG"].Value.ToString().Equals(getjgcode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// 删除或恢复
- /// </summary>
- /// <param name="flag">功能区分</param>
- private void DoDeleteOrResume(bool flag)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageBox.Show("请选择需要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效" && flag == true)
- {
- MessageBox.Show("您选择的数据已经无效,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "有效" && flag == false)
- {
- MessageBox.Show("您选择的数据已经有效,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否确认" + (flag ? "作废" : "恢复") + "该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- string jgcode = ugr.Cells["CODE_JG"].Value.ToString();
- string deletename = this.UserInfo.GetUserName().Trim();
- int count = ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.doDelete", new Object[] { jgcode, deletename, flag }, this.ob);
- if (count > 0)
- {
- MessageUtil.ShowTips((flag ? "作废" : "恢复") + "成功!");
- doQuery();
- if (flag == false)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["CODE_JG"].Value.ToString().Equals(jgcode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// check控件值改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraCheckEditor1_CheckedValueChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor1.Checked)
- {
- this.ultraTextEditor1.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor1.ReadOnly = true;
- }
- }
- private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor2.Checked)
- {
- this.ultraTextEditor3.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor3.ReadOnly = true;
- }
- }
- private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor3.Checked)
- {
- this.ultraTextEditor4.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor4.ReadOnly = true;
- }
- }
- private void ultraCheckEditor4_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor4.Checked)
- {
- this.ultraTextEditor5.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor5.ReadOnly = true;
- }
- }
- private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor5.Checked)
- {
- this.ultraComboEditor10.ReadOnly = false;
- }
- else
- {
- this.ultraComboEditor10.ReadOnly = true;
- }
- }
- /// <summary>
- /// 行激活事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- return;
- ultraTextEditor10.Text = ugr.Cells["SPEC_JG_DESC"].Value.ToString();
- ultraTextEditor10.Tag = ugr.Cells["SPEC_JG"].Value.ToString();
- this.ultraComboEditor2.Text = ugr.Cells["PRODUCCODE_JG_DESC"].Value.ToString();
- this.ultraComboEditor2.Value = ugr.Cells["PRODUCCODE_JG"].Value.ToString();
- this.ultraComboEditor3.Text = ugr.Cells["STEELCODE_JG_DESC"].Value.ToString();
- this.ultraComboEditor3.Value = ugr.Cells["STEELCODE_JG"].Value.ToString();
- this.ultraComboEditor4.Text = ugr.Cells["MODEL_DESC"].Value.ToString();
- this.ultraComboEditor4.Value = ugr.Cells["MODEL_CODE"].Value.ToString();
- this.ultraComboEditor5.Text = ugr.Cells["STYLE_JG"].Value.ToString();
- this.ultraTextEditor6.Text = ugr.Cells["REP_STEELNAME"].Value.ToString();
- this.ultraTextEditor6.Tag = ugr.Cells["REP_STEELCODE"].Value.ToString();
- this.ultraNumericEditor6.Text = ugr.Cells["MIN_D"].Value.ToString();
- this.ultraNumericEditor7.Text = ugr.Cells["MIN_H"].Value.ToString();
- this.ultraNumericEditor9.Text = ugr.Cells["DIAMETER_JG"].Value.ToString();
- this.ultraNumericEditor10.Text = ugr.Cells["HEIGHT_JG"].Value.ToString();
- textBox1.Text = ugr.GetValue("DIAMETER_SPEC");
- textBox2.Text = ugr.GetValue("DIAMETER_SPEC2");
- textBox3.Text = ugr.GetValue("LENGTH_SPEC");
- textBox4.Text = ugr.GetValue("LENGTH_SPEC2");
- this.ultraNumericEditor11.Text = ugr.Cells["LENGTH_JG"].Value.ToString();
- this.ultraNumericEditor5.Text = ugr.Cells["WEIGHT_JG"].Value.ToString();
- this.ultraNumericEditor8.Text = ugr.Cells["DIAMETER"].Value.ToString();
- this.ultraComboEditor11.Text = ugr.Cells["ALPHA"].Value.ToString();
- this.ultraNumericEditor1.Text = ugr.Cells["DIAMETER_PL"].Value.ToString();
- this.ultraNumericEditor2.Text = ugr.Cells["HEIGHT_PL"].Value.ToString();
- this.ultraNumericEditor3.Text = ugr.Cells["LENGTH_MIN"].Value.ToString();
- this.ultraNumericEditor4.Text = ugr.Cells["LENGTH_MAX"].Value.ToString();
- this.ultraTextEditor2.Text = ugr.Cells["MEMO"].Value.ToString();
- this.ultraComboEditor6.Value = ugr.Cells["PRODUCCODE"].Value.ToString();
- this.ultraComboEditor6.Text = ugr.Cells["PRODUCNAME"].Value.ToString();
- ultraTextEditor9.Tag = ugr.Cells["STD_CODE"].Value.ToString();
- ultraTextEditor9.Text = ugr.Cells["STD_NAME"].Value.ToString();
- this.ultraComboEditor8.Value = ugr.Cells["STD_STYLE"].Value.ToString();
- this.ultraNumericEditor14.Text = ugr.Cells["MIN_D_CP"].Value.ToString();
- this.ultraNumericEditor15.Text = ugr.Cells["MAX_D_CP"].Value.ToString();
- this.ultraNumericEditor12.Text = ugr.Cells["MIN_H_CP"].Value.ToString();
- this.ultraNumericEditor13.Text = ugr.Cells["MAX_H_CP"].Value.ToString();
- this.ultraNumericEditor16.Text = ugr.Cells["CHECK_J_VAL"].Value.ToString();
- ultraTextEditor7.Text = ugr.Cells["TAPER"].Value.ToString();
- ultraNumericEditor18.Text = ugr.Cells["MIN_D_JG"].Value.ToString();
- ultraNumericEditor17.Text = ugr.Cells["MAX_D_JG"].Value.ToString();
- ultraTextEditor8.Text = ugr.GetValue("SPEC_NAME");
- ultraTextEditor11.Text = ugr.GetValue("M_STD_NO");
- ultraTextEditor12.Text = ugr.GetValue("W_STD_NO");
- ultraTextEditor13.Text = ugr.GetValue("M_PRINT_NO");
- ultraTextEditor14.Text = ugr.GetValue("W_PRINT_NO");
- ultraTextEditor15.Text = ugr.GetValue("FILE_NAME");
- ultraTextEditor15.Tag = ugr.GetValue("FILE_PATH");
- _choiceSpecs.Clear();
- }
- private void ultraTextEditor6_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (ultraComboEditor3.SelectedItem == null)
- {
- MessageBox.Show("请先选择钢级名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- FrmRepSteel frms = new FrmRepSteel();
- frms.Ob1 = this.ob;
- frms.Code = this.ultraTextEditor6.Tag.ToString2();
- frms.ShowDialog();
- txtRepSteelCode.Text = frms.Code;
- ultraTextEditor6.Text = frms.Desc;
- }
- private void ultraComboEditor3_ValueChanged(object sender, EventArgs e)
- {
- if (ultraComboEditor3.Value == null) return;
- string code = ultraComboEditor3.Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getDynamicSteel", new Object[] { code }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- ultraTextEditor6.Text = dt.Rows[0][1].ToString();
- txtRepSteelCode.Text = dt.Rows[0][0].ToString();
- }
- }
- private void ultraNumericEditor7_ValueChanged(object sender, EventArgs e)
- {
- double w = 0;
- double n = 0;
- if (!IsDBNullOrNull(ultraNumericEditor6.Value))
- {
- w = Convert.ToDouble(ultraNumericEditor6.Value);
- }
- if (!IsDBNullOrNull(ultraNumericEditor7.Value))
- {
- n = Convert.ToDouble(ultraNumericEditor7.Value);
- }
- if (IsDBNullOrNull(ultraNumericEditor6.Value) && IsDBNullOrNull(ultraNumericEditor7.Value))
- {
- ultraNumericEditor15.Value = "";
- }
- else
- {
- ultraNumericEditor15.Value = w - 2 * n;
- }
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- this.ultraGrid1.UpdateData();
- }
- /// <summary>
- /// 判断是DBNull或者Null
- /// </summary>
- /// <param name="value">要判断的值</param>
- /// <returns>是否</returns>
- private bool IsDBNullOrNull(object value)
- {
- if (Convert.IsDBNull(value) || value == null)
- return true;
- return false;
- }
- private void ultraNumericEditor6_ValueChanged(object sender, EventArgs e)
- {
- this.ultraNumericEditor14.Value = this.ultraNumericEditor6.Value;
- double w = 0;
- double n = 0;
- if (!IsDBNullOrNull(ultraNumericEditor6.Value))
- {
- w = Convert.ToDouble(ultraNumericEditor6.Value);
- }
- if (!IsDBNullOrNull(ultraNumericEditor7.Value))
- {
- n = Convert.ToDouble(ultraNumericEditor7.Value);
- }
- if (IsDBNullOrNull(ultraNumericEditor6.Value) && IsDBNullOrNull(ultraNumericEditor7.Value))
- {
- ultraNumericEditor15.Value = "";
- }
- else
- {
- ultraNumericEditor15.Value = w - 2 * n;
- }
- }
- private void ultraPanel2_Scroll(object sender, ScrollEventArgs e)
- {
- //this.Update();
- //this.SuspendLayout();
- }
- private void ultraTextEditor8_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- string specs = "";
- if (_choiceSpecs.Count > 0)
- {
- foreach (string[] strs in _choiceSpecs)
- {
- specs += strs[0] + ";";
- }
- }
- else if (ultraGrid1.ActiveRow != null)
- {
- specs = ultraGrid1.GetActiveRowValue("SPEC_CODE");
- }
- PopupSpecificationsBasics popup = new PopupSpecificationsBasics(specs, ob);
- DialogResult result = popup.ShowDialog();
- if (result == DialogResult.OK)
- {
- ultraTextEditor8.Text = "";
- foreach (string[] strs in popup.ChoiceSpecs)
- {
- ultraTextEditor8.Text += strs[1] + "; ";
- }
- _choiceSpecs = popup.ChoiceSpecs;
- }
- }
- private void ultraTextEditor9_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.getStdName",
- new object[] { }, ob);
- dt.Columns["STD_NAME"].Caption = "标准名称";
- dt.Columns["STDSTYLE"].Caption = "标准类型";
- DataRow drBlank = dt.NewRow();
- drBlank["STDSTYLE"] = "交付";
- dt.Rows.InsertAt(drBlank, 0);
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STD_NAME", "STD_CODE");
- baseInfo.UltraGrid1.DisplayLayout.Bands[0].Columns["STDSTYLE"].Width = 20;
- baseInfo.LabelTextBox1.Caption = "标准名称";
- baseInfo.Shown += new EventHandler((c, d) =>
- {
- var row = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("STD_CODE") == ultraTextEditor9.Tag.ToString2()).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor9.Text = baseInfo.ChoicedRow.GetValue("STD_NAME");
- ultraTextEditor9.Tag = baseInfo.ChoicedRow.GetValue("STD_CODE");
- }
- }
- private void ultraTextEditor10_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.GetJGSpec",
- new object[] { }, ob);
- dt.Columns["SPEC_NAME"].Caption = "规格描述";
- dt.DefaultView.RowFilter = "SPEC_NAME NOT LIKE '%.%'";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt.DefaultView.ToTable(), "SPEC_NAME", "SPEC_CODE");
- baseInfo.LabelTextBox1.Caption = "规格描述";
- baseInfo.Shown += new EventHandler((c, d) =>
- {
- var row = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("SPEC_CODE") == ultraTextEditor10.Tag.ToString2()).FirstOrDefault();
- if (row != null)
- {
- row.Activate();
- }
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor10.Text = baseInfo.ChoicedRow.GetValue("SPEC_NAME");
- ultraTextEditor10.Tag = baseInfo.ChoicedRow.GetValue("SPEC_CODE");
- }
- }
- private void ultraGrid1_AfterRowCancelUpdate(object sender, RowEventArgs e)
- {
- }
- private void ultraTextEditor15_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- //Qcm/Jg/接箍码/文件名
- var row = ultraGrid1.ActiveRow;
- if (row == null)
- {
- MessageUtil.ShowWarning("请选择一条记录!");
- return;
- }
- string codejg = row.GetValue("CODE_JG");
- string path = "Qcm/Jg/" + row.GetValue("CODE_JG") + "/";
- if (e.Button.Key == "Show")
- {
- FormFileDown down = new FormFileDown(ob, path);
- down.ShowDialog();
- if (down.CtrlFileDown1.List.Count == 0)
- {
- UpdatePath(codejg, "", UserInfo.GetUserName());
- ultraGrid1.ActiveRow.Cells["FILE_NAME"].Value = "";
- ultraGrid1.ActiveRow.Cells["FILE_PATH"].Value = "";
- }
- }
- else
- {
- var serverFileList = FileHelper.Download(path);
- //if (serverFileList.Count > 0)
- //{
- // MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
- // return;
- //}
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = true;
- file.Title = "选择需要上传的图片";
- file.Filter = "图片文件(*.jpg);(*.gif);(*.png);(*.bmp)|*.jpg;*.gif;*.png;*.bmp";
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- foreach (string fileName in file.FileNames)
- {
- string name = System.IO.Path.GetFileName(fileName);
- if (name.Contains(" "))
- {
- MessageUtil.ShowWarning("上传的图片名称不能包含空格!");
- return;
- }
- if (name.Contains("°"))
- {
- MessageUtil.ShowWarning("上传的图片名称不能包含特殊符号【°】");
- return;
- }
- bean = new FileBean();
- bean.setFileName(name);
- bean.setPathName(path);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- }
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- string fileNames = "";
- List<FileBean> fileBeans = FileHelper.Download(path);
- foreach (var fileBean in fileBeans)
- {
- if (fileNames == "")
- {
- fileNames = path + fileBean.getFileName();
- }
- else
- {
- fileNames += "#" + path + fileBean.getFileName();
- }
- }
- UpdatePath(row.GetValue("CODE_JG"), fileNames, UserInfo.GetUserName());
- MessageUtil.ShowTips("上传成功!");
- doQuery();
- var redirectRow = ultraGrid1.Rows.Where(a => a.GetValue("CODE_JG") == codejg).FirstOrDefault();
- if (redirectRow != null)
- {
- redirectRow.Activate();
- }
- }
- else
- {
- MessageUtil.ShowTips("上传失败,请重试!");
- }
- }
- }
- }
- private void UpdatePath(string codeJg, string path, string user)
- {
- ServerHelper.SetData("com.steering.pss.qcm.JGCodeManage.updateJgFile",
- new object[] { codeJg, path, user }, ob);
- }
- private void ultraTextEditor16_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- //Qcm/Jg/接箍码/文件名
- var row = ultraGrid1.ActiveRow;
- string codejg = row.GetValue("CODE_JG");
- string path = "Qcm/Jg/" + codejg + "/";
- if (e.Button.Key == "Show")
- {
- FormFileDown down = new FormFileDown(ob, path);
- down.ShowDialog();
- if (down.CtrlFileDown1.List.Count == 0)
- {
- UpdatePath(codejg, "", UserInfo.GetUserName());
- ultraGrid1.ActiveRow.Cells["FILE_NAME"].Value = "";
- ultraGrid1.ActiveRow.Cells["FILE_PATH"].Value = "";
- }
- }
- }
- private void ultraTextEditor11_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraTextEditor textEditor = (UltraTextEditor)sender;
- PopupTextBox popupText = new PopupTextBox(textEditor.Text, 200);
- if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- textEditor.Text = popupText.TextInfo.Trim();
- }
- }
- private void ultraTextEditor12_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- ultraTextEditor11_EditorButtonClick(sender, e);
- }
- private void ultraTextEditor13_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- ultraTextEditor11_EditorButtonClick(sender, e);
- }
- private void ultraTextEditor14_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- ultraTextEditor11_EditorButtonClick(sender, e);
- }
- private void ultraCheckEditor6_CheckedChanged(object sender, EventArgs e)
- {
- ultraTextEditor17.ReadOnly = !ultraCheckEditor6.Checked;
- }
- }
- }
|