Browse Source

修复mes报错

肖奇伟 4 weeks ago
parent
commit
5da1de440b

+ 0 - 15
SCADA_DAQ/Bat/DBPublish.cmd

@@ -1,15 +0,0 @@
-@rem ¸üÐÂÊý¾Ý¿â
-
-@rem TargetDir
-set SrcPath=%1
-set SrcPath=%SrcPath:"=%
-
-@rem ProjectDir
-set ProjectDir=%2
-set ProjectDir=%ProjectDir:"=%
-
-@rem SolutionDir
-set SolutionDir=%3
-set SolutionDir=%SolutionDir:"=%
-
-"C:\Program Files\WinRAR\WinRAR.exe" a -ep1 -o+ -inul -r -ibck  "%ProjectDir%Data\QwPlatform.zip" "%SrcPath%Data\QwPlatform.db"

+ 0 - 12
SCADA_DAQ/Bat/DevicecfgPublish.cmd

@@ -1,12 +0,0 @@
-@rem ¸üÐÂÊý¾Ý¿â
-
-@rem TargetDir
-set SrcPath=%1
-set SrcPath=%SrcPath:"=%
-
-@rem ProjectDir
-set ProjectDir=%2
-set ProjectDir=%ProjectDir:"=%
-
-
-"C:\Program Files\WinRAR\WinRAR.exe" a -ep1 -o+ -inul -r -ibck  "%ProjectDir%Customer\Doc\DeviceCfg.zip" "%SrcPath%DeviceCfg.json"

+ 0 - 10
SCADA_DAQ/Bat/bulid.bat

@@ -1,10 +0,0 @@
-
-set SolutionDir=%1
-set SolutionDir=%SolutionDir:"=%
-
-set SolutionFileName=%1
-set SolutionFileName=%SolutionFileName:"=%
-
-MSBuild %SolutionFileName% /p:Configuration=Debug
-rem  MSBuild D:\ÏîÄ¿´úÂë¹ÜÀí\SCADA_DAQ2023\\"SCADA_DAQ3.0.sln" /p:Configuration=Debug
-pause

+ 5 - 5
SCADA_DAQ/Bat/publish.cmd

@@ -83,11 +83,11 @@ xcopy  "%ProjectDir%Icon\*.*" "%TargetPath%Publish\Content\Img\" /Y
 if exist "%ProjectDir%Tools"  echo F | xcopy  "%ProjectDir%Tools\*.*" "%TargetPath%Publish\Tools\" /Y
 if exist "%ProjectDir%Customer\Doc\DeviceCfg.zip"  xcopy "%ProjectDir%Customer\Doc\DeviceCfg.zip" "%TargetPath%Publish"
 
-xcopy  "%OutDir%\plugin\SCADA.CommonLib.dll" %OutDir%  /Y
-xcopy  "%OutDir%\plugin\SCADA.CommonCtrl.dll" %OutDir%  /Y
-xcopy  "%OutDir%\plugin\SCADA.dll" %OutDir%  /Y
-xcopy  "%OutDir%\plugin\Opc.Ua.*.dll" %OutDir%  /Y
-xcopy  "%OutDir%\plugin\Magick.*.dll" %OutDir%  /Y
+xcopy  "%OutDir%\plugin\SCADA.CommonLib.dll" "%OutDir%"  /Y
+xcopy  "%OutDir%\plugin\SCADA.CommonCtrl.dll" "%OutDir%"  /Y
+xcopy  "%OutDir%\plugin\SCADA.dll" "%OutDir%"  /Y
+xcopy  "%OutDir%\plugin\Opc.Ua.*.dll" "%OutDir%"  /Y
+xcopy  "%OutDir%\plugin\Magick.*.dll" "%OutDir%" /Y
 
 del /f /q "%OutDir%\plugin\SCADA.CommonLib.dll"
 del /f /q "%OutDir%\plugin\SCADA.CommonCtrl.dll" 

+ 16 - 8
SCADA_DAQ/Customer/Machines/DrillMachine.cs

@@ -163,18 +163,26 @@ namespace SCADA_DAQ.Customer.Machines
                 {
                     if (Directory.Exists(CustomerEnv.CustomerConfig.MesShareDir))
                     {
-                        var fileName = Path.GetFullPath($"{CustomerEnv.CustomerConfig.MesShareDir}\\{barcode}.txt");
-
-                        using (var fs = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write))
+                        try
                         {
-                            using (var wr = new StreamWriter(fs))
+                            var fileName = Path.GetFullPath($"{CustomerEnv.CustomerConfig.MesShareDir}\\{barcode}.txt");
+                            if (File.Exists(fileName)) FileHelper.DeleteFile(fileName);
+                            using (var fs = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write))
                             {
-                                wr.Write($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},{barcode}");
-                                wr.Flush();
-                                wr.Close();
+                                using (var wr = new StreamWriter(fs))
+                                {
+                                    wr.Write($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")},{barcode}");
+                                    wr.Flush();
+                                    wr.Close();
+                                }
+                                fs.Close();
                             }
-                            fs.Close();
                         }
+                        catch (Exception ex)
+                        {
+
+
+                        }                   
                     }
                     var xmlDoc = XDocument.Load(filePath);
                     board = SCADA.CommonLib.Helper.XmlHelper.Deserialize<Board>(xmlDoc.Descendants("Plane").FirstOrDefault());