-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlocationTranfer.py
More file actions
106 lines (76 loc) · 3.77 KB
/
locationTranfer.py
File metadata and controls
106 lines (76 loc) · 3.77 KB
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
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 LocationTransfer(QWidget):
def __init__(self):
super().__init__()
self.InitUI()
def InitUI(self):
self.window = uic.loadUi(os.getcwd()+os.sep+r"GUI\locationtransfer.ui")
self.FillingTable()
self.window.tblList.doubleClicked.connect(self.FillingLableTable)
self.window.btnSave.clicked.connect(self.RunProgram)
self.window.show()
def FillingTable(self):
dataBase=warehouseDB()
listing=dataBase.ListingViewWarehouse()
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):
dataBase=warehouseDB()
gelen=self.window.tblList.currentItem().text().split("/")
print(gelen)
self.window.lblMatID.setText(gelen[0])
self.window.lblLocNo.setText(gelen[3])
self.window.lblMNo.setText(gelen[5])
self.window.lblQuantity.setText(gelen[7])
self.window.lblMUnit.setText(gelen[9])
self.window.lblParty.setText(gelen[10])
self.window.lblExDate.setText(gelen[11])
wName="WAREHOUSE"
locClicked=str(gelen[3])
listing=dataBase.ListingLocationWithCondtion(wName,locClicked)
self.window.cmbLocNo.addItem("Choosing","-1")
#print(listing)
for lId,lName in listing:
self.window.cmbLocNo.addItem(lName,lId)
def RunProgram(self):
dataBase=warehouseDB()
answer=QMessageBox.question(self,"LOCATION TRANSFER",'Do you want to tranfer for this record ?',QMessageBox.Yes | QMessageBox.No)
if(answer==QMessageBox.Yes):
gelen=self.window.tblList.currentItem().text().split("/")
processId='8'
mId=gelen[4]
quan=gelen[7]
mUId=gelen[8]
partyNo=gelen[10]
expDate=gelen[11]
id=gelen[0]
quanNew=self.window.txtQuantity.text()
locName=self.window.cmbLocNo.currentText()
locId=str(dataBase.ListingLocation_V2 (locName)[0][0])
isOk=0
quanUpdate=int(quan)-int(quanNew)
if(quanNew>quan):
QMessageBox.Warning(self,"LOCATION TRANSFER","Quantity updated is bigger than quantity",QMessageBox.Ok,QMessageBox.Ok)
else:
dataBase.InsertingProcess(processId,mId,quan,mUId,partyNo)
dataBase.InsertingWarehouseQuantity(locId,mId,quanNew,mUId,partyNo,expDate)
if(quanUpdate==0):
dataBase.UpdatingWarehouseQuantityWithQuantityIsOk(id,quanUpdate,isOk)
else:
dataBase.UpdatingWarehouseQuantityWithQuantity(id,quanUpdate)
QMessageBox.information(self,"LOCATION TRANSFER","This transfer is successful",QMessageBox.Ok,QMessageBox.Ok)
self.window.tblList.clear()
self.FillingTable()
elif (answer==QMessageBox.No):
QMessageBox.information(self,"LOCATION TRANSFER","This transfer is unsuccessful",QMessageBox.Ok,QMessageBox.Ok)
#VALUE=["'"+locId+"'","'"+matId+"'","'"+quan+"'","'"+mUId+"'","'"+partyNo+"'","'"+expDate+"'"]))
# VALUE=["'"+locId+"'","'"+matId+"'","'"+quan+"'","'"+mUId+"'","'"+partyNo+"'","'"+expDate+"'"]))
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = LocationTransfer()
sys.exit(app.exec_())