Bläddra i källkod

新增配置类,用于保存最后登录用户名,和测试机连接状态

liuxinglong 6 år sedan
förälder
incheckning
7cb3b06181
55 ändrade filer med 456 tillägg och 270 borttagningar
  1. 3 0
      doc/configuration/config.ini
  2. 0 0
      doc/configuration/org.eclipse.core.runtime/.manager/.fileTableLock
  3. 0 0
      doc/configuration/org.eclipse.equinox.app/.manager/.fileTableLock
  4. BIN
      doc/configuration/org.eclipse.equinox.launcher/org.xmind.cathy_3.7.8.201807240049/splash.bmp
  5. 0 0
      doc/configuration/org.eclipse.osgi/.manager/.fileTableLock
  6. BIN
      doc/configuration/org.eclipse.osgi/508/data/SCR
  7. 15 0
      doc/configuration/org.eclipse.osgi/627/data/925368212/artifacts.xml
  8. 11 0
      doc/configuration/org.eclipse.osgi/718/data/cache.timestamps
  9. 5 0
      doc/configuration/org.eclipse.osgi/718/data/timestamps975068543
  10. 3 0
      doc/configuration/org.eclipse.update/platform.xml
  11. 14 0
      doc/p2/org.eclipse.equinox.p2.core/cache/artifacts.xml
  12. 0 0
      doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/.lock
  13. BIN
      doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/1540217574311.profile.gz
  14. BIN
      doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/1540217575907.profile.gz
  15. 4 0
      doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/state.properties
  16. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-10-1523956083576.xml
  17. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-13-1523961070529.xml
  18. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-14-1524018808929.xml
  19. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-16-1524018895378.xml
  20. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-17-1524019399076.xml
  21. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-18-1524019421188.xml
  22. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-19-1524019726223.xml
  23. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-20-1524891532209.xml
  24. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-21-1527217552676.xml
  25. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-22-1527218291917.xml
  26. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-25-1527222378251.xml
  27. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-26-1527224827930.xml
  28. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-27-1527224941235.xml
  29. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-32-1527231707642.xml
  30. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-33-1527231783036.xml
  31. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-35-1527232997784.xml
  32. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-37-1527331050804.xml
  33. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-38-1527331139512.xml
  34. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-39-1527331183651.xml
  35. 2 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-40-1527331383567.xml
  36. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-41-1527332411154.xml
  37. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-44-1527332941377.xml
  38. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-47-1527395461380.xml
  39. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-48-1527395675259.xml
  40. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-49-1528524761106.xml
  41. 4 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-50-1528524794505.xml
  42. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-6-1523953549012.xml
  43. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-7-1523953907481.xml
  44. 1 0
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-9-1523954639160.xml
  45. BIN
      doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Thumbnails/thumbnail.png
  46. 1 1
      pom.xml
  47. 171 222
      src/main/java/co/dc/aptiv/AptivApp.java
  48. 3 2
      src/main/java/co/dc/aptiv/ScanFrame.java
  49. 7 2
      src/main/java/co/dc/aptiv/mina/PLCMinaHandler.java
  50. 6 0
      src/main/java/co/dc/aptiv/mina/TestMachineCollectorMina.java
  51. 28 27
      src/main/java/co/dc/aptiv/mina/TestMachineCollectorMinaHandler.java
  52. 66 0
      src/main/java/co/dc/aptiv/pojo/ConfigPojo.java
  53. 54 0
      src/main/java/co/dc/aptiv/service/ConfigService.java
  54. 5 8
      src/main/resources/config.properties
  55. 4 8
      src/main/resources/logback.xml

+ 3 - 0
doc/configuration/config.ini

@@ -0,0 +1,3 @@
+#Linked configuration
+#Mon Oct 22 22:12:52 CST 2018
+osgi.sharedConfiguration.area=file\:configuration/

+ 0 - 0
doc/configuration/org.eclipse.core.runtime/.manager/.fileTableLock


+ 0 - 0
doc/configuration/org.eclipse.equinox.app/.manager/.fileTableLock


BIN
doc/configuration/org.eclipse.equinox.launcher/org.xmind.cathy_3.7.8.201807240049/splash.bmp


+ 0 - 0
doc/configuration/org.eclipse.osgi/.manager/.fileTableLock


BIN
doc/configuration/org.eclipse.osgi/508/data/SCR


+ 15 - 0
doc/configuration/org.eclipse.osgi/627/data/925368212/artifacts.xml

@@ -0,0 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?artifactRepository version='1.1.0'?>
+<repository name='D:\XMind\XMind\.eclipseextension' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1.0.0'>
+  <properties size='3'>
+    <property name='p2.timestamp' value='1540217575854'/>
+    <property name='org.eclipse.update.site.policy' value='USER-EXCLUDE'/>
+    <property name='org.eclipse.update.site.list' value=''/>
+  </properties>
+  <mappings size='3'>
+    <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
+    <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
+    <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
+  </mappings>
+  <artifacts size='0'/>
+</repository>

+ 11 - 0
doc/configuration/org.eclipse.osgi/718/data/cache.timestamps

@@ -0,0 +1,11 @@
+#Mon Oct 22 22:12:55 CST 2018
+E\:\\Project\\AptivApp\\doc\\plugins=0
+D\:\\XMind\\XMind\\links=0
+D\:\\XMind\\XMind\\plugins=1535447114257
+D\:\\XMind\\XMind\\configuration\\org.eclipse.update\\platform.xml=1532419255000
+E\:\\Project\\AptivApp\\doc\\features=0
+E\:\\Project\\AptivApp\\doc\\configuration\\org.eclipse.update\\platform.xml=1540217573925
+E\:\\Project\\AptivApp\\doc\\links=0
+E\:\\Project\\AptivApp\\doc\\dropins=0
+D\:\\XMind\\XMind\\dropins=0
+D\:\\XMind\\XMind\\features=1535447104074

+ 5 - 0
doc/configuration/org.eclipse.osgi/718/data/timestamps975068543

@@ -0,0 +1,5 @@
+#Timestamps for XMindProfile
+#Mon Oct 22 22:12:55 CST 2018
+file\:/D\:/XMind/XMind/.eclipseextension=1540217574039
+PROFILE=1540217575907
+file\:/E\:/Project/AptivApp/doc/configuration/org.eclipse.osgi/718/data/listener_1925729951/=1540217573721

+ 3 - 0
doc/configuration/org.eclipse.update/platform.xml

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config date="1540217573909" transient="false" shared_ur="file:configuration/org.eclipse.update/platform.xml" version="3.0">
+</config>

+ 14 - 0
doc/p2/org.eclipse.equinox.p2.core/cache/artifacts.xml

@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?artifactRepository version='1.1.0'?>
+<repository name='download cache' type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'>
+  <properties size='2'>
+    <property name='p2.system' value='true'/>
+    <property name='p2.timestamp' value='1540217573865'/>
+  </properties>
+  <mappings size='3'>
+    <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
+    <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
+    <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
+  </mappings>
+  <artifacts size='0'/>
+</repository>

+ 0 - 0
doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/.lock


BIN
doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/1540217574311.profile.gz


BIN
doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/1540217575907.profile.gz


+ 4 - 0
doc/p2/org.eclipse.equinox.p2.engine/profileRegistry/XMindProfile.profile/state.properties

@@ -0,0 +1,4 @@
+#Mon Oct 22 22:12:54 CST 2018
+1540217574311._simpleProfileRegistry_internal_1539058634053=1539058634053
+1540217574311.org.eclipse.equinox.p2.state.shared=initial
+1540217574311._simpleProfileRegistry_internal_-1=-1

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-10-1523956083576.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-13-1523961070529.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-14-1524018808929.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-16-1524018895378.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-17-1524019399076.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-18-1524019421188.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-19-1524019726223.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-20-1524891532209.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-21-1527217552676.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-22-1527218291917.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-25-1527222378251.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-26-1527224827930.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-27-1527224941235.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-32-1527231707642.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-33-1527231783036.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-35-1527232997784.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-37-1527331050804.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-38-1527331139512.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-39-1527331183651.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 2 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-40-1527331383567.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-41-1527332411154.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-44-1527332941377.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-47-1527395461380.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-48-1527395675259.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-49-1528524761106.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-50-1528524794505.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-6-1523953549012.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-7-1523953907481.xml


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Revisions/7jn0oqoh7u4joe113ctg8oj5ib/rev-9-1523954639160.xml


BIN
doc/workspace/temp/workbooks/74bf3594-96a1-45d4-8270-720183cd51f4.xmind.temp/Thumbnails/thumbnail.png


+ 1 - 1
pom.xml

@@ -157,7 +157,7 @@
             <groupId>org.apache.mina</groupId>
             <artifactId>mina-core</artifactId>
             <version>2.0.9</version>
-        </dependency>
+    </dependency>
         <dependency>
             <groupId>org.apache.mina</groupId>
             <artifactId>mina-transport-serial</artifactId>

+ 171 - 222
src/main/java/co/dc/aptiv/AptivApp.java

@@ -5,6 +5,7 @@ import co.dc.aptiv.mina.ComMinaA;
 import co.dc.aptiv.mina.PLCMina;
 import co.dc.aptiv.mina.TestMachineCollectorMina;
 import co.dc.aptiv.pojo.BillPojo;
+import co.dc.aptiv.pojo.ConfigPojo;
 import co.dc.aptiv.pojo.MaterielPojo;
 import co.dc.aptiv.pojo.UserPojo;
 import co.dc.aptiv.service.*;
@@ -12,11 +13,8 @@ import co.dc.aptiv.utils.CharacterConversionUtil;
 import co.dc.aptiv.utils.KeyboardUtil;
 import co.dc.aptiv.utils.ResetJButton;
 import co.dc.aptiv.utils.WindowUtil;
-import co.dc.commons.utils.DateTimeUtil;
-import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.dbutils.QueryRunner;
-import org.apache.commons.dbutils.handlers.MapHandler;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -38,10 +36,8 @@ import java.io.RandomAccessFile;
 import java.net.UnknownHostException;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
-import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Enumeration;
-import java.util.Map;
 
 /**
  * @describe: 主程序
@@ -51,13 +47,14 @@ import java.util.Map;
 public class AptivApp {
     public static UserPojo session = null;
 
-    private static final Log log = LogFactory.getLog(AptivApp.class);
+    private static final Log log = LogFactory.getLog (AptivApp.class);
     private JFrame frmv;
     private JPanel contentPane;
-    private JTextField textField;
-    private JTextField textField_1;
+    private JTextField username;
+    private JTextField password;
     private JLabel lblNewLabel;
     public static QueryRunner queryRunner;
+    public static ConfigService configService;
     public static UserService userService;
     public static BillService billService;
     public static BillDetailService billDetailService;
@@ -111,160 +108,120 @@ public class AptivApp {
     /**
      * 字符转换工具类
      */
-    public static CharacterConversionUtil ccu = new CharacterConversionUtil();
+    public static CharacterConversionUtil ccu = new CharacterConversionUtil ();
 
     /**
      * 程序入口
      *
      * @param args
      */
-    public static void main(String[] args) {
+    public static void main (String[] args) {
         //检查文件锁--用于限制程序多开
         try {
-            boolean runFlag = isRunning("德尔福激光工控V1.2.exe");
-            log.info("is running " + runFlag);
+            boolean runFlag = isRunning ("德尔福激光工控V1.2.exe");
+            log.info ("is running " + runFlag);
             if (runFlag) {
-                JOptionPane.showMessageDialog(null, "程序已打开,不可多开。", "提示", JOptionPane.ERROR_MESSAGE);
+                JOptionPane.showMessageDialog (null, "程序已打开,不可多开。", "提示", JOptionPane.ERROR_MESSAGE);
                 //退出程序
-                System.exit(0);
+                System.exit (0);
             }
         } catch (Exception e) {
-            log.error("检查文件锁异常。", e);
+            log.error ("检查文件锁异常。", e);
         }
 
         //新建进度条对象
-        JWindowLoding jWindowLoding = new JWindowLoding(500, 300, Color.white, Color.green, 100, 200, 300, 15);
-        jWindowLoding.start();
+        JWindowLoding jWindowLoding = new JWindowLoding (500, 300, Color.white, Color.green, 100, 200, 300, 15);
+        jWindowLoding.start ();
 
         //操作配置文件
-        String exePath = System.getProperty("exe.path");
-        if (StringUtils.isEmpty(exePath)) {
-            String path = AptivApp.class.getResource("/").getPath();
+        String exePath = System.getProperty ("exe.path");
+        if (StringUtils.isEmpty (exePath)) {
+            String path = AptivApp.class.getResource ("/").getPath ();
             exePath = path;
         }
-        System.setProperty("exe.path", exePath + "config.properties");
+        System.setProperty ("exe.path", exePath + "config.properties");
 
         //进度条进度设定
-        jWindowLoding.setProgress("正在初始化系统配置", 5);
+        jWindowLoding.setProgress ("正在初始化系统配置", 5);
 
         //加载各种bean
-        ApplicationContext cxt = new ClassPathXmlApplicationContext("applicationContent.xml");
+        ApplicationContext cxt = new ClassPathXmlApplicationContext ("applicationContent.xml");
         //数据库管理
-        queryRunner = (QueryRunner) cxt.getBean("queryRunner");
+        queryRunner = (QueryRunner) cxt.getBean ("queryRunner");
         //用户管理
-        userService = (UserService) cxt.getBean("userService");
+        userService = (UserService) cxt.getBean ("userService");
         //单据管理
-        billService = (BillService) cxt.getBean("billService");
+        billService = (BillService) cxt.getBean ("billService");
         //单据详情管理
-        billDetailService = (BillDetailService) cxt.getBean("billDetailService");
+        billDetailService = (BillDetailService) cxt.getBean ("billDetailService");
         //PLC
-        plcMina = (PLCMina) cxt.getBean("plcMina");
+        plcMina = (PLCMina) cxt.getBean ("plcMina");
         //采集器
-        collectorMina = (CollectorMina) cxt.getBean("collectorMina");
+        collectorMina = (CollectorMina) cxt.getBean ("collectorMina");
         //测试机设备管理
-        testMachineCollectorMina = (TestMachineCollectorMina) cxt.getBean("testMachineCollectorMina");
+        testMachineCollectorMina = (TestMachineCollectorMina) cxt.getBean ("testMachineCollectorMina");
         //配置管理
-        configuration = (PropertiesConfiguration) cxt.getBean("configuration");
+        configuration = (PropertiesConfiguration) cxt.getBean ("configuration");
         //产品管理
-        materielService = (MaterielService) cxt.getBean("materielService");
+        materielService = (MaterielService) cxt.getBean ("materielService");
         //二维码
-        qrcodeService = (QrCodeService) cxt.getBean("qrCodesService");
-        windowUtil = (WindowUtil) cxt.getBean("windowUtil");
+        qrcodeService = (QrCodeService) cxt.getBean ("qrCodesService");
+        windowUtil = (WindowUtil) cxt.getBean ("windowUtil");
 
-        jWindowLoding.setProgress("正在连接系统数据库", 10);
+        jWindowLoding.setProgress ("正在连接系统数据库", 10);
         //检查数据库连接
-        boolean dbFlag = userService.checkDb();
+        boolean dbFlag = userService.checkDb ();
         if (dbFlag == false) {
-            jWindowLoding.setProgress("系统数据库连接失败", 30);
-            JOptionPane.showMessageDialog(null, "系统数据库连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
-            System.exit(0);
+            jWindowLoding.setProgress ("系统数据库连接失败", 30);
+            JOptionPane.showMessageDialog (null, "系统数据库连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
+            System.exit (0);
         }
 
-        /*备份码表
-            1.获取订单的最后一条记录的日期
-            2.判断最后一条记录的日期是不是当前日期,是就不备份
-            3.判断以最后一条记录的日期为后缀的表是否存在,存在就表示之前备份过,不用再备份
-            4.备份码表为当前日期,并截断现有的码表
-            5.这样做会引起如下问题:
-                5.1:查看和导出记录的时候,得先去找指定的表
-                5.2: 导出多条订单记录会读很多张码表
-                5.3:跨时间的按订单时间算
-         */
-        //备份表
-       /* jWindowLoding.setProgress("备份码表", 40);
-        //获取订单的最后一条记录的日期
-        String billLastDate = billService.getLastDate();
-        //判断是不是从未生产过
-        if (StringUtils.isNotEmpty(billLastDate)) {
-            //判断获取的最后一条记录的日期是不是当前日期
-            if (!DateTimeUtil.getDateString().equals(billLastDate)) {
-                try {
-                    //设置表名
-                    String tableName = "bill_detail_" + billLastDate.replaceAll("-", "");
-                    //查询表是否存在
-                    String sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'aptiv' AND TABLE_NAME = ?";
-                    Map<String, Object> map = queryRunner.query(sql, new MapHandler(), tableName);
-                    //表不存在
-                    if (map == null) {
-                        //创建并复制表
-                        log.info("创建并复制表");
-                        queryRunner.update("CREATE TABLE " + tableName + " SELECT * FROM bill_detail");
-                        //截断表
-                        log.info("截断表");
-                        queryRunner.update("truncate table bill_detail");
-                    }
-                } catch (SQLException e) {
-                    e.printStackTrace();
-                }
-            }
-        }*/
-
-
         //检查PLC
-        jWindowLoding.setProgress("正在连接PLC", 50);
+        jWindowLoding.setProgress ("正在连接PLC", 50);
         //tcp配置--检查设备
-        plcMina.startConnection();
-        if (plcMina.isConnect() == false) {
-            plcMina.closeConnection();
-            jWindowLoding.setProgress("PLC连接失败", 90);
-            JOptionPane.showMessageDialog(null, "PLC连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
-            System.exit(0);
+        plcMina.startConnection ();
+        if (plcMina.isConnect () == false) {
+            plcMina.closeConnection ();
+            jWindowLoding.setProgress ("PLC连接失败", 90);
+            JOptionPane.showMessageDialog (null, "PLC连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
+            System.exit (0);
         }
 
         //检查激光机
-        jWindowLoding.setProgress("正在连接激光器", 70);
+        jWindowLoding.setProgress ("正在连接激光器", 70);
         //tcp配置--检查设备
-        printMina = new ComMinaA(configuration.getString("com"), Integer.parseInt(configuration.getString("bot")));
-        printMina.startConnection();
-        if (printMina.isConnect() == false) {
-            printMina.closeConnection();
-            jWindowLoding.setProgress("激光器连接失败", 80);
-            JOptionPane.showMessageDialog(null, "激光器连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
-            System.exit(0);
+        printMina = new ComMinaA (configuration.getString ("com"), Integer.parseInt (configuration.getString ("bot")));
+        printMina.startConnection ();
+        if (printMina.isConnect () == false) {
+            printMina.closeConnection ();
+            jWindowLoding.setProgress ("激光器连接失败", 80);
+            JOptionPane.showMessageDialog (null, "激光器连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
+            System.exit (0);
         }
 
         //检查采集器
-        jWindowLoding.setProgress("正在连接采集器", 80);
+        jWindowLoding.setProgress ("正在连接采集器", 80);
         //tcp配置--检查设备
-        collectorMina.startConnection();
-        if (collectorMina.isConnect() == false) {
-            collectorMina.closeConnection();
-            jWindowLoding.setProgress("采集器连接失败", 90);
-            JOptionPane.showMessageDialog(null, "采集器连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
-            System.exit(0);
+        collectorMina.startConnection ();
+        if (collectorMina.isConnect () == false) {
+            collectorMina.closeConnection ();
+            jWindowLoding.setProgress ("采集器连接失败", 90);
+            JOptionPane.showMessageDialog (null, "采集器连接失败.", "提示", JOptionPane.ERROR_MESSAGE);
+            System.exit (0);
         }
 
-        jWindowLoding.setProgress("初始化完成正在启动控制界面", 100);
-        jWindowLoding.finish();
+        jWindowLoding.setProgress ("初始化完成正在启动控制界面", 100);
+        jWindowLoding.finish ();
 
         //加载页面
-        EventQueue.invokeLater(new Runnable() {
-            public void run() {
+        EventQueue.invokeLater (new Runnable () {
+            public void run () {
                 try {
-                    AptivApp window = new AptivApp();
-                    window.frmv.setVisible(true);
+                    AptivApp window = new AptivApp ();
+                    window.frmv.setVisible (true);
                 } catch (Exception e) {
-                    log.error("系统启动界面异常:", e);
+                    log.error ("系统启动界面异常:", e);
                 }
             }
         });
@@ -274,163 +231,155 @@ public class AptivApp {
     /**
      * Create the application.
      */
-    public AptivApp() {
-        initialize();
+    public AptivApp () {
+        initialize ();
     }
 
     /**
      * Initialize the contents of the frame.
      */
-    public void initialize() {
+    public void initialize () {
         //禁止使用本地默认窗口样式,便于下方设置圆角窗口
         //JFrame.setDefaultLookAndFeelDecorated(true);
-        frmv = new JFrame();
-        frmv.setUndecorated(true);
-        frmv.setResizable(false);
-        frmv.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frmv = new JFrame ();
+        frmv.setUndecorated (true);
+        frmv.setResizable (false);
+        frmv.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
         //程序置顶
 //		frmv.setAlwaysOnTop(!frmv.isAlwaysOnTop());
 
         /*
          * 统一所有子窗口设置字体样式
          */
-        FontUIResource fontRes = new FontUIResource(new Font("微软雅黑", Font.PLAIN, 16));
-        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements(); ) {
-            Object key = keys.nextElement();
-            Object value = UIManager.get(key);
+        FontUIResource fontRes = new FontUIResource (new Font ("微软雅黑", Font.PLAIN, 16));
+        for (Enumeration<Object> keys = UIManager.getDefaults ().keys (); keys.hasMoreElements (); ) {
+            Object key = keys.nextElement ();
+            Object value = UIManager.get (key);
             if (value instanceof FontUIResource) {
-                UIManager.put(key, fontRes);
+                UIManager.put (key, fontRes);
             }
         }
 
-        frmv.setBounds(100, 100, 420, 460);
-        frmv.setLocationRelativeTo(null);
+        frmv.setBounds (100, 100, 420, 460);
+        frmv.setLocationRelativeTo (null);
 
-        contentPane = new JPanel() {
+        contentPane = new JPanel () {
             @Override
-            protected void paintComponent(Graphics g) {
-                super.paintComponent(g);
+            protected void paintComponent (Graphics g) {
+                super.paintComponent (g);
                 //登陆背景
-                Image image = new ImageIcon(MainFrame.class.getResource("img/loginbg.png")).getImage();
-                g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), this);
+                Image image = new ImageIcon (MainFrame.class.getResource ("img/loginbg.png")).getImage ();
+                g.drawImage (image, 0, 0, this.getWidth (), this.getHeight (), this);
             }
         };
-        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
-        contentPane.setBackground(Color.white);
-        frmv.setContentPane(contentPane);
-        contentPane.setLayout(null);
+        contentPane.setBorder (new EmptyBorder (5, 5, 5, 5));
+        contentPane.setBackground (Color.white);
+        frmv.setContentPane (contentPane);
+        contentPane.setLayout (null);
 
         /*
          * 关闭按钮
          */
-        JButton jButton = new ResetJButton("/co/dc/aptiv/img/close.png", "/co/dc/aptiv/img/close.png", "/co/dc/aptiv/img/close.png");
-        jButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                System.exit(0);
+        JButton jButton = new ResetJButton ("/co/dc/aptiv/img/close.png", "/co/dc/aptiv/img/close.png", "/co/dc/aptiv/img/close.png");
+        jButton.addActionListener (new ActionListener () {
+            public void actionPerformed (ActionEvent e) {
+                System.exit (0);
             }
         });
-        jButton.setBounds(368, 0, 52, 52);
-        contentPane.add(jButton);
+        jButton.setBounds (368, 0, 52, 52);
+        contentPane.add (jButton);
 
         /*
          * 用户名框
          */
-        textField = new JTextField();
-        KeyboardUtil kk2 = KeyboardUtil.getInstance();
-        kk2.register(textField);
-        textField.setBorder(new EmptyBorder(0, 0, 0, 0));
-        textField.setBounds(120, 185, 220, 40);
-        contentPane.add(textField);
-        textField.setColumns(10);
+        username = new JTextField ();
+        KeyboardUtil kk2 = KeyboardUtil.getInstance ();
+        kk2.register (username);
+        username.setBorder (new EmptyBorder (0, 0, 0, 0));
+        username.setBounds (120, 185, 220, 40);
+        contentPane.add (username);
+        username.setColumns (10);
 
         //加载最近一次登录的用户名
-        String lastname = configuration.getString("lastname", "");
-        if (StringUtils.isNotEmpty(lastname)) {
-            textField.setText(lastname);
+        final ConfigPojo configPojo = configService.get (1L);
+        if (configPojo != null && StringUtils.isNotEmpty (configPojo.getLastName ())) {
+            username.setText (configPojo.getLastName ());
         }
 
         /*
          * 密码框
          */
-        textField_1 = new JPasswordField();
-        KeyboardUtil kk = KeyboardUtil.getInstance();
-        kk.register(textField_1, true);
-        textField_1.setBorder(new EmptyBorder(0, 0, 0, 0));
-        textField_1.setColumns(10);
-        textField_1.setBounds(120, 240, 220, 40);
-        contentPane.add(textField_1);
-        textField_1.addKeyListener(new KeyListener() {
-            public void keyPressed(KeyEvent e) {
-                if (e.getKeyCode() == KeyEvent.VK_ENTER) {
-                    //保存登录名
-                    try {
-                        AptivApp.configuration.setProperty("lastname", textField.getText());
-                        AptivApp.configuration.save();
-                    } catch (ConfigurationException ee) {
-                        log.equals("保存登录名称异常" + ee);
-                    }
+        password = new JPasswordField ();
+        KeyboardUtil kk = KeyboardUtil.getInstance ();
+        kk.register (password, true);
+        password.setBorder (new EmptyBorder (0, 0, 0, 0));
+        password.setColumns (10);
+        password.setBounds (120, 240, 220, 40);
+        contentPane.add (password);
+        password.addKeyListener (new KeyListener () {
+            public void keyPressed (KeyEvent e) {
+                if (e.getKeyCode () == KeyEvent.VK_ENTER) {
                     //执行登陆
-                    UserPojo _user = userService.checklogin(textField.getText(), textField_1.getText());
+                    UserPojo _user = userService.checklogin (username.getText (), password.getText ());
                     if (_user != null) {
-                        lblNewLabel.setText("");
-                        configuration.setProperty("lastname", textField.getText());
+                        lblNewLabel.setText ("");
+                        ConfigPojo configPojo2 = new ConfigPojo ();
+                        configPojo2.setLastName (username.getText ());
+                        configService.updateConfig (configPojo2);
                         AptivApp.session = _user;
                         //进入下一个界面
-                        new MainFrame().setVisible(true);
-                        frmv.dispose();
+                        new MainFrame ().setVisible (true);
+                        frmv.dispose ();
                     } else {
                         //提示有误,重新登录
-                        lblNewLabel.setText("登录名或密码有误,请重新登录.");
+                        lblNewLabel.setText ("登录名或密码有误,请重新登录.");
                     }
                 }
             }
 
-            public void keyReleased(KeyEvent e) {
+            public void keyReleased (KeyEvent e) {
             }
 
-            public void keyTyped(KeyEvent e) {
+            public void keyTyped (KeyEvent e) {
             }
         });
 
         /*
          * 登录按钮
          */
-        JButton button = new ResetJButton("/co/dc/aptiv/img/btn.png", "/co/dc/aptiv/img/btn-h.png", "/co/dc/aptiv/img/btn-h.png");
-        button.addActionListener(new ActionListener() {
+        JButton button = new ResetJButton ("/co/dc/aptiv/img/btn.png", "/co/dc/aptiv/img/btn-h.png", "/co/dc/aptiv/img/btn-h.png");
+        button.addActionListener (new ActionListener () {
             //点击执行登陆操作
-            public void actionPerformed(ActionEvent arg0) {
-                //保存登录名
-                try {
-                    AptivApp.configuration.setProperty("lastname", textField.getText());
-                    AptivApp.configuration.save();
-                } catch (ConfigurationException e) {
-                    log.equals("保存登录名称异常" + e);
-                }
+            public void actionPerformed (ActionEvent arg0) {
+
                 //执行登陆
-                UserPojo _user = userService.checklogin(textField.getText(), textField_1.getText());
+                UserPojo _user = userService.checklogin (username.getText (), password.getText ());
                 if (_user != null) {
-                    lblNewLabel.setText("");
-                    configuration.setProperty("lastname", textField.getText());
+                    lblNewLabel.setText ("");
+                    //保存登录名
+                    ConfigPojo configPojo = new ConfigPojo ();
+                    configPojo.setLastName (username.getText ());
+                    configService.updateConfig (configPojo);
                     //进入下一个界面
-                    new MainFrame().setVisible(true);
+                    new MainFrame ().setVisible (true);
                     AptivApp.session = _user;
-                    frmv.dispose();
+                    frmv.dispose ();
                 } else {
                     //提示有误,重新登录
-                    lblNewLabel.setText("登录名或密码有误,请重新登录.");
+                    lblNewLabel.setText ("登录名或密码有误,请重新登录.");
                 }
             }
         });
-        button.setBounds(60, 346, 300, 50);
-        contentPane.add(button);
+        button.setBounds (60, 346, 300, 50);
+        contentPane.add (button);
 
         /*
          * 提示信息块
          */
-        lblNewLabel = new JLabel("");
-        lblNewLabel.setForeground(Color.RED);
-        lblNewLabel.setBounds(95, 320, 248, 15);
-        contentPane.add(lblNewLabel);
+        lblNewLabel = new JLabel ("");
+        lblNewLabel.setForeground (Color.RED);
+        lblNewLabel.setBounds (95, 320, 248, 15);
+        contentPane.add (lblNewLabel);
     }
 
     /**
@@ -440,19 +389,19 @@ public class AptivApp {
      * @return
      * @throws UnknownHostException
      */
-    public static boolean isUsing(int singleId) throws UnknownHostException {
+    public static boolean isUsing (int singleId) throws UnknownHostException {
         try {
             RandomAccessFile raf = null;
             FileChannel channel = null;
             FileLock lock = null;
             // 在临时文件夹创建一个临时文件,锁住这个文件用来保证应用程序只有一个实例被创建.
-            File sf = new File(System.getProperty("java.io.tmpdir") + singleId + ".single");
-            sf.deleteOnExit();
-            sf.createNewFile();
+            File sf = new File (System.getProperty ("java.io.tmpdir") + singleId + ".single");
+            sf.deleteOnExit ();
+            sf.createNewFile ();
 
-            raf = new RandomAccessFile(sf, "rw");
-            channel = raf.getChannel();
-            lock = channel.tryLock();
+            raf = new RandomAccessFile (sf, "rw");
+            channel = raf.getChannel ();
+            lock = channel.tryLock ();
             if (lock == null) {
                 // 如果没有得到锁,则程序退出.
                 // 没有必要手动释放锁和关闭流,当程序退出时,他们会被关闭的.
@@ -460,22 +409,22 @@ public class AptivApp {
             }
             return true;
         } catch (Exception e) {
-            log.error("检查时候有文件锁--异常", e);
+            log.error ("检查时候有文件锁--异常", e);
             return false;
         }
     }
 
-    public static boolean isRunning(String processName) {
+    public static boolean isRunning (String processName) {
         BufferedReader bufferedReader = null;
         try {
-            Process proc = Runtime.getRuntime().exec("tasklist /FI \"IMAGENAME eq " + processName + "\"");
-            bufferedReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+            Process proc = Runtime.getRuntime ().exec ("tasklist /FI \"IMAGENAME eq " + processName + "\"");
+            bufferedReader = new BufferedReader (new InputStreamReader (proc.getInputStream ()));
             String line = null;
             int i = 0;
-            while ((line = bufferedReader.readLine()) != null) {
+            while ((line = bufferedReader.readLine ()) != null) {
                 //判断是否存在
-                if (line.contains(processName)) {
-                    log.info("running info " + line);
+                if (line.contains (processName)) {
+                    log.info ("running info " + line);
                     i++;
                 }
             }
@@ -484,44 +433,44 @@ public class AptivApp {
             }
             return false;
         } catch (Exception ex) {
-            ex.printStackTrace();
+            ex.printStackTrace ();
             return false;
         } finally {
             if (bufferedReader != null) {
                 try {
-                    bufferedReader.close();
+                    bufferedReader.close ();
                 } catch (Exception ex) {
                 }
             }
         }
     }
 
-    public static String httpStr(String code) {
-        if (code.indexOf("http") != -1) {
-            int begin = code.indexOf("=");
+    public static String httpStr (String code) {
+        if (code.indexOf ("http") != -1) {
+            int begin = code.indexOf ("=");
             if (begin == -1) {
-                begin = code.indexOf("?");
+                begin = code.indexOf ("?");
             }
-            return code.substring(begin + 1, code.length());
+            return code.substring (begin + 1, code.length ());
         } else {
             return code;
         }
 
     }
 
-    public void Test1() {
-        CharacterConversionUtil ccu = new CharacterConversionUtil();
+    public void Test1 () {
+        CharacterConversionUtil ccu = new CharacterConversionUtil ();
 
-        System.out.println("abc 转成ascii码后结果为 " + Arrays.toString(ccu.String2ASCII("abc")));
-        System.out.println("abc 转成十六进制 ascii码后结果为 " + ccu.String2HexString("abc"));
-        System.out.println("[97, 98, 99] 转成字符串后结果为 " + ccu.ASCII2String(new int[]{97, 98, 99}));
-        System.out.println("十六进制 ascii码 02 41 42 43 0D 0A 转成字符串后结果为 " + ccu.HexString2String("02 41 42 43 0D 0A"));
+        System.out.println ("abc 转成ascii码后结果为 " + Arrays.toString (ccu.String2ASCII ("abc")));
+        System.out.println ("abc 转成十六进制 ascii码后结果为 " + ccu.String2HexString ("abc"));
+        System.out.println ("[97, 98, 99] 转成字符串后结果为 " + ccu.ASCII2String (new int[]{97, 98, 99}));
+        System.out.println ("十六进制 ascii码 02 41 42 43 0D 0A 转成字符串后结果为 " + ccu.HexString2String ("02 41 42 43 0D 0A"));
 
 //        System.out.println(AptivApp.qrcodeService.getQrCode(1L));
 
 
         //退出程序
-        System.exit(0);
+        System.exit (0);
     }
 
 

+ 3 - 2
src/main/java/co/dc/aptiv/ScanFrame.java

@@ -117,10 +117,11 @@ public class ScanFrame extends JFrame {
         AptivApp.plcMina.setScanFrame(this);
         glassPane.installAsGlassPane(this);
         setResizable(false);
-        setUndecorated(true);
+//        setUndecorated(true);
         setTitle("德尔福激光工控V1.2");
         setAlwaysOnTop(!isAlwaysOnTop());
-        onLine = AptivApp.configuration.getBoolean("onlineStatus");
+//        onLine = AptivApp.configuration.getBoolean("onlineStatus");
+        onLine = true;
         /*
          * 统一所有子窗口设置字体样式
          */

+ 7 - 2
src/main/java/co/dc/aptiv/mina/PLCMinaHandler.java

@@ -2,6 +2,7 @@ package co.dc.aptiv.mina;
 
 import co.dc.aptiv.AptivApp;
 import co.dc.aptiv.ScanFrame;
+import co.dc.aptiv.pojo.ConfigPojo;
 import co.dc.aptiv.service.BillService;
 import co.dc.commons.utils.DateTimeUtil;
 import org.apache.commons.dbutils.QueryRunner;
@@ -46,7 +47,9 @@ public class PLCMinaHandler extends MinaAbstractHandler {
             if ("LOK".equals(str)) {
                 log.info("收到确认PLC联机信号");
                 AptivApp.plcMina.getScanFrame().onLine = true;
-                AptivApp.configuration.setProperty("onlineStatus", true);
+                ConfigPojo configPojo = new ConfigPojo ();
+                configPojo.setOnLine (1);
+                AptivApp.configService.updateConfig (configPojo);
                 //保存修改的配置文件
                 AptivApp.plcMina.getScanFrame().saveOlineStatus();
                 AptivApp.testMachineCollectorMina.startConnection();
@@ -61,7 +64,9 @@ public class PLCMinaHandler extends MinaAbstractHandler {
             if ("DOK".equals(str)) {
                 log.info("收到确认PLC独立信号");
                 AptivApp.plcMina.getScanFrame().onLine = false;
-                AptivApp.configuration.setProperty("onlineStatus", false);
+                ConfigPojo configPojo = new ConfigPojo ();
+                configPojo.setOnLine (0);
+                AptivApp.configService.updateConfig (configPojo);
                 //保存修改的配置文件
                 AptivApp.plcMina.getScanFrame().saveOlineStatus();
                 //设置指示灯状态

+ 6 - 0
src/main/java/co/dc/aptiv/mina/TestMachineCollectorMina.java

@@ -15,6 +15,9 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.session.IdleStatus;
 import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.filter.codec.textline.LineDelimiter;
+import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
 import org.apache.mina.filter.logging.LoggingFilter;
 import org.apache.mina.transport.serial.SerialAddress;
 import org.apache.mina.transport.serial.SerialConnector;
@@ -22,6 +25,8 @@ import org.springframework.stereotype.Service;
 
 import co.dc.aptiv.ScanFrame;
 
+import java.nio.charset.Charset;
+
 
 @Service("testMachineCollectorMina")
 public class TestMachineCollectorMina extends MinaAbstract {
@@ -37,6 +42,7 @@ public class TestMachineCollectorMina extends MinaAbstract {
         // 创建连接客户端
         connector = new SerialConnector();
         connector.getFilterChain().addLast("log", new LoggingFilter());
+//        connector.getFilterChain().addLast("codecs", new ProtocolCodecFilter (new TextLineCodecFactory (Charset.defaultCharset(), LineDelimiter.CRLF, LineDelimiter.CRLF)));
         // 设置连接超时检查时间
         connector.setConnectTimeoutCheckInterval(30);
         // 添加处理器

+ 28 - 27
src/main/java/co/dc/aptiv/mina/TestMachineCollectorMinaHandler.java

@@ -20,17 +20,17 @@ import java.util.regex.Pattern;
  */
 public class TestMachineCollectorMinaHandler extends MinaAbstractHandler {
 
-    private static final Log log = LogFactory.getLog(TestMachineCollectorMinaHandler.class);
+    private static final Log log = LogFactory.getLog (TestMachineCollectorMinaHandler.class);
 
-    public TestMachineCollectorMinaHandler(TestMachineCollectorMina collectorMina, QueryRunner queryRunner) {
-        super(collectorMina, queryRunner);
+    public TestMachineCollectorMinaHandler (TestMachineCollectorMina collectorMina, QueryRunner queryRunner) {
+        super (collectorMina, queryRunner);
     }
 
     private BillService billService;
 
 
-    public TestMachineCollectorMinaHandler(MinaAbstract mina, QueryRunner queryRunner, BillService billService) {
-        super(mina, queryRunner);
+    public TestMachineCollectorMinaHandler (MinaAbstract mina, QueryRunner queryRunner, BillService billService) {
+        super (mina, queryRunner);
         this.billService = billService;
     }
 
@@ -39,50 +39,51 @@ public class TestMachineCollectorMinaHandler extends MinaAbstractHandler {
      * 处理收到的信息
      */
     @Override
-    public void messageReceived(IoSession session, Object message) throws Exception {
+    public void messageReceived (IoSession session, Object message) throws Exception {
         IoBuffer in = (IoBuffer) message;
-        byte[] bytes = new byte[in.remaining()];
-        in.get(bytes, 0, in.remaining());
-        String s = Integer.toHexString(bytes[0]);
+        byte[] bytes = new byte[in.remaining ()];
+        in.get (bytes, 0, in.remaining ());
+        String s = Integer.toHexString (bytes[0]);
+        log.info ("测试机发来数据--------------------------------------------------------------------------------------------------" + s);
         if (s != null) {
-            String dpn = AptivApp.ccu.HexString2String(bytes);
-            if (AptivApp.qrcodeService.getScanFrame().onLine) {
-                MaterielPojo materielPojo = AptivApp.materielService.findByDPN(dpn);
+            String dpn = AptivApp.ccu.HexString2String (bytes);
+            if (AptivApp.qrcodeService.getScanFrame ().onLine) {
+                MaterielPojo materielPojo = AptivApp.materielService.findByDPN (dpn);
                 //判断物料是否存在
                 if (materielPojo != null) {
-                    log.info("测试机发来的物料,DPN = " + dpn);
+                    log.info ("测试机发来的物料,DPN = " + dpn);
                     //判断当前是否可打印模式
 //                    if (AptivApp.printStatus) {
                     AptivApp.nowMaterielPojo = materielPojo;
-                    AptivApp.qrcodeService.getScanFrame().setComboBox_1();
-                    int codeFlag = AptivApp.qrcodeService.sendQrCode();
+                    AptivApp.qrcodeService.getScanFrame ().setComboBox_1 ();
+                    int codeFlag = AptivApp.qrcodeService.sendQrCode ();
                     if (codeFlag < 0) {
-                        log.info("发送码给激光机异常");
-                        AptivApp.qrcodeService.getScanFrame().alertMsg(1, "生产码异常,请停止打印并联系管理员!");
+                        log.info ("发送码给激光机异常");
+                        AptivApp.qrcodeService.getScanFrame ().alertMsg (1, "生产码异常,请停止打印并联系管理员!");
                     }
                     if (codeFlag == 0) {
-                        log.error("已接收测试机发的物料号,但程序尚未开始打印!");
-                        AptivApp.qrcodeService.getScanFrame().alertMsg(1, "已接收测试机发的物料号,但程序尚未开始打印!");
+                        log.error ("已接收测试机发的物料号,但程序尚未开始打印!");
+                        AptivApp.qrcodeService.getScanFrame ().alertMsg (1, "已接收测试机发的物料号,但程序尚未开始打印!");
                     }
 //                    }
                 } else {
                     //弹出提示信息
-                    AptivApp.qrcodeService.getScanFrame().alertMsg(1, "测试机发来的物料不存在,请检查测试机或物料!");
-                    log.info("测试机发来的物料不存在,DPN = " + dpn);
+                    AptivApp.qrcodeService.getScanFrame ().alertMsg (1, "测试机发来的物料不存在,请检查测试机或物料!");
+                    log.info ("测试机发来的物料不存在,DPN = " + dpn);
                 }
                 //给测试机回复收到物料号
-                Thread.sleep(100);
-                AptivApp.testMachineCollectorMina.sendByte(AptivApp.ccu.String2ASCII("ok"));
+                Thread.sleep (100);
+                AptivApp.testMachineCollectorMina.sendByte (AptivApp.ccu.String2ASCII ("ok"));
             }
         }
     }
 
-    public static String replaceBlank(String str) {
+    public static String replaceBlank (String str) {
         String dest = "";
         if (str != null) {
-            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
-            Matcher m = p.matcher(str);
-            dest = m.replaceAll("");
+            Pattern p = Pattern.compile ("\\s*|\t|\r|\n");
+            Matcher m = p.matcher (str);
+            dest = m.replaceAll ("");
         }
         return dest;
     }

+ 66 - 0
src/main/java/co/dc/aptiv/pojo/ConfigPojo.java

@@ -0,0 +1,66 @@
+package co.dc.aptiv.pojo;
+
+import co.dc.commons.annotation.Transient;
+import co.dc.commons.basedao.CommonPojoAbstract;
+
+import java.io.Serializable;
+
+/**
+ * @describe: 配置类
+ * @author: 刘兴龙
+ * @version: 2019/1/3 9:48
+ */
+
+public class ConfigPojo extends CommonPojoAbstract implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @Transient
+    public static final String tableName = "config";
+
+    @Override
+    public String getTableName() {
+        return tableName;
+    }
+
+    private Long id;
+    /**
+     * 最后登录用户
+     */
+    private String lastName;
+    /**
+     * 测试机连接状态
+     */
+    private Integer onLine;
+
+    public Long getId () {
+        return id;
+    }
+
+    public void setId (Long id) {
+        this.id = id;
+    }
+
+    public String getLastName () {
+        return lastName;
+    }
+
+    public void setLastName (String lastName) {
+        this.lastName = lastName;
+    }
+
+    public Integer getOnLine () {
+        return onLine;
+    }
+
+    public void setOnLine (Integer onLine) {
+        this.onLine = onLine;
+    }
+
+    @Override
+    public String toString () {
+        return "ConfigPojo{" +
+                "id=" + id +
+                ", lastName='" + lastName + '\'' +
+                ", onLine=" + onLine +
+                '}';
+    }
+}

+ 54 - 0
src/main/java/co/dc/aptiv/service/ConfigService.java

@@ -0,0 +1,54 @@
+package co.dc.aptiv.service;
+
+import co.dc.aptiv.pojo.ConfigPojo;
+import co.dc.commons.basedao.CommonBaseDao;
+import org.apache.commons.dbutils.QueryRunner;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+
+/**
+ * @describe: 配置类业务层
+ * @author: 刘兴龙
+ * @version: 2019/1/3 10:04
+ */
+@Service("configService")
+public class ConfigService {
+    private static final Log log = LogFactory.getLog (ConfigService.class);
+
+    @Resource(name = "commonBaseDao")
+    private CommonBaseDao baseDao;
+
+    @Resource
+    private QueryRunner queryRunner;
+
+    /**
+     * 更新基础信息
+     *
+     * @param pojo
+     */
+    public void updateConfig (ConfigPojo pojo) {
+        ConfigPojo configPojo = baseDao.findById (ConfigPojo.class, 1);
+        if (!StringUtils.isEmpty (pojo.getLastName ())) {
+            configPojo.setLastName (pojo.getLastName ());
+        }
+        if (pojo.getOnLine () != null && !configPojo.getOnLine ().equals (pojo.getOnLine ())) {
+            configPojo.setOnLine (pojo.getOnLine ());
+        }
+        baseDao.update (configPojo);
+        log.info ("更新配置类信息" + pojo.toString ());
+    }
+
+    /**
+     * 根据id取配置信息
+     *
+     * @param id
+     * @return
+     */
+    public ConfigPojo get (Long id) {
+        return baseDao.findById (ConfigPojo.class, id);
+    }
+}

+ 5 - 8
src/main/resources/config.properties

@@ -1,11 +1,8 @@
 #\u7CFB\u7EDF\u6570\u636E\u5E93\u914D\u7F6E
 dataSource.driverClass=com.mysql.jdbc.Driver
-dataSource.jdbcUrl=jdbc:mysql:///aptiv?useUnicode=true&characterEncoding=UTF-8
+dataSource.jdbcUrl=jdbc:mysql:///aptiv2?useUnicode=true&characterEncoding=UTF-8
 dataSource.user=root
-dataSource.password=
-
-#\u6700\u540E\u767B\u5F55\u7684\u7528\u6237\u540D
-lastname=admin
+dataSource.password=dckj@2018
 
 #PLC
 plc.ip=127.0.0.1
@@ -13,15 +10,15 @@ plc.port=3000
 
 #\u6FC0\u5149\u673A\u914D\u7F6E
 com=COM2
-bot=9600
+bot=57600
 
 #\u91C7\u96C6\u5668\u914D\u7F6E
 machine.ip=127.0.0.1
 machine.port=51236
 
 #\u8054\u673A\u72B6\u6001
-onlineStatus = false
+onlineStatus = true
 
 #\u6D4B\u8BD5\u673A\u914D\u7F6E
 testMachine.com=COM4
-testMachine.bot=57600
+testMachine.bot=9600

+ 4 - 8
src/main/resources/logback.xml

@@ -21,8 +21,7 @@
             <fileNamePattern>${LOG_PATH}/log-error-%d{yyyy-MM-dd}.%i.log
             </fileNamePattern>
             <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, 命名日志文件,例如log-error-2013-12-21.0.log -->
-            <timeBasedFileNamingAndTriggeringPolicy
-                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                 <maxFileSize>100MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
         </rollingPolicy>
@@ -41,8 +40,7 @@
         </filter>
     </appender>
 
-    <appender name="FILERUN"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <appender name="FILERUN" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${LOG_PATH}/log_run.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <fileNamePattern>${LOG_PATH}/log-warn-%d{yyyy-MM-dd}.%i.log
@@ -63,8 +61,7 @@
         </filter>
     </appender>
 
-    <appender name="FILEINFO"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <appender name="FILEINFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${LOG_PATH}/log_info.log</file>
 
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@@ -89,8 +86,7 @@
     </appender>
 
 
-    <appender name="FILEDEBUG"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <appender name="FILEDEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${LOG_PATH}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <fileNamePattern>${LOG_PATH}/log-debug-%d{yyyy-MM-dd}.%i.log