Accept Merge Request #2192: (feature/齐套检查与下达生产 -> develop)

Merge Request: 下发时修改需求计划的总预计加工时间

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2192
This commit is contained in:
管欢
2025-06-16 08:53:35 +08:00
committed by Coding
4 changed files with 6 additions and 39 deletions

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers
from . import models
from . import wizard

View File

@@ -1 +0,0 @@
from . import controllers

View File

@@ -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)

View File

@@ -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(','):