|
|
@@ -46,9 +46,12 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
dh = SystemInf.dh;
|
|
|
Choose.Enabled = false;
|
|
|
- fileList.Add("E:\\AOIMes\\Mes");
|
|
|
- fileList.Add("E:\\UAS");
|
|
|
- fileList.Add("");
|
|
|
+ //fileList.Add("E:\\AOIMes\\Mes");
|
|
|
+ //fileList.Add("E:\\UAS");
|
|
|
+ //fileList.Add("");
|
|
|
+
|
|
|
+
|
|
|
+ fileList.Add("E:\\cnc图片");
|
|
|
|
|
|
ChangeWoTimer = new Timer();
|
|
|
ChangeWoTimer.Interval = 30000;
|
|
|
@@ -97,21 +100,21 @@ namespace UAS_MES_NEW.Make
|
|
|
onWatch.Enabled = true;
|
|
|
FileBox.Visible = false;
|
|
|
|
|
|
- switch (Device.SelectedIndex)
|
|
|
+ switch (Device.Text)
|
|
|
{
|
|
|
- case 0:
|
|
|
+ case "AOI设备":
|
|
|
currFileType = "Txt";
|
|
|
equiType = "AOI";
|
|
|
/*ChangeWoTimer.Start();
|
|
|
ChangeWoFunc(null, null);*/
|
|
|
break;
|
|
|
- case 1:
|
|
|
- currFileType = "bmp";
|
|
|
+ case "Xray设备":
|
|
|
+ currFileType = "jpg";
|
|
|
equiType = "Xray";
|
|
|
onWatch.Enabled = false;
|
|
|
FileBox.Visible = true;
|
|
|
break;
|
|
|
- case 2:
|
|
|
+ case "CCD设备":
|
|
|
currFileType = "jpg";
|
|
|
equiType = "CCD";
|
|
|
break;
|
|
|
@@ -374,29 +377,78 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
else if (equiType == "Xray")
|
|
|
{
|
|
|
- if (Path.GetFileName(file).Contains('_'))
|
|
|
+ string ok = Path.Combine(file, "OK");
|
|
|
+ string ng = Path.Combine(file, "NG");
|
|
|
+ string na = Path.Combine(file, "NA");
|
|
|
+
|
|
|
+ List<string> pathList = new List<string> { };
|
|
|
+ if (Directory.Exists(ok))
|
|
|
+ {
|
|
|
+ string[] okPath = Directory.GetDirectories(ok);
|
|
|
+ if (okPath.Length > 0)
|
|
|
+ {
|
|
|
+ foreach (string item in okPath)
|
|
|
+ {
|
|
|
+ pathList.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Directory.Exists(ng))
|
|
|
{
|
|
|
- SN = Path.GetFileName(file).Split('_')[1].Replace(";", ";");
|
|
|
- string[] floderFile = Directory.GetFiles(file, $"*.{currFileType}");
|
|
|
+ string[] ngPath = Directory.GetDirectories(ng);
|
|
|
+ if (ngPath.Length > 0)
|
|
|
+ {
|
|
|
+ foreach (string item in ngPath)
|
|
|
+ {
|
|
|
+ pathList.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Directory.Exists(na))
|
|
|
+ {
|
|
|
+ string[] naPath = Directory.GetDirectories(na);
|
|
|
+ if (naPath.Length > 0)
|
|
|
+ {
|
|
|
+ foreach (string item in naPath)
|
|
|
+ {
|
|
|
+ pathList.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach(string currPath in pathList)
|
|
|
+ {
|
|
|
+ string[] floderFile = Directory.GetFiles(currPath, $"*.{currFileType}");
|
|
|
foreach (string floderFileItem in floderFile)
|
|
|
{
|
|
|
- if (UploadImageToFtp(floderFileItem, SN))
|
|
|
+ SN = Path.GetFileName(floderFileItem).Split('_')[0];
|
|
|
+ if(SN.ToLower() == "none")
|
|
|
{
|
|
|
- //if (!LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
- //{
|
|
|
- // LogMessage(0, $"核对NG:{oErrorMessage}");
|
|
|
- //}
|
|
|
- dh.ExecuteSql($@"INSERT INTO steptestmain (sm_id, sm_sn,sm_makecode,sm_stepcode,sm_indate,sm_machinecode,sm_result)
|
|
|
- VALUES ( steptestmain_seq.NEXTVAL,'{SN}','{ma_code.Text.Trim()}','{User.UserSourceCode}', sysdate,'Xray', 'http://192.168.1.5:8099/ftp/xray/{DateTime.Now.ToString("yyyyMMdd")}/{SN}/{Path.GetFileName(floderFileItem)}' )", "insert");
|
|
|
-
|
|
|
- if (Array.IndexOf(floderFile, floderFileItem) == floderFile.Length - 1)
|
|
|
+ SN = Path.GetFileName(currPath).Split('_')[1];
|
|
|
+
|
|
|
+ if (UploadImageToFtp(floderFileItem, SN))
|
|
|
{
|
|
|
- string newFloderName = Path.GetDirectoryName(file);
|
|
|
- Directory.Move(file, Path.Combine(newFloderName, "Log_" + Path.GetFileName(file)));
|
|
|
+ string time = File.GetCreationTime(floderFileItem).ToString("yyyy:MM:dd HH:mm:ss");
|
|
|
+ dh.ExecuteSql($@"UPDATE xraytest SET xt_url = 'http://192.168.41.232:8098/ftp/Xray/{DateTime.Now.ToString("yyyyMMdd")}/{SN}/{Path.GetFileName(floderFileItem)}',
|
|
|
+ xt_macode = '{ma_code.Text.Trim()}' WHERE checkdate = to_date('{time}','YYYY:MM:DD HH24:MI:SS')", "update");
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (UploadImageToFtp(floderFileItem, SN))
|
|
|
+ {
|
|
|
+ dh.ExecuteSql($@"UPDATE xraytest SET xt_url = 'http://192.168.41.232:8098/ftp/Xray/{DateTime.Now.ToString("yyyyMMdd")}/{SN}/{Path.GetFileName(floderFileItem)}',
|
|
|
+ xt_macode = '{ma_code.Text.Trim()}' WHERE barcode = '{SN}'", "update");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ string newFloderName = Path.GetDirectoryName(file);
|
|
|
+ Directory.Move(file, Path.Combine(newFloderName, "Log_" + Path.GetFileName(file)));
|
|
|
}
|
|
|
else if(equiType == "CCD")
|
|
|
{
|
|
|
@@ -646,11 +698,9 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
string ftpServer;
|
|
|
|
|
|
- ftpServer = equiType == "Xray" ? "ftp://10.8.0.215:21/xray/" : "ftp://10.8.0.215:21/ccd/";
|
|
|
- ftpServer = equiType == "Xray" ? "ftp://192.168.1.5:21/xray/" : "ftp://192.168.1.5:21/ccd/";
|
|
|
-
|
|
|
+ ftpServer = "ftp://192.168.41.232:21/Xray/";
|
|
|
string username = "vsftpd";
|
|
|
- string password = "vsftpd3ef41637hy";
|
|
|
+ string password = "vsftpd7de41958Jp";
|
|
|
|
|
|
string ftpTimePath = $"{ftpServer.TrimEnd('/')}/{DateTime.Now.ToString("yyyyMMdd")}";
|
|
|
string outResult = CreateFtpDirectoryIfNotExists(ftpTimePath, username, password);
|