Commit b90cb138 by 夏超

[fix] 修改问题

parent 5e618c3c
...@@ -33,6 +33,8 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask): ...@@ -33,6 +33,8 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask):
[('workstation_ids', '=', workstation_id)]) [('workstation_ids', '=', workstation_id)])
# process_list = list(set(process_ids.ids) & set(user_id.process_ids.ids)) # process_list = list(set(process_ids.ids) & set(user_id.process_ids.ids))
process_list = process_ids.ids process_list = process_ids.ids
if not process_ids:
return {"code": 0, "message": "获取成功!", "data": [], "process_ids": [], "count": 0}
domain = [ domain = [
("task_id.workshop_id", "=", workstation.workshop_id.id), ("task_id.workshop_id", "=", workstation.workshop_id.id),
("process_id", "in", process_list), ("process_id", "in", process_list),
......
...@@ -32,10 +32,88 @@ class RokeWorkstationWorkOrderModel(http.Controller): ...@@ -32,10 +32,88 @@ class RokeWorkstationWorkOrderModel(http.Controller):
html = template.render(values) html = template.render(values)
return html return html
@http.route('/roke/workstation/craft_design/workstation_bom/get', type='json', auth='user', csrf=False,
cors="*")
def workstation_bom_get(self):
"""
获取工艺明细的关键物料
"""
_self = http.request
routing_line_id = _self.jsonrequest.get("routing_line_id", 0)
p_bom_line = _self.env["roke.mes.p_bom.line"].search([("routing_line_id", "=", routing_line_id)],
order="create_date desc")
bom_list = []
for v in p_bom_line:
bom_list.append({
"id": v.id,
"product_id": v.product_id.id,
"product_name": v.product_id.name,
"qty": v.qty,
"must": v.must
})
return {"code": 0, "message": f"获取成功!", "data": bom_list}
@http.route('/roke/workstation/craft_design/workstation_bom/create', type='json', auth='user', csrf=False,
cors="*")
def workstation_bom_create(self):
"""
创建工艺明细的关键物料
"""
_self = http.request
routing_line_id = _self.jsonrequest.get("routing_line_id", 0)
product_id = _self.jsonrequest.get("product_id", 0)
qty = _self.jsonrequest.get("qty", 0)
must = _self.jsonrequest.get("must", False)
product = _self.env["roke.product"].search([("id", "=", product_id)])
if not product:
return {"code": 1, "message": "没找到对应的产品!"}
_self.env["roke.mes.p_bom.line"].create({
"product_id": product.id,
"product_routing_id": product.routing_id.id,
"routing_line_id": routing_line_id,
"qty": qty,
"must": must
})
return {"code": 0, "message": f"获取成功!"}
@http.route("/roke/workstation/craft_design/workstation_bom/update", type='json', auth="user", cors='*', csrf=False)
def workstation_bom_update(self, **kwargs):
"""
修改工艺明细的关键物料
"""
_self = http.request
bom_info = _self.jsonrequest.get("bom_info", [])
p_bom_line = _self.env["roke.mes.p_bom.line"]
for item in bom_info:
bom_id = item.get("id", 0)
product_id = item.get("product_id", 0)
product = _self.env["roke.product"].search([("id", "=", product_id)])
qty = item.get("qty", 0)
must = item.get("must", False)
p_bom_line_id = p_bom_line.sudo().search([("id", "=", bom_id)])
p_bom_line_id.write({
"product_id": product.id,
"product_routing_id": product.routing_id.id,
"qty": qty,
"must": must
})
return {"code": 0, "message": "更新成功"}
@http.route("/roke/workstation/craft_design/workstation_bom/delete", type='json', auth="user", cors='*', csrf=False)
def workstation_bom_delete(self, **kwargs):
"""
删除工艺明细的关键物料
"""
_self = http.request
bom_id = _self.jsonrequest.get("id", 0)
_self.env["roke.mes.p_bom.line"].search([("id", "=", bom_id)]).unlink()
return {"code": 0, "message": "删除成功"}
@http.route('/roke/workstation/craft_design/workstation_product/get', type='json', auth='user', csrf=False, cors="*") @http.route('/roke/workstation/craft_design/workstation_product/get', type='json', auth='user', csrf=False, cors="*")
def workstation_product_get(self): def workstation_product_get(self):
""" """
获取工单的不良报工记录 获取产品的数据,格式和工艺设计树一样
""" """
_self = http.request _self = http.request
product_id = _self.jsonrequest.get("product_id", 0) product_id = _self.jsonrequest.get("product_id", 0)
......
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