协助我的代码 - 自动化仓储库存控制

如何解决协助我的代码 - 自动化仓储库存控制

下面的代码是我的个人项目。我是初学者,每天还在学习,所以,它并不完美。所以,对于有经验的人来说,有些事情可能是多余的。

问题陈述:自动化仓储库存控制

问题:一旦托盘上的物品数量达到一定数量,如果您请求的数量高于可用数量,它不会向您显示错误消息。它将继续而不是停止并给您一条消息,让您知道您不能这样做或没有足够的可用产品。

""" 这是他必须调整的文件。从库存的角度来看。 """

class Product: #Parent of the class Product
    def __init__(self,name,width,length,height,weight_of_case,UPC,quantity):   #the __init__() is a method. Initializer,constructor.
        self.name = name  #parameters are the variables attached to the method.
        self.width = width
        self.length = length
        self.height = height
        self.weight_of_case = weight_of_case
        self.UPC = UPC
        self.quantity = quantity
        print("Product Created.")

"""
class Toilet_Paper(Product): #This is just to test the inheritance of the value
    pass #This would be considered the sibling of the Product class

class Snacks(Product): #This is just to test the inheritance of the value
    pass #This would be considered the sibling of the Product class
"""
class New_Product: #Parent of the class New_Product
    def __init__(self,new_name,new_width,new_length,new_height,new_weight_of_case,new_UPC,new_quantity):
        self.new_name = new_name  # parameters are the variables attached to the method.
        self.new_width = new_width
        self.new_length = new_length
        self.new_height = new_height
        self.new_weight_of_case = new_weight_of_case
        self.new_UPC = new_UPC
        self.new_quantity = new_quantity
        print("New Product Created.")
"""
class Drinks(New_Product): #This is just to test the inheritance of the value
    pass #This would be considered the sibling of the Product class
"""
p = Product(input("Name of Product: "),float(input("Width of case: ")),float(input("Length of case: ")),float(input("Height of case: ")),float(input("Weight of case: ")),input("Enter UPC: "),input("Enter amount of pieces: "))  #This is how you create a new product.

weight_of_case = p.weight_of_case #This gets the attribute within p.

def casesremaining(total_cases,cases_selected):
    return total_cases - cases_selected #if user enters more cases than are available to select,user should get a message saying "you canot select more cases than you have

def totalweight(weight_of_case,total_cases):
    return weight_of_case * total_cases

def weight_of_cases_selected(cases_selected,weight_of_case):
    return cases_selected * weight_of_case

total_cases = int(input("Enter amount of total cases on pallet: "))
total_weight = totalweight(float(weight_of_case),float(total_cases))
application = 1
yes = "yes"
no = "no"

print("Product added to pallet.")
print("Total weight of pallet is: {:.2f}.".format(total_weight))
print("Total amount of cases on a pallet is: ",total_cases)

while application == 1: #Could use "for cases in pallet():"
    case_selection = (input("Do you want to select a case? yes/no: "))
    if case_selection == yes:
        select = int(input("How many cases would you like to select? "))
        cases_selected = select
        total_weight_of_cases_selected = weight_of_cases_selected(float(cases_selected),float(weight_of_case))

        def remainingweight(total_weight,total_weight_of_cases_selected):
            return total_weight - total_weight_of_cases_selected

        remaining_weight = remainingweight(float(total_weight),float(total_weight_of_cases_selected))
        if cases_selected == select:
            total_cases_remaining = casesremaining(int(total_cases),int(cases_selected))
            total_cases = total_cases_remaining #Forgot to update the original variable from input.
            total_weight = remaining_weight #Same here. Remember to update variables as the program goes.
            print("Total weight now is: {:.2f}".format(remaining_weight))
            print("You know have ",total_cases_remaining," cases remaining.")
        #work on this
            if cases_selected > total_cases:  # new 10/25/2020 #Continue to check this. Not working
                print("You cannot select more than what is available on the pallet.")
                print("You need to order more.") #make a def or modify the actual def already in place.
                yes = "yes" or "y" or "Yes"
                no = "no" or "n" or "No"
                order_more = input("Would you like to order more? yes/no")
                continue
        if total_cases == 0: #new part 10/1/2020
            print("Your total amount of cases on the pallet is ",".")
            print("You have no more cases on the pallet.")
            no = "no"
            add = "add"
            change = "change"
            add_cases = input("Would you like to add more cases on the pallet,or change product? (add/change/no) ")
            if add_cases == add:
                cases_to_add = int(input("How many cases would you like to add? "))
                total_cases = cases_to_add+total_cases_remaining
                total_weight = weight_of_case * cases_to_add
                print("You have added to your pallet,",cases_to_add," more cases.")
                print("Your total cases on pallet now is: ",total_cases,".")
                print("Your total weight of pallet now is: {:.2f}.".format(total_weight))
            elif add_cases == change: #added on 10/12/2020 - May not work.
                new_p = New_Product(input("Name of Product: "),input("Enter amount of pieces: "))
                weight_of_case = new_p.new_weight_of_case  # This gets the attribute within p.
                total_cases = int(input("Enter amount of total cases on pallet: "))  # problem is not changing the value after input.
                total_weight = totalweight(float(weight_of_case),float(total_cases))
                print("New Product added to pallet.")
                print("Total weight of pallet is: {:.2f}.".format(total_weight))
                print("Total amount of cases on a pallet is: ",total_cases)
                continue
            else:
                if add_cases == no:
                    print("Thank you for using our application.")
                    break
    else:
        if case_selection == no or application == 0:
            print("Thank you for using our application.")
            break

#add 选项以添加更多产品。 #添加通过str(字符串)范围4拉出UPC的最后4个的能力:。 #即通过匹配 UPC 的最后 4 个来更轻松、更快速地识别大小写。

""" “还要加上每次更改发生的时间和日期。” “该应用程序根据每个案例的重量计算案例总数。 “由于重量,应用程序可识别每个托盘的不同数量的箱子。 "也许您可以添加维度来指定不同类型的产品??? “您可以输入产品 ID。 “您可以添加 UPC。 “您可以在哪里或使用什么来保存多个值(多个位置保存案例),以便应用程序可以继续跟踪库存?\n”, """

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-