ReadJSOrders plugin corrected

parent 75187032
...@@ -5,7 +5,6 @@ import random ...@@ -5,7 +5,6 @@ import random
import operator import operator
from datetime import datetime from datetime import datetime
import copy import copy
import routeQuery
from dream.plugins import plugin from dream.plugins import plugin
...@@ -17,26 +16,28 @@ class ReadJSOrders(plugin.InputPreparationPlugin): ...@@ -17,26 +16,28 @@ class ReadJSOrders(plugin.InputPreparationPlugin):
def preprocess(self, data): def preprocess(self, data):
""" inserts the retrieved production orders to the BOM echelon """ inserts the retrieved production orders to the BOM echelon
""" """
POdata = data["input"]["production_orders_spreadsheet"] POdata = data["input"].get("production_orders_spreadsheet",[])
productionOrders = [] productionOrders = []
data["input"]["BOM"]["orders"] = productionOrders data["input"]["BOM"]["orders"] = productionOrders
if POdata: if POdata:
POdata.pop(0) # pop the column names POdata.pop(0) # pop the column names
for order in POdata: for order in POdata:
orderID = POdata[0] orderID = order[0]
if not orderID: if not orderID:
continue continue
customer = POdata[1] customer = order[1]
project = POdata[2] project = order[2]
orderDate = POdata[3] orderDate = order[3]
dueDate = POdata[4] dueDate = order[4]
manager = POdata[5] priority = order[5]
manager = order[6]
productionOrders.append({ productionOrders.append({
"orderID": orderID, "orderID": orderID,
"orderName": project, "orderName": project,
"customer": customer, "customer": customer,
"orderDate": orderDate, "orderDate": orderDate,
"dueDate": dueDate, "dueDate": dueDate,
"priority": priority,
"manager": manager "manager": manager
}) })
......
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