提交 142dac5a authored 作者: 苏星豪's avatar 苏星豪

合并分支 'dev' 到 'test'

金彩山垛标绑定/删除重复方法 查看合并请求 tj_django/datacenter!15
......@@ -13861,41 +13861,6 @@ def label_replace(request,what,id=None):
return JsonResponse(data)
def jcs_virtual_stack_binding(batch,stack_binding):
data = {'stacks': [],'insert_sql': []}
for i in stack_binding:
is_physical = True
code = i['stack']
if code[:4] == 'xndb':
is_physical = False
stks = Stack.objects.filter(code=code)
if stks:
stack = stks[0]
else:
stack = Stack(company_id=batch.company_id, code=code)
stack.product_id = batch.product_id
stack.store_id = batch.store_fr_id
stack.is_physical = is_physical
stack.qty_lmt = 0
stack.save()
if stack.code_is_permanent == False:
# 2022-07-02 如诗仙太白含垛标套标,已事先将对应箱标写入stackdetails,入库时只扫垛标,不会上传垛标下面绑定的箱标
i['labels'] = []
for d in stack.stackdetails_stack.all():
i['labels'].append(d.label_code)
if batch.product_id:
product_id = str(batch.product_id)
else:
product_id = 'null'
for l in i['codes']:
data['insert_sql'].append("('" + l + "','" + l[:4] + "'," + product_id + "," + str(stack.id) + ")")
data['stacks'].append(code)
# s = "INSERT INTO inventory_stackdetails(company_id,product_id,label_pk_id,label_id,label_pkg,label_code,tm,stack_id) " + \
# "select company_id,product_id,label_pk_id,label_id,label_pkg,label_code,now(),stack_id " + \
# "from inventory_stkdetails where batch_id=" + str(batch.id) + " and stack_id>0 " + \
# "on CONFLICT(stack_id,label_pk_id) do nothing"
return data
def jcs_virtual_stack_binding(batch,stack_binding,company_id):
data = {'e': '' }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论