Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<!-- <field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="image"/>-->
|
||||
<!-- <field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>-->
|
||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||
<field name="upload_model_file"
|
||||
widget="many2many_binary"
|
||||
|
||||
@@ -948,6 +948,8 @@ class MrpProduction(models.Model):
|
||||
if production.programming_no in program_to_production_names:
|
||||
productions_not_delivered = self.env['mrp.production'].search(
|
||||
[('programming_no', '=', production.programming_no), ('programming_state', '=', '已编程未下发')])
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('programming_no', '=', production.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
||||
rework_workorder = production.workorder_ids.filtered(lambda m: m.state == 'rework')
|
||||
if rework_workorder:
|
||||
for rework_item in rework_workorder:
|
||||
@@ -960,6 +962,13 @@ class MrpProduction(models.Model):
|
||||
productions_not_delivered.write(
|
||||
{'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||
|
||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions_not_delivered}')
|
||||
productions.production_cnc_tool_checkout()
|
||||
except Exception as e:
|
||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||
|
||||
# 从cloud获取重新编程过的最新程序
|
||||
def get_new_program(self, processing_panel):
|
||||
try:
|
||||
|
||||
@@ -774,6 +774,8 @@ class ResProductMo(models.Model):
|
||||
# bfm下单
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
# machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
# quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
@@ -873,6 +875,8 @@ class ResProductMo(models.Model):
|
||||
'manual_quotation': item['manual_quotation'] or False,
|
||||
'part_number': item.get('part_number') or '',
|
||||
'active': True,
|
||||
# 'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(item['machining_drawings']),
|
||||
# 'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
|
||||
}
|
||||
tax_id = self.env['account.tax'].sudo().search(
|
||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||
|
||||
@@ -103,10 +103,20 @@ access_mrp_production_split_multi_group_sf_mrp_user,access.mrp.production.split.
|
||||
access_mrp_production_split_group_sf_mrp_user,access.mrp.production.split,mrp.model_mrp_production_split,sf_base.group_sf_mrp_user,1,1,1,0
|
||||
access_mrp_production_split_line_group_sf_mrp_user,access.mrp.production.split.line,mrp.model_mrp_production_split_line,sf_base.group_sf_mrp_user,1,1,1,0
|
||||
access_mrp_workcenter_capacity_manager_group_sf_mrp_user,mrp.workcenter.capacity.manager,mrp.model_mrp_workcenter_capacity,sf_base.group_sf_mrp_user,1,1,1,0
|
||||
|
||||
|
||||
access_mrp_workcenter_group_quality,mrp_workcenter_group_quality,model_mrp_workcenter,sf_base.group_quality,1,0,0,0
|
||||
access_mrp_workcenter_group_quality_director,mrp_workcenter_group_quality_director,model_mrp_workcenter,sf_base.group_quality_director,1,0,0,0
|
||||
access_sf_detection_result_group_quality,sf_detection_result_group_quality,model_sf_detection_result,sf_base.group_quality,1,0,1,0
|
||||
access_sf_detection_result_group_quality_director,sf_detection_result_group_quality_director,model_sf_detection_result,sf_base.group_quality_director,1,0,1,0
|
||||
access_mrp_workcenter_productivity_loss_group_quality,mrp_workcenter_productivity_loss_group_quality,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality,1,0,0,0
|
||||
access_mrp_workcenter_productivity_loss_group_quality_director,mrp_workcenter_productivity_loss_group_quality_director,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality_director,1,0,0,0
|
||||
access_mrp_workcenter_productivity_group_quality,mrp_workcenter_productivity_group_quality,mrp.model_mrp_workcenter_productivity,sf_base.group_quality,1,1,1,0
|
||||
access_mrp_workcenter_productivity_group_quality_director,mrp_workcenter_productivity_group_quality_director,mrp.model_mrp_workcenter_productivity,sf_base.group_quality_director,1,1,1,0
|
||||
access_mrp_production_group_plan_dispatch,mrp_production,model_mrp_production,sf_base.group_plan_dispatch,1,1,0,0
|
||||
access_mrp_workorder,mrp_workorder,model_mrp_workorder,sf_base.group_plan_dispatch,1,1,1,0
|
||||
access_mrp_production_group_quality,mrp_production,model_mrp_production,sf_base.group_quality,1,1,0,0
|
||||
access_mrp_production_group_quality_director,mrp_production,model_mrp_production,sf_base.group_quality_director,1,1,0,0
|
||||
access_mrp_workorder_group_quality,mrp_workorder,model_mrp_workorder,sf_base.group_quality,1,1,0,0
|
||||
access_mrp_workorder_group_quality_director,mrp_workorder,model_mrp_workorder,sf_base.group_quality_director,1,1,0,0
|
||||
access_mrp_workorder,mrp_workorder,model_mrp_workorder,sf_base.group_plan_dispatch,1,1,0,0
|
||||
access_sf_production_line_group_plan_dispatch,sf.production.line,model_sf_production_line,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_production_line_group_plan_director,sf.production.line,model_sf_production_line,sf_base.group_plan_director,1,1,1,0
|
||||
access_sf_production_line,sf.production.line,model_sf_production_line,sf_maintenance.sf_group_equipment_user,1,1,1,0
|
||||
|
||||
|
@@ -584,6 +584,12 @@
|
||||
position="after">
|
||||
<field name="duration" string="实际时长"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='time_tracking']" position="attributes">
|
||||
<attribute name="groups">
|
||||
mrp.group_mrp_manager,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user,sf_base.group_sf_order_user
|
||||
</attribute>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -58,17 +58,8 @@
|
||||
<field name="name">订单发货提醒</field>
|
||||
<field name="model">stock.picking</field>
|
||||
</record>
|
||||
<!-- <record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">-->
|
||||
<!-- <field name="name">装夹预调工单逾期预警</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record id="bussiness_mrp_workorder_pre_overdue" model="jikimo.message.bussiness.node">-->
|
||||
<!-- <field name="name">装夹预调工单已逾期</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
<record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_pre_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">装夹预调工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
@@ -77,12 +68,12 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">CNC加工工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
<record id="bussiness_mrp_workorder_cnc_overdue" model="jikimo.message.bussiness.node">
|
||||
<field name="name">CNC工单已逾期</field>
|
||||
<field name="name">CNC加工工单已逾期</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
@@ -96,7 +87,7 @@
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<record id="bussiness_mrp_workorder_surface_overdue_warning" model="jikimo.message.bussiness.node">
|
||||
<field name="name">表面工艺工单逾期预警</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
</record>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="ir_cron_mrp_workorder_overdue_warning">
|
||||
<record model="ir.cron" id="ir_cron_mrp_workorder_recover_time_warning">
|
||||
<field name="name">检查工单是否完成并恢复正常时效</field>
|
||||
<field name="model_id" ref="model_mrp_workorder"/>
|
||||
<field name="state">code</field>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import re
|
||||
from odoo import models, fields, api, _
|
||||
from urllib.parse import urlencode
|
||||
@@ -35,19 +36,20 @@ class SFMessageMrpProduction(models.Model):
|
||||
[('origin', '=', mrp_production.origin), ('picking_type_id.sequence_code', '=', 'SFP'),
|
||||
('state', '=', 'assigned')], limit=1)
|
||||
if stock_picking_sfp:
|
||||
url = self.request_url()
|
||||
url = self.request_url(stock_picking_sfp.id)
|
||||
content = content.replace('{{name}}', stock_picking_sfp.name).replace(
|
||||
'{{sale_order_name}}', mrp_production.origin).replace('{{request_url}}', url)
|
||||
contents.append(content)
|
||||
logging.info('生产完工入库提醒: %s' % contents)
|
||||
return contents
|
||||
|
||||
def request_url(self):
|
||||
def request_url(self, id):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
action_id = self.env.ref('mrp.mrp_production_action').id
|
||||
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||
# 查询参数
|
||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
|
||||
'view_type': 'kanban'}
|
||||
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'mrp.production',
|
||||
'view_type': 'form'}
|
||||
# 拼接查询参数
|
||||
query_string = urlencode(params)
|
||||
# 拼接URL
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import re
|
||||
from odoo import models, fields, api, _
|
||||
from urllib.parse import urlencode
|
||||
@@ -40,9 +41,10 @@ class SFMessageStockPicking(models.Model):
|
||||
('picking_type_id.sequence_code', '=', 'OUT')])
|
||||
if stock_picking_out and len(stock_picking_out) > 0:
|
||||
content = message_queue_id.message_template_id.content
|
||||
url = self.request_url()
|
||||
url = self.request_url1(stock_picking_out.id)
|
||||
content = content.replace('{{name}}', stock_picking_out.name).replace(
|
||||
'{{sale_order_name}}', stock_picking_out.origin).replace('{{request_url}}', url)
|
||||
logging.info('订单发货提醒: %s' % content)
|
||||
return content
|
||||
|
||||
def _get_message(self, message_queue_ids):
|
||||
@@ -96,3 +98,16 @@ class SFMessageStockPicking(models.Model):
|
||||
# 拼接URL
|
||||
full_url = url + "/web#" + query_string
|
||||
return full_url
|
||||
|
||||
def request_url1(self, id):
|
||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
action_id = self.env.ref('stock.action_picking_tree_all').id
|
||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
|
||||
# 查询参数
|
||||
params = {'id': id, 'menu_id': menu_id, 'action': action_id, 'model': 'stock.picking',
|
||||
'view_type': 'form'}
|
||||
# 拼接查询参数
|
||||
query_string = urlencode(params)
|
||||
# 拼接URL
|
||||
full_url = url + "/web#" + query_string
|
||||
return full_url
|
||||
|
||||
@@ -12,7 +12,7 @@ class SFMessageWork(models.Model):
|
||||
_name = 'mrp.workorder'
|
||||
_inherit = ['mrp.workorder', 'jikimo.message.dispatch']
|
||||
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids.state')
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids.state', 'production_id.tool_state')
|
||||
def _compute_state(self):
|
||||
super(SFMessageWork, self)._compute_state()
|
||||
for workorder in self:
|
||||
|
||||
@@ -104,6 +104,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
|
||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||
try:
|
||||
logging.info(f'已更新制造订单:{productions}')
|
||||
productions.production_cnc_tool_checkout()
|
||||
except Exception as e:
|
||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||
|
||||
@@ -31,19 +31,31 @@ class SfQualityCncTest(models.Model):
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
|
||||
# machining_drawings = fields.Binary(related='workorder_id.machining_drawings', string='2D加工图纸', readonly=True)
|
||||
# quality_standard = fields.Binary(related='workorder_id.quality_standard', string='质检标准', readonly=True)
|
||||
|
||||
def submit_pass(self):
|
||||
self.write({'result': 'pass', 'test_results': self.test_results, 'state': 'done'})
|
||||
if self.test_results in ['返工', '报废']:
|
||||
raise UserError(_('请重新选择【判定结果】-【检测结果】'))
|
||||
self.write({'result': 'pass', 'test_results': '合格', 'state': 'done'})
|
||||
self.workorder_id.write({'test_results': self.test_results})
|
||||
self.workorder_id.button_finish()
|
||||
|
||||
def submit_fail(self):
|
||||
if not self.reason and not self.detailed_reason and not self.test_results:
|
||||
if not self.test_results:
|
||||
raise UserError(_('请填写【判定结果】里的信息'))
|
||||
else:
|
||||
self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
|
||||
self.workorder_id.write(
|
||||
{'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
|
||||
self.workorder_id.button_finish()
|
||||
if self.test_results == '合格':
|
||||
raise UserError(_('请重新选择【判定结果】-【检测结果】'))
|
||||
self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
|
||||
self.workorder_id.write(
|
||||
{'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
|
||||
self.workorder_id.button_finish()
|
||||
|
||||
@api.onchange('test_results')
|
||||
def _onchange_test_results(self):
|
||||
if self.test_results == '合格':
|
||||
self.reason = False
|
||||
self.detailed_reason = False
|
||||
|
||||
|
||||
class SfQualityWorkOrder(models.Model):
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="name">加工质检单编码规则</field>
|
||||
<field name="code">quality.cnc.test</field>
|
||||
<field name="prefix">QCT</field>
|
||||
<field name="padding">4</field>
|
||||
<field name="padding">5</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
<field name="product_id"/>
|
||||
<field name="part_number"/>
|
||||
<field name="number"/>
|
||||
<field name="state"/>
|
||||
<field name="result"/>
|
||||
<field name="write_uid" widget='many2one_avatar_user' string="判定人" optional="hide"/>
|
||||
<field name="write_date" string="判定时间" optional="hide"/>
|
||||
<field name="state" widget="badge"
|
||||
decoration-success="state == 'done'"
|
||||
decoration-warning="state == 'waiting'"/>
|
||||
<field name="result" widget="badge"
|
||||
decoration-success="result == 'pass'"
|
||||
decoration-danger="result == 'fail'"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -89,7 +91,6 @@
|
||||
<group>
|
||||
<field name="part_number"/>
|
||||
<field name="processing_panel"/>
|
||||
<field name="detection_report"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -99,17 +100,19 @@
|
||||
<page string="判定结果">
|
||||
<group>
|
||||
<field name="test_results" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="reason" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="detailed_reason" attrs="{'readonly': [('state','=', 'done')]}"/>
|
||||
<field name="reason"
|
||||
attrs="{'readonly': [('state','=', 'done')],'required': [('test_results','in', ['返工','报废'])],'invisible': [('test_results','in', ['合格',False])]}"/>
|
||||
<field name="detailed_reason"
|
||||
attrs="{'readonly': [('state','=', 'done')],'required': [('reason','!=', False)],'invisible': [('test_results','in', ['合格',False])]}"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="2D图纸">
|
||||
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="machining_drawings" string="" widget="pdf_viewer"/>-->
|
||||
</page>
|
||||
<page string="客户质量标准">
|
||||
<!-- <field name="detection_report" string="" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="quality_standard" string=""/>-->
|
||||
</page>
|
||||
<page string="其他" attrs="{'readonly': [('state','=', 'done')]}">
|
||||
<page string="其他" attrs="{'invisible': [('state','=', 'waiting')]}">
|
||||
<group>
|
||||
<field name="write_uid" widget='many2one_avatar_user' string="判定人" readonly="1"/>
|
||||
<field name="write_date" string="判定时间" readonly="1"/>
|
||||
@@ -171,7 +174,7 @@
|
||||
<field name="name">驾驶舱</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">quality.cnc.test</field>
|
||||
<field name="view_mode">kanban,form</field>
|
||||
<field name="view_mode">kanban,tree,form</field>
|
||||
<field name="view_id" ref="quality_cnc_test_view_kanban"/>
|
||||
<field name="search_view_id" ref="quality_cnc_test_search"/>
|
||||
<field name="domain">[]</field>
|
||||
|
||||
@@ -34,36 +34,36 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="quality_point_view_form_inherit_sf">
|
||||
<field name="name">quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality.quality_point_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//sheet//group//group//field[@name='title']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//field[@name='picking_type_ids']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="quality_point_view_form_inherit_sf">
|
||||
<field name="name">quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality.quality_point_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//sheet//group//group//field[@name='title']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//field[@name='picking_type_ids']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="sf_quality_point_view_form_inherit_quality_control">
|
||||
<field name="name">sf.quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality_control.quality_point_view_form_inherit_quality_control"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="sf_quality_point_view_form_inherit_quality_control">
|
||||
<field name="name">sf.quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="quality_control.quality_point_view_form_inherit_quality_control"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
<field name="unit_price"/>
|
||||
<field name="price" options="{'format': false}"/>
|
||||
<field name="part_drawing_number"/>
|
||||
<field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>
|
||||
<field name="machining_drawings_name" invisible="1"/>
|
||||
<!-- <field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>-->
|
||||
<!-- <field name="machining_drawings_name" invisible="1"/>-->
|
||||
<field name="sale_order_id"
|
||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||
</group>
|
||||
|
||||
@@ -170,6 +170,7 @@ class MrpProduction(models.Model):
|
||||
# 修改cnc程序的‘刀具状态’
|
||||
workorder_ids = self.env['mrp.workorder'].sudo().search([('production_id', 'in', self.ids)])
|
||||
if invalid_tool:
|
||||
logging.info(f'无效刀:{invalid_tool}')
|
||||
# 修改cnc程序的‘刀具状态’为 ‘无效刀’
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', invalid_tool)])
|
||||
@@ -194,20 +195,25 @@ class MrpProduction(models.Model):
|
||||
# 自动调用重新获取编程的方法
|
||||
logging.info('cnc用刀校验到无效刀自动调用重新编程方法:update_programming_state()')
|
||||
self[0].update_programming_state()
|
||||
self[0].write({'is_rework': False})
|
||||
# 修改制造订单 编程状态变为“编程中” 制造订单状态为‘返工’
|
||||
self.write({'programming_state': '编程中', 'work_state': '编程中', 'state': 'rework'})
|
||||
if missing_tool_1:
|
||||
logging.info(f'线边、机内缺刀:{missing_tool_1}')
|
||||
# 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', missing_tool_1)])
|
||||
if cnc_ids:
|
||||
cnc_ids.write({'tool_state': '1'})
|
||||
if missing_tool_2 and not invalid_tool:
|
||||
if missing_tool_2 and invalid_tool == []:
|
||||
logging.info(f'库存缺刀:{missing_tool_2}')
|
||||
# 调用CAM工单程序用刀计划创建方法
|
||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||
[('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0].id).ids),
|
||||
[('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0]).ids),
|
||||
('cutting_tool_name', 'in', missing_tool_2)])
|
||||
if cnc_ids:
|
||||
logging.info('调用CAM工单程序用刀计划创建方法!!!')
|
||||
self.env['sf.cam.work.order.program.knife.plan'].sudo().create_cam_work_plan(cnc_ids)
|
||||
if not invalid_tool and not missing_tool_1:
|
||||
logging.info('校验cnc用刀正常!!!')
|
||||
logging.info('工单cnc程序用刀校验完成!!!')
|
||||
|
||||
Reference in New Issue
Block a user