def on_treeWidget_report_itemDoubleClicked(self, qtreeitem, p_int):
     if hasattr(self.current_content, 'flat'):
         if self.current_content.flat:
             dialog = MessageBox(self,
                                 title="提醒",
                                 text="文档尚未保存",
                                 informative="是否要保存文档",
                                 yes_text="保存",
                                 no_text="放弃保存")
             result = dialog.exec()
             if result == QMessageBox.Yes:
                 # 调用保存的槽函数
                 self.on_pushButton_accept_clicked()
     self.reportid = int(qtreeitem.text(0))
     condition = {'autoid': self.reportid}
     res = self.VC.get_data(2, True, *VALUES_TUPLE_RP_DETAIL, **condition)
     if not len(res):
         return
     content = str(res[0])
     if not self.gridLayout_11.isEmpty():
         self.gridLayout_11.removeWidget(self.current_content)
         self.current_content.close()
     self.current_content = XMLReadWrite(self)
     self.current_content.openxml(content)
     self.gridLayout_11.addWidget(self.current_content)
     self.current_content.__setattr__('autoid', self.reportid)
예제 #2
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 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 on_pushButton_pi_clicked(self):
        if self.label_checkstatus.text() != '检验合格':
            mesgbox = MessageBox(parent=self,
                                 title="提示",
                                 text="当前产品尚未检验合格无法入库")
            mesgbox.exec()
            return

        self.new_detail['warehousemanid'] = user.user_id
        self.new_detail['warehousemanname'] = user.user_name
        self.new_detail['pidate'] = user.now_date
        self.new_detail['pistatus'] = 3

        # 计算要入库的产品信息
        putin_msg = self.get_putin_msg()
        res = self.WC.update_preproductputinnote(self.autoid, putin_msg,
                                                 **self.new_detail)
        if not res:
            return
        self.pushButton_piwsman.setSign(True,
                                        user.user_id + ' ' + user.user_name)
        self.pushButton_save.setVisible(False)
        self.pushButton_accept.setVisible(False)
        self.pushButton_cancel.setVisible(False)
        self.pushButton_pi.setVisible(False)
        self.accepted.emit()
예제 #4
0
 def on_treeWidget_revalution_itemDoubleClicked(self, qtreeitem, p_int):
     if hasattr(self.current_content, 'flat'):
         if self.current_content.flat:
             dialog = MessageBox(self,
                                 title="提醒",
                                 text="文档尚未保存",
                                 informative="是否要保存文档",
                                 yes_text="保存",
                                 no_text="放弃保存")
             result = dialog.exec()
             if result == QMessageBox.Yes:
                 # 调用保存的槽函数
                 self.on_pushButton_save_clicked()
     self.docid = int(qtreeitem.text(0))
     key_dict = {'autoid': self.docid}
     res = self.SC.get_data(4, True, *VALUE_TUPLE_SD, **key_dict)
     if not len(res):
         return
     content = str(res[0])
     if not self.gridLayout_7.isEmpty():
         self.gridLayout_7.removeWidget(self.current_content)
         self.current_content.close()
     self.current_content = XMLReadWrite(self)
     self.current_content.openxml(content)
     self.gridLayout_7.addWidget(self.current_content)
     self.current_content.__setattr__('autoid', self.docid)
예제 #5
0
 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()
예제 #6
0
    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()
예제 #7
0
 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)
예제 #8
0
 def on_treeWidget_revalution_customContextMenuRequested(self, pos):
     if self.power[1] == '0':
         return
     if self.autoid is None:
         return
     sender_widget = self.sender()
     current_item = sender_widget.currentItem()
     menu = QMenu()
     button1 = menu.addAction("增加记录")
     button2 = menu.addAction("修改记录")
     button3 = menu.addAction("删除记录")
     global_pos = sender_widget.mapToGlobal(pos)
     action = menu.exec(global_pos)
     if action == button1:
         detail = SelectSelfDefineFormatModule('4', self)
         detail.selected.connect(self.new_records)
         detail.accepted.connect(self.get_format)
         detail.show()
     elif action == button2:
         if current_item is None:
             return
         if hasattr(self.current_content, 'flat'):
             if self.current_content.flat:
                 dialog = MessageBox(self,
                                     title="提醒",
                                     text="文档尚未保存",
                                     informative="是否要保存文档",
                                     yes_text="保存",
                                     no_text="放弃保存")
                 result = dialog.exec()
                 if result == QMessageBox.Yes:
                     # 调用保存的槽函数
                     self.on_pushButton_accept_clicked()
         self.docid = int(current_item.text(0))
         key_dict = {'autoid': self.docid}
         res = self.SC.get_data(4, True, *VALUE_TUPLE_SD, **key_dict)
         if not len(res):
             return
         content = str(res[0])
         if not self.gridLayout_7.isEmpty():
             self.gridLayout_7.removeWidget(self.current_content)
             self.current_content.close()
         self.current_content = XMLReadWrite(self)
         self.current_content.openxml(content)
         self.gridLayout_7.addWidget(self.current_content)
         self.current_content.__setattr__('autoid', self.docid)
     elif action == button3:
         if current_item is None:
             return
         id = int(current_item.text(0))
         condition = {'autoid': id}
         self.SC.delete_data(4, condition)
         self.get_format()
 def on_treeWidget_qrcode_customContextMenuRequested(self, pos):
     if self.power[1] == '0':
         return
     menu = QMenu()
     button1 = menu.addAction("上传二维码文件")
     g_pos = self.treeWidget_qrcode.mapToGlobal(pos)
     action = menu.exec(g_pos)
     if action == button1:
         clipboard = QApplication.clipboard()
         dir = clipboard.property("fileurl")
         if not dir:
             dir = "c:\\"
         files_route, file_types = QFileDialog.getOpenFileNames(
             self, "选择文件", dir, "*.txt;;All Files(*)")
         if not files_route:
             return
         informative = ''
         selected_dir = re.split(r'\w+.txt', files_route[0])[0]
         clipboard.setProperty("fileurl", selected_dir)
         for file_route in files_route:
             if not file_route.endswith(".txt"):
                 informative += file_route + "文件后缀错误\n"
                 continue
             filename = re.findall(r'\w+.txt', file_route)[0].split(".")[0]
             with open(file_route) as f:
                 try:
                     lines = f.readlines()
                 except UnicodeDecodeError:
                     informative += filename + ":编码格式错误\n"
                     continue
                 qrcode_list = []
                 for i in range(1, len(lines)):
                     content = lines[i].strip()
                     text = re.split(r',|,', content)
                     if len(text) != 5:
                         continue
                     text.append(user.now_date)
                     qrcode_list.append(text)
                 if not len(qrcode_list):
                     informative += filename + ":文件格式错误\n"
                     continue
                 res = self.QC.update_qrcoderep(None, *qrcode_list)
                 if res != "OK":
                     try:
                         qrcode = re.findall('\d+', res)[0]
                         informative += filename + ":" + qrcode + "重复\n"
                     except Exception:
                         pass
         if informative:
             msg = MessageBox(text="以下文件上传失败:", informative=informative)
             msg.exec()
         self.get_qrcoderepository()
예제 #10
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()
예제 #11
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()
예제 #12
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)
예제 #13
0
    def on_pushButton_accept_clicked(self):
        if not len(self.new_detail):
            return
        if self.autoid is None:
            if self.check_deptid_exist():
                msg = MessageBox(parent=self,
                                 text="部门编号重复",
                                 informative="当前编号已被使用, 请修改后重试!")
                msg.exec()
                self.lineEdit_deptid.setFocus()
                return
            if not self.check_parent_exist():
                msg = MessageBox(parent=self,
                                 text="上级部门不存在",
                                 informative="没有找到对应的上级部门, 请修改后重试!")
                msg.exec()
                self.lineEdit_parent.setFocus()
                return

                # 取消功能
            self.CC.update_data(2, **self.new_detail)
        else:
            condition = {'autoid': self.autoid}
            self.CC.update_data(2, condition, **self.new_detail)
        self.accept()
예제 #14
0
    def on_pushButton_accept_clicked(self):
        it = QTreeWidgetItemIterator(self.treeWidget_drawstuff)
        draw_list = []
        key_list = ['srid', 'stuffkind']
        while it.value():
            treeitem = it.value()
            item = self.qtreeitem2dict(key_list, treeitem)
            for stuff in self.stuff_repository:
                if stuff['autoid'] == int(item['srid']):
                    item['stuffid'] = stuff['stuffid']
                    item['stuffname'] = stuff['stuffname']
                    item['stufftype'] = stuff['stufftype']
                    item['stuffkind'] = stuff['stuffkind']
                    item['spec'] = stuff['spec']
                    item['package'] = stuff['package']
                    item['producer'] = stuff['producer']
                    item['batchno'] = stuff['batchno']
                    item['lrid'] = stuff['lrid']
                    item['content'] = stuff['content']
                    item['cunit'] = stuff['cunit']
                    item['water'] = stuff['water']

                    item['impurity'] = stuff['impurity']
                    item['rdensity'] = stuff['rdensity']
                    item['mbatchno'] = stuff['mbatchno']
                    break
            item['sdpid'] = self.sdpid
            item['ppid'] = self.ppid
            draw_list.append(item)
            it += 1
        sdpid_list = {
            'autoid': self.sdpid,
            'status': 2,
            'providerid': user.user_id,
            'providername': user.user_name,
            'drawdate': user.now_date
        }
        res = self.WC.update_stuffrepository_amount(self.ppid, *draw_list,
                                                    **sdpid_list)
        if res == 'accept':
            self.accept()
        elif res == 'rollback':
            msg = MessageBox(parent=self,
                             text="领料信息异常!",
                             informative="请刷新后重试!")
            msg.exec()
            timer = QTimer(self)
            timer.start(1000)
            timer.timeout.connect(msg.close)
 def on_treeWidget_report_customContextMenuRequested(self, pos):
     current_item = self.treeWidget_report.currentItem()
     global_pos = self.treeWidget_report.mapToGlobal(pos)
     menu = QMenu()
     action_1 = menu.addAction("增加")
     action_2 = menu.addAction("修改")
     action_3 = menu.addAction("删除")
     action = menu.exec(global_pos)
     if action == action_1:
         detail = SelectSelfDefineFormatModule("512", self)
         detail.selected.connect(self.add_oricheckpaper)
         detail.selected.connect(self.get_report)
         detail.show()
     elif action == action_2:
         if current_item is None:
             return
         if hasattr(self.current_content, 'flat'):
             if self.current_content.flat:
                 dialog = MessageBox(self,
                                     title="提醒",
                                     text="文档尚未保存",
                                     informative="是否要保存文档",
                                     yes_text="保存",
                                     no_text="放弃保存")
                 result = dialog.exec()
                 if result == QMessageBox.Yes:
                     # 调用保存的槽函数
                     self.on_pushButton_accept_clicked()
         self.reportid = int(current_item.text(0))
         condition = {'autoid': self.reportid}
         res = self.VC.get_data(2, True, *VALUES_TUPLE_RP_DETAIL,
                                **condition)
         if not len(res):
             return
         content = str(res[0])
         if not self.gridLayout_11.isEmpty():
             self.gridLayout_11.removeWidget(self.current_content)
             self.current_content.close()
         self.current_content = XMLReadWrite(self)
         self.current_content.openxml(content)
         self.gridLayout_11.addWidget(self.current_content)
         self.current_content.__setattr__('autoid', self.reportid)
     elif action == action_3:
         if current_item is None:
             return
         id = int(current_item.text(0))
         condition = {'autoid': id}
         self.VC.delete_data(2, condition)
         self.get_report()
    def on_pushButton_audit_clicked(self):
        if len(self.no_enough_stuff_list):
            text = "以下物料不足!无法执行指令!"
            informative = ";\n".join(self.no_enough_stuff_list)
            errordialig = MessageBox(self, text=text, informative=informative)
            errordialig.exec()
            return
        if self.autoid is None:
            self.new_detail['instructorid'] = user.user_id
            self.new_detail['instructorname'] = user.user_name
            self.new_detail['plandate'] = user.now_date
            self.new_detail['deptid'] = user.dept_id
            self.new_detail['deptname'] = user.dept_name
            self.new_detail['bpconstitutorid'] = user.user_id
            self.new_detail['bpconstitutorname'] = user.user_name
            self.new_detail['bpconsdate'] = user.now_date

        self.new_detail['status'] = 1
        self.new_detail['statustime'] = user.now_time
        self.new_detail['warrantorid'] = user.user_id
        self.new_detail['warrantorname'] = user.user_name
        self.new_detail['warrantdate'] = user.now_date
        self.new_detail['qadate'] = user.now_date
        self.new_detail['bpwarrantorid'] = user.user_id
        self.new_detail['bpwarrantorname'] = user.user_name
        self.new_detail['bpwarrantdate'] = user.now_date
        if self.autoid is None:
            prodtype = self.productkind.currentIndex()
            prod_id = self.prodname.namelist.currentItem().text(0)
            self.new_detail['id'] = prod_id
            ppid = self.PC.update_producingplan(prodtype=prodtype,
                                                **self.new_detail)
            self.autoid = ppid
            self.created.emit(self.autoid)
            # self.PC.update_data(3, **self.new_detail)
        else:
            condition = {'autoid': self.autoid}
            self.PC.update_data(3, condition, **self.new_detail)
        for item in self.stuff_list:
            if item['drawamount'] == 0:
                continue
            detail = {
                'ppid': self.autoid,
                'srid': item['autoid'],
                'drawamount': item['drawamount'],
                'stuffkind': item['stuffkind']
            }
            self.PC.update_data(7, **detail)
        self.accept()
예제 #17
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 '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()
예제 #19
0
 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()
예제 #20
0
    def on_treeWidget_deptlist_customContextMenuRequested(self, pos):
        if self.power[1] == '0':
            return
        current_item = self.treeWidget_deptlist.currentItem()
        menu = QMenu()
        item1 = menu.addAction("新建部门")
        item2 = menu.addAction("修改部门")
        item3 = menu.addAction("删除部门")
        # 把坐标转换为屏幕坐标
        screenpos = self.treeWidget_deptlist.mapToGlobal(pos)
        # 设置菜单显示的位置,返回点击了哪个功能
        action = menu.exec(screenpos)
        # 根据点击了哪个功能绑定对应的事件

        if action == item1:
            detail = ModifyDeptmentModule(parent=self)
            detail.accepted.connect(self.get_deptment_list)
            detail.show()
        elif action == item2:
            if current_item is None:
                return
            autoid = int(current_item.text(2))
            if autoid == 0:
                return

            detail = ModifyDeptmentModule(autoid, self)
            detail.accepted.connect(self.get_deptment_list)
            detail.show()
        elif action == item3:
            if current_item is None:
                return
            autoid = int(current_item.text(2))
            if autoid == 0:
                return
            s = QTreeWidgetItem()
            if current_item.childCount() > 0:
                msg = MessageBox(
                    self, text='无法删除部门', informative='当前部门下还有子部门'
                )
                msg.exec()
                return
            condition = {'autoid': autoid}
            self.CC.delete_data(2, condition)
            self.get_deptment_list()
        else:
            pass
    def on_accept_button_clicked(self):
        if self.prodname.flat == 0:
            text = "没有找到对应的产品信息,请修改后重试!"
            informative = "选择好产品名称后请不要再修改,否则将导致系统无法找到正确的产品!"
            errordialig = MessageBox(self, text=text, informative=informative)
            errordialig.exec()
            self.prodname.setFocus()
            return
        if len(self.no_enough_stuff_list):
            text = "以下物料不足!"
            informative = ";\n".join(self.no_enough_stuff_list)
            errordialig = MessageBox(self,
                                     text=text,
                                     informative=informative,
                                     yes_text="继续下达指令")
            res = errordialig.exec()
            if res == 65536:
                self.prodname.setFocus()
                return
        # 有修改过数据
        if self.new_detail:
            try:
                # 修改过记录,把当前的人员和日期存入修改记录中
                self.new_detail['instructorid'] = user.user_id
                self.new_detail['instructorname'] = user.user_name
                self.new_detail['plandate'] = user.now_date
                self.new_detail['deptid'] = user.dept_id
                self.new_detail['deptname'] = user.dept_name
                self.new_detail['bpconstitutorid'] = user.user_id
                self.new_detail['bpconstitutorname'] = user.user_name
                self.new_detail['bpconsdate'] = user.now_date

                # autoid不为空,则为修改记录
                # 否则为插入记录
                if self.autoid:
                    self.PC.update_producingplan(autoid=self.autoid,
                                                 **self.new_detail)
                    condition = {'ppid': self.autoid}
                    self.PC.delete_data(7, condition)
                else:
                    prodtype = self.productkind.currentIndex()
                    prod_id = self.prodname.namelist.currentItem().text(0)
                    self.new_detail['id'] = prod_id
                    ppid = self.PC.update_producingplan(prodtype=prodtype,
                                                        **self.new_detail)
                    self.autoid = ppid
                    self.created.emit(self.autoid)
                for item in self.stuff_list:
                    detail = {
                        'ppid': self.autoid,
                        'srid': item['autoid'],
                        'drawamount': item['drawamount'],
                        'stuffkind': item['stuffkind']
                    }
                    self.PC.update_data(7, **detail)
                self.accept()
            except Exception as e:
                SaveExcept(e, "提交生产指令时出错", **self.new_detail)
        else:
            self.close()
예제 #22
0
 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()
예제 #23
0
    def closeEvent(self, qcloseevent):
        if self.power[1] == '0' or self.ori_detail['status'] > 2:
            return
        if len(self.new_detail):
            qdialog = MessageBox(self,
                                 title="提醒",
                                 text="检验报告书",
                                 informative="是否保存修改?")
            res = qdialog.exec()
            if res == 16384:
                self.on_pushButton_save_clicked()

        for i in range(2, self.tabWidget.count() + 1):
            widgets = self.tabWidget.widget(i)

            try:
                for item in widgets.children():
                    try:
                        if item.current_content.flat == 1:
                            qdialog = MessageBox(
                                self,
                                title="提醒",
                                text=self.tabWidget.tabText(i),
                                informative="是否保存修改?")
                            res = qdialog.exec()
                            if res == 16384:
                                item.on_pushButton_accept_clicked()
                    except AttributeError:
                        pass
            except AttributeError:
                pass
예제 #24
0
    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()
예제 #25
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)
예제 #26
0
    def on_pushButton_accept_clicked(self):
        self.new_detail['clerkid'] = self.lineEdit_clerkid.text()
        self.new_detail['clerkname'] = self.lineEdit_clerkname.text()
        if self.new_detail['clerkid'] == '':
            msg = MessageBox(text="编号不能为空!")
            msg.exec()
            self.lineEdit_clerkid.setFocus()
            return
        else:
            res = self.CC.get_data(0, False, **self.new_detail)
            if len(res):
                msg = MessageBox(text="该编号已被使用!")
                msg.exec()
                self.lineEdit_clerkid.setFocus()
                return
        res = self.CC.update_data(0, **self.new_detail)

        clerk = ClerkDtailModule(res.autoid, self.parent())
        clerk.show()
        self.accept()
예제 #27
0
 def set_package_rate(self, package):
     lv = self.comboBox_packageLv.currentIndex() + 1
     items = re.split(r'\*|×|x|X', package)
     if len(items) != lv:
         msg = MessageBox(title="错误1!", informative="包装比例错误!")
         msg.exec()
         return False
     num_tuple = ('basicamount', 'spamount', 'mpamount')
     unit_tuple = ('basicunit', 'spunit', 'mpunit', 'bpunit')
     try:
         for i in range(len(items)):
             values = re.findall(r'\d+|\w+', items[i])
             self.new_detail[num_tuple[i]] = values[0]
             self.new_detail[unit_tuple[i]] = values[1]
         self.new_detail[unit_tuple[i + 1]] = values[2]
         return True
     except:
         msg = MessageBox(title="错误2!", informative="包装比例错误!")
         msg.exec()
         return False
예제 #28
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)
예제 #29
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()
    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()