Commit fa35b8bb by 夏超

[fix] 返修单生产工单产品问题

parent c4f7b918
...@@ -42,11 +42,11 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask): ...@@ -42,11 +42,11 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask):
sql = f""" sql = f"""
SELECT id, type, create_date SELECT id, type, create_date
FROM ( FROM (
SELECT roke_production_task.id, 'task' as "type", roke_production_task.create_date {f'''SELECT roke_production_task.id, 'task' as "type", roke_production_task.create_date
FROM roke_production_task LEFT JOIN roke_work_order on roke_work_order.task_id = roke_production_task.id FROM roke_production_task LEFT JOIN roke_work_order on roke_work_order.task_id = roke_production_task.id
WHERE roke_work_order.id in ({" , ".join([f"{v}" for v in work_order.ids])}) WHERE roke_work_order.id in ({" , ".join([f"{v}" for v in work_order.ids])})
and roke_production_task.state in ('未完工', '暂停') and roke_production_task.state in ('未完工', '暂停')
union all union all''' if work_order.ids else ""}
SELECT id, 'work' as "type", create_date SELECT id, 'work' as "type", create_date
FROM roke_work_order FROM roke_work_order
WHERE type = '返修' WHERE type = '返修'
...@@ -63,11 +63,11 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask): ...@@ -63,11 +63,11 @@ class JzjxInheritRokeWorkstationProductionTask(RokeWorkstationProductionTask):
count_sql = f""" count_sql = f"""
SELECT count(id) SELECT count(id)
FROM ( FROM (
SELECT roke_production_task.id {f'''SELECT roke_production_task.id, 'task' as "type", roke_production_task.create_date
FROM roke_production_task LEFT JOIN roke_work_order on roke_work_order.task_id = roke_production_task.id FROM roke_production_task LEFT JOIN roke_work_order on roke_work_order.task_id = roke_production_task.id
WHERE roke_work_order.id in ({" , ".join([f"{v}" for v in work_order.ids])}) WHERE roke_work_order.id in ({" , ".join([f"{v}" for v in work_order.ids])})
and roke_production_task.state in ('未完工', '暂停') and roke_production_task.state in ('未完工', '暂停')
union all union all''' if work_order.ids else ""}
SELECT id SELECT id
FROM roke_work_order FROM roke_work_order
WHERE type = '返修' WHERE type = '返修'
......
...@@ -24,3 +24,12 @@ class JzjxInheritProduction(InheritProduction): ...@@ -24,3 +24,12 @@ class JzjxInheritProduction(InheritProduction):
if repair_process_id: if repair_process_id:
res.update({"repair_process_id": repair_process_id}) res.update({"repair_process_id": repair_process_id})
return res return res
class JzjxRokeRefixAutoWorkOrder(http.Controller):
@http.route('/roke/config/get_refix_auto_work_order', type='json', auth='none', csrf=False, cors="*")
def get_refix_auto_work_order(self):
_self = http.request
refix_params = _self.env['ir.config_parameter'].sudo().get_param("refix_auto_work_order")
return {"code": 0, "message": "成功!", "state": refix_params == "True" or refix_params is True}
...@@ -26,8 +26,8 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel): ...@@ -26,8 +26,8 @@ class InheritRokeCreateWorkRecordWizard(models.TransientModel):
"product_id": new_record.work_order_id.product_id.id, "product_id": new_record.work_order_id.product_id.id,
"plan_qty": v.qty, "plan_qty": v.qty,
"sequence": 1, "sequence": 1,
"planned_start_time": datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), "planned_start_time": new_record.work_order_id.planned_start_time,
"plan_date": datetime.datetime.now().strftime('%Y-%m-%d') + " 23:59:59", "plan_date": new_record.work_order_id.plan_date,
"repair_task_id": new_record.pt_id.id or repair.wo_id.repair_task_id.id, "repair_task_id": new_record.pt_id.id or repair.wo_id.repair_task_id.id,
"type": "返修" "type": "返修"
}) })
......
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