Commit 1b09c945 by Aeolus

补货逻辑修改

parent 803caef7
...@@ -327,6 +327,7 @@ class TallyRecord(Base): ...@@ -327,6 +327,7 @@ class TallyRecord(Base):
hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号') hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号')
production_id = Column(INTEGER(10), nullable=False, comment='商品id') production_id = Column(INTEGER(10), nullable=False, comment='商品id')
production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称') production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
tally_count = Column(TINYINT(3), nullable=False, comment='补货数量')
status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1指令已下发(等待开仓) 2指令上报(补货完成)') status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1指令已下发(等待开仓) 2指令上报(补货完成)')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
......
...@@ -52,10 +52,10 @@ def get_production_list(): ...@@ -52,10 +52,10 @@ def get_production_list():
"content": i.content, "content": i.content,
"summary": i.summary, "summary": i.summary,
"status": i.status, "status": i.status,
"count": 1 "count": i.left_count
} }
else: else:
tmp_dict[i.production_id]["count"] += 1 tmp_dict[i.production_id]["count"] += i.left_count
tmp_dict[i.production_id]["hatch_no"].append(i.hatch_no) tmp_dict[i.production_id]["hatch_no"].append(i.hatch_no)
hatch_data = list(tmp_dict.values()) hatch_data = list(tmp_dict.values())
return BaseResponse(data=hatch_data) return BaseResponse(data=hatch_data)
...@@ -92,6 +92,7 @@ def get_production_info(): ...@@ -92,6 +92,7 @@ def get_production_info():
"content": hatch_info.content, "content": hatch_info.content,
"summary": hatch_info.summary, "summary": hatch_info.summary,
"status": hatch_info.status, "status": hatch_info.status,
"count": hatch_info.left_count
} }
return BaseResponse(data=hatch_data) return BaseResponse(data=hatch_data)
......
...@@ -238,6 +238,8 @@ def get_tallyman_hatch_list(): ...@@ -238,6 +238,8 @@ def get_tallyman_hatch_list():
"production_id": i.production_id, "production_id": i.production_id,
"name": i.name, "name": i.name,
"status": i.status, "status": i.status,
"left_count": i.left_count,
"total_count": i.total_count
} for i in hatch_list] } for i in hatch_list]
return BaseResponse(data=hatch_data) return BaseResponse(data=hatch_data)
...@@ -278,6 +280,7 @@ def run_tally_start(): ...@@ -278,6 +280,7 @@ def run_tally_start():
tally_record.hatch_no = i.hatch_no tally_record.hatch_no = i.hatch_no
tally_record.production_id = i.production_id tally_record.production_id = i.production_id
tally_record.production_name = i.name tally_record.production_name = i.name
tally_record.tally_count = i.total_count - i.left_count if i.left_count > 0 else i.total_count
tally_record.status = 1 tally_record.status = 1
db.session.add(tally_record) db.session.add(tally_record)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment