def on_CmdCancel_clicked(self): cu_id = self.getCurrentSelectPKValue() sql = "update t_order set fCanceled=1 where fOrderID='{pk}'" db = JPDb() sql = sql.format(pk=cu_id) msg = '您确认要作废此订单?\n' msg = msg + "Are you sure you want to cancel this order?" msg = msg.format(pk=cu_id) if QMessageBox.question(JPPub().MainForm, '确认', msg, QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.Yes: db.executeTransaction(sql) self.refreshListForm()
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()