去掉注释代码
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):
|
||||
|
||||
@@ -827,6 +827,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
re_work = self.env['mrp.workorder'].search([('production_id', '=', workorder.production_id.id),
|
||||
('processing_panel', '=', workorder.processing_panel),
|
||||
('is_rework', '=', True), ('state', 'in', ['done', 'rework'])])
|
||||
logging.info('re_work:%s' % re_work.state)
|
||||
if workorder.state not in ['cancel', 'progress', 'rework']:
|
||||
logging.info('工序:%s' % workorder.routing_type)
|
||||
logging.info('状态:%s' % workorder.state)
|
||||
@@ -840,10 +841,14 @@ class ResMrpWorkOrder(models.Model):
|
||||
# if re_work:
|
||||
# workorder.state = 'rework'
|
||||
if workorder.production_id.state == 'rework':
|
||||
if (workorder.routing_type == 'CNC加工' and re_work.state == 'done') or (
|
||||
if (workorder.routing_type == 'CNC加工' and workorder.state == 'done') or (
|
||||
workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '编程中' and re_work):
|
||||
logging.info('面111:%s' % workorder.processing_panel)
|
||||
workorder.state = 'waiting'
|
||||
elif workorder.production_id.state == 'progress':
|
||||
logging.info('面222:%s' % workorder.processing_panel)
|
||||
if workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已下发' and re_work:
|
||||
workorder.state = 'ready'
|
||||
# else:
|
||||
# if workorder.state not in ['cancel', 'rework']:
|
||||
# workorder.state = 'rework'
|
||||
@@ -998,6 +1003,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'detailed_reason': record.detailed_reason,
|
||||
'processing_panel': record.processing_panel,
|
||||
'routing_type': record.routing_type,
|
||||
'handle_result': '待处理' if record.test_results == '返工' or record.is_rework is True else '',
|
||||
'test_results': record.test_results,
|
||||
'test_report': record.detection_report})]})
|
||||
if record.routing_type == '解除装夹':
|
||||
|
||||
@@ -7,8 +7,8 @@ import os
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user