示例#1
0
    def MoveWasted(self):
        """During validation of entries ->
            barcode should be convertable to int, and should not be negative
            quantity should be convertable to int, and should not be negative
            weight should be convertable to float, and should not be negative
                XOR - logic between variables quantity and weight
        """
        self.barcode = self.e_manage_barcode.get()
        self.weight = self.e_manage_weight.get()
        self.quantity = self.e_manage_quantity.get()
        if self.barcode.isdecimal():
            print("Carry on")
        else:
            exception_window.pop_up_window("Use only digits in Barcode entry!", "MANAGE SUPPLY EXCEPTION")
        if self.quantity.isdecimal():
            exception_window.pop_up_window("Quantity must be a numerical value!", "MANAGE SUPPLY EXCEPTION")
        try:
            self.weight = float(self.weight)
            if self.weight <= 0:
                exception_window.pop_up_window("Weight value must be positive!",
                                               "MANAGE SUPPLY EXCEPTION")
        except ValueError:
            exception_window.pop_up_window("Weight must have a positive numerical value separated by dots (.)!",
                                           "MANAGE SUPPLY EXCEPTION")

        if len(self.weight) > 0 and len(self.quantity) > 0 or len(self.weight) == 0 and len(self.quantity) == 0:
            exception_window.pop_up_window(
                "Enter the quantity/weight of the product, and do not enter both values simultaniously!",
                "MANAGE SUPPLY EXCEPTION")
        else:
            print("Carry on")
示例#2
0
 def OpenReport(self):
     """
         No mechanism of overwirting existing file - maybe there is a way to check this
     """
     self.filename_load = tk.filedialog.askopenfilename(initialdir=self.filename_load, title="Open report",
                                                        filetypes= \
                                                            (("csv files", "*.csv"), ("all files", "*.*")))
     try:
         if self.filename_load[-1] == '/':
             exception_window.pop_up_window("Nie wybrano pliku!", "Wczytaj plik")
         print("Load path: " + self.filename_load)
         # else:
         #     self.filename_load = self.filename_load + '.csv'
         if (self.filename_load[-3:] == 'csv'):
             print("Go on")
         else:
             exception_window.pop_up_window("Należy podać scieżkę oraz nazwę pliku")
     except IndexError:
         print("OpenReport: FYI - open path to file wasn't specified!")
示例#3
0
    def ShowSoldSupply(self):
        # ALL BUFFERS should be initially RESET
        """During validation of entries ->
            prod_name should contain chaaracters not exceeding ??
            prod_category should contain chaaracters not exceeding ??
            e_prod_low_date should be formatted according to calendar entry
                (thus, it should be validated in this regard, or should not be editable at all)
            e_prod_hi_date should be formatted according to calendar entry
                (thus, it should be validated in this regard, or should not be editable at all)
            The Hi date must be larger than low date

            If only category is specified, the function should used any name
            We assume, that adding a category and name at the same time is pointless,
            so in that case, we take only name into account
        """
        try:
            if self.hi_date > self.lo_date:
                self.category = self.e_prod_category.get()
                self.add_name = self.e_prod_name.get()
                if len(self.category) > 0 and len(self.add_name) == 0 or len(self.category) == 0 and len(
                        self.add_name) > 0:
                    print("Carry on")
                else:
                    exception_window.pop_up_window("Only Category or only Name can be inserted!",
                                                   "PRODUCT MANAGEMENT EXCEPTION")
            else:
                exception_window.pop_up_window("Invalid date constrains!", "PRODUCT MANAGEMENT EXCEPTION")
        except:
            exception_window.pop_up_window("Invalid date constrains! or entries", "PRODUCT MANAGEMENT EXCEPTION")
示例#4
0
 def AddItem(self):
     # ALL BUFFERS should be initially RESET
     """During validation of entries ->
         add_name should contain chaaracters not exceeding ??
         category should contain chaaracters not exceeding ??
         price should be convertable to float, which value should not exceed 1000
         barcode should be convertable to int, and should not be negative
     """
     self.add_name = self.e_add_name.get()
     self.barcode = self.e_barcode.get()
     self.category = self.e_category.get()
     self.price = self.e_price.get()
     if self.barcode.isdecimal():
         try:
             self.price = float(self.price)
             if self.price <= 0:
                 exception_window.pop_up_window("Weight value must be positive!",
                                                "ADD NEW ITEM EXCEPTION")
         except ValueError:
             exception_window.pop_up_window("Weight must have a positive numerical value separated by dots (.)!",
                                            "ADD NEW ITEM EXCEPTION")
     else:
         exception_window.pop_up_window("Use only digits in Barcode entry!", "ADD NEW ITEM EXCEPTION")
示例#5
0
 def SupplyBatch(self):
     # ALL BUFFERS should be initially RESET
     """During validation of entries ->
         barcode should be convertable to int, and should not be negative
         exp_date should be formatted according to calendar entry
             (thus, it should be validated in this regard, or should not be editable at all)
         quantity should be convertable to int, and should not be negative
         weight should be convertable to float, and should not be negative
             XOR - logic between variables quantity and weight
     """
     self.barcode = self.e_supply_barcode.get()
     # self.exp_date
     self.quantity = self.e_supply_quantity.get()
     self.weight = self.e_supply_weight.get()
     if self.barcode.isdecimal():
         if self.quantity.isdecimal():
             exception_window.pop_up_window("Quantity must be a numerical value!", "SUPPLY BATCH EXCEPTION")
         try:
             self.weight = float(self.weight)
             if self.weight <= 0:
                 exception_window.pop_up_window("Weight value must be positive!",
                                                "SUPPLY BATCH EXCEPTION")
         except ValueError:
             exception_window.pop_up_window("Weight must have a positive numerical value separated by dots (.)!",
                                            "SUPPLY BATCH EXCEPTION")
         try:
             if self.exp_date < datetime.today():
                 exception_window.pop_up_window(
                     "The batch expiration date cannot be exceeded with respect to current date!",
                     "SUPPLY BATCH EXCEPTION")
         except:
             exception_window.pop_up_window("Invalid format of expiration date!","SUPPLY BATCH EXCEPTION")
             if len(self.weight) > 0 and len(self.quantity) > 0 or len(self.weight) == 0 and len(self.quantity) == 0:
                 exception_window.pop_up_window(
             "Enter the quantity/weight of the product, and do not enter both values simultaniously!",
             "SUPPLY BATCH EXCEPTION")
             else:
                 print("Carry on")
     else:
         exception_window.pop_up_window("Use only digits in Barcode entry!", "SUPPLY BATCH EXCEPTION")