From e145e8a3a476dff0adaa4b0334bfb37afcdaa3dd Mon Sep 17 00:00:00 2001 From: guanhuan Date: Fri, 13 Jun 2025 15:40:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E5=8F=91=E6=97=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=AE=A1=E5=88=92=E7=9A=84=E6=80=BB=E9=A2=84?= =?UTF-8?q?=E8=AE=A1=E5=8A=A0=E5=B7=A5=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_demand_plan/__init__.py | 1 - sf_demand_plan/controllers/__init__.py | 1 - sf_demand_plan/controllers/controllers.py | 37 ----------------------- sf_mrs_connect/controllers/controllers.py | 6 ++++ 4 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 sf_demand_plan/controllers/__init__.py delete mode 100644 sf_demand_plan/controllers/controllers.py diff --git a/sf_demand_plan/__init__.py b/sf_demand_plan/__init__.py index cec04a5b..408a6001 100644 --- a/sf_demand_plan/__init__.py +++ b/sf_demand_plan/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- -from . import controllers from . import models from . import wizard diff --git a/sf_demand_plan/controllers/__init__.py b/sf_demand_plan/controllers/__init__.py deleted file mode 100644 index e046e49f..00000000 --- a/sf_demand_plan/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import controllers diff --git a/sf_demand_plan/controllers/controllers.py b/sf_demand_plan/controllers/controllers.py deleted file mode 100644 index 5db1ebe6..00000000 --- a/sf_demand_plan/controllers/controllers.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -import logging -import json -from odoo import http, fields, models -from odoo.http import request -from odoo.addons.sf_base.controllers.controllers import MultiInheritController - - -class SfPlanMrsConnect(http.Controller, MultiInheritController): - - @http.route('/api/demand_plan/update_processing_time', type='json', auth='sf_token', methods=['GET', 'POST'], - csrf=False, - cors="*") - def update_processing_time(self, **kw): - """ - 根据模型id修改程序工时 - :param kw: - :return: - """ - try: - res = {'status': 1, 'message': '成功'} - datas = request.httprequest.data - ret = json.loads(datas) - ret = json.loads(ret['result']) - logging.info('根据模型id修改程序工时:%s' % ret) - demand_plan = request.env['sf.production.demand.plan'].sudo().search( - [('model_id', '=', ret['model_id'])]) - if demand_plan: - demand_plan.write( - {'processing_time': ret['total_estimated_time']}) - else: - res = {'status': 0, 'message': '未查到该需求计划'} - except Exception as e: - logging.info('update_demand_paln error:%s' % e) - res['status'] = -1 - res['message'] = '系统解析错误!' - return json.JSONEncoder().encode(res) diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 1091f905..b06c4213 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -42,6 +42,12 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): res = {'status': -2, 'message': '查询到待工艺确认的制造订单'} return json.JSONEncoder().encode(res) if productions: + # 修改需求计划中的程序工时 + demand_plan = request.env['sf.production.demand.plan'].with_user( + request.env.ref("base.user_admin")).search([('model_id', '=', ret['folder_name'])]) + if demand_plan and ret['total_estimated_time']: + demand_plan.write( + {'processing_time': ret['total_estimated_time']}) # 拉取所有加工面的程序文件 for r in ret['processing_panel'].split(','):