提交 47d08bb3 authored 作者: 李思鑫's avatar 李思鑫

经销商库存表加仓库

上级 4d763f20
......@@ -6958,6 +6958,7 @@ def children_stock(request):
# 2022-10-29 stkdetail分表
aid=str(c.ancestor_id)
tb_stk="stkdetails.c"+aid
print('tb_stk',tb_stk)
s="select (select name from company_company where id=b.company_id) company,"+\
"(select name from product_product where id=b.product_id) product,"+\
......@@ -6982,9 +6983,10 @@ def children_stock(request):
s="select (select name from company_company where id=b.company_id) company,"+\
"(select name from product_product where id=b.product_id) product,"+\
"b.x,b.h,b.p,b.company_id,b.product_id,"+\
"(select name from company_level where id=(select level_id from company_company where id=b.company_id)) "+\
" from (select a.product_id,a.company_id,sum(a.x) x,sum(a.h) h,sum(a.p) p from "+\
"(select product_id,company_id,"+\
"(select name from company_level where id=(select level_id from company_company where id=b.company_id)),"+\
"(select name from inventory_storehouse where id=b.store_id) store"+\
" from (select a.product_id,a.company_id,a.store_id, sum(a.x) x,sum(a.h) h,sum(a.p) p from "+\
"(select product_id,company_id,store_id,"+\
"case when label_pkg in (3,4) then "+\
"(select direction FROM inventory_voucher where id=vtype_id) "+\
"else 0 end x,"+\
......@@ -6996,7 +6998,7 @@ def children_stock(request):
"else 0 end p "+\
"from "+tb_stk+" "+sWhere+\
") a "+\
"group by a.product_id,a.company_id) b "+\
"group by a.product_id,a.company_id,a.store_id) b "+\
"order by company,product"
......@@ -7014,10 +7016,10 @@ def children_stock(request):
if r[4]:
a.append(str(r[4])+package_units[0])
if a:
qty=",".join(a)
qty=",".join(a)
data['stock'].append([
"<a href='/inventory/stock/agent/"+str(r[5])+"/'>"+r[0]+"</a>", #agent
r[8] if r[8] else '/',
r[7], #level
r[1], #product
qty #qty
......
......@@ -51,6 +51,7 @@
<thead>
<tr>
<th style='width:20%'>{% trans "经销商名称" %}</th>
<th style='width:8%'>{% trans "仓库名称" %}</th>
<th style='width:8%'>{% trans "层级" %}</th>
<th style='width:20%'>{% trans "产品名称" %}</th>
<th style='width:10%'>{% trans "库存数量" %}</th>
......@@ -59,6 +60,7 @@
<tbody></tbody>
<tfoot>
<th><input type="text" placeholder="{% trans "经销商名称" %}"></th>
<th><input type="text" placeholder="{% trans "仓库名称" %}"></th>
<th><input type="text" placeholder="{% trans "层级" %}"></th>
<th><input type="text" placeholder="{% trans "产品名称" %}"></th>
<th><input type="text" placeholder="{% trans "库存数量" %}"></th>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论