Forráskód Böngészése

Merge repos.ubtob.net:usoft/mes-client

callm 14 órája
szülő
commit
af7c736ba7

+ 8 - 10
UAS_MES_YTDZ/FunctionCode/Make/Make_ParseLog.Designer.cs

@@ -66,9 +66,7 @@
             this.Device.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Device.FormattingEnabled = true;
             this.Device.Items.AddRange(new object[] {
-            "AOI设备",
-            "X-ray设备",
-            "CCD设备"});
+            "Xray设备"});
             this.Device.Location = new System.Drawing.Point(193, 88);
             this.Device.Name = "Device";
             this.Device.Size = new System.Drawing.Size(387, 39);
@@ -97,10 +95,10 @@
             // 
             // txtPath
             // 
-            this.txtPath.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.txtPath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.txtPath.Location = new System.Drawing.Point(193, 154);
             this.txtPath.Name = "txtPath";
-            this.txtPath.Size = new System.Drawing.Size(387, 35);
+            this.txtPath.Size = new System.Drawing.Size(387, 31);
             this.txtPath.TabIndex = 3;
             // 
             // Choose
@@ -155,7 +153,7 @@
             this.FileBox.Controls.Add(this.SN1);
             this.FileBox.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.FileBox.ForeColor = System.Drawing.SystemColors.ControlText;
-            this.FileBox.Location = new System.Drawing.Point(801, 25);
+            this.FileBox.Location = new System.Drawing.Point(2201, 25);
             this.FileBox.Name = "FileBox";
             this.FileBox.Size = new System.Drawing.Size(759, 244);
             this.FileBox.TabIndex = 10;
@@ -385,12 +383,12 @@
             this.Name = "Make_ParseLog";
             this.Text = "Make_ParseLog";
             this.Load += new System.EventHandler(this.Make_ParseLog_Load);
-            this.panel1.ResumeLayout(true);
+            this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
-            this.FileBox.ResumeLayout(true);
+            this.FileBox.ResumeLayout(false);
             this.FileBox.PerformLayout();
-            this.tableLayoutPanel1.ResumeLayout(true);
-            this.ResumeLayout(true);
+            this.tableLayoutPanel1.ResumeLayout(false);
+            this.ResumeLayout(false);
 
         }
 

+ 76 - 26
UAS_MES_YTDZ/FunctionCode/Make/Make_ParseLog.cs

@@ -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);