Accept Merge Request #1165: (feature/修复返工向导 -> develop)
Merge Request: 修复返工向导 Created By: @杨金灵 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1165
This commit is contained in:
@@ -803,7 +803,7 @@ class MrpProduction(models.Model):
|
||||
'default_production_id': self.id,
|
||||
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
||||
'default_programming_state': cloud_programming['programming_state'],
|
||||
'default_is_reprogramming': False if cloud_programming['programming_state'] not in ['已下发'] else True
|
||||
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -801,6 +801,13 @@ class ResMrpWorkOrder(models.Model):
|
||||
'cancel']:
|
||||
if re_work and workorder.production_id.is_rework is False:
|
||||
workorder.state = 'ready'
|
||||
if workorder.routing_type == '表面工艺' and workorder.state not in ['done', 'progress']:
|
||||
unclamp_workorder = self.env['mrp.workorder'].search(
|
||||
[('production_id', '=', workorder.production_id.id),
|
||||
('sequence', '=', workorder.sequence - 1),
|
||||
('state', 'in', ['done'])])
|
||||
if unclamp_workorder:
|
||||
workorder.state = 'ready'
|
||||
# else:
|
||||
# if workorder.state not in ['cancel', 'rework']:
|
||||
# workorder.state = 'rework'
|
||||
|
||||
@@ -24,6 +24,7 @@ class ReworkWizard(models.TransientModel):
|
||||
# 根据工单的加工面来显示
|
||||
processing_panel_id = fields.Many2many('sf.processing.panel', string="加工面")
|
||||
is_reprogramming = fields.Boolean(string='申请重新编程', default=False)
|
||||
is_reprogramming_readonly = fields.Boolean(string='申请重新编程(只读)', default=False)
|
||||
reprogramming_num = fields.Integer('重新编程次数', default=0)
|
||||
programming_state = fields.Selection(
|
||||
[('待编程', '待编程'), ('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'),
|
||||
@@ -85,9 +86,10 @@ class ReworkWizard(models.TransientModel):
|
||||
lambda ap1: ap1.processing_panel == panel.name and ap1.handle_result == '待处理').write(
|
||||
{'handle_result': '已处理'})
|
||||
if self.is_reprogramming is False:
|
||||
if self.reprogramming_num >= 1:
|
||||
if self.programming_state in ['已编程', '已下发']:
|
||||
if self.reprogramming_num >= 1 and self.programming_state == '已编程':
|
||||
self.production_id.get_new_program(panel.name)
|
||||
else:
|
||||
if self.reprogramming_num >= 0 and self.programming_state == '已下发':
|
||||
ret = {'programming_list': []}
|
||||
cnc_rework = self.production_id.workorder_ids.filtered(
|
||||
lambda crw: crw.processing_panel == panel.name and crw.state in (
|
||||
@@ -121,7 +123,8 @@ class ReworkWizard(models.TransientModel):
|
||||
'program_path': cmm_line.program_path,
|
||||
'ftp_path': item_line.program_path,
|
||||
'processing_panel': panel.name,
|
||||
'program_create_date': datetime.strftime(cmm_line.program_create_date,
|
||||
'program_create_date': datetime.strftime(
|
||||
cmm_line.program_create_date,
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
ret['programming_list'].append(vals)
|
||||
@@ -132,7 +135,8 @@ class ReworkWizard(models.TransientModel):
|
||||
new_cnc_workorder.write({
|
||||
'cnc_ids': new_cnc_workorder.cnc_ids.sudo()._json_cnc_processing(panel.name,
|
||||
ret),
|
||||
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name, ret),
|
||||
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel.name,
|
||||
ret),
|
||||
'cnc_worksheet': new_cnc_workorder.cnc_worksheet})
|
||||
new_pre_workorder = self.production_id.workorder_ids.filtered(lambda
|
||||
p: p.routing_type == '装夹预调' and p.processing_panel == panel.name and p.state not in (
|
||||
@@ -144,12 +148,15 @@ class ReworkWizard(models.TransientModel):
|
||||
new_pre_workorder.write(
|
||||
{'processing_drawing': pre_rework.processing_drawing})
|
||||
self.production_id.write({'state': 'progress', 'is_rework': False})
|
||||
elif self.programming_state in ['待编程', '编程中']:
|
||||
self.production_id.write(
|
||||
{'programming_state': '编程中', 'work_state': '编程中', 'is_rework': True})
|
||||
if self.is_reprogramming is True:
|
||||
self.production_id.update_programming_state()
|
||||
self.production_id.write(
|
||||
{'programming_state': '编程中', 'work_state': '编程中'})
|
||||
if self.production_id.state == 'progress':
|
||||
self.production_id.write({'programming_state': '已编程', 'work_state': '编程中'})
|
||||
self.production_id.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||
|
||||
@api.onchange('production_id')
|
||||
def onchange_processing_panel_id(self):
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
decoration-danger="programming_state =='已编程'" readonly="1"/>
|
||||
</div>
|
||||
<group>
|
||||
<field name="is_reprogramming"
|
||||
attrs='{"invisible": [("routing_type","in",["装夹预调","CNC加工"])],"readonly": [("is_reprogramming","=",False)]}'/>
|
||||
<field name="is_reprogramming" force_save="1"
|
||||
attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","not in",["已下发"])]}'/>
|
||||
<field name="is_reprogramming_readonly" string="申请重新编程"
|
||||
attrs='{"invisible": ["|",("routing_type","in",["装夹预调","CNC加工"]),("programming_state","in",["已下发"])],"readonly": [("is_reprogramming_readonly","=",False)]}'/>
|
||||
<field name="rework_reason"
|
||||
attrs='{"invisible": [("routing_type","not in",["装夹预调","CNC加工"])],"required": [("routing_type","in",["装夹预调"])]}'/>
|
||||
<field name="detailed_reason"
|
||||
|
||||
@@ -44,7 +44,6 @@ class ReSaleOrder(models.Model):
|
||||
store=True, readonly=False, precompute=True, check_company=True, tracking=True,
|
||||
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
|
||||
remark = fields.Text('备注')
|
||||
translated_display_name = fields.Char('交货人电话号码')
|
||||
validity_date = fields.Date(
|
||||
string="Expiration",
|
||||
compute='_compute_validity_date',
|
||||
|
||||
Reference in New Issue
Block a user