Pārlūkot izejas kodu

Addes Productcodes, new Productcodetransformation X1K

Manuel Gall 2 gadi atpakaļ
vecāks
revīzija
c7fee26f72

BIN
server/database/stations.db


+ 124 - 97
server/json/LaserUI.json

@@ -2,335 +2,362 @@
   "Row1": [
     {
       "Label": "RP 31",
-      "File": "CE_SerNr_SlotT1_RP.31.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.31.rotiert.xml",
       "Image": "Positionierbild_RP31.jpg"
     },
     {
       "Label": "RP 36",
-      "File": "CE_SerNr_SlotT1_RP.36.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.36.rotiert.xml",
       "Image": "Positionierbild_RP36.jpg"
     },
     {
       "Label": "RP 41",
-      "File": "CE_SerNr_SlotT1_RP.41.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.41.rotiert.xml",
       "Image": "Positionierbild_RP41.jpg"
     },
     {
       "Label": "RP 46",
-      "File": "CE_SerNr_SlotT1_RP.46.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.46.rotiert.xml",
       "Image": "Positionierbild_RP46.jpg"
     },
     {
       "Label": "RP 51",
-      "File": "CE_SerNr_SlotT1_RP.51.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.51.rotiert.xml",
       "Image": "Positionierbild_RP51.jpg"
     },
     {
       "Label": "RP 56",
-      "File": "CE_SerNr_SlotT1_RP.56.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.56.rotiert.xml",
       "Image": "Positionierbild_RP56.jpg"
     },
     {
       "Label": "RP 61",
-      "File": "CE_SerNr_SlotT1_RP.61.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.61.rotiert.xml",
       "Image": "Positionierbild_RP61.jpg"
     },
     {
       "Label": "RP 66",
-      "File": "CE_SerNr_SlotT1_RP.66.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.66.rotiert.xml",
       "Image": "Positionierbild_RP66.jpg"
     },
     {
       "Label": "RP 71",
-      "File": "CE_SerNr_SlotT1_RP.71.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.71.rotiert.xml",
       "Image": "Positionierbild_RP71.jpg"
     },
     {
       "Label": "RP 76",
-      "File": "CE_SerNr_SlotT1_RP.76.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.76.rotiert.xml",
       "Image": "Positionierbild_RP76.jpg"
     },
     {
       "Label": "RP 81",
-      "File": "CE_SerNr_SlotT1_RP.81.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.81.rotiert.xml",
       "Image": "Positionierbild_RP81.jpg"
     },
     {
       "Label": "RP 86",
-      "File": "CE_SerNr_SlotT1_RP.86.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.86.rotiert.xml",
       "Image": "Positionierbild_RP86.jpg"
     },
     {
       "Label": "RP 91",
-      "File": "CE_SerNr_SlotT1_RP.91.rotiert",
+      "File": "CE_SerNr_SlotT1_RP.91.rotiert.xml",
       "Image": "Positionierbild_RP91.jpg"
     }
   ],
   "Row2": [
     {
       "Label": "EP 31",
-      "File": "CE_SerNr_SlotT1_EP.31.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.31.rotiert.xml",
       "Image": "Positionierbild_EP31.jpg"
     },
     {
       "Label": "EP 36",
-      "File": "CE_SerNr_SlotT1_EP.36.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.36.rotiert.xml",
       "Image": "Positionierbild_EP36.jpg"
     },
     {
       "Label": "EP 41",
-      "File": "CE_SerNr_SlotT1_EP.41.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.41.rotiert.xml",
       "Image": "Positionierbild_EP41.jpg"
     },
     {
       "Label": "EP 46",
-      "File": "CE_SerNr_SlotT1_EP.46.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.46.rotiert.xml",
       "Image": "Positionierbild_EP46.jpg"
     },
     {
       "Label": "EP 51",
-      "File": "CE_SerNr_SlotT1_EP.51.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.51.rotiert.xml",
       "Image": "Positionierbild_EP51.jpg"
     },
     {
       "Label": "EP 56",
-      "File": "CE_SerNr_SlotT1_EP.56.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.56.rotiert.xml",
       "Image": "Positionierbild_EP56.jpg"
     },
     {
       "Label": "EP 61",
-      "File": "CE_SerNr_SlotT1_EP.61.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.61.rotiert.xml",
       "Image": "Positionierbild_EP61.jpg"
     },
     {
       "Label": "EP 66",
-      "File": "CE_SerNr_SlotT1_EP.66.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.66.rotiert.xml",
       "Image": "Positionierbild_EP66.jpg"
     },
     {
       "Label": "EP 71",
-      "File": "CE_SerNr_SlotT1_EP.71.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.71.rotiert.xml",
       "Image": "Positionierbild_EP71.jpg"
     },
     {
       "Label": "EP 76",
-      "File": "CE_SerNr_SlotT1_EP.76.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.76.rotiert.xml",
       "Image": "Positionierbild_EP76.jpg"
     },
     {
       "Label": "EP 81",
-      "File": "CE_SerNr_SlotT1_EP.81.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.81.rotiert.xml",
       "Image": "Positionierbild_EP81.jpg"
     },
     {
       "Label": "EP 86",
-      "File": "CE_SerNr_SlotT1_EP.86.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.86.rotiert.xml",
       "Image": "Positionierbild_EP86.jpg"
     },
     {
       "Label": "EP 91",
-      "File": "CE_SerNr_SlotT1_EP.91.rotiert",
+      "File": "CE_SerNr_SlotT1_EP.91.rotiert.xml",
       "Image": "Positionierbild_EP91.jpg"
     }
   ],
   "SpecialButtons": [
-     {
-      "Label": "EP 31 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.31.rotiert",
+    {
+      "Label": "EP 31 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.31.rotiert.xml",
       "Image": "Positionierbild_EP31.jpg",
       "PositionX": 48,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
-     },
+    },
     {
-      "Label": "EP 36 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.36.rotiert",
+      "Label": "EP 36 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.36.rotiert.xml",
       "Image": "Positionierbild_EP36.jpg",
       "PositionX": 176,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 41 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.41.rotiert",
+      "Label": "EP 41 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.41.rotiert.xml",
       "Image": "Positionierbild_EP41.jpg",
       "PositionX": 304,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 46 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.46.rotiert",
+      "Label": "EP 46 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.46.rotiert.xml",
       "Image": "Positionierbild_EP46.jpg",
       "PositionX": 432,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 51 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.51.rotiert",
+      "Label": "EP 51 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.51.rotiert.xml",
       "Image": "Positionierbild_EP51.jpg",
       "PositionX": 560,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 56 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.56.rotiert",
+      "Label": "EP 56 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.56.rotiert.xml",
       "Image": "Positionierbild_EP56.jpg",
       "PositionX": 688,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 61 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.61.rotiert",
+      "Label": "EP 61 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.61.rotiert.xml",
       "Image": "Positionierbild_EP61.jpg",
       "PositionX": 816,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 66 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.66.rotiert",
+      "Label": "EP 66 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.66.rotiert.xml",
       "Image": "Positionierbild_EP66.jpg",
       "PositionX": 944,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 71 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.71.rotiert",
+      "Label": "EP 71 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.71.rotiert.xml",
       "Image": "Positionierbild_EP71.jpg",
       "PositionX": 1072,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 76 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.76.rotiert",
+      "Label": "EP 76 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.76.rotiert.xml",
       "Image": "Positionierbild_EP76.jpg",
       "PositionX": 1200,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 81 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.81.rotiert",
+      "Label": "EP 81 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.81.rotiert.xml",
       "Image": "Positionierbild_EP81.jpg",
       "PositionX": 1328,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 86 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.86.rotiert",
+      "Label": "EP 86 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.86.rotiert.xml",
       "Image": "Positionierbild_EP86.jpg",
       "PositionX": 1456,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
-      "Label": "EP 91 FLU",
-      "File": "CE_SerNr_FLU_SlotT1_EP.91.rotiert",
+      "Label": "EP 91 <br> FLU",
+      "File": "CE_SerNr_FLU_SlotT1_EP.91.rotiert.xml",
       "Image": "Positionierbild_EP91.jpg",
       "PositionX": 1584,
-      "PositionY": 350,
+      "PositionY": 500,
       "SizeX": 97,
       "SizeY": 80
     },
     {
       "Label": "HPM",
-      "File": "CE_SerNr_SlotT1_HPM",
-      "Image": "Positionierbild_HPM_MB19_MB27.jpg",
+      "File": "CE_SerNr_SlotT1_HPM.xml",
+      "Image": "Positionierbild_HPM.jpg",
       "PositionX": 400,
-      "PositionY": 500,
+      "PositionY": 600,
       "SizeX": 300,
       "SizeY": 100
     },
     {
       "Label": "MB19",
-      "File": "CE_SerNr_SlotT1_MB19",
-      "Image": "Positionierbild_HPM_MB19_MB27.jpg",
+      "File": "CE_SerNr_SlotT1_MB19.xml",
+      "Image": "Positionierbild_MB19.jpg",
       "PositionX": 400,
-      "PositionY": 625,
+      "PositionY": 725,
       "SizeX": 150,
       "SizeY": 50
     },
     {
-      "Label": "MB22",
-      "File": "CE_SerNr_SlotT1_MB22",
+      "Label": "MB23",
+      "File": "CE_SerNr_SlotT1_MB23.xml",
       "Image": "Positionierbild_SKA-SKI_MB22.jpg",
       "PositionX": 600,
-      "PositionY": 650,
-      "SizeX": 100,
+      "PositionY": 725,
+      "SizeX": 150,
+      "SizeY": 50
+    },
+    {
+      "Label": "MB23CH",
+      "File": "CE_SerNr_SlotT1_MB23CH.xml",
+      "Image": "Positionierbild_MB22.jpg",
+      "PositionX": 800,
+      "PositionY": 725,
+      "SizeX": 150,
       "SizeY": 50
     },
     {
       "Label": "MB27",
-      "File": "CE_SerNr_SlotT1_MB27",
-      "Image": "Positionierbild_HPM_MB19_MB27.jpg",
-      "PositionX": 600,
-      "PositionY": 720,
-      "SizeX": 100,
-      "SizeY": 100
+      "File": "CE_SerNr_SlotT1_MB27.xml",
+      "Image": "Positionierbild_MB27.jpg",
+      "PositionX": 1000,
+      "PositionY": 725,
+      "SizeX": 150,
+      "SizeY": 50
     },
     {
       "Label": "SKA-SKI",
-      "File": "CE_SerNr_SlotT1_SKA-SKI",
-      "Image": "Positionierbild_SKA-SKI_MB22.jpg",
+      "File": "CE_SerNr_SlotT1_SKA-SKI.xml",
+      "Image": "Positionierbild_SKA-SKI.jpg",
       "PositionX": 1400,
-      "PositionY": 500,
+      "PositionY": 600,
       "SizeX": 150,
       "SizeY": 150
     },
     {
       "Label": "A0",
-      "File": "CE_SerNr_SlotT1_A0",
-      "Image": "Positionierbild_A0_AZ29_AZ37_AZ38.jpg",
+      "File": "CE_SerNr_SlotT1_A0.xml",
+      "Image": "Positionierbild_A0.jpg",
       "PositionX": 200,
       "PositionY": 850,
       "SizeX": 75,
       "SizeY": 75
     },
     {
-      "Label": "AZ29",
-      "File": "CE_SerNr_SlotT1_AZ29",
-      "Image": "Positionierbild_A0_AZ29_AZ37_AZ38.jpg",
+      "Label": "AZ25",
+      "File": "CE_SerNr_SlotT1_AZ25-FP.xml",
+      "Image": "Positionierbild_AZ25-FP.jpg",
       "PositionX": 350,
       "PositionY": 850,
       "SizeX": 75,
       "SizeY": 75
     },
     {
-      "Label": "AZ37",
-      "File": "CE_SerNr_SlotT1_AZ37",
-      "Image": "Positionierbild_A0_AZ29_AZ37_AZ38.jpg",
+      "Label": "AZ29",
+      "File": "CE_SerNr_SlotT1_AZ29.xml",
+      "Image": "Positionierbild_AZ29.jpg",
       "PositionX": 500,
       "PositionY": 850,
       "SizeX": 75,
       "SizeY": 75
     },
     {
-      "Label": "AZ38",
-      "File": "CE_SerNr_SlotT1_AZ38",
-      "Image": "Positionierbild_A0_AZ29_AZ37_AZ38.jpg",
+      "Label": "AZ37",
+      "File": "CE_SerNr_SlotT1_AZ37.xml",
+      "Image": "Positionierbild_AZ37.jpg",
       "PositionX": 650,
       "PositionY": 850,
       "SizeX": 75,
       "SizeY": 75
+    },
+    {
+      "Label": "AZ38",
+      "File": "CE_SerNr_SlotT1_AZ38.xml",
+      "Image": "Positionierbild_AZ38.jpg",
+      "PositionX": 800,
+      "PositionY": 850,
+      "SizeX": 75,
+      "SizeY": 75
+    },
+    {
+      "Label": "Empty",
+      "File": "CE_empty.xml",
+      "Image": "",
+      "PositionX": 1600,
+      "PositionY": 850,
+      "SizeX": 125,
+      "SizeY": 75
     }
   ]
 }

+ 5 - 2
server/json/ProductCode.json

@@ -25,7 +25,8 @@
       "types": [
         "",
         "*",
-        "PZ"
+        "PZ",
+        "HA"
       ]
     },
     {
@@ -39,7 +40,9 @@
         "HZ-S",
         "RHZ-S",
         "DZ-S",
-        "RDZ-S"
+        "RDZ-S",
+        "HM24-S",
+        "SKA"
       ]
     },
     {

+ 1 - 0
server/was.conf

@@ -2,4 +2,5 @@
 :appconf:
   wizurl: https://centurio.evva.com/wiz/wiztest/
   wasurl: https://centurio.evva.com/departments/emontage/WAS/
+  universalstorageeinzelbilder: ../../universal-storage/storage/Stationsbilder/Einzelbilder/
   stations: [ 1, 2, 3, 8, 99]

+ 169 - 0
server/was.rb

@@ -782,6 +782,9 @@ class GetAssignments < Riddl::Implementation
   end
 end
 
+
+
+
 class SaveNewAssignment < Riddl::Implementation
   def response
     form = JSON.parse(@p[0].value.read);
@@ -794,11 +797,64 @@ class SaveNewAssignment < Riddl::Implementation
      
     #bring given pattern into correct string (initially pattern could be in different order than required)
     pattern = [];
+    patternsymlink = [];
     fullcode = JSON.parse( File.read(File.join(File.dirname(__dir__),"server/json/ProductCode.json")))
     fullcode["pattern"].each do |child|
       pattern.push(form["parts"][child["abk"]])
+      patternsymlink.push(child["abk"])
     end
     
+    
+    
+    #Create Assignments Symlink
+    #Station3_Ba;DZ-S_Of;MP_ID;12.jpg
+    
+    #img url
+    #form["img"]
+   
+    
+    #img name
+    #pp form
+    #pp pattern
+    #pp patternsymlink
+    
+    link = "Station" + form["station"]
+    pattern.each_with_index {|val, index|
+      if(val != "")
+        link = link + "_" + patternsymlink[index].to_s + ";" + val.to_s
+      end
+    }
+    
+    if(form["assignmentText"] != "")
+      link = link + "_ID;" + form["assignmentText"].to_s
+    end
+    link = link + ".jpg"
+    
+    #pp link
+    #pp @a[0][:appconf]["universalstorageeinzelbilder"]
+    #File.write(File.join(@a[0][:appconf]["universalstorageeinzelbilder"]),File.open("defaultContent/js/ui.js").read)
+    
+    #File.symlink  File.join("test.jpg"), File.join(@a[0][:appconf]["universalstorageeinzelbilder"])
+
+    imgfile = File.join(form["img"])
+    symfile = File.join(@a[0][:appconf]["universalstorageeinzelbilder"], "Symlinks", link)
+
+    #pp imgfile;
+    #pp symfile;
+    if File.file?(imgfile) #file exists
+      if !File.file?(symfile) #symlink should not exist
+        nw = "" + form["img"]
+        nw.slice! @a[0][:appconf]["universalstorageeinzelbilder"].to_s
+        File.symlink  "../" + nw, symfile
+      end
+    end
+    
+    
+    
+    
+    
+    #Create Assignemtns DB
+    
 
     checkimage = $db.execute "SELECT * FROM assignments WHERE image = '#{form["img"]}'"
     #if image not stored create new assignment with pattern, otherwise only add pattern
@@ -842,6 +898,116 @@ class SaveNewAssignment < Riddl::Implementation
 end
 
 
+class CreateSymlinks < Riddl::Implementation
+  def response
+    pp "Creating Symlinks"
+    
+    
+    #GETTING ALL Assignments
+    
+    ret = {}
+    ret2 = {}
+    resultstation = $db.execute "SELECT * FROM assignments"
+    resultstation.each do |row|
+      #row[0] pattern ID
+      #row[1] pattern image
+      
+      #if limiting to a specific assignment ID
+      #if row[0] != 627  #164 = battery
+      #  next
+      #end
+      
+      
+      #Getting Assignments for ID:
+      
+      ret2 = {}
+      allAssIds = $db.execute "SELECT DISTINCT AssID FROM patternassignments WHERE ID = #{row[0]}"
+      
+      allAssIds.each do |row2|
+        station = $db.execute "SELECT value FROM patternassignments WHERE ID = #{row[0]} AND AssID = #{row2[0]} AND type == 'STATION'"
+        stationvalue = Integer(station[0][0])
+        singleItem = $db.execute "SELECT type, value FROM patternassignments WHERE ID = #{row[0]} AND AssID = #{row2[0]} AND type != 'STATION'"
+        
+        if(ret2[stationvalue] == nil)
+          ret2[stationvalue] = Hash.new()
+        end
+        ret2[stationvalue][row2[0]] = Hash.new()
+        
+        singleItem.each do |it|
+          ret2[stationvalue][row2[0]][it[0]] = it[1]
+        end
+        
+        
+        link = "Station" + stationvalue.to_s
+        ret2[stationvalue][row2[0]].each do |key, value|
+          if(value != "")
+            if(key != "TEXT")
+              link = link + "_" + key.to_s + ";" + value.to_s
+            else
+              link = link + "_" + "ID" + ";" + value.to_s
+            end
+          end
+        end
+        
+        link = link + ".jpg"
+                   
+                   
+        #pp link
+        imgfile = File.join(row[1])
+        
+        
+        symfile = File.join(@a[0][:appconf]["universalstorageeinzelbilder"], "Symlinks", link)
+        
+        #pp "imgfile " + imgfile
+        #pp "symfile " + symfile
+            
+            
+        
+        #Create Symlinks for each Assignment
+        if File.file?(imgfile) #file exists
+          #pp "File exists"
+          if !File.symlink?(symfile) #symlink should not exist
+            pp "Creating Symlink"
+            nw = "" + row[1]
+            nw.slice! @a[0][:appconf]["universalstorageeinzelbilder"].to_s
+            
+            #pp "../" + nw
+            #pp symfile   
+
+            #pp "actual link creation";            
+            # nw = actual image, symfile = symlink location
+            File.symlink  "../" + nw, symfile
+          else  
+            #pp "Symlink exists"
+          end
+        end
+      end
+      
+      
+      
+      
+      
+      
+      
+    end
+    #Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(ret2))
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  end
+end
 
 class GetAssignment < Riddl::Implementation
   def response
@@ -1147,6 +1313,9 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
       on resource 'searchMultiple' do
         run ListAssignmentSearchMultiple, opts if post
       end
+      on resource 'createSymlinks' do
+        run CreateSymlinks, opts if get
+      end
       on resource '\d+' do
         run GetAssignment if get
         run RenameAssignmentImagePath if put 'list'

+ 3 - 0
server/was.xml

@@ -169,6 +169,9 @@
       <resource relative="searchMultiple">
         <post out="list"/>
       </resource>
+      <resource relative="createSymlinks">
+        <get/>
+      </resource>
       <resource relative="\d+">
         <get out="list"/>
         <put in="list"/>

BIN
ui/LaserUI/css/.evva.css.swp


+ 18 - 0
ui/ProvideLaserJson.php

@@ -0,0 +1,18 @@
+<?php
+  ini_set('display_errors', 1);
+  ini_set('display_startup_errors', 1);
+  error_reporting(E_ALL);
+   header("Access-Control-Allow-Origin: *");
+
+
+  header('Content-Type: application/json');
+  
+  
+  
+  $url = realpath("./../server/json/LaserUI.json");
+  $json = file_get_contents($url);
+  //$json = json_decode($json);
+  
+    echo $json;
+  
+?>

+ 28 - 5
ui/TransformProductCode.php

@@ -18,7 +18,7 @@
     return;
   }
   if(isset($_GET["Semantic"])){
-    $fixwerte = 6;
+    $fixwerte = 5;
     for($i = 0; $i < $fixwerte; ++$i){
       if(isset($productarray[$i])){
         $asocarray[$json->pattern[$i]->abk] = $productarray[$i];
@@ -75,7 +75,9 @@
   if(!array_key_exists("Zi", $asocarray)){
     $asocarray["Zi"] = "KeineAngabeZi";
   }
-  
+  if(!array_key_exists("Sn", $asocarray)){
+    $asocarray["Sn"] = "";
+  }
   if($asocarray["Pf"] == ""){
     $asocarray["Pf"] = "KeineAngabePf";
   }
@@ -85,13 +87,32 @@
   if($asocarray["Kf"] == ""){
     $asocarray["Kf"] = "KeineAngabeKf";
   }
-  if($asocarray["Zi"] != ""){ //Replace zylinder innen K with nothing    
+  if($asocarray["Zi"] != "" && $asocarray["Zi"] != "KeineAngabeZi"){ //Replace zylinder innen K with nothing (K31, K36 -> 31 oder 36)
     $asocarray["Zi"] = str_replace("K", "", $asocarray["Zi"]);
   }
   if($asocarray["Zi"] == ""){
     $asocarray["Zi"] = "KeineAngabeZi";
   }
   
+  /*
+  
+  //J.C: Knaufform (Kf): Wenn keine Angabe dazu, und es ist entweder ein KZ-S oder ein RKZ-S, dann ist die Knaufform ein „X1K“
+  if($asocarray["Kf"] == "KeineAngabeKf" && ($asocarray["Ba"] == "KZ-S" || $asocarray["Ba"] == "RKZ-S")){
+    $asocarray["Kf"] = "X1K";
+  }
+  
+  /*
+  
+  */
+  
+  //J.C: Schließnase (Sn): Wenn keine Angabe zur Schließnase, aber es sich um KZ-S, RKZ-S, HZ-S, RHZ-S, DZ-S, RDZ-S handelt, dann ist die Schließnase ein „SEP“
+  /*
+  if($asocarray["Sn"] == "" && ($asocarray["Ba"] == "KZ-S" || $asocarray["Ba"] == "RKZ-S" || $asocarray["Ba"] == "HZ-S" || $asocarray["Ba"] == "RHZ-S" || $asocarray["Ba"] == "DZ-S" || $asocarray["Ba"] == "RDZ-S")){
+    $asocarray["Sn"] = "SEP";
+  }
+  */
+
+  
   
   //reorder 4 same ordering
   foreach($json->pattern as $node){
@@ -103,6 +124,8 @@
       
     }
   }
-  
-  echo json_encode($asocarray2);
+  //für externe aufrufe zb. TransformProductCode2LaserFile damit der code nicht ausgegeben wird
+  if(!isset($noecho)){
+    echo json_encode($asocarray2);
+  }
 ?>

+ 39 - 6
ui/TransformProductCode2LaserFile.php

@@ -3,19 +3,52 @@
   ini_set('display_startup_errors', 1);
   error_reporting(E_ALL);
   
-  //header('Content-Type: application/json');
-  header("Content-Type: text/plain");
+  header('Content-Type: application/json');
 
+  if(isset($_GET["ProductCodeJson"])){
+    $productcode = json_decode($_GET["ProductCodeJson"]);
+  }
+  elseif (isset($_GET["ProductCode"])){
+    $noecho=true;
+    include "TransformProductCode.php"; //if in the same folder
+    $productcode = json_decode(json_encode($asocarray2));
+  }
   
-  $productcode = json_decode($_GET["ProductCode"]);
+  //{"Pb":"E","Sy":"A","Pk":"PZ","Ba":"KZ-S","Za":"31","Zi":"31","Of":"NI","Kf":"X1K","Pf":"KeineAngabePf","Va":"KeineAngabeVa","Sn":"SEP","Zs":"SET1"}
   
   if ($productcode->Ba == "RKZ-S" || $productcode->Ba == "RHZ-S" || $productcode->Ba == "RDZ-S"){
-    echo "CE_SerNr_SlotT1_RP." . $productcode->Za . ".rotiert.xml";
+    $file ="CE_SerNr_SlotT1_RP." . $productcode->Za . ".rotiert.xml";
   }
   elseif  (($productcode->Ba == "KZ-S" || $productcode->Ba == "HZ-S" || $productcode->Ba == "DZ-S") && $productcode->Pf == "FLU"){
-    echo "CE_SerNr_FLU_SlotT1_EP." . $productcode->Za . ".rotiert.xml";
+    $file = "CE_SerNr_FLU_SlotT1_EP." . $productcode->Za . ".rotiert.xml";
   }
   elseif  ($productcode->Ba == "KZ-S" || $productcode->Ba == "HZ-S" || $productcode->Ba == "DZ-S"){
-    echo "CE_SerNr_SlotT1_EP." . $productcode->Za . ".rotiert.xml";
+    $file = "CE_SerNr_SlotT1_EP." . $productcode->Za . ".rotiert.xml";
+  }
+  elseif  ($productcode->Pk == "HA" && $productcode->Ba == "HM24-S" ){
+    $file = "CE_SerNr_SlotT1_HPM.xml";
+  }
+  elseif  ($productcode->Pk == "AI" && $productcode->Ba == "AZ25-FP" ){
+    $file = "CE_SerNr_SlotT1_AZ25-FP.rotiert.xml";
+  }
+  elseif  ($productcode->Pk == "SKI" || $productcode->Pk == "SKA" ){
+    $file = "CE_SerNr_SlotT1_SKA-SKI.xml";
   }
+  elseif  ($productcode->Ba == "SKI" || $productcode->Ba == "SKA" ){
+    $file = "CE_SerNr_SlotT1_SKA-SKI.xml";
+  }
+  elseif  ($productcode->Pk == "HB" ){
+    $file = "CE_SerNr_SlotT1_" . $productcode->Ba . ".xml";
+  }
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  echo json_encode($file);
+  
 ?>

+ 1 - 1
ui/WaNrCheck/CreateImageAll.php

@@ -27,7 +27,7 @@ if(isset($_GET['Posi']) && !empty($_GET['Posi'])){
   imagettftext($im, 50, 0, 200, 650, $grey, $font, "Posi:   " . $posi);
 }
 if(isset($_GET['Produktcode']) && !empty($_GET['Produktcode'])){
-  imagettftext($im, 50, 0, 200, 750, $grey, $font, "Produktcode:   " . $prcode);
+  imagettftext($im, 50, 0, 200, 750, $grey, $font, "Produktcode:   " . urldecode($prcode));
 }
 if(isset($_GET['ScanInnen']) && !empty($_GET['ScanInnen'])){ 
   imagettftext($im, 50, 0, 200, 850, $grey, $font, "Scan Innen:   " . $scan1);

+ 16 - 1
ui/imageReplacement.php

@@ -140,12 +140,26 @@
       }
     }
     $fullfilename = substr($fullfilename, 1); 
-    $fullfilename2 = substr($fullfilename, 1); 
+    $fullfilename2 = $fullfilename; 
     $fullfilename = $universalStorageEinzelbilder . "Station" . $curstation . "/Station". $curstation.     "_" . $fullfilename . ".jpg";
     
     
     
     $url = realpath("./../../universal-storage/storage/Stationsbilder/Einzelbilder/" . "Station" . $curstation . "/Station". $curstation.     "_" . $fullfilename2 . ".jpg");
+    //if url does not exist check if symlink exists
+    
+    
+    if(!$url) {
+      $fullurl2 = "./../../universal-storage/storage/Stationsbilder/Einzelbilder/Symlinks/Station". $curstation.     "_" . $fullfilename2 . ".jpg";
+      $url = realpath($fullurl2);
+      //echo "URL: " . $fullurl2;
+      
+      
+      
+      $fullfilename = $universalStorageEinzelbilder . "Symlinks/Station". $curstation.     "_" . $fullfilename2 . ".jpg";
+    }
+    
+    
     
     //echo "URL: " . $url . " filename" . $fullfilename . "<br>";
     
@@ -154,6 +168,7 @@
     //if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
     if(!$url) {
       //echo $fullfilename;
+      //echo " Does not Exist <br>";
       //echo $key . " ";
       //echo json_encode($asocarray);
       

+ 1 - 2
ui/index.html

@@ -141,7 +141,7 @@
             <div class="wasGroup">
               <div class="wasLeft">Preview</div>
               <div class="wasRight">
-                <a href="https://centurio.evva.com/out/frames/WAS_Test/">WIZ-Preview</a>
+                <a href="https://centurio.evva.com/out/frames-emontage/WAS_Test/">WIZ-Preview</a>
               </div>
             </div>
             
@@ -618,7 +618,6 @@
       
       </div>
       
-      
       <h1>Create Productcode String</h1>
       <form id="createProductcodeString"  onsubmit="createProductcodeString()">
         <div id="FormPattern3">