优化了刀具管理-功能刀具组装的刀具物料字段,新增功能刀具组装完成时新建功能刀具列表、预警、实时分布、出入库记录数据功能
This commit is contained in:
@@ -393,7 +393,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
# 撤回功能刀具组装创建的任务
|
||||
self.env['sf.functional.tool.assembly'].search(
|
||||
[('functional_tool_code', '=', self.replacement_tool_code),
|
||||
('loading_task_source', '=', '机台换刀')]).unlink()
|
||||
('loading_task_source', '=', '1')]).unlink()
|
||||
|
||||
# 撤回数据更新
|
||||
self.env['sf.machine.table.tool.changing.apply'].search([('name', '=', self.name.id)]).write({
|
||||
@@ -444,7 +444,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
need_knife_time = fields.Datetime(string='需要用刀时间', readonly=False)
|
||||
plan_execute_status = fields.Selection([('0', '待下发'), ('1', '执行中'), ('2', '已完成')],
|
||||
string='计划执行状态', default='0', readonly=False)
|
||||
applicant = fields.Char(string='申请人', readonly=False)
|
||||
applicant = fields.Char(string='申请人', readonly=True)
|
||||
reason_for_applying = fields.Char(string='申请原因', readonly=False)
|
||||
remark = fields.Char(string='备注说明', readonly=False)
|
||||
|
||||
@@ -462,7 +462,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
'loading_task_source': '0',
|
||||
'coarse_middle_thin': None,
|
||||
'tool_loading_length': None,
|
||||
'applicant': self.applicant,
|
||||
'applicant': self.env.user.name,
|
||||
'reason_for_applying': self.reason_for_applying,
|
||||
'use_tool_time': self.need_knife_time,
|
||||
'machine_tool_name_id': self.machine_table_name_id.id,
|
||||
@@ -472,7 +472,8 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
|
||||
# 将计划执行状态改为执行中
|
||||
self.env['sf.cam.work.order.program.knife.plan'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1'})
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '1',
|
||||
'applicant': self.env.user.name})
|
||||
|
||||
|
||||
def revocation(self):
|
||||
@@ -480,13 +481,16 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
撤回装刀申请
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
||||
self.env['sf.functional.tool.assembly'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code),
|
||||
('loading_task_source', '=', 'CAM装刀')]).unlink()
|
||||
('loading_task_source', '=', '0')]).unlink()
|
||||
|
||||
# 将计划执行状态改为待执行
|
||||
self.env['sf.cam.work.order.program.knife.plan'].search(
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '0'})
|
||||
[('functional_tool_code', '=', self.functional_tool_code)]).write({'plan_execute_status': '0',
|
||||
'applicant': None})
|
||||
|
||||
|
||||
|
||||
@@ -504,19 +508,58 @@ class FunctionalToolAssembly(models.Model):
|
||||
functional_tool_length = fields.Char(string='功能刀具伸出长', readonly=True)
|
||||
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
|
||||
|
||||
tool_name = fields.Char(string='刀具名称', readonly=False)
|
||||
tool_brand = fields.Char(string='品牌', readonly=False)
|
||||
tool_type = fields.Char(string='型号', readonly=False)
|
||||
knife_handle_name = fields.Char(string='刀柄名称', readonly=False)
|
||||
knife_handle_brand = fields.Char(string='品牌', readonly=False)
|
||||
knife_handle_type = fields.Char(string='型号', readonly=False)
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False)
|
||||
tool_loading_length = fields.Char(string='装刀长', readonly=False)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=False)
|
||||
reference_length = fields.Char(string='参考伸出长', readonly=False)
|
||||
cut_time = fields.Char(string='已切削时间', readonly=False)
|
||||
cut_length = fields.Char(string='已切削长度', readonly=False)
|
||||
cut_number = fields.Char(string='已切削次数', readonly=False)
|
||||
# 整体式刀具型号
|
||||
mrs_cutting_tool_integral_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='整体式刀具型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '整体式刀具')])
|
||||
integral_code = fields.Char('整体式刀具序列号', readonly=True)
|
||||
integral_name = fields.Char('整体式刀具名称', readonly=True)
|
||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True)
|
||||
# 刀片型号
|
||||
mrs_cutting_tool_blade_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='刀片型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '刀片')])
|
||||
blade_code = fields.Char('刀片序列号', readonly=True)
|
||||
blade_name = fields.Char('刀片名称', readonly=True)
|
||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
|
||||
# 刀杆型号
|
||||
mrs_cutting_tool_cutterbar_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='刀杆型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '刀杆')])
|
||||
bar_code = fields.Char('刀杆序列号', readonly=True)
|
||||
bar_name = fields.Char('刀杆名称', readonly=True)
|
||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
|
||||
# 刀盘型号
|
||||
mrs_cutting_tool_cutterpad_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='刀盘型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '刀盘')])
|
||||
pad_code = fields.Char('刀盘序列号', readonly=True)
|
||||
pad_name = fields.Char('刀盘名称', readonly=True)
|
||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
||||
|
||||
# 刀柄型号
|
||||
mrs_cutting_tool_cutterhandle_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='刀柄型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '刀柄')])
|
||||
handle_code = fields.Char('刀柄序列号', readonly=True)
|
||||
handle_name = fields.Char('刀柄名称', readonly=True)
|
||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
||||
# 夹头型号
|
||||
mrs_cutting_tool_cutterhead_model_ids = fields.Many2many('sf.cutting.tool.model', 'sf_functional_tool_assembly_id',
|
||||
string='夹头型号', readonly=True, domain=
|
||||
[('mrs_cutting_tool_material_name', '=', '夹头')])
|
||||
chuck_code = fields.Char('夹头序列号', readonly=True)
|
||||
chuck_name = fields.Char('夹头名称', readonly=True)
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
||||
|
||||
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||
tool_loading_length = fields.Char(string='装刀长', readonly=True)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||
reference_length = fields.Char(string='参考伸出长', readonly=True)
|
||||
cut_time = fields.Char(string='已切削时间', readonly=True)
|
||||
cut_length = fields.Char(string='已切削长度', readonly=True)
|
||||
cut_number = fields.Char(string='已切削次数', readonly=True)
|
||||
|
||||
loading_task_source = fields.Selection([('0', 'CAM装刀'), ('1', '机台换刀')], string='装刀任务来源', readonly=True)
|
||||
applicant = fields.Char(string='申请人', readonly=True)
|
||||
@@ -524,7 +567,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
apply_time = fields.Datetime(string='申请时间', default=fields.Datetime.now(), readonly=True)
|
||||
assemble_status = fields.Selection([('0', '待组装'), ('1', '已组装'), ('2', '已出库')],string='组装状态', default='0', readonly=True)
|
||||
use_tool_time = fields.Datetime(string='用刀时间', readonly=True)
|
||||
production_line_name = fields.Char(string='产线名称', readonly=False)
|
||||
production_line_name_id = fields.Many2one('sf.production.line', string='产线名称', readonly=False)
|
||||
machine_tool_name_id = fields.Many2one('sf.machine_tool', string='机床名称', readonly=True)
|
||||
machine_tool_code = fields.Char(string='机台号', readonly=True)
|
||||
cutter_spacing_code = fields.Char(string='刀位号', readonly=True)
|
||||
@@ -552,12 +595,30 @@ class FunctionalToolAssembly(models.Model):
|
||||
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
|
||||
('cutter_spacing_code', '=', self.cutter_spacing_code)
|
||||
]).write({
|
||||
'tool_name': None,
|
||||
'tool_brand': None,
|
||||
'tool_type': None,
|
||||
'knife_handle_name': None,
|
||||
'knife_handle_brand': None,
|
||||
'knife_handle_type': None,
|
||||
'mrs_cutting_tool_integral_model_ids': None,
|
||||
'integral_code': None,
|
||||
'integral_name': None,
|
||||
'sf_tool_brand_id_1': None,
|
||||
'mrs_cutting_tool_blade_model_ids': None,
|
||||
'blade_code': None,
|
||||
'blade_name': None,
|
||||
'sf_tool_brand_id_2': None,
|
||||
'mrs_cutting_tool_cutterbar_model_ids': None,
|
||||
'bar_code': None,
|
||||
'bar_name': None,
|
||||
'sf_tool_brand_id_3': None,
|
||||
'mrs_cutting_tool_cutterpad_model_ids': None,
|
||||
'pad_code': None,
|
||||
'pad_name': None,
|
||||
'sf_tool_brand_id_4': None,
|
||||
'mrs_cutting_tool_cutterhandle_model_ids': None,
|
||||
'handle_code': None,
|
||||
'handle_name': None,
|
||||
'sf_tool_brand_id_5': None,
|
||||
'mrs_cutting_tool_cutterhead_model_ids': None,
|
||||
'chuck_code': None,
|
||||
'chuck_name': None,
|
||||
'sf_tool_brand_id_6': None,
|
||||
'coarse_middle_thin': None,
|
||||
'tool_loading_length': None,
|
||||
'new_former': None,
|
||||
@@ -579,14 +640,13 @@ class FunctionalToolAssembly(models.Model):
|
||||
self.env['sf.delivery.of.cargo.from.storage'].search([]).unlink()
|
||||
|
||||
vals = self.env['sf.functional.tool.assembly'].search([('check_box_1', '=', True),('assemble_status', '=', '1')])
|
||||
|
||||
if vals:
|
||||
for val in vals:
|
||||
self.env['sf.delivery.of.cargo.from.storage'].create({
|
||||
'functional_tool_code': val.functional_tool_code,
|
||||
'name': val.name.id,
|
||||
'functional_tool_type_id': val.functional_tool_type_id.id,
|
||||
'production_line_name': val.production_line_name,
|
||||
'production_line_name_id': val.production_line_name_id.id,
|
||||
'machine_tool_code': val.machine_tool_code,
|
||||
'receive_person': val.receive_person,
|
||||
'receive_time': val.receive_time
|
||||
@@ -596,7 +656,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
'functional_tool_code': self.functional_tool_code,
|
||||
'name': self.name.id,
|
||||
'functional_tool_type_id': self.functional_tool_type_id.id,
|
||||
'production_line_name': self.production_line_name,
|
||||
'production_line_name_id': self.production_line_name_id.id,
|
||||
'machine_tool_code': self.machine_tool_code,
|
||||
'receive_person': self.receive_person,
|
||||
'receive_time': self.receive_time
|
||||
|
||||
Reference in New Issue
Block a user