Example #1
0
 def __init__(self, autoid=None, parent=None):
     super(StuffDetail, self).__init__(parent)
     # 数据库操作类
     self.sd = StuffModel()
     self.autoid = autoid
     if autoid is not None:
         self.flush_basedata()
Example #2
0
 def __init__(self, parent=None):
     self.SM = StuffModel()
Example #3
0
class setStuff(object):
    def __init__(self, parent=None):
        self.SM = StuffModel()

    def update_stuff(self, autoid=None, **kwargs):
        return self.SM.update_stuff(autoid, **kwargs)
Example #4
0
 def get_stuffdict(self, display_flag=False, *args, **kwargs):
     return StuffModel.get_stuffdict(display_flag, *args, **kwargs)
Example #5
0
 def delete_data(self, table_num: int, condition={}, *args, **kwargs):
     table_str = TABLE_SET[table_num][0]
     err_msg = "删除" + TABLE_SET[table_num][1]
     return StuffModel.delete_data(table_str, err_msg, condition, *args,
                                   **kwargs)
Example #6
0
 def get_data(self, table_num: int, display_flag=False, *args, **kwargs):
     table_str = TABLE_SET[table_num][0]
     err_msg = "查询" + TABLE_SET[table_num][1]
     return StuffModel.get_data(table_str, err_msg, display_flag, *args,
                                **kwargs)
Example #7
0
 def update_productstuff(self, key_dict, *args, **kwargs):
     return StuffModel.update_productstuff(key_dict, *args, **kwargs)
Example #8
0
 def update_stuffdrawpaper(self, autoid=0, *args, **kwargs):
     return StuffModel.update_stuffdrawpaper(autoid, *args, **kwargs)
Example #9
0
 def get_Mprodstuff(self, ppid):
     return StuffModel.get_Mprodstuff(ppid)
Example #10
0
 def get_prodstuff(self, display_flag=False, *args, **kwargs):
     return StuffModel.get_prodstuff(display_flag, *args, **kwargs)
Example #11
0
class StuffDetail(StuffModule):
    def __init__(self, autoid=None, parent=None):
        super(StuffDetail, self).__init__(parent)
        # 数据库操作类
        self.sd = StuffModel()
        self.autoid = autoid
        if autoid is not None:
            self.flush_basedata()

    def flush_basedata(self):
        key_dict = {'autoid': self.autoid}
        stuff_detail = self.sd.get_stuffdict(False, **key_dict)
        if stuff_detail:
            self.set_data(stuff_detail[0])
            self.oridetail = model_to_dict(stuff_detail[0])
        else:
            errordialig = QtWidgets.QErrorMessage(self)
            errordialig.setWindowTitle("错误")
            # errordialig.setIcon(QtWidgets.QMessageBox.Warning)
            # errordialig.setText("没有找到对应的记录,请刷新后重试!")
            # 添加Yes和No2个按键
            # errordialig.setStandardButtons(
            ##button_yes = errordialig.button(QtWidgets.QMessageBox.Yes)
            # button_yes.setText("确认")
            # button_no = errordialig.button(QtWidgets.QMessageBox.No)
            # button_no.setText("取消")

    def set_data(self, detail):
        self.stufftype.setCurrentIndex(int(detail.stufftype))
        self.stuffid.setText(detail.stuffid)
        self.stuffname.setText(detail.stuffname)
        self.kind.setText(detail.kind)
        self.externalno.setText(detail.externalno)
        self.allowno.setText(detail.allowno)
        self.inputcode.setText(detail.inputcode)
        self.spec.setText(detail.spec)
        self.packageLv.setCurrentIndex(int(detail.packagelv))
        self.package_2.setText(detail.package)
        self.purchasingunit.setCurrentIndex(detail.unit)
        self.checkunit.setCurrentIndex(detail.checkunit)
        self.lowlimit.setText(str(detail.lowlimit))
        self.upperlimit.setText(str(detail.upperlimit))
        self.recheck.setText(str(detail.countercheckdays))
        self.expired.setText(str(detail.expireddays))
        self.ceffectunit.setText(detail.cunit)
        self.storage.setText(detail.storage)
        # 若为前处理,则不显示原料检验项目和供应商和生产厂家
        if detail.stufftype == 1:
            # 删除原料检验项目
            self.tab.removeTab(1)
            # 删除供应商和生产厂家
            # 由于前面删除了一个,所以序号往前了
            self.tab.removeTab(3)
        else:
            # 删除前处理配方和前处理检验项目
            self.tab.removeTab(2)
            self.tab.removeTab(2)
            self.workshoplabel.setVisible(False)
            self.workshop.setVisible(False)
            self.productionlinelabel.setVisible(False)
            self.productionline.setVisible(False)
        if detail.plid:
            productline = ProductLineConroller()
            productlinedetail = productline.get_productline(autoid=detail.plid)
            if productlinedetail:
                self.workshop.setText(productlinedetail[0].deptname)
                self.productionline.setText(productlinedetail[0].linename)