def updateoutlineedit(self): pname=dbconn.getpronamebyno(self.ui.comboBox.currentText()) #print pname if pname!=None: self.ui.lineEdit_3.setText(pname) else: self.ui.lineEdit_3.setText('')
def updatelineedit(self): pname=dbconn.getpronamebyno(self.ui.prono.currentText()) #print pname if pname!=None: self.ui.lineEdit.setText(pname) else: self.ui.lineEdit.setText('')
def querlineedit(self): pname=dbconn.getpronamebyno(self.ui.comboBox_2.currentText()) #print pname if pname!=None: self.ui.lineEdit_11.setText(pname) else: self.ui.lineEdit_11.setText('')
def updateoutlineedit(self): pname = dbconn.getpronamebyno(self.ui.comboBox.currentText()) #print pname if pname != None: self.ui.lineEdit_3.setText(pname) else: self.ui.lineEdit_3.setText('')
def querlineedit(self): pname = dbconn.getpronamebyno(self.ui.comboBox_2.currentText()) #print pname if pname != None: self.ui.lineEdit_11.setText(pname) else: self.ui.lineEdit_11.setText('')
def updatelineedit(self): pname = dbconn.getpronamebyno(self.ui.prono.currentText()) #print pname if pname != None: self.ui.lineEdit.setText(pname) else: self.ui.lineEdit.setText('')
def delproduct(self): if self.ui.lineEdit_9.text()=='': QMessageBox.information(self,'Waring',u'请输入编号和名称') return else: sqlstr=[self.ui.lineEdit_9.text()] name=dbconn.getpronamebyno(self.ui.lineEdit_9.text()) if dbconn.deldataproduct(sqlstr)==0: self.ui.textEdit.append(u"编号:"+sqlstr[0]+u".......名称:"+name+u"...........数据删除失败,请检查编号和名称是否正确!!!") else: self.ui.textEdit.append(u"编号:"+sqlstr[0]+u".......名称:"+name+u"...........数据删除成功!!") self.model=QtSql.QSqlQueryModel(self) sql=u''' select prodcutno as 编号,productname as 名称 from productlist ''' self.model.setQuery(sql) self.ui.tableView.setModel(self.model) self.ui.lineEdit_10.setText('') self.ui.lineEdit_9.setText('')
def delproduct(self): if self.ui.lineEdit_9.text() == '': QMessageBox.information(self, 'Waring', u'请输入编号和名称') return else: sqlstr = [self.ui.lineEdit_9.text()] name = dbconn.getpronamebyno(self.ui.lineEdit_9.text()) if dbconn.deldataproduct(sqlstr) == 0: self.ui.textEdit.append(u"编号:" + sqlstr[0] + u".......名称:" + name + u"...........数据删除失败,请检查编号和名称是否正确!!!") else: self.ui.textEdit.append(u"编号:" + sqlstr[0] + u".......名称:" + name + u"...........数据删除成功!!") self.model = QtSql.QSqlQueryModel(self) sql = u''' select prodcutno as 编号,productname as 名称 from productlist ''' self.model.setQuery(sql) self.ui.tableView.setModel(self.model) self.ui.lineEdit_10.setText('') self.ui.lineEdit_9.setText('')
def __init__(self,parent=None): QtGui.QWidget.__init__(self,parent) self.ui = Ui_Dialog() self.ui.setupUi(self) self.model=QtSql.QSqlTableModel(self) self.model.setTable('productlist') self.model.setHeaderData(0,QtCore.Qt.Horizontal,u"编号") self.model.setHeaderData(1,QtCore.Qt.Horizontal,u"名称") self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit) self.model.select() self.ui.tableView.setModel(self.model) model1=QtSql.QSqlQueryModel(self) sql=u''' select prodctuno as 编号,time as 时间,prodtype as 良否,qty as 数量,\ place as 库位,recordman as 记录人, mark as 备注 from record ''' model1.setQuery(sql) self.ui.tableView_2.setModel(model1) model=QtSql.QSqlQueryModel() sql=u''' select prodctuno as 编号,time as 时间,prodtype as 良否,qty as 数量,\ lingyongman as 领用人, place as 库位,recordman as 记录人, mark as 备注 from outrecord ''' model.setQuery(sql) self.ui.tableView_5.setModel(model) self.ui.radioButton.setChecked(True) self.ui.radioButton_4.setChecked(True) self.ui.radioButton_5.setChecked(True) self.inall() self.outall() self.curall() plist=dbconn.getprono() self.ui.prono.addItems(plist) self.ui.comboBox.addItems(plist) self.ui.comboBox_2.addItems(plist) pname=dbconn.getpronamebyno(self.ui.prono.currentText()) self.ui.lineEdit.setText(pname) self.ui.lineEdit_3.setText(pname) self.ui.lineEdit_11.setText(pname) self.connect(self.ui.prono,QtCore.SIGNAL('currentIndexChanged(QString)'),self.updatelineedit) self.connect(self.ui.comboBox,QtCore.SIGNAL('currentIndexChanged(QString)'),self.updateoutlineedit) self.connect(self.ui.comboBox_2,QtCore.SIGNAL('currentIndexChanged(QString)'),self.querlineedit) self.connect(self.ui.pushButton,QtCore.SIGNAL('clicked()'),self.insertdata) self.connect(self.ui.pushButton_3,QtCore.SIGNAL('clicked()'),self.outdata) self.connect(self.ui.lineEdit_2,QtCore.SIGNAL('textChanged(QString)'),self.checkint) self.connect(self.ui.lineEdit_6,QtCore.SIGNAL('textChanged(QString)'),self.checkint) #self.connect(self.ui.addButton,QtCore.SIGNAL("click()"),self.addinfo) #self.connect(self.ui.cancelButton,QtCore.SIGNAL("click()"),QtCore.SLOT('close()')) self.connect(self.ui.pushButton_2,QtCore.SIGNAL('clicked()'),self.cancledate) self.connect(self.ui.pushButton_5,QtCore.SIGNAL('clicked()'),self.addproduct) self.connect(self.ui.pushButton_6,QtCore.SIGNAL('clicked()'),self.updateproduct) self.connect(self.ui.pushButton_7,QtCore.SIGNAL('clicked()'),self.delproduct) self.connect(self.ui.pushButton_8,QtCore.SIGNAL('clicked()'),self.querproduct) self.connect(self.ui.tableView,QtCore.SIGNAL('clicked(QModelIndex)'),self.selproductno) self.connect(self.ui.tabWidget,QtCore.SIGNAL('currentChanged(int)'),self.tabchange) self.connect(self.ui.pushButton_9,QtCore.SIGNAL('clicked()'),self.inall) self.connect(self.ui.pushButton_10,QtCore.SIGNAL('clicked()'),self.outall) self.connect(self.ui.pushButton_11,QtCore.SIGNAL('clicked()'),self.curall)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_Dialog() self.ui.setupUi(self) self.model = QtSql.QSqlTableModel(self) self.model.setTable('productlist') self.model.setHeaderData(0, QtCore.Qt.Horizontal, u"编号") self.model.setHeaderData(1, QtCore.Qt.Horizontal, u"名称") self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit) self.model.select() self.ui.tableView.setModel(self.model) model1 = QtSql.QSqlQueryModel(self) sql = u''' select prodctuno as 编号,time as 时间,prodtype as 良否,qty as 数量,\ place as 库位,recordman as 记录人, mark as 备注 from record ''' model1.setQuery(sql) self.ui.tableView_2.setModel(model1) model = QtSql.QSqlQueryModel() sql = u''' select prodctuno as 编号,time as 时间,prodtype as 良否,qty as 数量,\ lingyongman as 领用人, place as 库位,recordman as 记录人, mark as 备注 from outrecord ''' model.setQuery(sql) self.ui.tableView_5.setModel(model) self.ui.radioButton.setChecked(True) self.ui.radioButton_4.setChecked(True) self.ui.radioButton_5.setChecked(True) self.inall() self.outall() self.curall() plist = dbconn.getprono() self.ui.prono.addItems(plist) self.ui.comboBox.addItems(plist) self.ui.comboBox_2.addItems(plist) pname = dbconn.getpronamebyno(self.ui.prono.currentText()) self.ui.lineEdit.setText(pname) self.ui.lineEdit_3.setText(pname) self.ui.lineEdit_11.setText(pname) self.connect(self.ui.prono, QtCore.SIGNAL('currentIndexChanged(QString)'), self.updatelineedit) self.connect(self.ui.comboBox, QtCore.SIGNAL('currentIndexChanged(QString)'), self.updateoutlineedit) self.connect(self.ui.comboBox_2, QtCore.SIGNAL('currentIndexChanged(QString)'), self.querlineedit) self.connect(self.ui.pushButton, QtCore.SIGNAL('clicked()'), self.insertdata) self.connect(self.ui.pushButton_3, QtCore.SIGNAL('clicked()'), self.outdata) self.connect(self.ui.lineEdit_2, QtCore.SIGNAL('textChanged(QString)'), self.checkint) self.connect(self.ui.lineEdit_6, QtCore.SIGNAL('textChanged(QString)'), self.checkint) #self.connect(self.ui.addButton,QtCore.SIGNAL("click()"),self.addinfo) #self.connect(self.ui.cancelButton,QtCore.SIGNAL("click()"),QtCore.SLOT('close()')) self.connect(self.ui.pushButton_2, QtCore.SIGNAL('clicked()'), self.cancledate) self.connect(self.ui.pushButton_5, QtCore.SIGNAL('clicked()'), self.addproduct) self.connect(self.ui.pushButton_6, QtCore.SIGNAL('clicked()'), self.updateproduct) self.connect(self.ui.pushButton_7, QtCore.SIGNAL('clicked()'), self.delproduct) self.connect(self.ui.pushButton_8, QtCore.SIGNAL('clicked()'), self.querproduct) self.connect(self.ui.tableView, QtCore.SIGNAL('clicked(QModelIndex)'), self.selproductno) self.connect(self.ui.tabWidget, QtCore.SIGNAL('currentChanged(int)'), self.tabchange) self.connect(self.ui.pushButton_9, QtCore.SIGNAL('clicked()'), self.inall) self.connect(self.ui.pushButton_10, QtCore.SIGNAL('clicked()'), self.outall) self.connect(self.ui.pushButton_11, QtCore.SIGNAL('clicked()'), self.curall)