12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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 UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Special
- {
- public partial class Special_GetSNLog : Form
- {
- DataHelper dh;
- ftpOperater ftp = null;
- LogStringBuilder sql = new LogStringBuilder();
- public Special_GetSNLog()
- {
- InitializeComponent();
- }
- private void Special_BoxSplit_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- ftp = new ftpOperater();
- }
- private void Split_Click(object sender, EventArgs e)
- {
- if (!dh.CheckExist("makeserial", "ms_sncode = '" + SNCODE.Text + "' or MS_FIRSTSN = '" + SNCODE.Text + "'"))
- {
- OperatResult.AppendText(">>SN号" + SNCODE.Text + "不存在\n", Color.Red, SNCODE);
- return;
- }
- try
- {
- string sn = dh.getFieldDataByCondition("makeserial", "ms_firstsn", "ms_sncode = '" + SNCODE.Text + "' or MS_FIRSTSN = '" + SNCODE.Text + "'").ToString();
- string address = ftp.Download(sn+".csv");
- if (address.Length == 0)
- {
- OperatResult.AppendText(">>SN号" + SNCODE.Text + "不存在LOG文件\n", Color.Red, SNCODE);
- return;
- }
- OperatResult.AppendText(">>SN号" + SNCODE.Text + "LOG文件下载至"+ address + "\n", Color.Green, SNCODE);
- return;
- }
- catch (Exception ex)
- {
- OperatResult.AppendText(ex.Message+"\n", Color.Red, SNCODE);
- return;
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- ftp.UpLoadFile(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\" + @"SNLog", "1.csv","/log/", SNCODE.Text +".csv");
- MessageBox.Show("OK");
- }
- private void button2_Click(object sender, EventArgs e)
- {
- DataTable dt = ExcelHandler.ReadFromCSV(@"C:\UAS_MES\unknown_Fail.csv", true);
- for (int i = 0; i < 13; i++)
- {
- if (dt.Rows[i]["TestResult"].ToString() == "NG")
- {
- MessageBox.Show("NG");
- break;
- }
- }
- MessageBox.Show("OK");
- BaseUtil.FillDgvWithDataTable(dataGridView1, dt);
- }
- }
- }
|