fix(api): 修复创建商品时条码保存有误的问题
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
修复创建商品时条码保存有误的问题,并添加了默认的数量为1.0的条码。
This commit is contained in:
parent
3ced4879bc
commit
08ede35dff
4
app.py
4
app.py
@ -115,6 +115,7 @@ def add_product(dict_good, location):
|
|||||||
data_barcode = {
|
data_barcode = {
|
||||||
"product_id": int(response_grocy["created_object_id"]),
|
"product_id": int(response_grocy["created_object_id"]),
|
||||||
"barcode": dict_good["gtin"],
|
"barcode": dict_good["gtin"],
|
||||||
|
"amount": 1.0,
|
||||||
}
|
}
|
||||||
grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode)
|
grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode)
|
||||||
# add barcode, EAN-13, ex. 6921168593910
|
# add barcode, EAN-13, ex. 6921168593910
|
||||||
@ -122,6 +123,7 @@ def add_product(dict_good, location):
|
|||||||
data_barcode = {
|
data_barcode = {
|
||||||
"product_id": int(response_grocy["created_object_id"]),
|
"product_id": int(response_grocy["created_object_id"]),
|
||||||
"barcode": dict_good["gtin"].lstrip("0"),
|
"barcode": dict_good["gtin"].lstrip("0"),
|
||||||
|
"amount": 1.0,
|
||||||
}
|
}
|
||||||
grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode)
|
grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode)
|
||||||
|
|
||||||
@ -425,7 +427,7 @@ def add_to_stream():
|
|||||||
|
|
||||||
# 初始化 APScheduler 并添加定时任务
|
# 初始化 APScheduler 并添加定时任务
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
scheduler.add_job(func=consume_stream, trigger="interval", seconds=300)
|
scheduler.add_job(func=consume_stream, trigger="interval", seconds=10)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
# 确保程序退出时停止定时任务
|
# 确保程序退出时停止定时任务
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user