Files
storage_fresco/initdata/storagephysics.py
2019-05-23 13:36:01 +00:00

92 lines
3.4 KiB
Python
Executable File

#!/usr/bin/python
"""
Generate Physics Databasecontent
"""
import sys
if __name__ == '__main__':
storages = ['T001', 'T002', 'S001']
rfzs = 2
xSt = [18, 18, 39]
ySt = [7, 7, 8]
#Number of zones, followed by list with Zonestart X-Values
zones = [1, 1, 1, 1, 1]
zonestart = [[1], [1], [1], [1], [1]]
#Midvalue - where to start inserting Boxes (liste for each storage, with Tuple for each zone)
midSt = [[(18, 9), (12, 1)],\
[(16, 9)],\
[(16, 9)],\
[(16, 9)],\
[(1, 1)]]
#Z-value for Throughfeed shelfes
zTr = {'T001' : 7, \
'T002' : 7}
#Decide if a Throughfeed Storage is managed by a Slotbase
TrManaged = ['T002']
#Z-value dict for Commisioning shelfes
zCo = {'C001' : [1, 1, 1, 1, 1]}
#BoxnrCircles for IPoints
Nrs = {'I001': 1000100,\
'I002': 2000100}
idx = 0
print ("-- Storages configured")
print ("DELETE FROM Physics;")
print ("-- RFZs configured")
print ("INSERT INTO Physics VALUES ('RFZs', '%d');" % rfzs)
print ("INSERT INTO Physics VALUES ('Storages', '%d');" %len (storages))
for storage in storages:
print ("INSERT INTO Physics VALUES ('Storage%d', '%s');" %(idx, storage))
print ("INSERT INTO Physics VALUES ('X_%s','%d');" %(storage, xSt[idx]))
print ("INSERT INTO Physics VALUES ('Y_%s','%d');" %(storage, ySt[idx]))
#FixMe
if storage[0] in ['S', 'T']:
print ("INSERT INTO Physics VALUES ('ZONES_%s','%d');" %(storage, zones[idx]))
for i in range (1, zones[idx] + 1):
print ("INSERT INTO Physics VALUES ('ZONESTART_%s_%d','%d');" %(storage, i, zonestart[idx][i - 1]))
print ("INSERT INTO Physics VALUES ('XMid_%s_%d','%d');" %(storage, i, midSt[idx][i - 1][0]))
print ("INSERT INTO Physics VALUES ('YMid_%s_%d','%d');" %(storage, i, midSt[idx][i - 1][1]))
if storage[0] == 'S':
print ("-- Singleplace shelf configured")
print ("INSERT INTO Physics VALUES ('Z_%s','1');" %(storage))
elif storage[0] == 'T':
print ("-- Throughfeed shelf configured")
print ("INSERT INTO Physics VALUES ('Z_%s','%d');" %(storage, zTr[storage]))
elif storage[0] == 'C':
print ("-- Commisioning shelf configured")
for x in range (1 , xSt[idx] + 1):
for y in range (1, ySt[idx] + 1):
print ("INSERT INTO Physics VALUES ('Z_%s_%d_%d','%d');" %(storage, x, y, zCo[storage][y - 1]))
else:
print ("Invalid Storage")
sys.exit (0)
idx += 1
idx = 0
#slotbase for Commisioning shelfes
print ("-- Slotbase --")
print ("DELETE FROM Slotbase;")
for storage in storages:
if storage[0] == 'C':
print ("-- Build Slotbase for Commisioning storage %s --" % storage)
for x in range (1, xSt[idx] + 1):
for y in range (1, ySt[idx] + 1):
print ("INSERT INTO Slotbase (id, x, y) VALUES ('%s', %d, %d);" %(storage, x, y))
elif storage[0] == 'T' and storage in TrManaged:
print ("INSERT INTO Physics VALUES ('%s_Managed', 1);" %storage)
print ("-- Build Slotbase for managed Throughfeed Storage %s --" % storage)
for x in range (1, xSt[idx] + 1):
for y in range (1, ySt[idx] + 1):
print ("INSERT INTO Slotbase (id, x, y, article) VALUES ('%s', %d, %d, 'dynamic');" %(storage, x, y))
idx += 1
print ("-- BoxNrStart for I-Point")
for ipoint in Nrs:
print ("INSERT INTO Physics VALUES ('BoxNr_%s', '%d');" %(ipoint, Nrs[ipoint]))