1.工单状态新增‘返工’,2,在制造订单上点击返工选择加工面确认后,新增加工面的对应工单及新增重置cloud的编程单的状态3.优化返工向导
This commit is contained in:
@@ -47,7 +47,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
('切割', '切割'), ('表面工艺', '表面工艺')
|
||||
], string="工序类型")
|
||||
results = fields.Char('结果')
|
||||
state = fields.Selection(selection_add=[('to be detected', "待检测")])
|
||||
state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')])
|
||||
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
|
||||
@@ -820,26 +820,26 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
# @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
||||
# def _compute_state(self):
|
||||
# super(ResMrpWorkOrder, self)._compute_state()
|
||||
# for item in self:
|
||||
# print(item.name)
|
||||
# print(item.state)
|
||||
# print(item.is_remanufacture)
|
||||
# scrap_workorder = self.env['mrp.workorder'].search(
|
||||
# [('production_id', '=', item.production_id.id), ('routing_type', '=', 'CNC加工'),
|
||||
# ('state', '=', 'done'), ('test_results', 'in', ['返工', '报废'])])
|
||||
# print(scrap_workorder)
|
||||
# # if item.routing_type == 'CNC加工' and item.state in ['done'] and item.test_results in ['返工', '报废']:
|
||||
# if item.routing_type == '解除装夹':
|
||||
# if scrap_workorder and item.state not in ['cancel']:
|
||||
# item.state = 'cancel'
|
||||
# elif item.routing_type == '表面工艺':
|
||||
# if scrap_workorder:
|
||||
# stock_move = self.env['stock.move'].search(
|
||||
# [('origin', '=', item.production_id.name)])
|
||||
# stock_move.write({'state': 'cancel'})
|
||||
# item.picking_ids.write({'state': 'cancel'})
|
||||
# item.state = 'cancel'
|
||||
# for workorder in self:
|
||||
# if any(
|
||||
# (wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' for wo in
|
||||
# production.workorder_ids):
|
||||
# production.state = 'rework'
|
||||
# if workorder.state == 'pending':
|
||||
# if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
# workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned' else 'waiting'
|
||||
# continue
|
||||
# if workorder.state not in ('waiting', 'ready'):
|
||||
# continue
|
||||
# if not all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
# workorder.state = 'pending'
|
||||
# continue
|
||||
# if workorder.production_id.reservation_state not in ('waiting', 'confirmed', 'assigned'):
|
||||
# continue
|
||||
# if workorder.production_id.reservation_state == 'assigned' and workorder.state == 'waiting':
|
||||
# workorder.state = 'ready'
|
||||
# elif workorder.production_id.reservation_state != 'assigned' and workorder.state == 'ready':
|
||||
# workorder.state = 'waiting'
|
||||
|
||||
# 重写工单开始按钮方法
|
||||
def button_start(self):
|
||||
@@ -1175,24 +1175,25 @@ class CNCprocessing(models.Model):
|
||||
|
||||
def _json_cnc_processing(self, panel, ret):
|
||||
cnc_processing = []
|
||||
for item in ret['programming_list']:
|
||||
if item['processing_panel'] == panel and item['ftp_path'].find('.dmi') == -1:
|
||||
cnc_processing.append((0, 0, {
|
||||
'sequence_number': item['sequence_number'],
|
||||
'program_name': item['program_name'],
|
||||
'cutting_tool_name': item['cutting_tool_name'],
|
||||
'cutting_tool_no': item['cutting_tool_no'],
|
||||
'processing_type': item['processing_type'],
|
||||
'margin_x_y': item['margin_x_y'],
|
||||
'margin_z': item['margin_z'],
|
||||
'depth_of_processing_z': item['depth_of_processing_z'],
|
||||
'cutting_tool_extension_length': item['cutting_tool_extension_length'],
|
||||
'cutting_tool_handle_type': item['cutting_tool_handle_type'],
|
||||
'estimated_processing_time': item['estimated_processing_time'],
|
||||
'program_path': item['ftp_path'],
|
||||
'program_create_date': datetime.strptime(item['program_create_date'], '%Y-%m-%d %H:%M:%S'),
|
||||
'remark': item['remark']
|
||||
}))
|
||||
if ret is not False:
|
||||
for item in ret['programming_list']:
|
||||
if item['processing_panel'] == panel and item['ftp_path'].find('.dmi') == -1:
|
||||
cnc_processing.append((0, 0, {
|
||||
'sequence_number': item['sequence_number'],
|
||||
'program_name': item['program_name'],
|
||||
'cutting_tool_name': item['cutting_tool_name'],
|
||||
'cutting_tool_no': item['cutting_tool_no'],
|
||||
'processing_type': item['processing_type'],
|
||||
'margin_x_y': item['margin_x_y'],
|
||||
'margin_z': item['margin_z'],
|
||||
'depth_of_processing_z': item['depth_of_processing_z'],
|
||||
'cutting_tool_extension_length': item['cutting_tool_extension_length'],
|
||||
'cutting_tool_handle_type': item['cutting_tool_handle_type'],
|
||||
'estimated_processing_time': item['estimated_processing_time'],
|
||||
'program_path': item['ftp_path'],
|
||||
'program_create_date': datetime.strptime(item['program_create_date'], '%Y-%m-%d %H:%M:%S'),
|
||||
'remark': item['remark']
|
||||
}))
|
||||
return cnc_processing
|
||||
|
||||
# 根据程序名和加工面匹配到ftp里对应的Nc程序名,可优化为根据cnc_processing.program_path进行匹配
|
||||
@@ -1648,12 +1649,13 @@ class CMMprogram(models.Model):
|
||||
|
||||
def _json_cmm_program(self, panel, ret):
|
||||
cmm_program = []
|
||||
for item in ret['programming_list']:
|
||||
if item['processing_panel'] == panel and item['ftp_path'].find('.dmi') != -1:
|
||||
cmm_program.append((0, 0, {
|
||||
'sequence_number': 1,
|
||||
'program_name': item['program_name'],
|
||||
'program_path': item['ftp_path'],
|
||||
'program_create_date': datetime.strptime(item['program_create_date'], '%Y-%m-%d %H:%M:%S'),
|
||||
}))
|
||||
if ret is not False:
|
||||
for item in ret['programming_list']:
|
||||
if item['processing_panel'] == panel and item['ftp_path'].find('.dmi') != -1:
|
||||
cmm_program.append((0, 0, {
|
||||
'sequence_number': 1,
|
||||
'program_name': item['program_name'],
|
||||
'program_path': item['ftp_path'],
|
||||
'program_create_date': datetime.strptime(item['program_create_date'], '%Y-%m-%d %H:%M:%S'),
|
||||
}))
|
||||
return cmm_program
|
||||
|
||||
Reference in New Issue
Block a user