Commit d1fc4c7e by 夏超

[fix] 东联推送添加UUID

parent bea2ea5c
import datetime
import json
import logging
import uuid
from collections import defaultdict
import pymssql
......@@ -171,13 +171,14 @@ class InheritRokeWorkstationPicking(RokeWorkstationPicking):
except Exception as e:
return {"code": 1, "message": "数据库链接失败,请检查数据库链接参数", "data": None}
sql = """
INSERT INTO WBLLD (WBLLD_RWBH, WBLLLD_RWLX, WBLLD_CPBH, WBLLD_XQSL, WBLLD_LLSL, WBLLD_datetime, WBLLD_YGBH, WBLLD_YGMC)
INSERT INTO WBLLD (F_UUID, WBLLD_RWBH, WBLLLD_RWLX, WBLLD_CPBH, WBLLD_XQSL, WBLLD_LLSL, WBLLD_datetime, WBLLD_YGBH, WBLLD_YGMC)
VALUES
"""
sql_list = []
_uuid = uuid.uuid1()
for v in task_id_list:
sql_list.append(f"""
('{v.get("code", "")}', '{v.get("task_type", "")}', '{v.get("material_code", "")}', {v.get("demand_qty", 0)}, {v.get("qty", 0)},
('{_uuid}', '{v.get("code", "")}', '{v.get("task_type", "")}', '{v.get("material_code", "")}', {v.get("demand_qty", 0)}, {v.get("qty", 0)},
'{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}', '{emp.code or ""}', '{emp.name or ""}')
""")
if not sql_list:
......
import datetime
import uuid
import pymssql
import logging
......@@ -54,15 +55,16 @@ class InheritRokeResultPutWarehouseWizard(models.TransientModel):
em = self.env["roke.employee"].search([("user_id", "=", self.env.uid)], limit=1)
insert_sql_data = []
_uuid = uuid.uuid1()
for v in results:
if v.id in insert_id:
continue
insert_sql_data.append(f"""
('{v.product_id.code}', '{v.wo_id.code}', {v.qty or 0}, {v.id}, '{v.pt_id.code}', '{v.pt_id.task_type}',
({_uuid}, '{v.product_id.code}', '{v.wo_id.code}', {v.qty or 0}, {v.id}, '{v.pt_id.code}', '{v.pt_id.task_type}',
'{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}', '{em.code or ""}', '{em.name or ""}')
""")
sql = """
INSERT INTO WBCCB (WBCCB_CPBH, WBCCB_GDBH, WBCCB_CCSL, WBCCB_CCID, WBCCB_RWBH, WBCCB_RWLX, WBCCB_datetime, WBCCB_YGBH, WBCCB_YGMC)
INSERT INTO WBCCB (F_UUID, WBCCB_CPBH, WBCCB_GDBH, WBCCB_CCSL, WBCCB_CCID, WBCCB_RWBH, WBCCB_RWLX, WBCCB_datetime, WBCCB_YGBH, WBCCB_YGMC)
VALUES
"""
if not insert_sql_data:
......
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