Compare commits

...

25 Commits

Author SHA1 Message Date
guanhuan
8e27ee2434 修复取消订单状态已更新时的提示 2025-02-20 10:25:56 +08:00
guanhuan
5dc5602e3d 月结取消订单 2025-02-10 09:47:42 +08:00
马广威
e20bf3816a Accept Merge Request #1790: (feature/制造功能优化 -> develop)
Merge Request: 人工线下加工工单也需要走cloud编程流程的优化需求

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1790?initial=true
2025-02-08 14:10:19 +08:00
mgw
44f29d001e 调整人工线下加工页面内容 2025-02-08 14:08:53 +08:00
mgw
aff81f0b3a Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化 2025-02-08 13:32:59 +08:00
mgw
88840abf9f 制造订单编程状态搜索的优化需求 2025-02-08 13:32:40 +08:00
胡尧
332276752a Accept Merge Request #1789: (feature/mrp_bug_fixed -> develop)
Merge Request: 修复bug

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1789?initial=true
2025-02-07 10:54:56 +08:00
胡尧
d852cf54df 修复bug 2025-02-07 10:49:17 +08:00
管欢
6756cc201c Accept Merge Request #1788: (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/1788
2025-02-06 11:14:52 +08:00
guanhuan
06dd9c12e0 人工线下加工工单下发通知修改 2025-02-06 10:43:11 +08:00
mgw
978e427734 调整制造订单集合 2025-02-05 17:44:32 +08:00
mgw
dd35a6ae5f Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化 2025-02-05 17:42:10 +08:00
mgw
0a8cc050b8 人工线下加工工单也需要走cloud编程流程的优化需求 2025-02-05 17:41:52 +08:00
管欢
eb47e4c963 Accept Merge Request #1787: (feature/工单返工优化 -> develop)
Merge Request: CNC工单返工

Created By: @管欢
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @管欢
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1787
2025-01-23 16:48:24 +08:00
guanhuan
5636681ee6 CNC工单返工 2025-01-23 16:42:16 +08:00
guanhuan
9b49edb290 装夹工单返工 2025-01-23 13:55:35 +08:00
胡尧
39b29960e3 Accept Merge Request #1786: (feature/验证合并的逻辑 -> develop)
Merge Request: Merge branch 'develop' into feature/验证合并的逻辑

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1786?initial=true
2025-01-21 10:40:27 +08:00
胡尧
6abb237491 Merge branch 'develop' into feature/验证合并的逻辑 2025-01-21 10:39:41 +08:00
胡尧
b0c043676c Accept Merge Request #1785: (release/release_2.8 -> develop)
Merge Request: 优化工件下产线,修改CNC加工工单状态为待检测时,同步修改对应质检单状态为待处理

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1785?initial=true
2025-01-21 10:39:19 +08:00
马广威
8bfe5eca03 Accept Merge Request #1783: (feature/制造功能优化 -> develop)
Merge Request: 申请编程状态控制

Created By: @马广威
Accepted By: @马广威
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1783?initial=true
2025-01-20 14:04:27 +08:00
mgw
dbcf8b1089 申请编程状态控制 2025-01-20 14:02:54 +08:00
胡尧
c436bbea46 Merge branch 'release/release_2.8' into feature/验证合并的逻辑 2025-01-17 16:12:27 +08:00
黄焱
53ceed4649 Accept Merge Request #1782: (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/1782?initial=true
2025-01-17 14:22:56 +08:00
hyyy
e39e9d8812 放弃保存 -> 不保存 2025-01-17 14:17:46 +08:00
胡尧
19e1b16122 屏蔽将制造订单的补货组修改为不同的代码 2025-01-17 09:27:38 +08:00
11 changed files with 105 additions and 26 deletions

View File

@@ -62,7 +62,7 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
const dom1 = buttonsDom.children('.o_form_button_save') const dom1 = buttonsDom.children('.o_form_button_save')
const dom2 = buttonsDom.children('.o_form_button_cancel') const dom2 = buttonsDom.children('.o_form_button_cancel')
dom1.append('保存') dom1.append('保存')
dom2.append('放弃保存') dom2.append('保存')
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)

View File

@@ -4,6 +4,7 @@ import json
import logging import logging
from odoo.addons.sf_mrs_connect.controllers.controllers import Sf_Mrs_Connect from odoo.addons.sf_mrs_connect.controllers.controllers import Sf_Mrs_Connect
from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect
from datetime import datetime
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -30,6 +31,7 @@ class WorkorderExceptionConroller(http.Controller):
workorder = request.env['mrp.workorder'].sudo().search([ workorder = request.env['mrp.workorder'].sudo().search([
('rfid_code', '=', ret['RfidCode']), ('rfid_code', '=', ret['RfidCode']),
('routing_type', '=', 'CNC加工'), ('routing_type', '=', 'CNC加工'),
('state', '!=', 'rework')
]) ])
if not workorder: if not workorder:
res = {'Succeed': False, 'ErrorCode': 401, 'Error': '无效的工单'} res = {'Succeed': False, 'ErrorCode': 401, 'Error': '无效的工单'}
@@ -41,7 +43,10 @@ class WorkorderExceptionConroller(http.Controller):
'exception_code': ret.get('coding'), 'exception_code': ret.get('coding'),
'exception_content': ret.get('Error', '') 'exception_content': ret.get('Error', '')
}) })
# 申请重新编程
workorder.production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
reprogramming_reason=ret.get('Error', ''))
workorder.production_id.write({'programming_state': '编程中', 'work_state': '编程中', 'is_rework': False})
except Exception as e: except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
_logger.info('workder_exception error:%s' % e) _logger.info('workder_exception error:%s' % e)

View File

@@ -132,6 +132,26 @@ class Sf_Bf_Connect(http.Controller):
request.cr.rollback() request.cr.rollback()
return json.JSONEncoder().encode(res) return json.JSONEncoder().encode(res)
@http.route('/api/bfm_cancel_order', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def get_bfm_cancel_order(self, **kw):
"""
业务平台取消销售订单
:param kw:
:return:
"""
res = {'status': 1, 'message': '工厂取消销售订单成功'}
logging.info('get_bfm_cancel_order:%s' % kw['order_number'])
try:
sale_order_info = request.env['sale.order'].sudo().search([('name', '=', kw['order_number'])])
sale_order_info._action_cancel()
return json.JSONEncoder().encode(res)
except Exception as e:
logging.error('get_bfm_cancel_order error: %s' % e)
res['status'] = -1
res['message'] = '工厂取消销售订单失败,请联系管理员'
return json.JSONEncoder().encode(res)
class jdElcp(http.Controller): class jdElcp(http.Controller):

View File

@@ -577,16 +577,19 @@ class MrpProduction(models.Model):
# 编程单更新 # 编程单更新
# 增加触发时间参数 # 增加触发时间参数
def update_programming_state(self, trigger_time=None): def update_programming_state(self, trigger_time=None, reprogramming_reason=None):
try: try:
manufacturing_type = 'rework' manufacturing_type = None
if self.is_scrap: if self.is_scrap:
manufacturing_type = 'scrap' manufacturing_type = 'scrap'
elif self.tool_state == '2': elif self.tool_state == '2':
manufacturing_type = 'invalid_tool_rework' manufacturing_type = 'invalid_tool_rework'
elif self.is_rework:
manufacturing_type = 'rework'
res = {'programming_no': self.programming_no, res = {'programming_no': self.programming_no,
'manufacturing_type': manufacturing_type, 'manufacturing_type': manufacturing_type,
'trigger_time': trigger_time} 'trigger_time': trigger_time,
'reprogramming_reason': reprogramming_reason}
logging.info('res=%s:' % res) logging.info('res=%s:' % res)
configsettings = self.env['res.config.settings'].get_values() configsettings = self.env['res.config.settings'].get_values()
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
@@ -1302,6 +1305,7 @@ class MrpProduction(models.Model):
# 对制造订单所以面的cnc工单的程序用刀进行校验 # 对制造订单所以面的cnc工单的程序用刀进行校验
try: try:
logging.info(f'已更新制造订单:{productions_not_delivered}') logging.info(f'已更新制造订单:{productions_not_delivered}')
productions = productions.filtered(lambda p: p.production_type == '自动化产线加工')
productions.production_cnc_tool_checkout() productions.production_cnc_tool_checkout()
except Exception as e: except Exception as e:
logging.info(f'对cnc工单的程序用刀进行校验报错{e}') logging.info(f'对cnc工单的程序用刀进行校验报错{e}')

View File

@@ -455,6 +455,32 @@ class ResMrpWorkOrder(models.Model):
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True) ("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因') detailed_reason = fields.Text('详细原因')
is_rework = fields.Boolean(string='是否返工', default=False) is_rework = fields.Boolean(string='是否返工', default=False)
# rework_flag = fields.Boolean(string='返工标志', compute='_compute_rework_flag')
#
# @api.depends('state', 'production_line_state')
# def _compute_rework_flag(self):
# for record in self:
# if record.state == 'done' and record.routing_type == '装夹预调':
# next_workorder = record.production_id.workorder_ids.filtered(
# lambda w: w.sequence == record.sequence + 1)
# if next_workorder and next_workorder.routing_type == 'CNC加工' and next_workorder.state in ['ready',
# 'waiting',
# 'pending'] and next_workorder.production_line_state == '待上产线':
# record.rework_flag = False
# elif next_workorder and next_workorder.routing_type == '表面工艺' and next_workorder.state in ['ready',
# 'waiting',
# 'pending']:
# record.rework_flag = False
# else:
# record.rework_flag = True
# else:
# record.rework_flag = True
#
# def button_rework(self):
# for item in self:
# item.state = 'progress'
# for time_id in item.time_ids:
# time_id.write({'date_end': None})
def button_change_env(self): def button_change_env(self):
self.is_test_env = not self.is_test_env self.is_test_env = not self.is_test_env

View File

@@ -1,6 +1,6 @@
import logging import logging
import json import json
from odoo import models, fields, api from odoo import models, fields, api, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -24,6 +24,8 @@ class SaleOrder(models.Model):
self.state = 'supply method' self.state = 'supply method'
def action_confirm(self): def action_confirm(self):
if self._get_forbidden_state_confirm() & set(self.mapped('state')):
raise UserError(_('订单状态已发生变化,请刷新当前页面'))
# 判断是否所有产品都选择了供货方式 # 判断是否所有产品都选择了供货方式
filter_line = self.order_line.filtered(lambda line: not line.supply_method) filter_line = self.order_line.filtered(lambda line: not line.supply_method)
if filter_line: if filter_line:

View File

@@ -180,14 +180,14 @@ class StockRule(models.Model):
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
productions_values) productions_values)
# 将这一批制造订单的采购组根据成品设置为不同的采购组 # 将这一批制造订单的采购组根据成品设置为不同的采购组
product_group_id = {} # product_group_id = {}
for index, production in enumerate(productions): # for index, production in enumerate(productions):
if production.product_id.id not in product_group_id.keys(): # if production.product_id.id not in product_group_id.keys():
product_group_id[production.product_id.id] = production.procurement_group_id.id # product_group_id[production.product_id.id] = production.procurement_group_id.id
else: # else:
productions_values[index].update({'name': production.name}) # productions_values[index].update({'name': production.name})
procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index]) # procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id # production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) # self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) # self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
@@ -197,7 +197,7 @@ class StockRule(models.Model):
''' '''
# productions._create_workorder() # productions._create_workorder()
# #
self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) # self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
( (
p.move_dest_ids.procure_method != 'make_to_order' and not p.move_dest_ids.procure_method != 'make_to_order' and not
@@ -289,7 +289,7 @@ class StockRule(models.Model):
if production_item.product_id.id in product_id_to_production_names: if production_item.product_id.id in product_id_to_production_names:
# 同一个产品多个制造订单对应一个编程单和模型库 # 同一个产品多个制造订单对应一个编程单和模型库
# 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递 # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
if not production_item.programming_no and production_item.production_type == '自动化产线加工': if not production_item.programming_no and production_item.production_type in ['自动化产线加工', '人工线下加工']:
if not production_programming.programming_no: if not production_programming.programming_no:
production_item.fetchCNC( production_item.fetchCNC(
', '.join(product_id_to_production_names[production_item.product_id.id])) ', '.join(product_id_to_production_names[production_item.product_id.id]))

View File

@@ -117,11 +117,11 @@
<xpath expr="//sheet//group//group//div[3]" position="after"> <xpath expr="//sheet//group//group//div[3]" position="after">
<field name="production_type" readonly="1"/> <field name="production_type" readonly="1"/>
<field name="manual_quotation" readonly="1" <field name="manual_quotation" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/> attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
<field name="programming_no" readonly="1" <field name="programming_no" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}"/> attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"/>
<field name="programming_state" readonly="1" <field name="programming_state" readonly="1"
attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工'])]}" attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工'])]}"
decoration-success="programming_state == '已编程'" decoration-success="programming_state == '已编程'"
decoration-warning="programming_state =='编程中'" decoration-warning="programming_state =='编程中'"
decoration-danger="programming_state =='已编程未下发'"/> decoration-danger="programming_state =='已编程未下发'"/>
@@ -632,6 +632,8 @@
<field name="state" icon="fa-filter" enable_counters="1"/> <field name="state" icon="fa-filter" enable_counters="1"/>
<field name="delivery_status" icon="fa-filter" enable_counters="1"/> <field name="delivery_status" icon="fa-filter" enable_counters="1"/>
<field name="production_type" icon="fa-filter" enable_counters="1"/> <field name="production_type" icon="fa-filter" enable_counters="1"/>
<field name="programming_state" icon="fa-filter" enable_counters="1"/>
</searchpanel> </searchpanel>
</xpath> </xpath>
<filter name='todo' position="replace"/> <filter name='todo' position="replace"/>

View File

@@ -163,6 +163,7 @@
<field name='is_delivery' invisible="1"/> <field name='is_delivery' invisible="1"/>
<field name="is_trayed" invisible="1"/> <field name="is_trayed" invisible="1"/>
<field name="is_inspect" invisible="1"/> <field name="is_inspect" invisible="1"/>
<!-- <field name="rework_flag" invisible="1"/>-->
<!-- <field name='is_send_program_again' invisible="1"/>--> <!-- <field name='is_send_program_again' invisible="1"/>-->
<!-- 工单form页面的开始停工按钮等 --> <!-- 工单form页面的开始停工按钮等 -->
<!-- <button name="button_start" type="object" string="开始" class="btn-success" --> <!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
@@ -211,6 +212,9 @@
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/> attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
<button name="print_method" type="object" string="打印二维码" class="btn-primary" <button name="print_method" type="object" string="打印二维码" class="btn-primary"
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/> attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
<!-- <button type="object" class="oe_highlight jikimo_button_confirm" name="button_rework"-->
<!-- string="返工"-->
<!-- attrs='{"invisible": [("rework_flag","=",True)]}' confirm="是否返工"/>-->
</xpath> </xpath>
<xpath expr="//page[1]" position="before"> <xpath expr="//page[1]" position="before">
<page string="开料要求" attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'> <page string="开料要求" attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'>
@@ -489,7 +493,7 @@
</group> </group>
</page> </page>
<page string="2D加工图纸" attrs="{'invisible': [('routing_type','!=','装夹预调')]}"> <page string="2D加工图纸" attrs='{"invisible": [("routing_type","not in",["装夹预调", "人工线下加工"])]}'>
<field name="machining_drawings" widget="adaptive_viewer"/> <field name="machining_drawings" widget="adaptive_viewer"/>
</page> </page>
@@ -561,7 +565,7 @@
</page> </page>
</xpath> </xpath>
<xpath expr="//page[1]" position="before"> <xpath expr="//page[1]" position="before">
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'> <page string="CNC程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
<field name="cnc_ids" widget="one2many" string="工作程序" default_order="sequence_number,id" <field name="cnc_ids" widget="one2many" string="工作程序" default_order="sequence_number,id"
readonly="0"> readonly="0">
<tree> <tree>
@@ -585,7 +589,7 @@
</field> </field>
</page> </page>
<page string="CMM程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'> <page string="CMM程序" attrs='{"invisible": [("routing_type","not in",["CNC加工", "人工线下加工"])]}'>
<field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1"> <field name="cmm_ids" widget="one2many" string="CMM程序" readonly="1">
<tree> <tree>
<field name="sequence_number"/> <field name="sequence_number"/>
@@ -638,7 +642,7 @@
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/> <field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//form//sheet//group//group[2]" position="replace"> <xpath expr="//form//sheet//group//group[2]" position="replace">
<group string="装夹图纸" attrs="{'invisible': [('routing_type', '!=', '装夹预调')]}"> <group string="装夹图纸" attrs="{'invisible': [('routing_type', 'not in', ['装夹预调', '人工线下加工'])]}">
<!-- 隐藏加工图纸字段名 --> <!-- 隐藏加工图纸字段名 -->
<field name="processing_drawing" widget="pdf_viewer" string="" readonly="1"/> <field name="processing_drawing" widget="pdf_viewer" string="" readonly="1"/>
<!-- <field name="production_id" invisible="0"/>--> <!-- <field name="production_id" invisible="0"/>-->

View File

@@ -16,6 +16,7 @@ class SFMessageProduct(models.Model):
mrp_production_list = self.env['mrp.production'].sudo().search( mrp_production_list = self.env['mrp.production'].sudo().search(
[('product_id', '=', product_product.id)]) [('product_id', '=', product_product.id)])
production_num = 0 production_num = 0
routing_type = None
for mrp_production_info in mrp_production_list: for mrp_production_info in mrp_production_list:
routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调' routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调'
mrp_production_ready = mrp_production_info.workorder_ids.filtered( mrp_production_ready = mrp_production_info.workorder_ids.filtered(
@@ -23,7 +24,7 @@ class SFMessageProduct(models.Model):
if mrp_production_ready: if mrp_production_ready:
production_num += 1 production_num += 1
if production_num >= 1: if production_num >= 1:
url = self.get_request_url() url = self.get_request_url(routing_type)
content = content.replace('{{product_id}}', product_product.name).replace( content = content.replace('{{product_id}}', product_product.name).replace(
'{{number}}', str(production_num)).replace( '{{number}}', str(production_num)).replace(
'{{request_url}}', url) '{{request_url}}', url)
@@ -42,11 +43,15 @@ class SFMessageProduct(models.Model):
contents.append(content) contents.append(content)
return contents, message_queue_ids return contents, message_queue_ids
def get_request_url(self): def get_request_url(self, routing_type):
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id
menu_id = self.env.ref('mrp.menu_mrp_root').id menu_id = self.env.ref('mrp.menu_mrp_root').id
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', '工件装夹中心')]).id if routing_type == '人工线下加工':
routing_name = '线下工作中心'
else:
routing_name = '工件装夹中心'
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', routing_name)]).id
# 查询参数 # 查询参数
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder', params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
'view_type': 'list', 'active_id': active_id} 'view_type': 'list', 'active_id': active_id}

View File

@@ -200,6 +200,17 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
'send_time': ret['send_time'], 'send_time': ret['send_time'],
}) })
logging.info('已创建无效功能刀具的编程记录:%s' % production.name) logging.info('已创建无效功能刀具的编程记录:%s' % production.name)
elif ret['reprogramming_reason']:
production.programming_record_ids.create({
'number': len(production.programming_record_ids) + 1,
'production_id': production.id,
'reason': ret['reprogramming_reason'],
'programming_method': ret['programme_way'],
'current_programming_count': ret['reprogramming_num'],
'target_production_id': productions_reprogram,
'apply_time': ret['trigger_time'],
'send_time': ret['send_time'],
})
else: else:
logging.info('无对应状态,不需更新编程记录') logging.info('无对应状态,不需更新编程记录')