上传
This commit is contained in:
921
点检/MainWindow.xaml.cs
Normal file
921
点检/MainWindow.xaml.cs
Normal file
@ -0,0 +1,921 @@
|
||||
using BLL;
|
||||
using DAL;
|
||||
using HandyControl.Controls;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Tool;
|
||||
using View;
|
||||
using Window = System.Windows.Window;
|
||||
|
||||
namespace 点检
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private SoundPlayer playerNG = new SoundPlayer(System.Environment.CurrentDirectory + "\\ng.wav");
|
||||
private SoundPlayer playerOK = new SoundPlayer(System.Environment.CurrentDirectory + "\\ok.wav");
|
||||
private CheckViewModel viewModel = new CheckViewModel();
|
||||
private SettingModel set = new SettingModel();
|
||||
private CheckBLL checkBLL = new CheckBLL();
|
||||
private CheckDAL checkDAL = new CheckDAL();
|
||||
private List<ExclModel> ExclModel = new List<ExclModel>();
|
||||
private List<IniModel> InitestModel = new List<IniModel>();
|
||||
private List<ExclModel> ExclModel2 = new List<ExclModel>();
|
||||
private List<IniModel> InitestModel2 = new List<IniModel>();
|
||||
private List<ExclModel> ExclModel3 = new List<ExclModel>();
|
||||
private List<IniModel> InitestModel3 = new List<IniModel>();
|
||||
private List<ExclModel> ExclModelend = new List<ExclModel>();
|
||||
private List<IniModel> InitestModelend = new List<IniModel>();
|
||||
private List<ExclModel> StandardExclModelModel = new List<ExclModel>();
|
||||
private List<IniModel> StandardInitestModel = new List<IniModel>();
|
||||
public string[] Jinjiimei { get; set; }
|
||||
private string user;
|
||||
private ConfigHelper configHelper = new ConfigHelper();
|
||||
private int devedle1 = 0;
|
||||
private int devedle2 = 0;
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
set = checkBLL.LoadConfig();
|
||||
ComboBoxType.ItemsSource = set.Types;
|
||||
if (set.Types.Count() > set.index)
|
||||
{
|
||||
ComboBoxType.SelectedIndex = set.index;
|
||||
}
|
||||
else
|
||||
{
|
||||
ComboBoxType.SelectedIndex=0;
|
||||
}
|
||||
viewModel.devcode1 = set.devcode1;
|
||||
viewModel.devcode2 = set.devcode2;
|
||||
//绑定界面
|
||||
DataContext = viewModel;
|
||||
|
||||
intiot();
|
||||
LoginShared("192.168.2.149", "工程", "12345678");
|
||||
//DirectoryInfo theFolder1 = new DirectoryInfo("\\\\192.168.2.149\\生产数据");
|
||||
////DirectoryInfo theFolder1 = new DirectoryInfo("\\\\192.168.2.149\\生产数据\\制造二课\\制造二课(模组车间)\\功能中移回传log");
|
||||
|
||||
//DirectoryInfo[] dir12 = theFolder1.GetDirectories();
|
||||
//ReplacetestModel = checkBLL.getReplacetest(set.pathch1);
|
||||
//InitestModel = checkBLL.getinitest(set.pathini,1);
|
||||
//string sdfsed = checkDAL.getendini3("0.4","0.5","0.5");
|
||||
}
|
||||
public void intiot()
|
||||
{
|
||||
viewModel.devcode1no = "夹具1读取" + devedle1 + "个log文件";
|
||||
viewModel.devcode2no = "夹具2读取" + devedle2 + "个log文件";
|
||||
}
|
||||
public static void LoginShared(string path, string user, string pwd)
|
||||
{
|
||||
Process p = new Process();
|
||||
//打开cmd管理员窗口
|
||||
p.StartInfo.FileName = System.Environment.GetEnvironmentVariable("ComSpec");
|
||||
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardInput = true;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.CreateNoWindow = true;
|
||||
|
||||
p.Start();
|
||||
//往窗口内写入数据
|
||||
p.StandardInput.WriteLine(@"Net Use {0} /del", path); //必须先删除,否则报错
|
||||
|
||||
|
||||
p.StandardInput.WriteLine(@"Net Use {0} ""{1}"" /user:{2}", path, pwd, user);
|
||||
p.StandardInput.WriteLine("exit"); //加入exie防止WaitForExit卡死。
|
||||
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
}
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//new MessageBoxView("提示!", "请输入账号!").ShowDialog();
|
||||
//return;
|
||||
|
||||
Dictionary<string, string> dic = configHelper.ReadAll();
|
||||
var item = new List<string>() { "点检登录" };
|
||||
var logModel = new LoginModel();
|
||||
bool? dialog = new MesLoginView("登录", dic, item, logModel).ShowDialog();
|
||||
if (dialog == true)
|
||||
{
|
||||
user = logModel.name;
|
||||
if (user != "")
|
||||
{
|
||||
LogHelper.WriteLogMater(logModel.bumen + user + "登录");
|
||||
viewModel.name = user;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewModel.name = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
viewModel.name = "";
|
||||
}
|
||||
}
|
||||
catch (Exception ee) {
|
||||
LogHelper.WriteLog(ee.ToString());
|
||||
new MessageBoxView("错误!", ee.Message.ToString()).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoxType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
set.index = ComboBoxType.SelectedIndex;
|
||||
checkBLL.SetConfig(set);
|
||||
viewModel.type = ComboBoxType.SelectedValue.ToString();
|
||||
Jinjiimei = checkDAL.Getimei(viewModel.type);
|
||||
ComboBoximei.ItemsSource = Jinjiimei;
|
||||
}
|
||||
catch(Exception ee)
|
||||
{
|
||||
LogHelper.WriteLog(ee.ToString());
|
||||
new MessageBoxView("错误!", ee.Message.ToString()).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoximei_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (ComboBoximei.SelectedValue == null)
|
||||
{
|
||||
viewModel.snimei = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
viewModel.snimei = ComboBoximei.SelectedValue.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void Clear_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string retul = checkBLL.getloadtest(set.pathLoad);
|
||||
if (retul!="OK")
|
||||
{
|
||||
new MessageBoxView("错误!", retul).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
checkBLL.Clearfile(set);
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.WriteLog(ee.ToString());
|
||||
new MessageBoxView("错误!", ee.Message.ToString()).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Jinji1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string reault = Jinji(viewModel.devcode1, set.pathch1,1);
|
||||
if (reault != "OK")
|
||||
{
|
||||
LogHelper.WriteLog(reault);
|
||||
new MessageBoxView("错误!", reault).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new MessageBoxView("提示!", "点检成功").ShowDialog();
|
||||
if (File.Exists(playerOK.SoundLocation))
|
||||
{
|
||||
playerOK.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Jinji2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string reault = Jinji(viewModel.devcode2, set.pathch2,2);
|
||||
if (reault != "OK")
|
||||
{
|
||||
LogHelper.WriteLog(reault);
|
||||
new MessageBoxView("错误!", reault).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new MessageBoxView("提示!", "点检成功").ShowDialog();
|
||||
if (File.Exists(playerOK.SoundLocation))
|
||||
{
|
||||
playerOK.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
private string Jinji(string devcode, string path,int line)
|
||||
{
|
||||
try
|
||||
{
|
||||
string retul = checkBLL.getloadtest(set.pathLoad);
|
||||
if (retul != "OK")
|
||||
{
|
||||
new MessageBoxView("错误!", retul).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
string relist = "OK";
|
||||
relist = checkDAL.checkdist(devcode, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (relist != "OK")
|
||||
{
|
||||
//NgView(relist);
|
||||
return relist;
|
||||
}
|
||||
ExclModel = new List<ExclModel>();
|
||||
InitestModel = new List<IniModel>();
|
||||
StandardExclModelModel = new List<ExclModel>();
|
||||
StandardInitestModel = new List<IniModel>();
|
||||
Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(path, viewModel.snimei, 0);
|
||||
if (tuple.Item2 != "OK")
|
||||
{
|
||||
//NgView(tuple.Item2);
|
||||
return tuple.Item2;
|
||||
}
|
||||
ExclModel = tuple.Item1;
|
||||
//ExclModel = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
InitestModel = checkBLL.getinitest(set.pathini, line);
|
||||
string rtsul = checkBLL.Checktest(ExclModel, InitestModel);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
StandardExclModelModel = checkDAL.GetStandardExcl(devcode, viewModel.type, viewModel.snimei);
|
||||
if (StandardExclModelModel == null)
|
||||
{
|
||||
//NgView("抓取功率标准MES连接失败!或没有标准记录!");
|
||||
return "抓取功率标准MES连接失败!或没有标准记录!";
|
||||
}
|
||||
rtsul = checkBLL.Checklog(ExclModel, StandardExclModelModel, "点检表", "数据库", viewModel.type);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
StandardInitestModel = checkDAL.GetStandardIni(devcode, viewModel.type, viewModel.snimei);
|
||||
if (StandardInitestModel == null)
|
||||
{
|
||||
//NgView("抓取线损标准MES连接失败!或没有标准记录!");
|
||||
return "抓取线损标准MES连接失败!或没有标准记录!";
|
||||
}
|
||||
rtsul = checkBLL.Checkini(InitestModel, StandardInitestModel, "点检", "数据库");
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkDAL.updata(InitestModel, ExclModel, "点金", devcode, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.moveto(devcode, viewModel.type, viewModel.snimei);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog(rtsul);
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.coply(path, 1, devcode);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog(rtsul);
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
return rtsul;
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.WriteLog(ee.ToString());
|
||||
return ee.ToString();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Grab1_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string realut = Grab(viewModel.devcode1, set.pathch1, "CH1", devedle1,1);
|
||||
if (realut != "OK")
|
||||
{
|
||||
LogHelper.WriteLog(realut);
|
||||
new MessageBoxView("错误!", realut).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new MessageBoxView("提示!", "抓取成功").ShowDialog();
|
||||
if (File.Exists(playerOK.SoundLocation))
|
||||
{
|
||||
playerOK.Play();
|
||||
}
|
||||
}
|
||||
intiot();
|
||||
}
|
||||
private void Grab2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string realut = Grab(viewModel.devcode2, set.pathch2, "CH2", devedle2,2);
|
||||
if (realut != "OK")
|
||||
{
|
||||
LogHelper.WriteLog(realut);
|
||||
new MessageBoxView("错误!", realut).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new MessageBoxView("提示!", "抓取成功").ShowDialog();
|
||||
//if (File.Exists(playerOK.SoundLocation))
|
||||
//{
|
||||
// playerOK.Play();
|
||||
//}
|
||||
}
|
||||
intiot();
|
||||
}
|
||||
private string Grab(string devedleget, string path, string getch, int getlei,int line)
|
||||
{
|
||||
try
|
||||
{
|
||||
string retul = checkBLL.getloadtest(set.pathLoad);
|
||||
if (retul != "OK")
|
||||
{
|
||||
new MessageBoxView("错误!", retul).ShowDialog();
|
||||
if (File.Exists(playerNG.SoundLocation))
|
||||
{
|
||||
playerNG.Play();
|
||||
}
|
||||
}
|
||||
string relist = checkDAL.checkdist(devedleget, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (relist != "OK")
|
||||
{
|
||||
//NgView(relist);
|
||||
return relist;
|
||||
}
|
||||
if (getch == "CH1")
|
||||
{
|
||||
if (devedle1 > 2 || devedle1 < 0)
|
||||
{
|
||||
//NgView("夹具1抓取的数量错误" + devedle1);
|
||||
return "夹具1抓取的数量错误" + devedle1;
|
||||
}
|
||||
if (devedle2 != 0)
|
||||
{
|
||||
//NgView("夹具2抓取的数量错误" + devedle2);
|
||||
return "夹具2抓取的数量错误" + devedle2;
|
||||
}
|
||||
}
|
||||
else if (getch == "CH2")
|
||||
{
|
||||
if (devedle2 > 2 || devedle2 < 0)
|
||||
{
|
||||
//NgView("夹具1抓取的数量错误" + devedle1);
|
||||
return "夹具2抓取的数量错误为" + devedle2;
|
||||
}
|
||||
if (devedle1 != 0)
|
||||
{
|
||||
//NgView("夹具1抓取的数量错误" + devedle2);
|
||||
return "夹具1抓取的数量错误为" + devedle1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "不知道是夹具几";
|
||||
}
|
||||
if (getlei == 0)
|
||||
{
|
||||
ExclModel = new List<ExclModel>();
|
||||
InitestModel = new List<IniModel>();
|
||||
Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(path, viewModel.snimei, getlei);
|
||||
if (tuple.Item2 != "OK")
|
||||
{
|
||||
//NgView(tuple.Item2);
|
||||
return tuple.Item2;
|
||||
}
|
||||
ExclModel = tuple.Item1;
|
||||
//ExclModel = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
InitestModel = checkBLL.getinitest(set.pathini, line);
|
||||
string rtsul = checkBLL.Checktest(ExclModel, InitestModel);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.moveto(devedleget, viewModel.type, viewModel.snimei);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog(rtsul);
|
||||
//NgView(rtsul);
|
||||
return rtsul;
|
||||
}
|
||||
getlei = getlei + 1;
|
||||
NgView("第一抓取成功");
|
||||
}
|
||||
else if (getlei == 1)
|
||||
{
|
||||
ExclModel2 = new List<ExclModel>();
|
||||
InitestModel2 = new List<IniModel>();
|
||||
Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(path, viewModel.snimei, getlei);
|
||||
if (tuple.Item2 != "OK")
|
||||
{
|
||||
//NgView(tuple.Item2);
|
||||
getlei = 0;
|
||||
return tuple.Item2;
|
||||
}
|
||||
ExclModel2 = tuple.Item1;
|
||||
//ExclModel2 = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
InitestModel2 = checkBLL.getinitest(set.pathini, line);
|
||||
string rtsul = checkBLL.Checktest(ExclModel2, InitestModel2);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checkini(InitestModel, InitestModel2, "抓取1", "抓取2");
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checklog(ExclModel, ExclModel2, "抓取表1", "抓取表2", viewModel.type);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
getlei = getlei + 1;
|
||||
|
||||
NgView("第二抓取成功");
|
||||
}
|
||||
else if (getlei == 2)
|
||||
{
|
||||
ExclModel3 = new List<ExclModel>();
|
||||
InitestModel3 = new List<IniModel>();
|
||||
ExclModelend = new List<ExclModel>();
|
||||
InitestModelend = new List<IniModel>();
|
||||
Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(path, viewModel.snimei, getlei);
|
||||
if (tuple.Item2 != "OK")
|
||||
{
|
||||
//NgView(tuple.Item2);
|
||||
getlei = 0;
|
||||
return tuple.Item2;
|
||||
}
|
||||
ExclModel3 = tuple.Item1;
|
||||
//ExclModel3 = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
InitestModel3 = checkBLL.getinitest(set.pathini, line);
|
||||
string rtsul = checkBLL.Checktest(ExclModel3, InitestModel3);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checkini(InitestModel, InitestModel3, "抓取1", "抓取3");
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checklog(ExclModel, ExclModel3, "抓取表1", "抓取表3", viewModel.type);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checkini(InitestModel2, InitestModel3, "抓取2", "抓取3");
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.Checklog(ExclModel2, ExclModel3, "抓取表2", "抓取表3",viewModel.type);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
ExclModelend = checkDAL.getendtest(ExclModel, ExclModel2, ExclModel3);
|
||||
InitestModelend = checkDAL.getendinitest(InitestModel, InitestModel2, InitestModel3);
|
||||
rtsul = checkDAL.updata(InitestModel, ExclModel, "抓取1", devedleget, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkDAL.updata(InitestModel2, ExclModel2, "抓取2", devedleget, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkDAL.updata(InitestModel3, ExclModel3, "抓取3", devedleget, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkDAL.updata(InitestModelend, ExclModelend, "标准", devedleget, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog("");
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
rtsul = checkBLL.coply(path, 3, devedleget);
|
||||
if (rtsul != "OK")
|
||||
{
|
||||
//LogHelper.WriteLog(rtsul);
|
||||
//NgView(rtsul);
|
||||
getlei = 0;
|
||||
return rtsul;
|
||||
}
|
||||
getlei = 0;
|
||||
NgView("抓取上传成功");
|
||||
}
|
||||
return "OK";
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.WriteLog(ee.ToString());
|
||||
return ee.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (getch == "CH1")
|
||||
{
|
||||
devedle1 = getlei;
|
||||
}
|
||||
else if (getch == "CH2")
|
||||
{
|
||||
devedle2 = getlei;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void NgView(string msg)
|
||||
{
|
||||
viewModel.Msg = msg;
|
||||
if (File.Exists(playerOK.SoundLocation))
|
||||
{
|
||||
playerOK.Play();
|
||||
}
|
||||
}
|
||||
#region 点检
|
||||
//private void Jinji1_Clickend(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// string relist = checkDAL.checkdist(viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (relist != "OK")
|
||||
// {
|
||||
|
||||
// NgView(relist);
|
||||
// return;
|
||||
// }
|
||||
// ExclModel = new List<ExclModel>();
|
||||
// InitestModel = new List<IniModel>();
|
||||
// StandardExclModelModel = new List<ExclModel>();
|
||||
// StandardInitestModel = new List<IniModel>();
|
||||
// Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(set.pathch1, viewModel.snimei, 0);
|
||||
// if (tuple.Item2 != "OK")
|
||||
// {
|
||||
// NgView(tuple.Item2);
|
||||
// return;
|
||||
// }
|
||||
// ExclModel = tuple.Item1;
|
||||
// //ExclModel = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
// InitestModel = checkBLL.getinitest(set.pathini, 1);
|
||||
// string rtsul = checkBLL.Checktest(ExclModel, InitestModel);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// StandardExclModelModel = checkDAL.GetStandardExcl(viewModel.devcode1, viewModel.type, viewModel.snimei);
|
||||
// if (StandardExclModelModel == null)
|
||||
// {
|
||||
// NgView("抓取功率标准MES连接失败!或没有标准记录!");
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checklog(ExclModel, StandardExclModelModel, "点检表", "数据库");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// StandardInitestModel = checkDAL.GetStandardIni(viewModel.devcode1, viewModel.type, viewModel.snimei);
|
||||
// if (StandardInitestModel == null)
|
||||
// {
|
||||
// NgView("抓取线损标准MES连接失败!或没有标准记录!");
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checkini(InitestModel, StandardInitestModel, "点检", "数据库");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkDAL.updata(InitestModel, ExclModel, "点金", viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.moveto(viewModel.devcode1, viewModel.type, viewModel.snimei);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog(rtsul);
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.coply(set.pathch1, 1, viewModel.devcode1);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog(rtsul);
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 抓取
|
||||
//private void Grab1_Clickend(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string relist = checkDAL.checkdist(viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (relist != "OK")
|
||||
// {
|
||||
|
||||
// NgView(relist);
|
||||
// return;
|
||||
// }
|
||||
// if (devedle1 > 2 || devedle1 < 0)
|
||||
// {
|
||||
// NgView("夹具1抓取的数量错误" + devedle1);
|
||||
// return;
|
||||
// }
|
||||
// if (devedle2 != 0)
|
||||
// {
|
||||
// NgView("夹具2抓取的数量错误" + devedle2);
|
||||
// return;
|
||||
// }
|
||||
// if (devedle1 == 0)
|
||||
// {
|
||||
// ExclModel = new List<ExclModel>();
|
||||
// InitestModel = new List<IniModel>();
|
||||
// Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(set.pathch1, viewModel.snimei, devedle1);
|
||||
// if (tuple.Item2 != "OK")
|
||||
// {
|
||||
// NgView(tuple.Item2);
|
||||
// return;
|
||||
// }
|
||||
// ExclModel = tuple.Item1;
|
||||
// //ExclModel = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
// InitestModel = checkBLL.getinitest(set.pathini, 1);
|
||||
// string rtsul = checkBLL.Checktest(ExclModel, InitestModel);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.moveto(viewModel.devcode1, viewModel.type, viewModel.snimei);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog(rtsul);
|
||||
// NgView(rtsul);
|
||||
// return;
|
||||
// }
|
||||
// devedle1 = devedle1 + 1;
|
||||
// }
|
||||
// else if (devedle1 == 1)
|
||||
// {
|
||||
// ExclModel2 = new List<ExclModel>();
|
||||
// InitestModel2 = new List<IniModel>();
|
||||
// Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(set.pathch1, viewModel.snimei, devedle1);
|
||||
// if (tuple.Item2 != "OK")
|
||||
// {
|
||||
// NgView(tuple.Item2);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// ExclModel2 = tuple.Item1;
|
||||
// //ExclModel2 = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
// InitestModel2 = checkBLL.getinitest(set.pathini, 1);
|
||||
// string rtsul = checkBLL.Checktest(ExclModel2, InitestModel2);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checkini(InitestModel, InitestModel2, "抓取1", "抓取2");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checklog(ExclModel, ExclModel2, "抓取表1", "抓取表2");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// devedle1 = devedle1 + 1;
|
||||
// }
|
||||
// else if (devedle1 == 2)
|
||||
// {
|
||||
// ExclModel3 = new List<ExclModel>();
|
||||
// InitestModel3 = new List<IniModel>();
|
||||
// ExclModelend = new List<ExclModel>();
|
||||
// InitestModelend = new List<IniModel>();
|
||||
// Tuple<List<ExclModel>, string> tuple = checkBLL.getReplacetest(set.pathch1, viewModel.snimei, devedle1);
|
||||
// if (tuple.Item2 != "OK")
|
||||
// {
|
||||
// NgView(tuple.Item2);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// ExclModel3 = tuple.Item1;
|
||||
// //ExclModel3 = checkBLL.getReplacetest(set.pathch1, viewModel.snimei);
|
||||
// InitestModel3 = checkBLL.getinitest(set.pathini, 1);
|
||||
// string rtsul = checkBLL.Checktest(ExclModel3, InitestModel3);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checkini(InitestModel, InitestModel3, "抓取1", "抓取3"); ;
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checklog(ExclModel, ExclModel3, "抓取表1", "抓取表3");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checkini(InitestModel2, InitestModel3, "抓取2", "抓取3");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.Checklog(ExclModel2, ExclModel3, "抓取表2", "抓取表3");
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// ExclModelend = checkDAL.getendtest(ExclModel, ExclModel2, ExclModel3);
|
||||
// InitestModelend = checkDAL.getendinitest(InitestModel, InitestModel2, InitestModel3);
|
||||
// rtsul = checkDAL.updata(InitestModel, ExclModel, "抓取1", viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkDAL.updata(InitestModel2, ExclModel2, "抓取2", viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkDAL.updata(InitestModel3, ExclModel3, "抓取3", viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkDAL.updata(InitestModelend, ExclModelend, "标准", viewModel.devcode1, viewModel.type, viewModel.snimei, viewModel.name);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog("");
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// rtsul = checkBLL.coply(set.pathch1, 1, viewModel.devcode1);
|
||||
// if (rtsul != "OK")
|
||||
// {
|
||||
// LogHelper.WriteLog(rtsul);
|
||||
// NgView(rtsul);
|
||||
// devedle1 = 0;
|
||||
// return;
|
||||
// }
|
||||
// devedle1 = 0;
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ee)
|
||||
// {
|
||||
|
||||
// LogHelper.WriteLog(ee.ToString());
|
||||
// NgView(ee.ToString());
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// intiot();
|
||||
// }
|
||||
////}
|
||||
#endregion
|
||||
|
||||
private void button_Click()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user