可以帮我解决这个更新库存功能,哪里出错了? [英] can help me with this Update inventory funciton, where is wrong?

查看:79
本文介绍了可以帮我解决这个更新库存功能,哪里出错了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




目前我在做这个汽车预订网站。我想只在客户开始预订时间前一天更新我们的库存,因此在此之前,我仍然可以租给其他客户。例如。如果她在两个月前预订,我仍然可以在这2个月内将这辆车租给其他人,但有一天我需要扣除这辆车的库存,因为第二天我必须把这辆车交给那个顾客。

以下是我的汽车库存更新功能。但它似乎不能按我的方式工作,因为我循环遍历我的Booking1表以获取所有start_datetime并仅在此start_datetime前一天更新我的库存。我的start_datetime的格式为2007-12-21 17:05:05,我使用Bktime = time.mktime(time.strptime(%,%Y-%m-%)将其更改为秒d%H:%M:%S))。但它似乎不起作用。谁能帮我这个。可以在start_datetime前一天更新我的汽车库存。感谢任何帮助:)

hi

currently i am doing this car booking website. i would like to only update our inventory one day before customer''s start booking time, thus before that, i am still able to rent to other customers. E.g. if she book two month before, i can still rent this car to others within this 2 month, but one day before i need to deduct this car inventory as the next day i have to give this car to that customer.
the following is my car inventory update function. but it seems did not work in my way, as i loop through my Booking1 table to get all the start_datetime and update my inventory only if it is one day before this start_datetime. my start_datetime is in the format of "2007-12-21 17:05:05", i have changed it into seconds by using Bktime=time.mktime(time.strptime(invtime,"%Y-%m-%d %H:%M:%S")). but it seems not work. can anyone help me with this. can update my car inventory only one day before the start_datetime. thanks for any kind help:)

展开 | 选择 | Wrap | 行号

推荐答案





目前我在做这个汽车预订网站。我想只在客户开始预订时间前一天更新我们的库存,因此在此之前,我仍然可以租给其他客户。例如。如果她在两个月前预订,我仍然可以在这2个月内将这辆车租给其他人,但有一天我需要扣除这辆车的库存,因为第二天我必须把这辆车交给那个顾客。

以下是我的汽车库存更新功能。但它似乎不能按我的方式工作,因为我循环遍历我的Booking1表以获取所有start_datetime并仅在此start_datetime前一天更新我的库存。我的start_datetime的格式为2007-12-21 17:05:05,我使用Bktime = time.mktime(time.strptime(%,%Y-%m-%)将其更改为秒d%H:%M:%S))。但它似乎不起作用。谁能帮我这个。可以在start_datetime前一天更新我的汽车库存。感谢任何帮助:)

hi

currently i am doing this car booking website. i would like to only update our inventory one day before customer''s start booking time, thus before that, i am still able to rent to other customers. E.g. if she book two month before, i can still rent this car to others within this 2 month, but one day before i need to deduct this car inventory as the next day i have to give this car to that customer.
the following is my car inventory update function. but it seems did not work in my way, as i loop through my Booking1 table to get all the start_datetime and update my inventory only if it is one day before this start_datetime. my start_datetime is in the format of "2007-12-21 17:05:05", i have changed it into seconds by using Bktime=time.mktime(time.strptime(invtime,"%Y-%m-%d %H:%M:%S")). but it seems not work. can anyone help me with this. can update my car inventory only one day before the start_datetime. thanks for any kind help:)

展开 | 选择 | Wrap | 行号



您计算 onebefore 的方式,它将始终评估为True。我认为您应该计算出租车的日期和当前日期之间的差异,如果差异大于一天,请将车保留在库存中,否则将其移除。
The way you have calculated onebefore, it will always evaluate to True. I think you should calculate the difference between the date the car has been rented and the present date, and if the difference is greater than one day, keep the car in inventory, otherwise remove it.



谢谢你,我按照这个逻辑做了,我觉得这是正确的。但它的错误很小。我的代码如下:

thanks for it, i have done according to this logic and i feel it is correct. but it got small error. my code is in the following:

展开 | 选择 | Wrap | 行号



您计算 onebefore 的方式,它将始终评估为True。我认为您应该计算出租车的日期和当前日期之间的差异,如果差异大于一天,请将车保留在库存中,否则将其移除。
The way you have calculated onebefore, it will always evaluate to True. I think you should calculate the difference between the date the car has been rented and the present date, and if the difference is greater than one day, keep the car in inventory, otherwise remove it.



谢谢你,我按照这个逻辑做了,我觉得这是正确的。但它的错误很小。我的代码如下:

thanks for it, i have done according to this logic and i feel it is correct. but it got small error. my code is in the following:

展开 | 选择 | Wrap | 行号


这篇关于可以帮我解决这个更新库存功能,哪里出错了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆