Ejemplo n.º 1
0
    def __init__(self,
                 dataBaseType: JPDbType = JPDbType.MySQL,
                 *args,
                 **kwargs):
        super(JPMainWindow, self).__init__(*args, **kwargs)
        try:
            db = JPDb()
            db.setDatabaseType(dataBaseType)
            JPPub().MainForm = self
        except Exception as e:
            QMessageBox.warning(self, "提示", str(e))

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.label_Title.setText("")
        self.commandDict = {}
        self.logoPixmap = None

        self.addOneButtonIcon(self.ui.ChangeUser, "changeuser.png")
        self.addOneButtonIcon(self.ui.ChangePassword, "changepassword.png")
        # self.addLogoToLabel(self.ui.label_logo)

        # 用户及密码修改功能
        objUser = JPUser()
        objUser.INIT()  # 程序开始时只初始化一次
        objUser.userChange.connect(self.onUserChanged)
        objUser.currentUserID()
        self.ui.ChangeUser.clicked.connect(objUser.changeUser)
        self.ui.ChangePassword.clicked.connect(objUser.changePassword)

        # 堆叠布局
        self.ui.stackedWidget.removeWidget(self.ui.page)
        self.ui.stackedWidget.removeWidget(self.ui.page_2)

        # 隐藏树标题
        self.ui.label_FunPath.setText('')
        self.ui.treeWidget.setHeaderHidden(True)

        # 设置状态条中的进度条及标签
        self.Label = QLabel(" ")
        self.ProgressBar = QProgressBar()
        self.statusBar = self.statusBar()
        self.statusBar.addPermanentWidget(self.Label)
        self.statusBar.addPermanentWidget(self.ProgressBar)
        self.ProgressBar.setGeometry(0, 0, 100, 5)
        self.ProgressBar.hide()
        self.statusBar.hide()

        self.ui.splitter.setStretchFactor(0, 2)
        self.ui.splitter.setStretchFactor(1, 11)

        # 连接点击了功能树中的节点到函数
        self.ui.treeWidget.itemClicked[QTreeWidgetItem,
                                       int].connect(self.treeViewItemClicked)
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()
        JPPub().MainForm = self
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.label_Title.setText("Zion OrderM")
        #self.ui.label_Title.setText("ColorPro OrderM")
        #self.setWindowTitle("ColorPro OrderM")
        self.setWindowTitle("Zion OrderM")

        # self.icoPath = ":/pic/res/ico/{}"
        # self.logoPath = ":/logo/res/{}"
        self.icoPath = getcwd() + "\\res\\ico\\{}"
        self.logoPath = getcwd() + "\\res\\{}"

        # 设置主窗体中按钮图标及Logo
        self.logoPixmap = QPixmap(self.logoPath.format("zions_100.png"))
        self.backPixmap = QPixmap(self.logoPath.format("zions_tm.png"))
        self.addOneButtonIcon(self.ui.ChangeUser, "changeuser.png")
        self.addOneButtonIcon(self.ui.ChangePassword, "changepassword.png")
        self.addLogoToLabel(self.ui.label_logo)

        # 用户及密码修改功能
        objUser = JPUser()
        objUser.INIT()  # 程序开始时只初始化一次
        objUser.userChange.connect(self.onUserChanged)
        objUser.currentUserID()
        self.ui.ChangeUser.clicked.connect(objUser.changeUser)
        self.ui.ChangePassword.clicked.connect(objUser.changePassword)

        # 堆叠布局
        self.ui.stackedWidget.removeWidget(self.ui.page)
        self.ui.stackedWidget.removeWidget(self.ui.page_2)

        # 隐藏树标题
        self.ui.label_FunPath.setText('')
        self.ui.treeWidget.setHeaderHidden(True)

        # 设置状态条中的进度条及标签
        self.Label = QLabel("")
        self.ProgressBar = QProgressBar()
        self.statusBar().addPermanentWidget(self.Label)
        self.statusBar().addPermanentWidget(self.ProgressBar)
        self.ProgressBar.hide()

        # 连接点击了功能树中的节点到函数
        self.ui.treeWidget.itemClicked[QTreeWidgetItem,
                                       int].connect(self.treeViewItemClicked)
Ejemplo n.º 3
0
 def on_CmdConfirm_clicked(self):
     us = JPUser()
     uid = us.currentUserID()
     cu_id = self.getCurrentSelectPKValue()
     if self.getCurrentColumnValue(13) == 1:
         msg = '单据已经确认,无法重复确认!\n'
         msg = msg + 'The payment has been confirmed and cannot be repeated.'
         QMessageBox.information(JPPub().MainForm, '提示', msg)
         return
     sql0 = f"select '{cu_id}';"
     sql1 = f"update t_order set fConfirmed=1,fConfirmID={uid} where fOrderID='{cu_id}'"
     sql2 = f"update t_product_outbound_order set fConfirmed=1,fConfirmID={uid} where fOrderID='{cu_id}'"
     sql3 = f"""
         UPDATE t_product_information AS p,
             (SELECT fProductID,
                 sum(fQuant) AS sum_sl
             FROM t_product_outbound_order_detail
             WHERE fOrderID='{cu_id}'
             GROUP BY  fProductID) AS q1 SET p.fCurrentQuantity=p.fCurrentQuantity-q1.sum_sl
         WHERE p.fID=q1.fProductID;
         """
     if not cu_id:
         return
     else:
         sql = [sql2, sql3, sql0] if cu_id[0:2] == 'PO' else [sql1, sql0]
     db = JPDb()
     msg = "单据【{pk}】确认后将不能修改。是否要确认此付款单?" + '\n'
     msg = msg + 'The bill [{pk}] of payment will not be amended after confirmation.'
     msg = msg + "  Do you want to confirm this payment form?"
     msg = msg.format(pk=cu_id)
     if QMessageBox.question(JPPub().MainForm, '确认', msg,
                             QMessageBox.Yes | QMessageBox.No,
                             QMessageBox.No) == QMessageBox.Yes:
         db.executeTransaction(sql)
         if cu_id[0:2] == 'PO':
             JPPub().broadcastMessage(tablename="t_product_outbound_order",
                                      PK=cu_id,
                                      action='confirmation')
         else:
             JPPub().broadcastMessage(tablename="t_order",
                                      action='confirmation',
                                      PK=cu_id)
         self.refreshListForm()