Special_GetSNLog.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. using UAS_MES_NEW.PublicMethod;
  12. namespace UAS_MES_NEW.Special
  13. {
  14. public partial class Special_GetSNLog : Form
  15. {
  16. DataHelper dh;
  17. ftpOperater ftp = null;
  18. LogStringBuilder sql = new LogStringBuilder();
  19. public Special_GetSNLog()
  20. {
  21. InitializeComponent();
  22. }
  23. private void Special_BoxSplit_Load(object sender, EventArgs e)
  24. {
  25. dh = SystemInf.dh;
  26. ftp = new ftpOperater();
  27. }
  28. private void Split_Click(object sender, EventArgs e)
  29. {
  30. if (!dh.CheckExist("makeserial", "ms_sncode = '" + SNCODE.Text + "' or MS_FIRSTSN = '" + SNCODE.Text + "'"))
  31. {
  32. OperatResult.AppendText(">>SN号" + SNCODE.Text + "不存在\n", Color.Red, SNCODE);
  33. return;
  34. }
  35. try
  36. {
  37. string sn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_sncode = '" + SNCODE.Text + "' or MS_FIRSTSN = '" + SNCODE.Text + "'").ToString();
  38. string address = ftp.Download(sn+".csv");
  39. if (address.Length == 0)
  40. {
  41. OperatResult.AppendText(">>SN号" + SNCODE.Text + "不存在LOG文件\n", Color.Red, SNCODE);
  42. return;
  43. }
  44. OperatResult.AppendText(">>SN号" + SNCODE.Text + "LOG文件下载至"+ address + "\n", Color.Green, SNCODE);
  45. return;
  46. }
  47. catch (Exception ex)
  48. {
  49. OperatResult.AppendText(ex.Message+"\n", Color.Red, SNCODE);
  50. return;
  51. }
  52. }
  53. private void button1_Click(object sender, EventArgs e)
  54. {
  55. ftp.UpLoadFile(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\" + @"SNLog", "1.csv","/log/", SNCODE.Text +".csv");
  56. MessageBox.Show("OK");
  57. }
  58. private void button2_Click(object sender, EventArgs e)
  59. {
  60. DataTable dt = ExcelHandler.ReadFromCSV(@"C:\UAS_MES\unknown_Fail.csv", true);
  61. for (int i = 0; i < 13; i++)
  62. {
  63. if (dt.Rows[i]["TestResult"].ToString() == "NG")
  64. {
  65. MessageBox.Show("NG");
  66. break;
  67. }
  68. }
  69. MessageBox.Show("OK");
  70. BaseUtil.FillDgvWithDataTable(dataGridView1, dt);
  71. }
  72. }
  73. }