new plugin for JopShop instance. Reads production orders from a spreadsheet

parent 81390931
from copy import copy
import json
import time
import random
import operator
from datetime import datetime
import copy
import routeQuery
from dream.plugins import plugin
class ReadJSOrders(plugin.InputPreparationPlugin):
""" Input preparation
reads the production orders from the corresponding spreadsheet
"""
def preprocess(self, data):
""" inserts the retrieved production orders to the BOM echelon
"""
POdata = data["input"]["production_orders_spreadsheet"]
productionOrders = []
data["input"]["BOM"]["orders"] = productionOrders
if POdata:
POdata.pop(0) # pop the column names
for order in POdata:
orderID = POdata[0]
if not orderID:
continue
customer = POdata[1]
project = POdata[2]
orderDate = POdata[3]
dueDate = POdata[4]
manager = POdata[5]
productionOrders.append({
"orderID": orderID,
"orderName": project,
"customer": customer,
"orderDate": orderDate,
"dueDate": dueDate,
"manager": manager
})
return data
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment