Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修复返工-cmm
This commit is contained in:
@@ -36,12 +36,17 @@ class MrpProduction(models.Model):
|
||||
def _compute_tool_state_remark(self):
|
||||
for item in self:
|
||||
if item.workorder_ids:
|
||||
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
|
||||
if workorder_ids.filtered(lambda a: a.tool_state_remark):
|
||||
work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark)
|
||||
work_ids = []
|
||||
for workorder_id in item.workorder_ids:
|
||||
if workorder_id.tool_state == '1':
|
||||
work_ids.append(workorder_id)
|
||||
if work_ids:
|
||||
tool_state_remark = ''
|
||||
for work_id in work_ids:
|
||||
tool_state_remark = f"{work_id.tool_state_remark}\n"
|
||||
if tool_state_remark == '':
|
||||
tool_state_remark = f"{work_id.tool_state_remark}"
|
||||
else:
|
||||
tool_state_remark = f"{tool_state_remark}\n{work_id.tool_state_remark}"
|
||||
item.tool_state_remark = tool_state_remark
|
||||
else:
|
||||
item.tool_state_remark = False
|
||||
@@ -51,10 +56,16 @@ class MrpProduction(models.Model):
|
||||
for item in self:
|
||||
if item.workorder_ids:
|
||||
tool_state = item.tool_state
|
||||
workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工'))
|
||||
if workorder_ids.filtered(lambda a: a.tool_state == '2'):
|
||||
work_ids_1 = []
|
||||
work_ids_2 = []
|
||||
for workorder_id in item.workorder_ids:
|
||||
if workorder_id.tool_state == '2':
|
||||
work_ids_2.append(workorder_id)
|
||||
elif workorder_id.tool_state == '1':
|
||||
work_ids_1.append(workorder_id)
|
||||
if work_ids_2:
|
||||
item.tool_state = '2'
|
||||
elif workorder_ids.filtered(lambda a: a.tool_state == '1'):
|
||||
elif work_ids_1:
|
||||
item.tool_state = '1'
|
||||
else:
|
||||
item.tool_state = '0'
|
||||
|
||||
@@ -189,11 +189,12 @@ class ResMrpWorkOrder(models.Model):
|
||||
if item.cnc_ids.filtered(lambda a: a.tool_state == '2'):
|
||||
item.tool_state_remark = None
|
||||
elif item.cnc_ids.filtered(lambda a: a.tool_state == '1'):
|
||||
tool_state_remark = f'{item.processing_panel}缺刀:['
|
||||
tool_state_remark = []
|
||||
cnc_ids = item.cnc_ids.filtered(lambda a: a.tool_state == '1')
|
||||
for cnc_id in cnc_ids:
|
||||
tool_state_remark = f"{tool_state_remark}'{cnc_id.cutting_tool_name}'"
|
||||
item.tool_state_remark = f"{tool_state_remark}]"
|
||||
if cnc_id.cutting_tool_name not in tool_state_remark:
|
||||
tool_state_remark.append(cnc_id.cutting_tool_name)
|
||||
item.tool_state_remark = f"{item.processing_panel}缺刀:{tool_state_remark}"
|
||||
else:
|
||||
item.tool_state_remark = None
|
||||
|
||||
@@ -820,7 +821,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
|
||||
'production_id.tool_state')
|
||||
def _compute_state(self):
|
||||
super()._compute_state()
|
||||
for workorder in self:
|
||||
|
||||
@@ -263,8 +263,17 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
if self.tool_name_id.name:
|
||||
cnc_processing_ids = self.env['sf.cnc.processing'].search(
|
||||
[('tool_state', '=', '1'), ('cutting_tool_name', '=', self.tool_name_id.name)])
|
||||
production_ids = []
|
||||
if cnc_processing_ids:
|
||||
cnc_processing_ids.sudo().write({'tool_state': '0'})
|
||||
for item in cnc_processing_ids:
|
||||
if item.workorder_id and item.workorder_id.production_id not in production_ids:
|
||||
production_ids.append(item.workorder_id.production_id)
|
||||
if production_ids:
|
||||
# 对同一制造订单的工单的cnc编程单的功能刀具状态进行变更,并调用工单的功能刀具状态计算方法
|
||||
for production_id in production_ids:
|
||||
cnc_ids = cnc_processing_ids.filtered(lambda a: a.workorder_id.production_id == production_id)
|
||||
cnc_ids.sudo().write({'tool_state': '0'})
|
||||
cnc_ids.workorder_id._compute_tool_state()
|
||||
|
||||
def tool_inventory_displacement_out(self):
|
||||
"""
|
||||
|
||||
@@ -876,7 +876,7 @@ class StockPicking(models.Model):
|
||||
if not stock_id:
|
||||
num = "%05d" % 1
|
||||
else:
|
||||
m = int(stock_id.name[-3:]) + 1
|
||||
m = int(stock_id.name[-5:]) + 1
|
||||
num = "%05d" % m
|
||||
return name + str(num)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user