diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 6329dd9e..7f4dc2b8 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -42,10 +42,10 @@ class ResProductMo(models.Model): product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型') embryo_model_type_id = fields.Many2one('sf.model.type', string='坯料模型类型') materials_id = fields.Many2one('sf.production.materials', string='材料') - # materials_type_id = fields.Many2one('sf.materials.model', string='材料型号', - # domain="[('materials_id', '=', materials_id)]") - materials_type_id = fields.Many2one(related='cutting_tool_model_id.material_model_id', string='材料型号', + materials_type_id = fields.Many2one('sf.materials.model', string='材料型号', domain="[('materials_id', '=', materials_id)]") + # materials_type_id = fields.Many2one(related='cutting_tool_model_id.material_model_id', string='材料型号', + # domain="[('materials_id', '=', materials_id)]") # cutting_tool_model_id.material_model_id server_product_process_parameters_id = fields.Many2one('sf.production.process.parameter', string='表面工艺参数(服务产品)') @@ -58,10 +58,10 @@ class ResProductMo(models.Model): cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='型号名称') specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='物料号') - # cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型', - # domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]") - cutting_tool_type_id = fields.Many2one(related='cutting_tool_model_id.cutting_tool_type_id', string='类型', + cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='类型', domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]") + # cutting_tool_type_id = fields.Many2one(related='cutting_tool_model_id.cutting_tool_type_id', string='类型', + # domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]") # brand_id = fields.Many2one('sf.machine.brand', '品牌') brand_id = fields.Many2one(related='cutting_tool_model_id.brand_id', string='品牌') # cutting_tool_model_id.brand_id @@ -630,14 +630,14 @@ class ResProductMo(models.Model): cutting_tool_installing_structure = fields.Char(related='specification_id.installing_structure', string='安装结构') # specification_id.installing_structure - # cutting_tool_blade_id = fields.Many2one( - # 'sf.cutting_tool.standard.library', - # domain="[('cutting_tool_type', '=', '刀片')]", - # string='适用刀片型号' # 使用空列表作为默认值 - # ) - cutting_tool_blade_id = fields.Many2one(related='specification_id.blade_id', - domain="[('cutting_tool_type', '=', '刀片')]", - string='适用刀片型号') + cutting_tool_blade_id = fields.Many2one( + 'sf.cutting_tool.standard.library', + domain="[('cutting_tool_type', '=', '刀片')]", + string='适用刀片型号' # 使用空列表作为默认值 + ) + # cutting_tool_blade_id = fields.Many2one(related='specification_id.blade_id', + # domain="[('cutting_tool_type', '=', '刀片')]", + # string='适用刀片型号') # specification_id.blade_id # cutting_tool_tool_shim = fields.Char('适配刀垫型号', size=50) cutting_tool_tool_shim = fields.Char(related='specification_id.tool_shim', @@ -756,14 +756,14 @@ class ResProductMo(models.Model): # string='适用刀柄型号' # ) - # cutting_tool_handle_id = fields.Many2one( - # 'sf.cutting_tool.standard.library', - # domain="[('cutting_tool_type', '=', '刀柄')]", - # string='适用刀柄型号' - # ) - cutting_tool_handle_id = fields.Many2one(related='cutting_tool_model_id.handle_id', - domain="[('cutting_tool_type', '=', '刀柄')]", - string='适用刀柄型号') + cutting_tool_handle_id = fields.Many2one( + 'sf.cutting_tool.standard.library', + domain="[('cutting_tool_type', '=', '刀柄')]", + string='适用刀柄型号' + ) + # cutting_tool_handle_id = fields.Many2one(related='cutting_tool_model_id.handle_id', + # domain="[('cutting_tool_type', '=', '刀柄')]", + # string='适用刀柄型号') # cutting_tool_model_id.handle_id # 注册状态 diff --git a/sf_message/__manifest__.py b/sf_message/__manifest__.py index 7139f840..1cc18aaa 100644 --- a/sf_message/__manifest__.py +++ b/sf_message/__manifest__.py @@ -14,6 +14,7 @@ 'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify','stock', 'sf_tool_management', 'sf_manufacturing', 'sf_hr'], 'data': [ 'data/bussiness_node.xml', + 'data/template_data.xml', ], 'test': [ ], diff --git a/sf_message/data/template_data.xml b/sf_message/data/template_data.xml new file mode 100644 index 00000000..868b3f52 --- /dev/null +++ b/sf_message/data/template_data.xml @@ -0,0 +1,84 @@ + + + + + 坯料采购提醒 + + purchase.order + + markdown + normal + ### 坯料采购通知: +单号:采购单[{{name}}]({{request_url}}) +事项:请确认坯料采购单并处理 + + + + 坯料发料提醒 + + stock.picking + + markdown + normal + ### 坯料发料提醒: +单号:产品[{{product_id}}]({{request_url}}) +事项:共{{number}}个生产发料单待确认处理 + + + + 工单已下发通知 + + mrp.workorder + + markdown + normal + ### 工单已下发通知: +单号:产品[{{product_id}}]({{request_url}}) +事项:共{{number}}个工单已下发,请查收知悉 + + + + + + + + 调拨入库 + + stock.picking + + markdown + normal + ### 调拨入库通知: +单号:调拨入库单[{{name}}]({{request_url}}) +事项:完成刀具物料上架入库 + + + + + + 功能刀具寿命到期 + + sf.functional.tool.dismantle + + markdown + normal + ### 功能刀具寿命到期提醒: +单号:拆解单[{{code}}]({{request_url}}) +事项:{{functional_tool_id.tool_name_id.name}}寿命已到期,需拆解 + + + + + + 功能刀具组装 + + sf.functional.tool.assembly + + markdown + normal + ### 功能刀具组装通知: +单号:组装任务单[{{name}}]({{request_url}}) +事项:{{use_tool_time}}前完成组装 + + + \ No newline at end of file diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 965fa03c..ce63c25d 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -95,16 +95,20 @@ class CNCprocessing(models.Model): # tool_state_remark1 = f'{key}无效刀:{data1.get(key)}' # 无效刀处理逻辑 # 1、创建制造订单无效刀检测结果记录 - logging.info('创建制造订单无效刀检测结果记录!') - production_id.detection_result_ids.create({ - 'production_id': production_id.id, - 'processing_panel': key, - 'routing_type': 'CNC加工', - 'rework_reason': 'programming', # 原因:编程(programming) - 'detailed_reason': '无效功能刀具', - 'test_results': '返工', - 'handle_result': '待处理' - }) + if not production_id.detection_result_ids.filtered( + lambda a: (a.processing_panel == key and a.detailed_reason == '无效功能刀具' + and a.handle_result == '待处理' and a.routing_type == 'CNC加工' + and a.rework_reason == 'programming' and a.test_results == '返工')): + logging.info('创建制造订单无效刀检测结果记录!') + production_id.detection_result_ids.create({ + 'production_id': production_id.id, + 'processing_panel': key, + 'routing_type': 'CNC加工', + 'rework_reason': 'programming', # 原因:编程(programming) + 'detailed_reason': '无效功能刀具', + 'test_results': '返工', + 'handle_result': '待处理' + }) # 修改当前面装夹预调工单的 is_rework 为 True # work_ids = production_id.workorder_ids.filtered( # lambda a: a.routing_type == '装夹预调' and a.processing_panel == key and not a.is_rework)