Merge branch 'feature/修复多面返工工单状态变更错误' into develop
This commit is contained in:
@@ -56,7 +56,8 @@ class MrpProduction(models.Model):
|
|||||||
reprogramming_num = fields.Integer('重新编程次数', default=0)
|
reprogramming_num = fields.Integer('重新编程次数', default=0)
|
||||||
work_state = fields.Char('业务状态')
|
work_state = fields.Char('业务状态')
|
||||||
programming_state = fields.Selection(
|
programming_state = fields.Selection(
|
||||||
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发')], string='编程状态',
|
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'), ('已下发', '已下发')],
|
||||||
|
string='编程状态',
|
||||||
tracking=True)
|
tracking=True)
|
||||||
glb_file = fields.Binary("glb模型文件")
|
glb_file = fields.Binary("glb模型文件")
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True)
|
production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True)
|
||||||
|
|||||||
@@ -827,27 +827,36 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
re_work = self.env['mrp.workorder'].search([('production_id', '=', workorder.production_id.id),
|
re_work = self.env['mrp.workorder'].search([('production_id', '=', workorder.production_id.id),
|
||||||
('processing_panel', '=', workorder.processing_panel),
|
('processing_panel', '=', workorder.processing_panel),
|
||||||
('is_rework', '=', True), ('state', 'in', ['done', 'rework'])])
|
('is_rework', '=', True), ('state', 'in', ['done', 'rework'])])
|
||||||
logging.info('re_work:%s' % re_work.state)
|
|
||||||
if workorder.state not in ['cancel', 'progress', 'rework']:
|
if workorder.state not in ['cancel', 'progress', 'rework']:
|
||||||
|
if workorder.production_id.state == 'rework':
|
||||||
|
logging.info('len(re_work):%s' % len(re_work))
|
||||||
logging.info('工序:%s' % workorder.routing_type)
|
logging.info('工序:%s' % workorder.routing_type)
|
||||||
logging.info('状态:%s' % workorder.state)
|
logging.info('状态:%s' % workorder.state)
|
||||||
logging.info('is_rework:%s' % workorder.is_rework)
|
logging.info('is_rework:%s' % workorder.is_rework)
|
||||||
logging.info('面:%s' % workorder.processing_panel)
|
logging.info('面:%s' % workorder.processing_panel)
|
||||||
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
||||||
logging.info('制造状态:%s' % workorder.production_id.state)
|
logging.info('制造状态:%s' % workorder.production_id.state)
|
||||||
# if workorder.state =='done' and workorder.is_rework is True:
|
if re_work:
|
||||||
# workorder.state = 'rework'
|
if workorder.routing_type == '装夹预调' and workorder.state not in ['done', 'rework',
|
||||||
# else:
|
'cancel'] and workorder.is_rework is False:
|
||||||
# if re_work:
|
workorder.state = 'waiting'
|
||||||
# workorder.state = 'rework'
|
if workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']:
|
||||||
if workorder.production_id.state == 'rework':
|
pre_workorder = self.env['mrp.workorder'].search(
|
||||||
if (workorder.routing_type == 'CNC加工' and workorder.state == 'done') or (
|
[('production_id', '=', workorder.production_id.id),
|
||||||
workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '编程中' and re_work):
|
('processing_panel', '=', workorder.processing_panel),
|
||||||
logging.info('面111:%s' % workorder.processing_panel)
|
('routing_type', '=', '装夹预调'), ('state', '=', 'done')])
|
||||||
|
if pre_workorder:
|
||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
elif workorder.production_id.state == 'progress':
|
elif workorder.production_id.state == 'progress':
|
||||||
logging.info('面222:%s' % workorder.processing_panel)
|
logging.info('len(re_work):%s' % len(re_work))
|
||||||
if workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已下发' and re_work:
|
logging.info('工序:%s' % workorder.routing_type)
|
||||||
|
logging.info('状态:%s' % workorder.state)
|
||||||
|
logging.info('is_rework:%s' % workorder.is_rework)
|
||||||
|
logging.info('面:%s' % workorder.processing_panel)
|
||||||
|
logging.info('编程状态:%s' % workorder.production_id.programming_state)
|
||||||
|
logging.info('制造状态:%s' % workorder.production_id.state)
|
||||||
|
if workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已下发':
|
||||||
|
if re_work:
|
||||||
workorder.state = 'ready'
|
workorder.state = 'ready'
|
||||||
# else:
|
# else:
|
||||||
# if workorder.state not in ['cancel', 'rework']:
|
# if workorder.state not in ['cancel', 'rework']:
|
||||||
@@ -988,7 +997,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if record.routing_type == '装夹预调':
|
if record.routing_type == '装夹预调':
|
||||||
if not record.material_center_point and record.X_deviation_angle > 0:
|
if not record.material_center_point and record.X_deviation_angle > 0:
|
||||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||||
if not record.rfid_code:
|
if not record.rfid_code and record.is_rework is False:
|
||||||
raise UserError("请扫RFID码进行绑定")
|
raise UserError("请扫RFID码进行绑定")
|
||||||
record.process_state = '待加工'
|
record.process_state = '待加工'
|
||||||
# record.write({'process_state': '待加工'})
|
# record.write({'process_state': '待加工'})
|
||||||
@@ -1130,32 +1139,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
workorder.detection_report = base64.b64encode(open(report_file_path, 'rb').read())
|
workorder.detection_report = base64.b64encode(open(report_file_path, 'rb').read())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# 重新下发nc程序
|
|
||||||
# def button_send_program_again(self):
|
|
||||||
# try:
|
|
||||||
# res = {'programming_no': self.production_id.programming_no}
|
|
||||||
# configsettings = self.env['res.config.settings'].get_values()
|
|
||||||
# config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
|
||||||
# url = '/api/intelligent_programming/reset_state_again'
|
|
||||||
# config_url = configsettings['sf_url'] + url
|
|
||||||
# r = requests.post(config_url, json=res, data=None, headers=config_header)
|
|
||||||
# r = r.json()
|
|
||||||
# result = json.loads(r['result'])
|
|
||||||
# if result['status'] == 1:
|
|
||||||
# productions = self.env['mrp.production'].search(
|
|
||||||
# [('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
|
|
||||||
# if productions:
|
|
||||||
# workorder = productions.workorder_ids.filtered(
|
|
||||||
# lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
|
|
||||||
# 'progress'])
|
|
||||||
# if workorder:
|
|
||||||
# productions.write({'work_state': '编程中', 'programming_state': '编程中'})
|
|
||||||
# else:
|
|
||||||
# raise UserError(result['message'])
|
|
||||||
# except Exception as e:
|
|
||||||
# logging.info('button_send_program_again error:%s' % e)
|
|
||||||
# raise UserError("重新下发nc程序失败,请联系管理员")
|
|
||||||
|
|
||||||
def print_method(self):
|
def print_method(self):
|
||||||
"""
|
"""
|
||||||
解除装夹处调用关联制造订单的关联序列号的打印方法
|
解除装夹处调用关联制造订单的关联序列号的打印方法
|
||||||
|
|||||||
@@ -455,6 +455,9 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//filter[@name='planning_issues']" position="before">
|
<xpath expr="//filter[@name='planning_issues']" position="before">
|
||||||
<separator/>
|
<separator/>
|
||||||
|
<filter string="返工且已编程" name="filter_rework_programmed"
|
||||||
|
domain="[('state', '=', 'rework'),('programming_state', '=', '已编程')]"/>
|
||||||
|
<separator/>
|
||||||
<filter name="filter_programming" string="编程中"
|
<filter name="filter_programming" string="编程中"
|
||||||
domain="[('programming_state', '=', '编程中')]"/>
|
domain="[('programming_state', '=', '编程中')]"/>
|
||||||
<filter name="filter_programmed" string="已编程"
|
<filter name="filter_programmed" string="已编程"
|
||||||
@@ -555,7 +558,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<!-- <field name="handle_result"/>-->
|
<!-- <field name="handle_result"/>-->
|
||||||
<field name="test_report" readonly="1" widget="pdf_viewer"/>
|
<field name="test_report" readonly="1" widget="pdf_viewer"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -81,10 +81,14 @@ class ReworkWizard(models.TransientModel):
|
|||||||
if production_id:
|
if production_id:
|
||||||
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
if self.env.user.has_group('sf_base.group_sf_order_user'):
|
||||||
panel_ids = []
|
panel_ids = []
|
||||||
|
panel_arr = production_id.product_id.model_processing_panel
|
||||||
for p in production_id.detection_result_ids.filtered(
|
for p in production_id.detection_result_ids.filtered(
|
||||||
lambda ap1: ap1.handle_result == '待处理'):
|
lambda ap1: ap1.handle_result == '待处理'):
|
||||||
|
if p.processing_panel not in panel_arr:
|
||||||
|
panel_arr += ','.join(p.processing_panel)
|
||||||
|
for item in panel_arr.split(','):
|
||||||
panel = self.env['sf.processing.panel'].search(
|
panel = self.env['sf.processing.panel'].search(
|
||||||
[('name', 'ilike', p.processing_panel)])
|
[('name', 'ilike', item)])
|
||||||
if panel:
|
if panel:
|
||||||
panel_ids.append(panel.id)
|
panel_ids.append(panel.id)
|
||||||
domain = {'processing_panel_id': [('id', 'in', panel_ids)]}
|
domain = {'processing_panel_id': [('id', 'in', panel_ids)]}
|
||||||
|
|||||||
Reference in New Issue
Block a user