Browse Source

Merge branch 'master' of ssh://10.10.101.21/source/mes-client

Hcsy 8 years ago
parent
commit
6d9131525c

+ 15 - 2
UAS-MES/Entity/SystemInf.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 
 namespace UAS_MES.Entity
 {
@@ -56,5 +57,17 @@ namespace UAS_MES.Entity
         /// 是否允许打印程序
         /// </summary>
         public static bool EnablePrint;
+        /// <summary>
+        /// 缓存数据的文件夹
+        /// </summary>
+        public static string CacheFolder= Environment.GetEnvironmentVariable("windir").Substring(0, 1)+@":\UAS_MES\CacheFile\";
+        /// <summary>
+        /// 日志文件的缓存路径
+        /// </summary>
+        public static string LogFolder = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\UAS_MES\Log\";
+        /// <summary>
+        /// 缓存的XML文件的路径和名称
+        /// </summary>
+        public static string CacheFilePath= Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\UAS_MES\CacheFile\CacheInfo.xml";
     }
-}
+}

+ 0 - 1
UAS-MES/FunctionCode/Make/Make_ColorBoxLabelPrint.cs

@@ -97,7 +97,6 @@ namespace UAS_MES.Make
             {
                 lbl = new ApplicationClass();
                 BaseUtil.WriteLbl(lbl);
-                ftpOperater ftp = new ftpOperater();
             }
             catch (Exception ex)
             {

+ 0 - 2
UAS-MES/FunctionCode/Make/Make_PackageCollection.cs

@@ -195,8 +195,6 @@ namespace UAS_MES.Make
                                 break;
                             case "MIX":
                                 break;
-                            case "SPEC":
-                                break;
                             default:
                                 break;
                         }

+ 2 - 0
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -306,6 +306,8 @@ namespace UAS_MES.Make
                                     return;
                                 }
                                 break;
+                            case "MIX":
+                                break;
                             default:
                                 break;
                         }

+ 3 - 3
UAS-MES/Main.cs

@@ -83,7 +83,7 @@ namespace UAS_MES
         private void Main_Load(object sender, EventArgs e)
         {
             //杀死全部未关闭的打印进程
-            string[] lines = System.IO.File.ReadAllLines(lblpath + @"\" + "lblprocess" + ".txt");
+            string[] lines = System.IO.File.ReadAllLines(SystemInf.CacheFolder+ "lblprocess.txt");
             foreach (string line in lines)
             {
                 if (line != "")
@@ -104,12 +104,12 @@ namespace UAS_MES
                         catch (Exception)
                         {
                         }
-                        FileStream fs = new FileStream(lblpath + @"\" + "lblprocess" + ".txt", FileMode.Open, FileAccess.Read);
+                        FileStream fs = new FileStream(SystemInf.CacheFolder+ "lblprocess.txt", FileMode.Open, FileAccess.Read);
                         StreamReader sr = new StreamReader(fs);
                         String s = sr.ReadToEnd();
                         sr.Close();
                         fs.Close();
-                        FileStream fas = new FileStream(lblpath + @"\" + "lblprocess" + ".txt", FileMode.Create, FileAccess.ReadWrite);
+                        FileStream fas = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Create, FileAccess.ReadWrite);
                         StreamWriter sw = new StreamWriter(fas);
                         sw.Write(s.Replace(line+"\r\n",""));
                         sw.Flush();

+ 11 - 11
UAS-MES/Program.cs

@@ -4,6 +4,7 @@ using System.Security.Principal;
 using System.Text;
 using System.Windows.Forms;
 using System.Xml;
+using UAS_MES.Entity;
 using UAS_MES.PublicMethod;
 
 namespace UAS_MES
@@ -35,22 +36,21 @@ namespace UAS_MES
                 Application.AddMessageFilter(g);
                 //启用异常记录日志的操作
                 string sysdisc = Environment.GetEnvironmentVariable("windir").Substring(0, 1);
-                string lblpath = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo";
                 //创建标签缓存的文件夹
                 if (!Directory.Exists(ftpOperater.DownLoadTo))
                     Directory.CreateDirectory(ftpOperater.DownLoadTo);
-                if (!Directory.Exists(sysdisc + @":\Log"))
-                    Directory.CreateDirectory(sysdisc + @":\Log");
-                FileStream fs = new FileStream(sysdisc + @":\Log\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
+                if (!Directory.Exists(SystemInf.LogFolder))
+                    Directory.CreateDirectory(SystemInf.LogFolder);
+                FileStream fs = new FileStream(SystemInf.LogFolder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 fs.Close();
                 //创建存储登录信息的文件
-                if (!Directory.Exists(sysdisc + @":\Log\cacheInfo"))
-                    Directory.CreateDirectory(sysdisc + @":\Log\cacheInfo");
-                FileStream fcaches = new FileStream(sysdisc + @":\Log\cacheInfo\cacheInfo.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
+                if (!Directory.Exists(SystemInf.CacheFolder))
+                    Directory.CreateDirectory(SystemInf.CacheFolder);
+                FileStream fcaches = new FileStream(SystemInf.CacheFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 fcaches.Close();
                 //判断是否xml文件大小为0
-                FileInfo info = new FileInfo(sysdisc + @":\Log\cacheInfo\cacheInfo.xml");
-                if (info.Length==0)
+                FileInfo info = new FileInfo(SystemInf.CacheFilePath);
+                if (info.Length == 0)
                 {
                     XmlDocument doc = new XmlDocument();
                     //创建类型声明节点  
@@ -59,10 +59,10 @@ namespace UAS_MES
                     //创建根节点  
                     XmlElement xeRoot = doc.CreateElement("cacheInfo");
                     doc.AppendChild(xeRoot);
-                    doc.Save(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml");
+                    doc.Save(SystemInf.CacheFilePath);
                 }
                 //创建记录打印进程的文件
-                FileStream fas = new FileStream(lblpath + @"\" + "lblprocess" + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
+                FileStream fas = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                 fas.Close();
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                     Application.Run(new Login());

+ 4 - 5
UAS-MES/PublicMethod/BaseUtil.cs

@@ -987,8 +987,7 @@ namespace UAS_MES.PublicMethod
             }
             var temp = ProInf.Keys.Max();
             String str = SystemInf.ProcessesID + "|" + ProInf[temp];
-            string lblpath = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo";
-            FileStream fs = new FileStream(lblpath + @"\" + "lblprocess" + ".txt", FileMode.Append, FileAccess.Write);
+            FileStream fs = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Append, FileAccess.Write);
             StreamWriter sw = new StreamWriter(fs);
             sw.WriteLine(str, Encoding.UTF8);
             sw.Close();
@@ -1005,7 +1004,7 @@ namespace UAS_MES.PublicMethod
                 XmlReaderSettings settings = new XmlReaderSettings();
                 //忽略文档里面的注释
                 settings.IgnoreComments = true;
-                XmlReader reader = XmlReader.Create(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml", settings);
+                XmlReader reader = XmlReader.Create(SystemInf.CacheFilePath, settings);
                 doc.Load(reader);
                 //先得到根节点
                 XmlNode rootNode = doc.SelectSingleNode("cacheInfo");
@@ -1057,7 +1056,7 @@ namespace UAS_MES.PublicMethod
                 XmlReaderSettings settings = new XmlReaderSettings();
                 //忽略文档里面的注释
                 settings.IgnoreComments = true;
-                XmlReader reader = XmlReader.Create(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml", settings);
+                XmlReader reader = XmlReader.Create(SystemInf.CacheFilePath, settings);
                 doc.Load(reader);
                 //先得到根节点
                 XmlNode rootNode = doc.SelectSingleNode("cacheInfo");
@@ -1088,7 +1087,7 @@ namespace UAS_MES.PublicMethod
                 }
                 //关闭Reader
                 reader.Close();
-                doc.Save(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml");
+                doc.Save(SystemInf.CacheFilePath);
             }
             catch (Exception e)
             {

+ 2 - 1
UAS-MES/PublicMethod/LogManager.cs

@@ -1,11 +1,12 @@
 using System;
 using System.IO;
+using UAS_MES.Entity;
 
 namespace UAS_MES.PublicMethod
 {
     class LogManager
     {
-        public static string LogAddress = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\" + @"Log\";
+        public static string LogAddress = SystemInf.LogFolder;
         /// <summary>
         /// 记录操作
         /// </summary>

+ 120 - 0
UAS_DLLTest/Form1.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>