def on_treeWidget_stufflist_customContextMenuRequested(self, pos):
        id = 0
        lrid = 0
        # 返回调用者的对象
        sender_widget = self.sender()
        current_item = sender_widget.currentItem()
        if current_item is None:
            return

        id = int(current_item.text(0))
        lrid = int(current_item.text(1))

        menu = QMenu()
        button1 = menu.addAction("登记入库")
        button2 = menu.addAction("查看检验报告")

        global_pos = sender_widget.mapToGlobal(pos)
        action = menu.exec(global_pos)

        if action == button1:
            detail = EditStuffCheckInModule(id, lrid, self)
            detail.accepted.connect(self.get_stuff_list)
            detail.show()

        elif action == button2:
            if lrid == 0:
                message = MessageBox(text="没有找到对应的检验报告", parent=self)
                message.show()
                return
            detail = CheckreportModule(lrid, True, self)
            detail.show()
Beispiel #2
0
    def show_plandoc(self):
        if not len(self.ori_detail):
            return
        ext = self.ori_detail['ext']
        title = self.ori_detail['doctitle']
        self.doc = self.ori_detail['doc']

        if ext in ("doc", "docx"):
            self.groupBox_pdf.setVisible(False)
            self.axWidget.setVisible(True)
            self.axWidget.clear()
            if not (self.axWidget.setControl("Word.Application")
                    or self.axWidget.setControl("Kwps.Application")):
                msg = MessageBox(self, text="没有安装Word/WPS文字!")
                msg.show()
                return
            self.open_office(title + '.' + ext)
        elif ext == "pdf":
            self.axWidget.setVisible(False)
            self.axWidget.clear()
            self.groupBox_pdf.setVisible(True)
            self.open_pdf(title + '.' + ext)
        elif ext in ("xls", "xlsx"):
            self.groupBox_pdf.setVisible(False)
            self.axWidget.setVisible(True)
            self.axWidget.clear()
            if not (self.axWidget.setControl("Excel.Application")
                    or self.axWidget.setControl("Ket.Application")):
                msg = MessageBox(self, text="没有安装Excel/WPS表格!")
                msg.show()
                return
            self.open_office(title + '.' + ext)
    def on_pushButton_accept_clicked(self):
        text = ''
        if self.lineEdit_stuff.text() == '':
            text = "物料不能为空!\n"
        if self.lineEdit_amount.text() in ('', '0'):
            text += "到货数量不能为空!\n"
        if self.lineEdit_batchno.text() == '':
            text += "进厂批号不能为空!\n"
        if len(text) > 0:
            message = MessageBox(self, text="以下信息填写错误", informative=text)
            message.show()
            return
        if len(self.new_detail):
            if self.spid:
                key_dict_supplyer = {'autoid': self.spid}
                supplyer_list = self.SC.get_supply(False,
                                                   *VALUES_TUPLE_SUPPLYER,
                                                   **key_dict_supplyer)
                if len(supplyer_list):
                    supplyer = supplyer_list[0]
                    self.new_detail['supid'] = supplyer['supid']
                    self.new_detail['supname'] = supplyer['supname']
                self.new_detail['paperno'] = self.paperno
                self.new_detail['papertype'] = self.papertype
                self.new_detail['checkindate'] = user.now_date
            res = self.WC.update_stuffcheckinlist(self.autoid,
                                                  **self.new_detail)

            self.accept()
 def show_errormsg(self, msg):
     text = "以下物料配方设置出错,请检查配方后重新领料"
     informative = ""
     for i, item in enumerate(msg):
         informative += str(i + 1) + '、' + item + '设置出错\n'
     dialog = MessageBox(self, text=text, informative=informative)
     dialog.show()
 def not_find_proddetail(self, p_int):
     if p_int == 6:
         msg = MessageBox(parent=self, title="错误", text="领料单异常!",
                      informative="没有找到对应的产品信息!")
         msg.show()
         timer = QTimer(self)
         timer.start(1000)
         timer.timeout.connect(msg.close)
Beispiel #6
0
    def on_pushButton_accept_clicked(self):
        if not len(self.new_detail):
            return
        saleamount = self.lineEdit_amount.text()
        if saleamount in ('0', ''):
            msg = MessageBox(self, text="销售数量不能为空")
            msg.show()
            return
        if self.autoid is None and self.snid is not None:
            self.new_detail['snid'] = self.snid

        self.SC.update_salenotegoods(self.autoid, **self.new_detail)
        self.accept()
Beispiel #7
0
 def on_pushButton_accept_clicked(self):
     if not len(self.new_detail):
         return
     status, text = self.check_amount()
     if status != 0:
         msg = MessageBox(self, text=text)
         msg.show()
         return
     key_dict = {'autoid': self.autoid}
     self.new_detail['wdid'] = user.user_id
     self.new_detail['wdname'] = user.user_name
     self.SC.update_productstuff(key_dict, **self.new_detail)
     self.accept()
Beispiel #8
0
 def on_pushButton_accept_clicked(self):
     text = ''
     if self.lineEdit_stuff.text() == '':
         text = "物料不能为空!\n"
     if self.lineEdit_amount.text() in ('', '0'):
         text += "采购数量不能为空!\n"
     if len(text) > 0:
         message = MessageBox(self, text="以下信息填写错误", informative=text)
         message.show()
         return
     if len(self.new_detail):
         if self.ppid:
             self.new_detail['ppid'] = self.ppid
         res = self.SC.update_purchstuff(self.autoid, **self.new_detail)
         self.accept()
 def on_pushButton_accept_clicked(self):
     if not self.autoid or 'eqno' in self.new_detail:
         eqno = self.lineEdit_id.text()
         key_dict = {'eqno': eqno}
         res = self.EC.get_data(0, True, 'autoid', **key_dict)
         if len(res):
             msg = MessageBox(self, text="设备编号重复")
             msg.show()
             return
     if len(self.new_detail):
         if self.autoid:
             condition = {'autoid': self.autoid}
             self.EC.update_data(0, condition, **self.new_detail)
         else:
             self.EC.update_data(0, **self.new_detail)
     self.accept()
 def on_pushButton_accept_clicked(self):
     if 'paperno' in self.new_detail:
         key_dict = {'paperno': self.new_detail['paperno']}
         res = self.SC.get_purchasingplan(True, *VALUES_TUPLE_PAPERNO,
                                          **key_dict)
         if len(res) > 0:
             message = MessageBox(self,
                                  text="单号重复,请修改后重新提交",
                                  informative="已经存在单号为" +
                                  self.new_detail['paperno'] + "的记录了!")
             message.show()
             self.lineEdit_paperno.setFocus()
             return
     if len(self.new_detail):
         res = self.SC.update_purchasingplan(self.autoid, **self.new_detail)
         self.accept()
Beispiel #11
0
 def on_pushButton_upload_clicked(self):
     fileurl, type = QFileDialog.getOpenFileName(
         self, "打开文件",
         os.path.expanduser("~") + "\Desktop",
         "选择文件(*.docx *.doc *.pdf);;All File(*.*)")
     if not fileurl:
         return
     filename = fileurl.split("/")[-1]
     name_no_ext = filename.split(".")[0]
     ext = fileurl.split(".")[1]
     if ext.lower() not in ('doc', 'docx', 'xls', 'xlsx', 'pdf'):
         return
     fp = open(fileurl, 'rb')
     with fp:
         file_byte = fp.read()
         fp.close()
     fp = None
     self.lineEdit_doctitle.setText(name_no_ext)
     self.new_detail['doc'] = file_byte
     self.doc = file_byte
     self.new_detail['ext'] = ext.lower()
     self.new_detail['doctitle'] = name_no_ext
     if ext in ("doc", "docx"):
         self.groupBox_pdf.setVisible(False)
         self.axWidget.setVisible(True)
         self.axWidget.clear()
         if not (self.axWidget.setControl("Word.Application")
                 or self.axWidget.setControl("Kwps.Application")):
             msg = MessageBox(self, text="没有安装Word/WPS文字!")
             msg.show()
             return
         self.open_office(name_no_ext + '.' + ext)
     elif ext == "pdf":
         self.axWidget.setVisible(False)
         self.axWidget.clear()
         self.groupBox_pdf.setVisible(True)
         self.open_pdf(name_no_ext + '.' + ext)
     elif ext in ("xls", "xlsx"):
         self.groupBox_pdf.setVisible(False)
         self.axWidget.setVisible(True)
         self.axWidget.clear()
         if not (self.axWidget.setControl("Excel.Application")
                 or self.axWidget.setControl("Ket.Application")):
             msg = MessageBox(self, text="没有安装Excel/WPS表格!")
             msg.show()
             return
         self.open_office(name_no_ext + '.' + ext)
 def on_pushButton_accept_clicked(self):
     if not len(self.new_detail):
         return
     if 'paperno' in self.new_detail:
         key_dict = {'paperno': self.new_detail['paperno']}
         res = self.SC.get_salenotes(True, *VALUES_TUPLE_PAPERNO, **key_dict)
         if len(res):
             msg = MessageBox(
                 self, text="单号重复,请修改后重新提交",
                 informative="已经存在单号为" + self.new_detail['paperno'] +
                             "的记录了!"
             )
             msg.show()
             self.lineEdit_paperno.setFocus()
             return
     self.new_detail['creatorid'] = user.user_id
     self.new_detail['creatorname'] = user.user_name
     self.SC.update_salenotes(self.autoid, **self.new_detail)
     self.accept()
    def on_pushButton_accept_clicked(self):
        if self.lineEdit_amount.text() in ('', '0'):
            msg = MessageBox(self, text="入库数量不能未空")
            msg.show()
            return
        if self.pushButton_applyer.text() in ('', ' '):
            self.pushButton_applyer.setSign(
                True, user.user_id + ' ' + user.user_name)
            self.new_detail['piapplyerid'] = user.user_id
            self.new_detail['piapplyername'] = user.user_name
            self.new_detail['pidate'] = user.now_date
        self.new_detail['pistatus'] = 1

        self.WC.update_productputinnote(self.autoid, **self.new_detail)
        realamount = decimal.Decimal(self.lineEdit_amount.text())
        detail = {'realamount': realamount}
        self.PC.update_producingplan(self.ppid, **detail)

        self.pushButton_save.setVisible(False)
        self.pushButton_accept.setVisible(False)
        self.pushButton_cancel.setVisible(True)
        self.pushButton_pi.setVisible(True)
        self.accepted.emit()
Beispiel #14
0
 def on_treeWidget_doclist_itemDoubleClicked(self, qtreeitem, p_int):
     id = int(qtreeitem.text(1))
     if id == 0:
         return
     self.current_docid = id
     condition = {'autoid': id}
     res = self.DC.get_data(0, False, *VALUES_TUPLE_DC, **condition)
     if not len(res):
         return
     self.doc = res[0]
     ext = self.doc['ext']
     title = self.doc['title']
     if ext in ("doc", "docx"):
         self.groupBox_pdf.setVisible(False)
         self.axWidget.setVisible(True)
         self.axWidget.clear()
         if not (self.axWidget.setControl("Word.Application")
                 or self.axWidget.setControl("Kwps.Application")):
             msg = MessageBox(self, text="没有安装Word/WPS文字!")
             msg.show()
             return
         self.open_office(title + '.' + ext)
     elif ext == "pdf":
         self.axWidget.setVisible(False)
         self.axWidget.clear()
         self.groupBox_pdf.setVisible(True)
         self.open_pdf(title + '.' + ext)
     elif ext in ("xls", "xlsx"):
         self.groupBox_pdf.setVisible(False)
         self.axWidget.setVisible(True)
         self.axWidget.clear()
         if not (self.axWidget.setControl("Excel.Application")
                 or self.axWidget.setControl("Ket.Application")):
             msg = MessageBox(self, text="没有安装Excel/WPS表格!")
             msg.show()
             return
         self.open_office(title + '.' + ext)
Beispiel #15
0
    def on_treeWidget_orderlist_customContextMenuRequested(self, pos):
        if self.power[1] == '0':
            return
        id = 0
        index = self.tabWidget.currentIndex()
        if index == 2:
            return
            # 返回调用者的对象
        sender_widget = self.sender()
        current_item = sender_widget.currentItem()
        if current_item is not None:
            id = int(current_item.text(0))
        menu = QMenu()
        if index == 0:
            button1 = menu.addAction("新增计划单")
            button2 = menu.addAction("修改计划单")
            button3 = menu.addAction("删除计划单")
            button4 = menu.addAction("提交执行")
        elif index == 1:
            button5 = menu.addAction("完成计划单")
            button6 = menu.addAction("退回编辑")

        global_pos = sender_widget.mapToGlobal(pos)
        action = menu.exec(global_pos)
        if index == 0:
            if action == button1:
                detail = EditpurchasingplanModule(None, self)
                detail.accepted.connect(self.get_orderdetail)
                detail.show()
            elif action == button2:
                detail = EditpurchasingplanModule(id, self)
                detail.accepted.connect(self.get_orderdetail)
                detail.show()
            elif action == button3:
                if id is None:
                    return
                key_dict = {
                    'ppid': id
                }
                self.SC.delete_purchstuff(**key_dict)
                self.SC.delete_purchasingplan(id)
            elif action == button4:
                if id is None:
                    return
                warrantor = current_item.text(5)
                if warrantor in ('', ' '):
                    message = MessageBox(
                        self, text="无法提交执行", informative="批准人还没有签名"
                    )
                    message.show()
                    return
                key_dict = {
                    'status': 1
                }
                self.SC.update_purchasingplan(id, **key_dict)

        elif index == 1:
            if action == button5:
                if id is None:
                    return
                key_dict = {
                    'status': 2
                }
                self.SC.update_purchasingplan(id, **key_dict)
            elif action == button6:
                if id is None:
                    return
                key_dict = {
                    'status': 0
                }
                self.SC.update_purchasingplan(id, **key_dict)
        self.get_orderdetail()
Beispiel #16
0
    def on_treeWidget_orderlist_customContextMenuRequested(self, pos):
        if self.power[1] == '0':
            return
        id = 0
        index = self.tabWidget.currentIndex()
        # 返回调用者的对象
        sender_widget = self.sender()
        current_item = sender_widget.currentItem()
        if current_item is not None:
            id = int(current_item.text(0))

        menu = QMenu()
        if index == 0:
            button1 = menu.addAction("新增销售单")
            button2 = menu.addAction("修改销售单")
            button3 = menu.addAction("删除销售单")
            button4 = menu.addAction("提交审核")
        elif index == 1:
            button5 = menu.addAction("审核签名")
            button6 = menu.addAction("取消提交")
        elif index == 2:
            button7 = menu.addAction("取消发货")
        global_pos = sender_widget.mapToGlobal(pos)
        action = menu.exec(global_pos)
        if index == 0:
            if action == button1:
                detail = EditSaleOrderMudule(parent=self)
                detail.accepted.connect(self.get_order_list)
                detail.show()
            elif action == button2:
                if id is None:
                    return
                detail = EditSaleOrderMudule(id, self)
                detail.accepted.connect(self.get_order_list)
                detail.show()
            elif action == button3:
                if id is None:
                    return

                key_dict_output = {'snid': id}
                res = self.WC.get_productputoutpaper(True,
                                                     *VALUES_TUPLE_OUTPUT,
                                                     **key_dict_output)
                if len(res):
                    key_dict_qrcode = {'ppopid': res[0]}
                    qrcodelist = self.WC.get_ppopqrcode(
                        True, *VALUES_TUPLE_OUTPUTDATE, **key_dict_qrcode)
                    if len(qrcodelist):
                        msg = MessageBox(self, text="已有出库记录,无法取消发货!")
                        msg.show()
                key_dict = {'snid': id}
                self.SC.delete_salenotes(id)
                self.SC.delete_salenotegoods(**key_dict)
                self.WC.delete_productputoutpaper(**key_dict)
                self.get_order_list()
            elif action == button4:
                if id is None:
                    return
                key_dict = {'status': 1}
                self.SC.update_salenotes(id, **key_dict)
                self.get_order_list()
        elif index == 1:
            if action == button5:
                if id is None:
                    return
                key_dict = {
                    'consignmentid': user.user_id,
                    'consignmentname': user.user_name,
                    'status': 2
                }
                self.SC.update_salenotes(id, **key_dict)
                key_dict_output = {'snid': id}
                res = self.WC.get_productputoutpaper(False,
                                                     *VALUES_TUPLE_OUTPUT,
                                                     **key_dict_output)
                if not len(res):
                    output_detail = {
                        'snid': id,
                        'snpaperno': current_item.text(1),
                        'pokind': "销售出库",
                        'clientid': current_item.text(2).split(' ')[0],
                        'clientname': current_item.text(2).split(' ')[1],
                        'remark': current_item.text(13)
                    }
                    res = self.WC.update_productputoutpaper(**output_detail)
                self.get_order_list()
            elif action == button6:
                if id is None:
                    return
                key_dict = {
                    'consignmentid': '',
                    'consignmentname': '',
                    'status': 0
                }
                self.SC.update_salenotes(id, **key_dict)
                self.get_order_list()
        elif index == 2:
            if action == button7:
                if id is None:
                    return
                key_dict = {
                    'consignmentid': '',
                    'consignmentname': '',
                    'status': 1
                }
                self.SC.update_salenotes(id, **key_dict)
                self.get_order_list()
    def on_treeWidget_orderlist_customContextMenuRequested(self, pos):
        if self.power[1] == '0':
            return
        id = 0
        snid = 0
        index = self.tabWidget.currentIndex()
        if index != 0:
            return
        # 返回调用者的对象
        sender_widget = self.sender()
        current_item = sender_widget.currentItem()
        if current_item is not None:
            id = int(current_item.text(0))
            snid = int(current_item.text(1))

        menu = QMenu()

        button1 = menu.addAction("新增出库单")
        button2 = menu.addAction("修改出库单")
        button3 = menu.addAction("删除出库单")
        menu.addSeparator()
        button4 = menu.addAction("提交出库")
        menu.addSeparator()
        button5 = menu.addAction("查看销售订单")

        global_pos = sender_widget.mapToGlobal(pos)
        action = menu.exec(global_pos)

        if action == button1:
            detail = EditProductPutOutPaperModule(parent=self)
            detail.accepted.connect(self.get_order_list)
            detail.show()
        elif action == button2:
            if id is None:
                return
            detail = EditProductPutOutPaperModule(id, self)
            detail.accepted.connect(self.get_order_list)
            detail.show()
        elif action == button3:
            if id is None:
                return

            key_dict_output = {'ppopid': id}
            res = self.WC.get_ppopqrcode(True, *VALUES_TUPLE_OUTPUT,
                                         **key_dict_output)
            if len(res):
                msg = MessageBox(self, text="已有出库记录,无法删除出库单!")
                msg.show()
                return

            key_dict = {'autoid': id}
            self.WC.delete_productputoutpaper(**key_dict)
            self.get_order_list()
        elif action == button4:
            if id is None:
                return
            key_dict = {
                'status': 1,
                'auditorid': user.user_id,
                'auditorname': user.user_name,
                'putoutdate': user.now_date
            }
            res = self.WC.apply_productputoutpaper(id, snid, **key_dict)
            if res == "OK":
                if snid != 0:
                    key_dict_salenote = {
                        'status': 3,
                        'deliverid': user.user_id,
                        'delivername': user.user_name
                    }
                    self.SC.update_salenotes(snid, **key_dict_salenote)
                self.get_order_list()
            else:
                REP_KIND = ("整箱", "零头", "合箱")
                if not len(self.prod_list):
                    self.ppopid = id
                    self.get_qrcode_list()
                informative = ''
                prodname = ''
                batchno = ''
                for item in res[1]:
                    for it in self.prod_list:
                        if it['ppid'] == item[1]:
                            prodname = it['prodname']
                            batchno = it['batchno']
                kind = REP_KIND[item[0]]
                informative += prodname + '(' + kind + '),批号:' + batchno + '\n'
                msg = MessageBox(self,
                                 text="以下产品库存不足",
                                 informative=informative)
                msg.exec()
                return
        elif action == button5:
            if snid == 0:
                msg = MessageBox(self, text="没有找到关联的销售订单")
                msg.show()
                return
            detail = SaleOrderModule(snid, self)
            detail.show()