Exemplo n.º 1
0
    def validate_orderQry_list(self):

        orderQry_list = [
            x for x in self.order_list if x[2] > 5 and not x[0].isnumeric()
        ]

        for orderQry_error in orderQry_list:

            validate_error_obj = validateError()

            if orderQry_error[0] is None or orderQry_error[0] == "":

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_QUANTITY_REQUIRED").data
                validate_error_obj.row = orderQry_error[1]
                validate_error_obj.column = get_column_letter(
                    orderQry_error[2])

            elif not orderQry_error[0].isnumeric():

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_QUANTITY_INTEGER").data
                validate_error_obj.row = orderQry_error[1]
                validate_error_obj.column = get_column_letter(
                    orderQry_error[2])

            self.error_list.append(validate_error_obj)

        return self.error_list
Exemplo n.º 2
0
    def validate_item_list(self):

        item_list = [
            x for x in self.order_list
            if x[2] == 1 and (not x[0].isnumeric() or x[0] == "")
        ]

        for item_error in item_list:

            validate_error_obj = validateError()

            if item_error[0] is None or item_error[0] == "":

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_ITEM_REQUIRED").data
                validate_error_obj.row = item_error[1]
                validate_error_obj.column = get_column_letter(item_error[2])

            elif not item_error[0].isnumeric():

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_ITEM_INTEGER").data
                validate_error_obj.row = item_error[1]
                validate_error_obj.column = get_column_letter(item_error[2])

            self.error_list.append(validate_error_obj)

        return self.error_list
Exemplo n.º 3
0
    def validate_customer_code(self,customer_code) :

        validateError_obj =  validateError()

        if not str(customer_code) :

            validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_CUSTOMERCODE_REQUIRED").data  
            validateError_obj.row = self.row_int + 1
            validateError_obj.column = 1

            self.validateError_list.append(validateError_obj)

            return None
        
        else : 
                                    
            customer_list = Customer.objects.filter(customer_code__iexact = str(customer_code))

            if len(customer_list) <=0 :
                                        
                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_CUSTOMERCODE_EXISTING").data  
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 1

                self.validateError_list.append(validateError_obj)

                return None

            else :

                return  str(customer_code)
Exemplo n.º 4
0
    def validate_plant_list(self):

        plant_list = [
            x for x in self.order_list
            if x[0].upper() in list(self.get_plant_codet_in_workbook())
            and x[2] == 5
        ]

        for plant_error in plant_list:

            validate_error_obj = validateError()

            station_len_int = len(
                Station.objects.filter(station_code__iexact=str(
                    plant_error[0]),
                                       station_type__iexact="PLANT",
                                       is_active=True))

            if plant_error[0] is None or plant_error[0] == "":

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_PLANTCODE_REQUIRED").data
                validate_error_obj.row = plant_error[1]
                validate_error_obj.column = get_column_letter(plant_error[2])

            elif station_len_int == 0:

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_PLANTCODE_DATABASE").data
                validate_error_obj.row = plant_error[1]
                validate_error_obj.column = get_column_letter(plant_error[2])

            self.error_list.append(validate_error_obj)

        return self.error_list
Exemplo n.º 5
0
    def validate_project_code(self,project_code) :

        validateError_obj =  validateError()

        if not str(project_code) :

            validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PROJECTCODE_REQUIRED").data
            validateError_obj.row = self.row_int + 1
            validateError_obj.column = 2

            self.validateError_list.append(validateError_obj)

            return None
                                
        else : 
            project_list = Project.objects.filter(project_code__iexact = str(project_code))
                                    
            if len(project_list) <=0 :

                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PROJECTCODE_EXISTING").data
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 2

                self.validateError_list.append(validateError_obj)

                return None

            else :

                return str(project_code)
Exemplo n.º 6
0
    def validate_plant_code(self,plant_code) :

        validateError_obj =  validateError()

        if not str(plant_code) :

            validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PLANTCODE_REQUIRED").data
            validateError_obj.row = self.row_int + 1
            validateError_obj.column = 5

            self.validateError_list.append(validateError_obj)

            return None
                                
        else : 
                                    
            plant_list = Station.objects.filter(station_code__iexact=str(plant_code).strip(),station_type__iexact="PLANT",is_active=True)
                                    
            if len(plant_list) <=0 :

                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PLANTCODE_EXISTING").data
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 6

                self.validateError_list.append(validateError_obj)

                return None

            else :

                return str(plant_code)
Exemplo n.º 7
0
    def validate_route_code(self,route_code) :

        validateError_obj =  validateError()

        if not str(route_code) :

            validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_ROUTECODE_REQUIRED").data
            validateError_obj.row = self.row_int + 1
            validateError_obj.column = 3

            self.validateError_list.append(validateError_obj)

            return None
                                
        else : 
                                    
            return str(route_code)
Exemplo n.º 8
0
    def validate_pickup_before(self,pickup_before) :

        validateError_obj =  validateError()

        if  not pickup_before.isdigit() :
                                
            validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PICKUPBEFORE_INTEGER").data
            validateError_obj.row = self.row_int + 1
            validateError_obj.column = 7

            self.validateError_list.append(validateError_obj)

            return None

        else :

            return int(pickup_before)
Exemplo n.º 9
0
    def validate_complete_time(self,complete_time) :

        validateError_obj =  validateError()

        if  not isinstance(complete_time, int) :
    
            if rex.match(str(complete_time)):

                return str(complete_time)

            else :

                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_COMPLETETIME_INCORRECT_FORMAT").data
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 12

                self.validateError_list.append(validateError_obj)

                return None
Exemplo n.º 10
0
    def validate_delivery_time(self,delivery_time) :

        validateError_obj =  validateError()

        if  not isinstance(delivery_time, int) :
    
            if rex.match(str(delivery_time)):

                return str(delivery_time)

            else:

                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_DELIVERYTIME_INCORRECT_FORMAT").data
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 11
            
                self.validateError_list.append(validateError_obj)

                return None
Exemplo n.º 11
0
    def validate_pickup_time(self,pickup_time) :

        validateError_obj =  validateError()

        if  not isinstance(pickup_time, int) :
    
            if rex.match(str(pickup_time)):
        
                return str(pickup_time)

            else:

                validateError_obj.error = configMessage.configs.get("ROUTE_MASTER_PICKUPTIME_INCORRECT_FORMAT").data
                                    
                validateError_obj.row = self.row_int + 1
                validateError_obj.column = 9

                self.validateError_list.append(validateError_obj)

                return None
Exemplo n.º 12
0
    def validate_partNumber_list(self):

        partNumber_list = [
            x for x in self.order_list if x[2] == 2 and x[0] == ""
        ]

        for partNumber_error in partNumber_list:

            validate_error_obj = validateError()

            if partNumber_error[0] is None or partNumber_error[0] == "":

                validate_error_obj.error = configMessage.configs.get(
                    "UPLOAD_ORDER_PARTNUMBER_REQUIRED").data
                validate_error_obj.row = partNumber_error[1]
                validate_error_obj.column = get_column_letter(
                    partNumber_error[2])

            self.error_list.append(validate_error_obj)

        return self.error_list