Browse Source

Product list name refactored
Name instead of ID

Jovian (Netbook) 6 years ago
parent
commit
b7235db2b3
2 changed files with 7 additions and 7 deletions
  1. 3 3
      app_customer.py
  2. 4 4
      consumer/connect.py

+ 3 - 3
app_customer.py

@@ -68,11 +68,11 @@ while running:
         houseList = consumer.getWarehousesOfCompany(login)
         targetHouseId = houseAsker.select(houseList)
         proList = consumer.getProductSet()
-        productIdList = productAsker.selectInto(proList)
-        productQuantityList = [100] * len(productIdList)
+        proSelectNameList = productAsker.selectInto(proList)
+        productQuantityList = [100] * len(proSelectNameList)
         dueDate = date.today() + timedelta(15)
         if (confirmAsker.confirm()):
-            consumer.addOrder(login, targetHouseId, productIdList, productQuantityList, dueDate)
+            consumer.addOrder(login, targetHouseId, proSelectNameList, productQuantityList, dueDate)
             consumer.commit()
         else:
             display.error('Order creation aborted')

+ 4 - 4
consumer/connect.py

@@ -72,13 +72,13 @@ class DataConsumer():
 
         return rows
 
-    def addOrder(self, company, houseId, proIdList, proQuantityList, dueDate):
+    def addOrder(self, company, houseId, proList, proQuantityList, dueDate):
 
         # Debug : work under progress
         print('add order not implemented yet')
         print(company)
         print(houseId)
-        print(proIdList)
+        print(proList)
         print(proQuantityList)
         print(dueDate)
         
@@ -93,8 +93,8 @@ class DataConsumer():
         ordId = cursor.fetchone()[0]
 
         # Add ordered items
-        for k in range(len(proIdList)):
-            proName = proIdList[k]
+        for k in range(len(proList)):
+            proName = proList[k]
             proQuantity = proQuantityList[k]
             cursor.execute("INSERT INTO ordereditem(ori_quantity, ori_deliveryduedate, pro_id, ord_id, war_id) SELECT %s, %s, pro_id, %s, %s FROM product WHERE pro_name = %s", (proQuantity, dueDate, ordId, houseId, proName))
         cursor.close()