Exemplo n.º 1
0
 def renameSlot(self):
     indexes = self.protableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         outitem = select_outbound_by_code(ind.data())
         if outitem.customer_id != None:
             pers = select_customer_by_id(outitem.customer_id)
         if outitem.employee_id != None:
             pers = select_employee_by_id(outitem.employee_id)
     replay = QMessageBox.warning(
         QMessageBox(), "Oop's",
         'You want delete\n {} : '.format(outitem.code) +
         '\n{}'.format(pers.name) + '\n Are you sure?',
         QMessageBox.Yes | QMessageBox.Cancel)
     if replay == QMessageBox.Yes:
         if outitem.tools:
             increaseToolsInvQty(outitem.tools, outitem.req_qty)
         if outitem.rawMaterial:
             increaseRawMaterialInvQty(outitem.raw_material,
                                       outitem.req_qty)
         if outitem.spareParts:
             increaseSparePartsInvQty(outitem.spareParts, outitem.req_qty)
         if outitem.finishProducts:
             increaseFinishProductInvQty(outitem.finishProducts,
                                         outitem.req_qty)
         delete_outbound(outitem.id)
         self.refresheddata()
    def data(self, index, role=Qt.DisplayRole):
        col = index.column()
        item = self.items[index.row()]

        if role == Qt.DisplayRole:
            if col == 0:
                return QVariant(item.code)
            if col == 1:
                if item.customer_id:
                    cust = select_customer_by_id(item.customer_id)
                    sname = cust.name
                if item.employee_id:
                    empl = select_employee_by_id(item.employee_id)
                    sname = empl.name
                return QVariant(sname)
            if col == 2:
                if item.customer_id:
                    stype = "Customer"
                if item.employee_id:
                    stype = "Employee"
                return QVariant(stype)
            elif col == 3:
                if item.raw_material_id:
                    raw = select_row_material_by_id(item.raw_material_id)
                    mname = raw.name
                if item.spare_part_id:
                    spare = select_spare_parts_by_id(item.spare_part_id)
                    mname = spare.name
                if item.tools_id:
                    tool = select_tools_by_id(item.tools_id)
                    mname = tool.name
                # return QVariant(mname)
                if item.product_id:
                    tool = select_finish_product_by_id(item.product_id)
                    mname = tool.name
                return QVariant(mname)
            elif col == 4:
                if item.raw_material_id:
                    return QVariant('Raw Material')
                if item.spare_part_id:
                    return QVariant('Spare Parts')
                if item.tools_id:
                    return QVariant('Tools')
                if item.product_id:
                    return QVariant('Finish Product')
            #
            elif col == 5:
                return QVariant(item.req_qty)
            elif col == 6:
                return QVariant(str(item.out_date.date()))
            elif col == 7:
                if item.status == 1:
                    ssta = 'Open'
                if item.status == 0:
                    ssta = 'Close'
                return QVariant(ssta)
            return QVariant()
Exemplo n.º 3
0
 def openFPDialog(self):
     from uiview.ui_addFPOB import Ui_addFPOBDialog
     id = before(self.rqulistWidget.currentItem().text(), '-')
     if self.reqTypecomboBox.currentIndex() == 1:
         retitem = select_employee_by_id(id)
     if self.reqTypecomboBox.currentIndex() == 2:
         retitem = select_customer_by_id(id)
     self.di = Ui_addFPOBDialog(retitem)
     self.di.exec_()
Exemplo n.º 4
0
    def Clicked(self, item):
        id = before(item.text(), '-')
        if self.reqTypecomboBox.currentIndex() == 1:
            retitem = select_employee_by_id(id)
        if self.reqTypecomboBox.currentIndex() == 2:
            retitem = select_customer_by_id(id)
        self.addNewRMbtn.setEnabled(True)
        self.addNewSPbtn.setEnabled(True)
        self.addNewTObtn.setEnabled(True)
        self.addNewFPbtn.setEnabled(True)
        self.closeOutbtn.setEnabled(True)
        self.refreshbtn.setEnabled(True)

        self.setData(retitem)
        return retitem
Exemplo n.º 5
0
    def data(self, index, role=Qt.DisplayRole):
        col = index.column()
        item = self.items[index.row()]

        if role == Qt.DisplayRole:
            if col == 0:
                return QVariant(item.code)
            if col == 1:
                if item.customer_id:
                    cust = select_customer_by_id(item.customer_id)
                    return QVariant(cust.name)
                if item.employee_id:
                    empl = select_employee_by_id(item.employee_id)
                    return QVariant(empl.name)
            elif col == 2:
                if item.raw_material_id:
                    raw = select_row_material_by_id(item.raw_material_id)
                    mname = raw.name
                # return QVariant(mname)
                if item.spare_part_id:
                    spare = select_spare_parts_by_id(item.spare_part_id)
                    mname = spare.name
                # return QVariant(mname)
                if item.tools_id:
                    tool = select_tools_by_id(item.tools_id)
                    mname = tool.name
                # return QVariant(mname)
                if item.product_id:
                    tool = select_finish_product_by_id(item.product_id)
                    mname = tool.name
                return QVariant(mname)
            elif col == 3:
                if item.raw_material_id:
                    return QVariant('Raw Material')
                if item.spare_part_id:
                    return QVariant('Spare Parts')
                if item.tools_id:
                    return QVariant('Tools')
                if item.product_id:
                    return QVariant('Finish Product')
            #
            elif col == 4:
                return QVariant(item.req_qty)
            return QVariant()