下发时修改需求计划的总预计加工时间
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from . import controllers
|
||||
@@ -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)
|
||||
@@ -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(','):
|
||||
|
||||
Reference in New Issue
Block a user