-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVMS.py
112 lines (93 loc) · 3.75 KB
/
VMS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! /usr/bin/python
# Repair log for VMS
# By Paul Hartman
# Copyright 2018
# use python 3
#### DO ONE THING BUT DO IT WELL! ####
# Import space
import os
# Def Space
def clear():
if (os.name == 'nt'):
c = os.system('cls')
else:
c = os.system('clear')
del c
def getdatetime(timedateformat='complete'):
from datetime import datetime
timedateformat = timedateformat.lower()
if timedateformat == 'day':
return ((str(datetime.now())).split(' ')[0]).split('-')[2]
elif timedateformat == 'month':
return ((str(datetime.now())).split(' ')[0]).split('-')[1]
elif timedateformat == 'year':
return ((str(datetime.now())).split(' ')[0]).split('-')[0]
elif timedateformat == 'hour':
return (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[0]
elif timedateformat == 'minute':
return (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[1]
elif timedateformat == 'second':
return (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[2]
elif timedateformat == 'millisecond':
return (str(datetime.now())).split('.')[1]
elif timedateformat == 'yearmonthday':
return (str(datetime.now())).split(' ')[0]
elif timedateformat == 'daymonthyear':
return ((str(datetime.now())).split(' ')[0]).split('-')[2] + '-' + ((str(datetime.now())).split(' ')[0]).split('-')[1] + '-' + ((str(datetime.now())).split(' ')[0]).split('-')[0]
elif timedateformat == 'hourminutesecond':
return ((str(datetime.now())).split(' ')[1]).split('.')[0]
elif timedateformat == 'secondminutehour':
return (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[2] + ':' + (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[1] + ':' + (((str(datetime.now())).split(' ')[1]).split('.')[0]).split(':')[0]
elif timedateformat == 'complete':
return str(datetime.now())
elif timedateformat == 'datetime':
return (str(datetime.now())).split('.')[0]
elif timedateformat == 'timedate':
return ((str(datetime.now())).split('.')[0]).split(' ')[1] + ' ' + ((str(datetime.now())).split('.')[0]).split(' ')[0]
# Variable space
path_v = "~/VMS/vehicles/"
file_full = 'path_v' + 'VIN'
date = getdatetime('daymonthyear')
# What vehicle are we playing with today?
clear
VIN = input('What is the VIN Number. (Type "x" to exit')
VIN2 = input('Please confirm the VIN Number (Type "x" to exit')
if VIN2 == VIN:
break
else:
print ('The Vin Numbers do not match! please try again. Type "x" both times to exit program.')
# Escape sequence
if VIN == "x":
exit(
)
# Open that vehicle's file or create it if it doesn't exist
try:
with open(file_full) as file:
pass
except IOError as e:
print ("Unable to open the file on that vehicle. Have you created it yet?")
# NOTE: Build a program to create files on new Vehicles.
mileage = input("What is the mileage?")
print ("Please describle the problem?")
problem = input()
# Did we use any parts?
print ("Were any parts or supplies used? (Y/N)")
yn = input ()
a = s.lower(yn)
del yn
__ = a[0]
if __ = "y"
while __= "y"
make = input("What is the make of the part")
part = input("What is the part number?")
parts = [make + ',' + part]
for item in parts
partslist.append(item)
yn = input("Any more")
yn = input ()
a = s.lower(yn)
del yn
__ = a[0]
# Ok now it is time to write all this in a file
# want to write in csv format: date,mileage,problem,parts,parts,parts,etc
f.write(date + mileage + problem + partslist)