Minor Fixes
Added Header
This commit is contained in:
48
Taurus.py
48
Taurus.py
@@ -19,6 +19,17 @@ entities ['201861'] = [
|
||||
(9, 'MAN', '00201685', 'ADED-Nation.-Vers.', 'AN', 8, 0, '', 0)
|
||||
]
|
||||
|
||||
#CHHeaderDD type File date File time Sys status Sender Receiver System typeSoftw ver. DD version
|
||||
#DH201861000000000800020157508000201576060002015770100020168124000201682240005020121000020168408000201685080
|
||||
#VH201861DD 201705311140480DSP GmbH Aschara VC5 Herde++ 2.18STK 2.0
|
||||
|
||||
"""
|
||||
Entity 201862
|
||||
Zu-Abgang
|
||||
"""
|
||||
#NR, ART, ITEM, NAME, TYPE, LEN, RESOLUTION, UNIT, CODE
|
||||
entities ['201862'] = []
|
||||
|
||||
"""
|
||||
Entity 201863
|
||||
Tierdaten
|
||||
@@ -188,6 +199,12 @@ class TAURUS:
|
||||
if request:
|
||||
self.log ("Path %s" % path)
|
||||
file = open (path + self.writefilename, 'w')
|
||||
#Header
|
||||
wline = self.generated ('201861', entities ['201861'])
|
||||
file.write (wline + '\n')
|
||||
wline = self.createaheader (entities ['201861'])
|
||||
file.write (wline + '\n')
|
||||
|
||||
for reqentity, reqd in request:
|
||||
self.log ("Request %s ausfuehren" % reqentity)
|
||||
if reqentity == '201863':
|
||||
@@ -285,6 +302,34 @@ class TAURUS:
|
||||
return ds
|
||||
|
||||
|
||||
def createaheader (self, ddef):
|
||||
"""
|
||||
Header
|
||||
"""
|
||||
|
||||
data = {'00000000': 'DD'}
|
||||
data ['00201575'] = datetime.now().strftime ('%Y%m%d')
|
||||
data ['00201576'] = datetime.now().strftime ('%H%M%S')
|
||||
data ['00201577'] = 0
|
||||
data ['00201681'] = 'Siliconform'
|
||||
data ['00201682'] = 'Herde++'
|
||||
data ['00502012'] = 'pyLactor'
|
||||
data ['00201684'] = '1.00'
|
||||
data ['00201685'] = 'TK 2.0'
|
||||
ds = "VN201861"
|
||||
for nr, art, item, name, datatype, length, resolution, unit, code in ddef:
|
||||
if item in data:
|
||||
if datatype == 'AN':
|
||||
ds += str (data[item]).rjust (int (length))
|
||||
elif datatype == 'N':
|
||||
_v = "%d" % (int (data[item] * (10**int (resolution))))
|
||||
ds += _v.rjust (int (length))
|
||||
else:
|
||||
ds += '?' * length
|
||||
self.log (ds, 9)
|
||||
return ds
|
||||
|
||||
|
||||
def createmilkdataset (self, animalinfo, ddef, milkings):
|
||||
"""
|
||||
Creating entity for 880022
|
||||
@@ -336,11 +381,12 @@ class TAURUS:
|
||||
|
||||
if __name__ == "__main__":
|
||||
taurus = TAURUS (DB ('/opt/data/animaldb.sqlite', '/tmp/talog.sql', logtest, errlogtest), loglevel = 9, writefilename = 'rep.taur')
|
||||
print ("Orginal")
|
||||
taurus.parsefile ('sampledata/', 'Tau_ms.2')
|
||||
print ("UPDATE")
|
||||
taurus.parsefile ('sampledata/', 'Update.taur')
|
||||
print ("REQUEST")
|
||||
taurus.parsefile ('sampledata/', 'TAU_REQ_20180116.2')
|
||||
sys.exit (0)
|
||||
print ("MELKverbot")
|
||||
taurus.parsefile ('sampledata/', 'Melkverbot.taur')
|
||||
print ("REQUEST")
|
||||
|
||||
Reference in New Issue
Block a user