-
Notifications
You must be signed in to change notification settings - Fork 2
/
warehouseEntry.py
117 lines (93 loc) · 4.26 KB
/
warehouseEntry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import sys
import os
from PyQt5.QtWidgets import QApplication,QWidget,QMessageBox,QListWidgetItem,QTableWidget,QTableWidgetItem,QVBoxLayout
from PyQt5 import uic
from DB.warehouseDB import warehouseDB
class WarehouseEntry(QWidget):
def __init__(self):
super().__init__()
self.InitUI()
def InitUI(self):
self.window = uic.loadUi(os.getcwd()+os.sep+r"GUI\warehouseentry.ui")
self.FillingLocaiton()
self.FillingTable()
self.window.tblList.doubleClicked.connect(self.FillingLableTable)
self.window.btnSave.clicked.connect(self.TakingWarehouse)
self.window.btnScrap.clicked.connect(self.TakingScraping)
self.window.show()
def FillingLocaiton(self):
dataBase=warehouseDB()
listing=dataBase.ListingLocation()
self.window.cmbLocNo.addItem("Choosing","-1")
#print(listing)
for lId,lName in listing:
self.window.cmbLocNo.addItem(lName,lId)
def FillingTable(self):
dataBase=warehouseDB()
listing=dataBase.ListingWareHouseEntry()
for id,wName,locId,locName,MıD,mNo,mName,quan,mUId,mUName,partyNo,expDate in listing:
item=QListWidgetItem("{}/{}/{}/{}/{}/{}/{}/{}/{}/{}/{}/{}".format(id,wName,locId,locName,MıD,mNo,mName,quan,mUId,mUName,partyNo,expDate))
self.window.tblList.addItem(item)
def FillingLableTable(self):
gelen=self.window.tblList.currentItem().text().split("/")
#print(gelen)
self.window.lblMatID.setText(gelen[0])
self.window.lblMNo.setText(gelen[5])
self.window.txtQuantity.setText(gelen[7])
self.window.lblMUnit.setText(gelen[9])
self.window.lblParty.setText(gelen[10])
self.window.lblExDate.setText(gelen[11])
def TakingWarehouse(self):
dataBase=warehouseDB()
answer=QMessageBox.question(self,"QUESTION",'Do you want to take warehouse for this record ?',QMessageBox.Yes | QMessageBox.No)
if(answer==QMessageBox.Yes):
gelen=self.window.tblList.currentItem().text().split("/")
print(gelen)
processId='1'
mId=gelen[4]
quan=gelen[7]
mUId=gelen[8]
partyNo=gelen[10]
id=gelen[0]
dataBase.InsertingProcess(processId,mId,quan,mUId,partyNo)
locationname=self.window.cmbLocNo.currentText()
print(locationname)
listingLog=locationname
locations=dataBase.Locations(listingLog)
for lId,lName in locations:
self.window.cmbLocNo.addItem(lId,lName)
print(locations)
locationId=locations[0][0]
print(str(locationId))
dataBase.UpdatingWarehouseQuantity(id,locationId)
QMessageBox.information(self,"TAKING WAREHOUSE","This record is successful",QMessageBox.Ok,QMessageBox.Ok)
self.window.tblList.clear()
self.FillingTable()
elif (answer==QMessageBox.No):
QMessageBox.information(self,"TAKING WAREHOUSE","This record is unsuccessful",QMessageBox.Ok,QMessageBox.Ok)
def TakingScraping(self):
dataBase=warehouseDB()
answer=QMessageBox.question(self,"QUESTION",'Do you want to scrap this record ?',QMessageBox.Yes | QMessageBox.No)
if(answer==QMessageBox.Yes):
gelen=self.window.tblList.currentItem().text().split("/")
print(gelen)
processId='5'
mId=gelen[4]
quan=gelen[7]
mUId=gelen[8]
partyNo=gelen[10]
id=gelen[0]
mNo=gelen[5]
isOk=0
dataBase.InsertingProcess(processId,mId,quan,mUId,partyNo)
dataBase.UpdatingWarehouseQuantityForScraping(id,isOk)
dataBase.InsertingScrap(mNo,quan,partyNo,mUId,id)
QMessageBox.information(self,"SCRAPING","Scraping is successful",QMessageBox.Ok,QMessageBox.Ok)
self.window.tblList.clear()
self.FillingTable()
elif(answer==QMessageBox.Np):
QMessageBox.information(self,"SCRAPING","Scraping is not successful",QMessageBox.Ok,QMessageBox.Ok)
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = WarehouseEntry()
sys.exit(app.exec_())