去掉注释代码
This commit is contained in:
@@ -129,13 +129,16 @@ class MrpProduction(models.Model):
|
||||
if production.state == 'progress':
|
||||
if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'pending_cam'
|
||||
if production.state == 'pending_cam':
|
||||
if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')):
|
||||
production.state = 'done'
|
||||
# if production.state == 'pending_cam':
|
||||
# if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')):
|
||||
# production.state = 'done'
|
||||
if any(
|
||||
(
|
||||
wo.test_results == '返工' and wo.state == 'done' and programming_state == '编程中') or wo.state == 'rework' or (
|
||||
wo.is_rework is True and wo.state == 'done') for wo in
|
||||
wo.test_results == '返工' and wo.state == 'done' and production.programming_state == '已编程') or (
|
||||
wo.state == 'rework' and production.programming_state == '编程中') or (
|
||||
wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中',
|
||||
'已编程'])
|
||||
for wo in
|
||||
production.workorder_ids):
|
||||
production.state = 'rework'
|
||||
|
||||
@@ -198,8 +201,8 @@ class MrpProduction(models.Model):
|
||||
production.write({'programming_state': '已编程未下发' if item[
|
||||
'programming_state'] == '已编程' else '编程中'})
|
||||
else:
|
||||
self.write({'programming_state': '已编程未下发' if item[
|
||||
'programming_state'] == '已编程' else '编程中'})
|
||||
return item['programming_state']
|
||||
|
||||
else:
|
||||
raise UserError(ret['message'])
|
||||
except Exception as e:
|
||||
@@ -760,8 +763,11 @@ class MrpProduction(models.Model):
|
||||
|
||||
# 返工
|
||||
def button_rework(self):
|
||||
if self.programming_state != '已编程':
|
||||
self._cron_get_programming_state()
|
||||
cloud_programming_state = None
|
||||
if self.programming_state != '已编程' and self.reprogramming_num >= 1:
|
||||
cloud_programming_state = self._cron_get_programming_state()
|
||||
logging.info('cloud_programming_state:%s' % cloud_programming_state)
|
||||
logging.info('programming_state:%s' % self.programming_state)
|
||||
return {
|
||||
'name': _('返工'),
|
||||
'type': 'ir.actions.act_window',
|
||||
@@ -771,8 +777,12 @@ class MrpProduction(models.Model):
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_product_id': self.product_id.id,
|
||||
'default_programming_state': self.programming_state,
|
||||
'default_is_reprogramming': True if self.programming_state in ['已编程'] else False
|
||||
'default_programming_state': self.programming_state if cloud_programming_state is not None else cloud_programming_state,
|
||||
'default_is_reprogramming': False if (cloud_programming_state in ['编程中',
|
||||
'待编程'] and self.programming_state in [
|
||||
'编程中'])
|
||||
or (cloud_programming_state in [
|
||||
'已编程'] and self.programming_state in ['已编程未下发']) else True
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,13 +817,7 @@ class MrpProduction(models.Model):
|
||||
lambda m1: m1.state != 'rework' and m1.processing_panel == rework_workorder[0].processing_panel)
|
||||
if not new_pancel_workorder.cnc_ids:
|
||||
production.get_new_program(rework_workorder[0].processing_panel)
|
||||
rework_production = self.env['mrp.production'].search(
|
||||
[('state', '=', 'rework'), ('programming_no', '=', production.programming_no)])
|
||||
if rework_production:
|
||||
rework_production.workorder_ids.filtered(
|
||||
lambda m2: m2.state != 'rework' and m2.processing_panel == rework_workorder[
|
||||
0].processing_panel and m2.routing_type == '装夹预调').write({'state': 'ready'})
|
||||
rework_production.write({'state': 'progress'})
|
||||
production.write({'state': 'progress', 'programming_state': '已下发'})
|
||||
|
||||
# 从cloud获取重新编程过的最新程序
|
||||
def get_new_program(self, processing_panel):
|
||||
|
||||
Reference in New Issue
Block a user