Пример #1
0
    def okPress(self):
        finished = cl.finishedProduct()
        finished.ID = self.target_product.ID
        finished.weight = float(self.totalYield.text())
        finished.kind = self.kind
        finished.unfinishedProductIncluded.append(self.target_product)
        cl.inv.listAllUnfinishedProduct.pop(
            cl.inv.listAllUnfinishedProduct.index(self.target_product))
        cl.inv.listAllFinishedProduct.append(finished)

        target_container = str(self.container.text())
        found = False
        for item in cl.inv.listAllContainers:
            if str(item.ID) == target_container:
                target_container = item
                found = True
        if found == False:
            newContainer = cl.container()
            newContainer.ID = target_container
            newContainer.kind = finished.kind
            cl.inv.listAllContainers.append(newContainer)
            target_container = newContainer
        target_container.productIncluded.append(finished)
        finished.container = target_container
        target_container.weight += finished.weight

        cl.save()
        yieldW.update()
        self.hide()
Пример #2
0
def init():
    """
        Init het scherm met de functies
    """
    root = Tk()

    root.state('zoomed')
    root.configure(bg='#ffc917')
    mainContainer = classes.container(root)
    mainContainer.viewInputStationFrame()

    root.mainloop()
Пример #3
0
    def confirm(self):
        try:
            global products

            unitChoice = None
            purposeChoice = None

            if self.pushOneGram.isChecked(): unitChoice = 1.00
            elif self.pushHalfGram.isChecked(): unitChoice = 0.50
            elif self.pushOtherType.isChecked():
                unitChoice = float(self.lineOtherType.text())

            if self.pushPackaging.isChecked(): purposeChoice = 'packaging'
            elif self.pushSample.isChecked(): purposeChoice = 'sample'
            elif self.pushTesting_2.isChecked(): purposeChoice = 'testing'
            elif self.pushOtherPurp.isChecked():
                purposeChoise = str(self.lineOtherPurpose.text())

            cont = self.currentContainer
            newCont = cl.container()
            cont.kind = str(cont.kind)[3:]

            cont.weight = float(self.lineCurrentWeight.text())

            if purposeChoice == 'packaging': newCont.isPackaged = True
            newCont.purpose = purposeChoice
            newCont.weight = float(self.lineWeightUsed.text())
            newCont.unitSize = unitChoice
            newCont.numberOfUnits = int(self.lineUnitPacked.text())
            newCont.ID = self.lineContainerName.text()
            newCont.kind = cont.kind
            newCont.productIncluded = cont.productIncluded[:]
            newCont.location = cont.location
            newCont.location.items.append(newCont)
            cl.inv.listAllContainers.append(newCont)
            cl.inv.listAllContainersArchive.append(newCont)
            cont.history.append([
                str(datetime.datetime.now()), '-', newCont.weight,
                'packaged into ' + str(newCont.numberOfUnits) + ' units'
            ])
            newCont.history.append([
                str(datetime.datetime.now()), '+', newCont.weight,
                'made from ' + str(cont.ID) + ' : ' + cont.kind
            ])

            products.append(newCont)
            self.cancel()
            print('Packing Complete')
            lg.write('packagingSelectWindow - packaging successful...')
        except:
            lg.write('packagingSelectWindow - ERROR: confirm(self)',
                     deepData=str(sys.exc_info()))
Пример #4
0
    def __init__(self):
        super(POSPricingWindow, self).__init__()
        uic.loadUi(cl.UIstem + 'posPricing.ui', self)

        self.currentCompany = None
        self.currentProduct = cl.container()
        self.priceWindows = list()
        self.productsToSell = list()

        self.currentTrans = None

        self.unitButtons = [self.pushAllUnit, self.pushPartialUnit]

        self.buttonBox.accepted.connect(self.ok)
        self.buttonBox.rejected.connect(self.cancel)
        self.pushAllUnit.clicked.connect(
            lambda: self.unitClicked(self.pushAllUnit))
        self.pushPartialUnit.clicked.connect(
            lambda: self.unitClicked(self.pushPartialUnit))
Пример #5
0
    def confirm(self):
        try:
            typeChoice = None
            if self.pushRsopt.isChecked(): typeChoice = 'RSO'
            elif self.pushDistillate.isChecked(): typeChoice = 'Distillate'

            cont = self.currentContainer
            newCont = cl.container()
            cont.kind = str(cont.kind)[3:]
            cont.weight = float(self.lineCurrentWeight.text())
            newCont.ID = str(self.lineContainerName.text())
            if typeChoice == 'RSO': newCont.kind = '(P)RSO'
            elif typeChoice == 'Distillate':
                newCont.kind = '(P)Distillate'
                newCont.ID = str(self.lineFlavorName.text())

            newCont.weight = float(self.lineWeightUsed.text())
            cont.history.append([
                str(datetime.datetime.now()), '-', newCont.weight,
                'made into ' + str(newCont.ID) + ' : ' + newCont.kind
            ])
            newCont.history.append([
                str(datetime.datetime.now()), '+', newCont.weight,
                'made from ' + str(cont.ID)
            ])
            newCont.productIncluded = cont.productIncluded[:]
            cl.inv.listAllContainers.append(newCont)
            cl.inv.listAllContainersArchive.append(newCont)
            newCont.location = cont.location
            newCont.location.items.append(newCont)

            self.cancel()
            lg.write('packagingMakeWindow - ' + str(typeChoice) + ' made...')
        except:
            lg.write('packagingMakeWindow - ERROR: confirm(self)',
                     deepData=str(sys.exc_info()))
Пример #6
0
    def okPress(self):
        try:
            finished = cl.finishedProduct()
            finished.ID = self.target_product.ID
            finished.weight = float(self.totalYield.text())
            finished.kind = self.kind
            finished.location = self.target_product.location
            try:
                self.target_product.location.items.pop(
                    self.target_product.location.items.index(
                        self.target_product))
            except:
                pass
            finished.owner = self.target_product.owner  ###
            finished.unfinishedProductIncluded.append(self.target_product)
            cl.inv.listAllUnfinishedProduct.pop(
                cl.inv.listAllUnfinishedProduct.index(self.target_product))
            cl.inv.listAllFinishedProduct.append(finished)
            cl.inv.listAllFinishedProductArchive.append(finished)

            target_container = str(self.container.text())
            found = False
            for item in cl.inv.listAllContainers:
                if str(item.ID) == target_container:
                    target_container = item
                    found = True
            if found == False:
                newContainer = cl.container()
                newContainer.ID = target_container
                newContainer.kind = finished.kind
                cl.inv.listAllContainers.append(newContainer)
                cl.inv.listAllContainersArchive.append(newContainer)
                target_container = newContainer
            target_container.history.append([
                str(datetime.datetime.now()), '+', finished.weight,
                'yielded from ' + str(finished.ID)
            ])
            target_container.productIncluded.append(finished)
            finished.container = target_container
            target_container.weight += finished.weight

            optionList = []
            for i in cl.inv.listAllLocations:
                optionList.append(str(i.ID))
            inn2, ok = QtGui.QInputDialog.getItem(self, 'Choose',
                                                  'Choose location to store:',
                                                  optionList)
            if ok:
                for i in cl.inv.listAllLocations:
                    if str(i.ID) == inn2:
                        target_container.location = i
                        i.items.append(target_container)
            else:
                return

            try:
                cl.inv.ALLCONTAINERS.append(target_container)
            except:
                cl.inv.ALLCONTAINERS = [target_container]

            cl.save()
            yieldW.update()
            self.hide()
            lg.write('YieldPOP - product yielded...', deepData=finished)
        except:
            lg.write('YieldPOP - ERROR: okPress(self)',
                     deepData=str(sys.exc_info()))