Commit 7cfdc6af by 夏超

[fix] 领料单数据上传

parent 2e6716fb
...@@ -60,6 +60,33 @@ class InheritProductionTask(models.Model): ...@@ -60,6 +60,33 @@ class InheritProductionTask(models.Model):
'folder_id': 2}) 'folder_id': 2})
files.append(a.id) files.append(a.id)
self.document_ids = [(4, a.id)] self.document_ids = [(4, a.id)]
if "finish_qty" in vals.keys() or "state" in vals.keys():
system_id = self.env.ref("roke_workstation_sync_ps.roke_workstation_sync_ps_integrate_system")
sync_address = system_id.sync_address
sync_port = system_id.sync_port
sync_uname = system_id.sync_uname
sync_passwd = system_id.sync_passwd
db_name = system_id.db_name
try:
conn = pymssql.connect(host=sync_address, user=sync_uname, password=sync_passwd, database=db_name)
cur = conn.cursor()
except Exception as e:
raise ValidationError("数据库链接失败,请检查数据库链接参数")
for v in self:
sql = f"""
UPDATE JHMRP
SET JHMRP_CCSL = {vals.get('finish_qty', 0)}
WHERE JHMRP_JHBH = '{v.code}'
"""
try:
cur.execute(sql)
conn.commit()
except Exception as e:
raise ValidationError("数据库查询失败")
finally:
cur.close()
conn.close()
return res return res
def change_routing_id_work_order(self, routing): def change_routing_id_work_order(self, routing):
......
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