List of commits:
Subject Hash Author Date (UTC)
Added a encoding sniffing to open the files in right encoding on Windows OS machines d0dbe5da1ca5810bfcc240a1e635ce053168b423 Sebastian 2019-05-06 14:54:04
Small usability improvements for the user to detect errors on different OS 2ec13ba3c85207c799eed1cf48ab1230d245a05f Sebastian 2019-05-06 08:25:54
Combined with the picklist creation project 4e5023c3c2bebc53794fe29edbcf9a7be93c826a Sebastian 2019-05-03 11:40:35
Created a building script for Linux based systems and made it possible to use the script from anywhere inside the filesystem e97b391d7b1cda885c99b6b483d414c75b288b75 Sebastian 2019-04-15 15:00:47
Added a working Linux executable Version, together with a different workspace creation process c84d49cf0f99fd3dcb7faabe82c125c8adc970cb Sebastian 2019-04-12 16:53:29
removed unnecessary files from the report and upload folder 94af82cbd9fd7f592fb6b421986c3d900f1bf532 Sebastian 2019-04-05 12:51:43
Added 2 options: a new order import to plenty and a fba shipment creation db5b9c168dabe3d6524b5674dd977044be286e0a Sebastian 2019-04-05 12:48:53
adjusted to another sync format and added a new export format that includes the sale price d33a1909c4f1ff88569509ad4510a5419e323136 Basti 2019-03-22 10:27:22
first Version of the Sync Upload de9ea87dff9ced84f635dd05d5ae039be870ae8a Basti 2019-03-19 16:32:44
First commit including Readme and folder structure 7e77aa7abd6013ce56d6878c7004973e32011a13 Basti 2019-03-19 10:44:36
Commit d0dbe5da1ca5810bfcc240a1e635ce053168b423 - Added a encoding sniffing to open the files in right encoding on Windows OS machines
Author: Sebastian
Author date (UTC): 2019-05-06 14:54
Committer name: Sebastian
Committer date (UTC): 2019-05-06 14:54
Parent(s): 2ec13ba3c85207c799eed1cf48ab1230d245a05f
Signing key:
Tree: 85703e0964f1a8710fde7a06ed97bfdb23a68eaf
File Lines added Lines deleted
inventory_synchronisation.py 35 12
packages/__pycache__/picklist_creation.cpython-37.pyc 0 0
packages/__pycache__/syncfile.cpython-37.pyc 0 0
packages/picklist_creation.py 10 2
packages/syncfile.py 8 10
File inventory_synchronisation.py changed (mode: 100644) (index ab66838..f1c7df8)
... ... from tkinter.filedialog import askopenfilename, askdirectory
3 3 import sys import sys
4 4 import os import os
5 5 import re import re
6 import chardet
6 7 from packages.syncfile import importAmazonOrder, importNewOrder from packages.syncfile import importAmazonOrder, importNewOrder
7 8 #from packages.excelfile import createExcelSheet #from packages.excelfile import createExcelSheet
8 9
 
... ... def main():
16 17
17 18 use_current_dir = 'x' use_current_dir = 'x'
18 19 newpath = '' newpath = ''
20 export_file = {"filepath":"",
21 "encoding":""}
22 shipment_file = {"filepath":"",
23 "encoding":""}
19 24 # Check if there is already a Report folder for the Amazon report files, if not create a new one. # Check if there is already a Report folder for the Amazon report files, if not create a new one.
20 25 reportpath = os.getcwd() + '/Report' reportpath = os.getcwd() + '/Report'
21 26 if not os.path.exists(reportpath): if not os.path.exists(reportpath):
 
... ... def main():
108 113
109 114 # Ask the user if the task is to import received items at amazon or to # Ask the user if the task is to import received items at amazon or to
110 115 # create a new order for production # create a new order for production
111 line = chr(171) * 70
112 altline = chr(187) * 70
116 line = "#" * 70
117 altline = "|" * 70
113 118 print("{0}\n".format(line)) print("{0}\n".format(line))
114 print(" "+chr(420)+"reparation for the Script / Vorbereitung für den Script\n")
119 print(" Preparation for the Script / Vorbereitung für den Script\n")
115 120 print("{0}\n".format(line)) print("{0}\n".format(line))
116 121 print(" Get a export of all variations from plentymarkets\n & save it in Report\n") print(" Get a export of all variations from plentymarkets\n & save it in Report\n")
117 122 print(" Lade einen Export von allen Varianten in Plentymarkets\n & speichere diesen in Report\n") print(" Lade einen Export von allen Varianten in Plentymarkets\n & speichere diesen in Report\n")
 
... ... def main():
138 143 root.withdraw() root.withdraw()
139 144 print("\n{0}\n".format(line)) print("\n{0}\n".format(line))
140 145 print("Open the export file of all items, to get the Variation ID which is needed for the Upload.\n") print("Open the export file of all items, to get the Variation ID which is needed for the Upload.\n")
141 export = askopenfilename(initialdir=reportpath
146 export_file['filepath'] = askopenfilename(initialdir=reportpath
142 147 , title="Export from Plentymarkets" , title="Export from Plentymarkets"
143 148 , filetypes=[ ("csv files" ,"*.csv" ) ] ) , filetypes=[ ("csv files" ,"*.csv" ) ] )
149 # detect the encoding of the file
150 with open(export_file['filepath'], mode='rb') as item:
151 raw_data = item.read()
152 export_file['encoding'] = chardet.detect(raw_data)['encoding']
144 153
145 154 # AMAZON RECEIVED PART # AMAZON RECEIVED PART
146 155 if(task.lower() == 'amazon'): if(task.lower() == 'amazon'):
147 156 print("Open the report file of the recent delivered FBA packages,\nthis will contain the amount of items that amazon received.\n") print("Open the report file of the recent delivered FBA packages,\nthis will contain the amount of items that amazon received.\n")
148 157 print("\n{0}\n".format(line)) print("\n{0}\n".format(line))
149 report = askopenfilename(initialdir=reportpath
158 shipment_file['filepath'] = askopenfilename(initialdir=reportpath
150 159 , title="FBA-Report" , title="FBA-Report"
151 160 , filetypes=[ ("csv files" ,"*.csv" ) ] ) , filetypes=[ ("csv files" ,"*.csv" ) ] )
161 # detect the encoding of the file
162 with open(shipment_file['filepath'], mode='rb') as item:
163 raw_data = item.read()
164 shipment_file['encoding'] = chardet.detect(raw_data)['encoding']
152 165
153 166 try: try:
154 importAmazonOrder(export=export, folder=uploadpath, orderid=order,
155 plentyid=configid, report=report
167 importAmazonOrder(export=export_file, folder=uploadpath, orderid=order,
168 plentyid=configid, report=shipment_file
156 169 ) )
157 170 except Exception as Err: except Exception as Err:
158 171 print("Something went terribly wrong...") print("Something went terribly wrong...")
 
... ... def main():
162 175 if(task.lower() == 'order'): if(task.lower() == 'order'):
163 176 print("Open the Excel list of items to be ordered.\n") print("Open the Excel list of items to be ordered.\n")
164 177 print("\n{0}\n".format(line)) print("\n{0}\n".format(line))
165 neworder = askopenfilename(initialdir=reportpath
178 shipment_file['filepath'] = askopenfilename(initialdir=reportpath
166 179 , title="Order list for production" , title="Order list for production"
167 180 , filetypes=[ ("csv files" ,"*.csv" ) ] ) , filetypes=[ ("csv files" ,"*.csv" ) ] )
181 # detect the encoding of the file
182 with open(shipment_file['filepath'], mode='rb') as item:
183 raw_data = item.read()
184 shipment_file['encoding'] = chardet.detect(raw_data)['encoding']
168 185
169 186 try: try:
170 order = importNewOrder(export=export, folder=uploadpath, orderlist=neworder,
187 order = importNewOrder(export=export_file, folder=uploadpath, orderlist=shipment_file,
171 188 orderid=order, producerlist=producer, orderid=order, producerlist=producer,
172 189 plentyid=configid) plentyid=configid)
173 190 except Exception as Err: except Exception as Err:
 
... ... def main():
178 195 if(task.lower() == 'fba'): if(task.lower() == 'fba'):
179 196 print("Open the stock report with the calculated shipment.\n") print("Open the stock report with the calculated shipment.\n")
180 197 print("\n{0}\n".format(line)) print("\n{0}\n".format(line))
181 newshipment = askopenfilename(initialdir=reportpath,
198 shipment_file['filepath'] = askopenfilename(initialdir=reportpath,
182 199 title="Latest stock report from Amazon", title="Latest stock report from Amazon",
183 200 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
184 importAmazonOrder(export=export, reportfolder=reportpath, folder=uploadpath,
185 orderid=order, plentyid=configid, stockreport=newshipment
201
202 # detect the encoding of the file
203 with open(shipment_file['filepath'], mode='rb') as item:
204 raw_data = item.read()
205 shipment_file['encoding'] = chardet.detect(raw_data)['encoding']
206
207 importAmazonOrder(export=export_file, reportfolder=reportpath, folder=uploadpath,
208 orderid=order, plentyid=configid, stockreport=shipment_file
186 209 ) )
187 210 #try: #try:
188 211 #print("here will be the function for the ExcelSheet") #print("here will be the function for the ExcelSheet")
File packages/__pycache__/picklist_creation.cpython-37.pyc changed (mode: 100644) (index 9ba7187..2a63a0d)
File packages/__pycache__/syncfile.cpython-37.pyc changed (mode: 100644) (index a36c165..10ed670)
File packages/picklist_creation.py changed (mode: 100644) (index 5e48b4c..3a84ec5)
1 1 from tkinter import Tk from tkinter import Tk
2 2 import csv import csv
3 import chardet
3 4 from tkinter.filedialog import askopenfilename from tkinter.filedialog import askopenfilename
4 5 from packages import syncfile from packages import syncfile
5 6
6 7 def picklist_creation(shipmentlist, folder, uploadfolder): def picklist_creation(shipmentlist, folder, uploadfolder):
7 8
9 location_file = {"filepath": "",
10 "encoding": ""}
8 11 # Get the path of the locationlist # Get the path of the locationlist
9 locationlist = askopenfilename(initialdir=folder,
12 location_file['filepath'] = askopenfilename(initialdir=folder,
10 13 title="Locationlist", title="Locationlist",
11 14 filetypes=[ ("csv files", "*.csv") ]) filetypes=[ ("csv files", "*.csv") ])
12 15
16 # check the encoding of the file
17 with open(location_file['filepath'], mode = 'rb') as item:
18 raw_data = item.read()
19 location_file['encoding'] = chardet.detect(raw_data)['encoding']
20
13 21 # The headers of the outputfile # The headers of the outputfile
14 22 column_names = ['Sku', 'location', 'Barcode', '@location', 'Shipment'] column_names = ['Sku', 'location', 'Barcode', '@location', 'Shipment']
15 23
 
... ... def picklist_creation(shipmentlist, folder, uploadfolder):
20 28 shipping_items = [] shipping_items = []
21 29
22 30 # Open the locationlist and gather all locations for each sku # Open the locationlist and gather all locations for each sku
23 with open(locationlist, mode = 'r') as item:
31 with open(location_file['filepath'], mode = 'r', encoding = location_file['encoding']) as item:
24 32 reader = csv.DictReader(item, delimiter=';') reader = csv.DictReader(item, delimiter=';')
25 33
26 34 for row in reader: for row in reader:
File packages/syncfile.py changed (mode: 100644) (index 633782f..a61e4fd)
... ... from os.path import isfile
7 7 from packages import picklist_creation from packages import picklist_creation
8 8
9 9 # Define and initialize the line seperators # Define and initialize the line seperators
10 line = chr(171)*70
11 altline = chr(187)*70
10 line = "#"*70
11 altline = "|"*70
12 12
13 13 def writeNewCsv(dataset, path, header, name): def writeNewCsv(dataset, path, header, name):
14 14 '''Write Data into new CSV for Upload '''Write Data into new CSV for Upload
 
... ... def importAmazonOrder(export, reportfolder, folder, orderid, plentyid, report=''
72 72 # initialize a dictionary to save the necessary data # initialize a dictionary to save the necessary data
73 73 Data = {} Data = {}
74 74 syncname = 'fba-received' syncname = 'fba-received'
75 with open(report, mode='r') as item:
75 with open(report['filepath'], mode='r', encoding=report['encoding']) as item:
76 76 reader = csv.DictReader(item, delimiter="\t") reader = csv.DictReader(item, delimiter="\t")
77 77
78 78 for position, row in enumerate( reader ): for position, row in enumerate( reader ):
 
... ... def importAmazonOrder(export, reportfolder, folder, orderid, plentyid, report=''
125 125 town = towns[0] town = towns[0]
126 126 countryid = countryids[0] countryid = countryids[0]
127 127
128 with open(stockreport, mode = 'r') as item:
128 with open(stockreport['filepath'], mode = 'r', encoding=stockreport['encoding']) as item:
129 129 reader = csv.DictReader(item, delimiter=';') reader = csv.DictReader(item, delimiter=';')
130 130
131 131 for row in reader: for row in reader:
 
... ... def importAmazonOrder(export, reportfolder, folder, orderid, plentyid, report=''
156 156 position += 1 position += 1
157 157
158 158 # Open the Export file to get the right Variation ID for each SKU on the List # Open the Export file to get the right Variation ID for each SKU on the List
159 with open(export, mode='r') as item:
159 with open(export['filepath'], mode='r', encoding=export['encoding']) as item:
160 160 reader = csv.DictReader(item, delimiter=";") reader = csv.DictReader(item, delimiter=";")
161 161
162 162 for row in reader: for row in reader:
 
... ... def importNewOrder(export, folder, orderlist, orderid, producerlist, plentyid):
183 183 producer_set = set() producer_set = set()
184 184 producer_dict = dict() producer_dict = dict()
185 185 order_amount = int() order_amount = int()
186 with open(orderlist, mode='r') as item:
186 with open(orderlist['filepath'], mode='r', encoding=orderlist['encoding']) as item:
187 187 reader = csv.DictReader(item, delimiter=';') reader = csv.DictReader(item, delimiter=';')
188 188
189 189 for row in reader: for row in reader:
 
... ... def importNewOrder(export, folder, orderlist, orderid, producerlist, plentyid):
222 222 print(err) print(err)
223 223 sys.exit() sys.exit()
224 224
225 with open(export, mode='r') as item:
225 with open(export['filepath'], mode='r', encoding=export['encoding']) as item:
226 226 reader = csv.DictReader(item, delimiter=';') reader = csv.DictReader(item, delimiter=';')
227 227
228 228 # Get the variation id and the price # Get the variation id and the price
 
... ... def importNewOrder(export, folder, orderlist, orderid, producerlist, plentyid):
261 261 orderid = int( orderid ) + 1 orderid = int( orderid ) + 1
262 262
263 263 # Open the orderlist again, to fill in the producer details # Open the orderlist again, to fill in the producer details
264 with open(orderlist, mode = 'r') as item:
264 with open(orderlist['filepath'], mode = 'r', encoding=orderlist['encoding']) as item:
265 265 reader = csv.DictReader(item, delimiter=';') reader = csv.DictReader(item, delimiter=';')
266 266
267 267 for row in reader: for row in reader:
 
... ... def createInboundPlan(folder, shipmentlist, deliverydata):
314 314
315 315 inboundplan = tkinter.filedialog.askopenfilename(initialdir=folder, inboundplan = tkinter.filedialog.askopenfilename(initialdir=folder,
316 316 title="Inbound-plan Template file") title="Inbound-plan Template file")
317
318
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/initBasti/Complete_Order_Plenty_Update

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/initBasti/Complete_Order_Plenty_Update

Clone this repository using git:
git clone git://git.rocketgit.com/user/initBasti/Complete_Order_Plenty_Update

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main