| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- 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 Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Infragistics.Win;
- using System.IO;
- namespace Core.LZMes.Client.QCM
- {
- public partial class QCM0107 : FrmBase
- {
- public QCM0107()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Add":
- this.Add();
- break;
- case "Edit":
- this.Edit();
- break;
- }
- }
- private void DoQuery()
- {
- //查询
- try
- {
- this.dataSet1.Clear();
- string prod_line = "";
- if (this.comboBox3.Text.ToString() == "卷板")
- {
- prod_line = "JB1";
- }
- else if (this.comboBox3.Text.ToString() == "中厚板")
- {
- prod_line = "ZHB";
- }
- else if (this.comboBox3.Text.ToString() == "线棒")
- {
- prod_line = "XB1";
- }
- else if (this.comboBox3.Text.ToString() == "炼钢")
- {
- prod_line = "LG";
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0106.QueryDefect";
- ccp.MethodName = "QueryMemo";
- ccp.ServerParams = new object[] { prod_line };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void Add()
- {
- try
- {
- string prod_line = "";
- if (this.comboBox1.Text.ToString() == "卷板")
- {
- prod_line = "JB1";
- }
- else if (this.comboBox1.Text.ToString() == "中厚板")
- {
- prod_line = "ZHB";
- }
- else if (this.comboBox1.Text.ToString() == "线棒")
- {
- prod_line = "XB1";
- }
- else if (this.comboBox1.Text.ToString() == "炼钢")
- {
- prod_line = "LG";
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0106.QueryDefect";
- ccp.MethodName = "AddMemo";
- ccp.ServerParams = new object[] { prod_line, this.textBox3.Text.ToString(),this.UserInfo.GetUserName().ToString(),
- this.textBox1.Text.ToString()};
- //ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == 1)
- {
- MessageBox.Show("处理备注添加成功", "提示");
- }
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
-
- }
- private void Edit()
- {
- try
- {
- string prod_line = "";
- if (this.comboBox1.Text.ToString() == "卷板")
- {
- prod_line = "JB1";
- }
- else if (this.comboBox1.Text.ToString() == "中厚板")
- {
- prod_line = "ZHB";
- }
- else if (this.comboBox1.Text.ToString() == "线棒")
- {
- prod_line = "XB1";
- }
- else if (this.comboBox1.Text.ToString() == "炼钢")
- {
- prod_line = "LG";
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0106.QueryDefect";
- ccp.MethodName = "EMemo";
- ccp.ServerParams = new object[] { prod_line, this.textBox3.Text.ToString(),this.UserInfo.GetUserName().ToString(),
- this.textBox1.Text.ToString()};
- //ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == 1)
- {
- MessageBox.Show("处理备注修改成功", "提示");
- }
-
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- /*public string memo = "";
- private void button1_Click(object sender, EventArgs e)
- {
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text.ToLower() == "true")
- {
- if (memo == "")
- {
- memo = ugr.Cells["MEMO"].Value.ToString();
- }
- else if (memo != "")
- {
- memo +=";"+ ugr.Cells["MEMO"].Value.ToString();
- }
- }
- }
- this.DialogResult = DialogResult.OK;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- this.DoQuery();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- this.Add();
- }*/
- private void QCM0107_Load(object sender, EventArgs e)
- {
- this.comboBox3.Text = "卷板";
- this.comboBox1.Text = "卷板";
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- this.comboBox1.Text = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Text.ToString();
- this.textBox1.Text = this.ultraGrid1.ActiveRow.Cells["MEMO_CODE"].Text.ToString();
- this.textBox3.Text = this.ultraGrid1.ActiveRow.Cells["MEMO"].Text.ToString();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- OpenFileDialog Ofd = new OpenFileDialog();
- Ofd.Title = "选择文件";
- //Ofd.Filter = "文件 (*.doc;*;docx;*.xls;*.xlsx;*.et;*.png;*.xml;*.jpg)|*.doc;*;docx;*.xls;*.xlsx;*.et;*.png;*.xml;*.jpg";
- Ofd.Filter = "文件 (*.xls;*.xlsx)|*.xls;*.xlsx";
- //Ofd.Filter = "文件 (*.*)|*.*";
- if (Ofd.ShowDialog() == DialogResult.OK)
- {
- this.textBox2.Text = Ofd.FileName.ToString();//选取文件路径
- }
- if (MessageBox.Show("确定上传?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- FileStream read = new FileStream(this.textBox2.Text.Trim(), FileMode.Open, FileAccess.Read);
- byte[] byData = new byte[read.Length];
- read.Read(byData, 0, (int)read.Length);
- read.Close();
- if (byData == null) { MessageBox.Show("请先选择需要上传的文件!", "提示"); return; }
- //获取文件扩展名
- string[] str = this.textBox2.Text.Trim().Split('.');
- string extName = "." + str[str.Length - 1];
- CoreClientParam ccp = new CoreClientParam();
- //ccp.ServerName = "QCM.QCM01.QCM0106.ImportExcelUtil";
- ccp.ServerName = "QCM.QCM01.QCM0107.ImportEasyExcelUtil";
- ccp.MethodName = "dateImport";
- ccp.ServerParams = new object[] { byData, this.textBox2.Text.Trim(),this.UserInfo.GetUserName() };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if(ccp.ReturnCode == 1){
- MessageBox.Show("导入成功", "提示");
- }
- this.textBox2.Text = "";
- //this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("上传失败,请选择正确的文件路径", "提示");
- }
- }
- }
- }
|