File inventory_synchronisation.py changed (mode: 100644) (index bb3cb81..28ffeb4) |
... |
... |
import re |
6 |
6 |
import chardet |
import chardet |
7 |
7 |
from packages.syncfile import importAmazonOrder, writeNewCsv |
from packages.syncfile import importAmazonOrder, writeNewCsv |
8 |
8 |
from packages.shipment_finish import finishShipment |
from packages.shipment_finish import finishShipment |
|
9 |
|
from packages.plenty_export import plentyExport |
9 |
10 |
#from packages.excelfile import createExcelSheet |
#from packages.excelfile import createExcelSheet |
10 |
11 |
|
|
11 |
12 |
def main(): |
def main(): |
|
... |
... |
def main(): |
123 |
124 |
|
|
124 |
125 |
task = '' |
task = '' |
125 |
126 |
|
|
126 |
|
while(not(task.lower() == 'ama' or task.lower() == 'fin' or task.lower() == 'fba')): |
|
127 |
|
task = input('Do you want to create a new FBA Shipment?(fba)\nDo you want to finish a shipment?(fin)\nOr do you want to import received items at Amazon (ama)?\n') |
|
128 |
|
if(not(task.lower() == 'ama' or task.lower() == 'fin' or task.lower() == 'fba')): |
|
129 |
|
print("Please enter either 'fba', 'fin' or 'ama'.\n") |
|
|
127 |
|
while(not(task.lower() == 'ama' or\ |
|
128 |
|
task.lower() == 'fin' or\ |
|
129 |
|
task.lower() == 'exp' or\ |
|
130 |
|
task.lower() == 'fba')): |
|
131 |
|
task = input('Do you want to create a new FBA Shipment?(fba)\nDo you want to finish a shipment?(fin)\nDo you want to export the plenty quantity to the storage report?(exp)\nOr do you want to import received items at Amazon (ama)?\n') |
|
132 |
|
if(not(task.lower() == 'ama' or task.lower() == 'fin' or task.lower() == 'exp' or task.lower() == 'fba')): |
|
133 |
|
print("Please enter either 'fba', 'fin', 'exp' or 'ama'.\n") |
130 |
134 |
|
|
131 |
135 |
# Set to 0000 because the current state of the script doesnt need the orderid anymore |
# Set to 0000 because the current state of the script doesnt need the orderid anymore |
132 |
136 |
order ='0000' |
order ='0000' |
|
... |
... |
def main(): |
207 |
211 |
orderid=order, plentyid=configid, stockreport=shipment_file |
orderid=order, plentyid=configid, stockreport=shipment_file |
208 |
212 |
) |
) |
209 |
213 |
|
|
|
214 |
|
print("\npress ENTER to continue...") |
|
215 |
|
input() |
|
216 |
|
|
|
217 |
|
# PLENTY EXPORT PART |
|
218 |
|
if(task.lower() == 'exp'): |
|
219 |
|
print("\n{0}\n".format(line)) |
|
220 |
|
print("Open the current plenty location export ID49\n") |
|
221 |
|
print("Use the options: positive physical quantity and FNSKU\n") |
|
222 |
|
print("\n{0}\n".format(altline)) |
|
223 |
|
print("Öffne den derzeitigen plenty Lagerplatz Export ID49\n") |
|
224 |
|
print("Nutze die Optionen: positiver physischer Lagerbestand und FNSKU\n") |
|
225 |
|
print("\n{0}\n".format(line)) |
|
226 |
|
|
|
227 |
|
locationexport={'filepath':'', |
|
228 |
|
'encoding':''} |
|
229 |
|
|
|
230 |
|
locationexport['filepath'] = askopenfilename(initialdir=reportpath, |
|
231 |
|
title="Storage quantity export Plentymarkets", |
|
232 |
|
filetypes=[ ("csv files", "*.csv") ]) |
|
233 |
|
|
|
234 |
|
# detect the encoding of the file |
|
235 |
|
with open(locationexport['filepath'], mode='rb') as item: |
|
236 |
|
raw_data = item.read() |
|
237 |
|
locationexport['encoding'] = chardet.detect(raw_data)['encoding'] |
|
238 |
|
|
|
239 |
|
plentyExport(plentyexport=locationexport,folder=uploadpath) |
|
240 |
|
|
|
241 |
|
print("\npress ENTER to continue...") |
|
242 |
|
input() |
|
243 |
|
|
|
244 |
|
|
210 |
245 |
if __name__ == '__main__': |
if __name__ == '__main__': |
211 |
246 |
main() |
main() |
File packages/picklist_creation.py changed (mode: 100644) (index 3a84ec5..19dd873) |
... |
... |
def picklist_creation(shipmentlist, folder, uploadfolder): |
19 |
19 |
location_file['encoding'] = chardet.detect(raw_data)['encoding'] |
location_file['encoding'] = chardet.detect(raw_data)['encoding'] |
20 |
20 |
|
|
21 |
21 |
# The headers of the outputfile |
# The headers of the outputfile |
22 |
|
column_names = ['Sku', 'location', 'Barcode', '@location', 'Shipment'] |
|
|
22 |
|
column_names = ['Sku', 'location', 'Barcode', '@location', 'Shipment', 'Versand', 'Kiste'] |
23 |
23 |
|
|
24 |
24 |
# Define the Dictionary for the datasets and the list for multiple locations |
# Define the Dictionary for the datasets and the list for multiple locations |
25 |
25 |
# on a single SKU |
# on a single SKU |
|
... |
... |
def picklist_creation(shipmentlist, folder, uploadfolder): |
71 |
71 |
Data[row['Name']+'+1']['Shipment'] = row['Menge'] |
Data[row['Name']+'+1']['Shipment'] = row['Menge'] |
72 |
72 |
|
|
73 |
73 |
syncfile.writeNewCsv(dataset=Data,path=uploadfolder, header=column_names,name='picklist') |
syncfile.writeNewCsv(dataset=Data,path=uploadfolder, header=column_names,name='picklist') |
|
74 |
|
|
|
75 |
|
print("press ENTER to continue...\n") |
|
76 |
|
input() |
File packages/plenty_export.py added (mode: 100644) (index 0000000..88471e0) |
|
1 |
|
import csv |
|
2 |
|
import sys |
|
3 |
|
from tkinter.filedialog import askopenfilename |
|
4 |
|
from packages import syncfile |
|
5 |
|
import datetime |
|
6 |
|
|
|
7 |
|
def plentyExport(plentyexport, folder): |
|
8 |
|
today = datetime.datetime.now() |
|
9 |
|
todaystr = today.strftime("%d-%m-%Y_%H-%M") |
|
10 |
|
|
|
11 |
|
Data = {} |
|
12 |
|
|
|
13 |
|
column_names = ["SKU", |
|
14 |
|
"FNSKU", |
|
15 |
|
"QUANTITY", |
|
16 |
|
"NUMBER_OF_PLACES", |
|
17 |
|
"QTY_PLACE_1", |
|
18 |
|
"QTY_PLACE_2", |
|
19 |
|
"QTY_PLACE_3", |
|
20 |
|
"QTY_PLACE_4", |
|
21 |
|
"QTY_PLACE_5"] |
|
22 |
|
|
|
23 |
|
with open(plentyexport['filepath'], mode = 'r', encoding=plentyexport['encoding']) as item: |
|
24 |
|
reader = csv.DictReader(item, delimiter = ";") |
|
25 |
|
|
|
26 |
|
for rownum, row in enumerate( reader ): |
|
27 |
|
if( not ( row['VariationNo'] in [ * Data ] ) ): |
|
28 |
|
stock = 0 |
|
29 |
|
try: |
|
30 |
|
row['Stock'] = int(float(str( row['Stock'] ).replace(",",".") )) |
|
31 |
|
stock = row['Stock'] |
|
32 |
|
except Exception as exc: |
|
33 |
|
print("ERROR @ numberformat change: {0}\n".format( exc )) |
|
34 |
|
print("press ENTER to continue...\n") |
|
35 |
|
input() |
|
36 |
|
sys.exit() |
|
37 |
|
try: |
|
38 |
|
values = [row[ "VariationNo" ], |
|
39 |
|
row[ "Barcode" ], |
|
40 |
|
stock, |
|
41 |
|
1, |
|
42 |
|
stock, |
|
43 |
|
0, |
|
44 |
|
0, |
|
45 |
|
0, |
|
46 |
|
0 |
|
47 |
|
] |
|
48 |
|
except KeyError: |
|
49 |
|
print("Expected column names: VariationNo, Barcode, Stock\n") |
|
50 |
|
print("Got: {0}".format(", ".join([*row]))) |
|
51 |
|
print("press ENTER to continue...\n") |
|
52 |
|
input() |
|
53 |
|
sys.exit() |
|
54 |
|
|
|
55 |
|
Data[row['VariationNo']] = dict(zip(column_names, values)) |
|
56 |
|
|
|
57 |
|
elif( row['VariationNo'] in [ * Data ]): |
|
58 |
|
if(Data[row['VariationNo']]['QUANTITY'] and row['Stock']): |
|
59 |
|
row['Stock'] = int(float(str( row['Stock'] ).replace(",",".") )) |
|
60 |
|
Data[row['VariationNo']]['NUMBER_OF_PLACES'] += 1 |
|
61 |
|
try: |
|
62 |
|
Data[row['VariationNo']]['QUANTITY'] = int( Data[row['VariationNo']]['QUANTITY'] ) + row['Stock'] |
|
63 |
|
Data[row['VariationNo']]['QTY_PLACE_' + str(Data[row['VariationNo']]['NUMBER_OF_PLACES'])] = row['Stock'] |
|
64 |
|
|
|
65 |
|
except Exception as exc: |
|
66 |
|
Data[row['VariationNo']]['QUANTITY'] = exc |
|
67 |
|
print("ERROR @ quantity assign: {0}\n".format(exc)) |
|
68 |
|
print("press ENTER to continue...\n") |
|
69 |
|
input() |
|
70 |
|
sys.exit() |
|
71 |
|
|
|
72 |
|
syncfile.writeNewCsv(dataset=Data,path=folder,header=column_names,name="export_" + todaystr) |
|
73 |
|
if __name__ == '__main__': |
|
74 |
|
main() |
File packages/shipment_finish.py changed (mode: 100644) (index 98276cb..9602318) |
... |
... |
import os |
7 |
7 |
import sys |
import sys |
8 |
8 |
import csv |
import csv |
9 |
9 |
import chardet |
import chardet |
|
10 |
|
from packages import plenty_export |
10 |
11 |
|
|
11 |
12 |
# Define and initialize the line seperators |
# Define and initialize the line seperators |
12 |
13 |
line = "#"*70 |
line = "#"*70 |
|
... |
... |
def reducePlentyMarketsQty(dataset, folder): |
251 |
252 |
|
|
252 |
253 |
#print("NEW: {0}\n".format( Data[data_row]['Stock'] )) |
#print("NEW: {0}\n".format( Data[data_row]['Stock'] )) |
253 |
254 |
|
|
|
255 |
|
print("{0}\n".format(line)) |
|
256 |
|
print("Create a list of the current plentymarkets location quantity\n") |
|
257 |
|
print("{0}\n".format(altline)) |
|
258 |
|
print("Erstelle eine Liste des derzeitigen Bestands der Plentymarkets Lagerplätze\n") |
|
259 |
|
plenty_export.plentyExport(plentyexport=locationlist, folder=folder.replace('Report','Upload')) |
|
260 |
|
print("{0}\n".format(line)) |
|
261 |
|
|
254 |
262 |
Data_and_fields = {'data':Data, 'fields':column_names} |
Data_and_fields = {'data':Data, 'fields':column_names} |
255 |
263 |
return Data_and_fields |
return Data_and_fields |
256 |
264 |
|
|