| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmPhyRStd : FrmBaseQcm
- {
- int index = 0;
- private string _selectedCode = "";
- public FrmPhyRStd()
- {
- InitializeComponent();
- ExceptionHelper.RegistException();
- _dtBaseQcm = new DtPhyRStd(this);
- }
- List<FileBean> fileList = new List<FileBean>();
- public List<FileBean> FileList
- {
- get { return fileList; }
- set { fileList = value; }
- }
- private string filePath = ""; //用于保存上传图片
- public string FilePath
- {
- get { return filePath; }
- set { filePath = value; }
- }
- private string oldfilePath = "";//前一个路径,用于删除。
- public string OldfilePath
- {
- get { return oldfilePath; }
- set { oldfilePath = value; }
- }
- protected override void BeginDoAction(ActionType actionType)
- {
- if (actionType == ActionType.Add || actionType == ActionType.Modify)
- {
- _selectedCode = "";
- }
- else
- {
- _selectedCode = ultraGrid1.ActiveRow.Cells["PHY_STD_ID"].Value.ToString();
- }
- }
- protected override void SuccessDoAction(ActionType actionType)
- {
- if (actionType == ActionType.Add)
- {
- SetGridRowActiveWithKey(ultraGrid1, "PHY_STD_ID", "CREATE_NAME", "CREATE_TIME");
- }
- else if (actionType == ActionType.Modify)
- {
- SetGridRowActiveWithKey(ultraGrid1, "PHY_STD_ID", "UPDATE_NAME", "UPDATE_TIME");
- }
- else
- {
- SetGridRowActiveWithKey(ultraGrid1, "PHY_STD_ID", _selectedCode);
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- //PHY_TYPE
- if (ultraGrid1.ActiveRow == null)
- return;
- cmbPhyType.SelecteValue = ultraGrid1.ActiveRow.Cells["PHY_CODE"].Value.ToString();
- cmbStdName.SelecteValue = ultraGrid1.ActiveRow.Cells["STD_CODE"].Value.ToString();
- cmbStdAlpha.SelecteValue = ultraGrid1.ActiveRow.Cells["STD_CODE_ALPHA"].Value.ToString();
- cmbPhyStd.SelecteValue = ultraGrid1.ActiveRow.Cells["PHY_STD"].Value.ToString();
- txtMemo.Text = ultraGrid1.ActiveRow.Cells["MEMO"].Value.ToString();
- ultraTextEditor1.Text = ultraGrid1.ActiveRow.Cells["STD_FILE_PATH"].Value.ToString();
- index = 1;
- }
- private void FrmPhyRStd_Load(object sender, EventArgs e)
- {
- LoadBaseInfo();
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "");
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- this.flowLayoutPanel2.BackColor = Color.Transparent;
- cmbStdName.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- cmbPhyStd.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- cmbPhyType.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- cmbPhyType2.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- }
- protected override void LoadBaseInfo()
- {
- QcmBaseQuery.NitializeStandardG(cmbStdName, false, ob);
- //QcmBaseQuery.NitializeAlphaStandard(cmbStdAlpha, false, ob);
- QcmBaseQuery.NitializeStandardSS(cmbPhyStd, false, ob);
- QcmBaseQuery.NitializeBasePhyB(cmbPhyType, false, ob);
- QcmBaseQuery.NitializeBasePhyB(cmbPhyType2, true, ob);
- cmbStdAlpha.ComboBox.DropDownListWidth = 200;
- cmbStdName.ComboBox.DropDownListWidth = 200;
- ClsBaseInfo.SetComboItemHeight(cmbPhyType.ComboBox);
- ClsBaseInfo.SetComboItemHeight(cmbPhyType2.ComboBox);
- ClsBaseInfo.SetComboItemHeight(cmbStdName.ComboBox);
- ClsBaseInfo.SetComboItemHeight(cmbPhyStd.ComboBox);
- //string code = "";
- //if (cmbStdName.SelecteValue != null)
- // code = cmbStdName.SelecteValue.ToString();
- //DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBasePhyRStdMng.getStdAlpha", new object[] { code }, this.ob);
- //if (dt != null && dt.Rows.Count > 0)
- //{
- // DataRow dr = dt.NewRow();
- // for (int i = 0; i < dt.Columns.Count; i++)
- // {
- // dr[i] = "";
- // }
- // dt.Rows.InsertAt(dr, 0);
- //}
- //cmbStdAlpha.ComboBox.DataSource = dt;
- //cmbStdAlpha.ComboBox.ValueMember = "STD_CODE";
- //cmbStdAlpha.ComboBox.DisplayMember = "STD_NAME";
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- SetDeleteColor(e, "VALIDFLAG", "0");
- }
- private void cmbStdName_ComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- string code = "";
- if (cmbStdName.SelecteValue != null)
- {
- code = cmbStdName.SelecteValue.ToString();
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ComBasePhyRStdMng.getStdAlpha", new object[] { code }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- DataRow dr = dt.NewRow();
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- dr[i] = "";
- }
- dt.Rows.InsertAt(dr, 0);
- }
- cmbStdAlpha.ComboBox.DataSource = dt;
- cmbStdAlpha.ComboBox.ValueMember = "STD_CODE";
- cmbStdAlpha.ComboBox.DisplayMember = "STD_NAME";
- ClsBaseInfo.SetComboItemHeight(cmbStdAlpha.ComboBox);
- cmbStdAlpha.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (e.Button.Key.Equals("2")) //选择上传文件
- {
- fileList = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- string filter = "图片文件(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|Word文档(*.doc;*.docx)|*.doc;*.docx|文本文档(*.txt;)|*.txt";
- // file.Multiselect = true;
- file.Filter = filter;
- if (!ultraTextEditor1.Text.Trim().Equals(""))
- {
- OldfilePath = "PhyRStd/" + ultraTextEditor1.Text;
- }
- if (file.ShowDialog() == DialogResult.OK)
- {
- foreach (string fileName in file.FileNames)
- {
- bean = new FileBean();
- string filena = System.IO.Path.GetFileName(fileName);
- bean.setFileName(DateTime.Now.ToString("yyyyMMdd") + filena);
- bean.setPathName("PhyRStd");
- bean.setFile(FileHelper.FileToArray(fileName));
- fileList.Add(bean);
- ultraTextEditor1.Text = DateTime.Now.ToString("yyyyMMdd") + filena;
- FilePath = "PhyRStd/" + filena;
- }
- index = 2;
- }
- }
- if (e.Button.Key.Equals("1")) //预览
- {
- if (index == 2)
- {
- MessageUtil.ShowWarning("此文件尚未上传到服务器!");
- return;
- }
- if (ultraTextEditor1.Text.Trim() == "")
- {
- MessageUtil.ShowWarning("没有文件可预览!");
- return;
- }
- FrmFilePreview ffp = new FrmFilePreview();
- ffp.FilePath = ultraTextEditor1.Text.ToString();
- ffp.ShowDialog();
- if (ffp.FilePath != "")
- System.IO.File.Delete(ffp.FilePath);
- }
- }
- }
- }
|