优化工单
This commit is contained in:
@@ -58,6 +58,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
('cancel', '取消')], string='Status',
|
||||
compute='_compute_state', store=True,
|
||||
default='pending', copy=False, readonly=True, recursive=True, index=True, tracking=True)
|
||||
|
||||
# state = fields.Selection(selection_add=[('to be detected', "待检测"), ('rework', '返工')], tracking=True)
|
||||
|
||||
@api.depends('production_id.manual_quotation')
|
||||
@@ -243,6 +244,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
store=True, compute='_compute_tool_state')
|
||||
tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True)
|
||||
reserved_duration = fields.Float('预留时长', default=30, tracking=True)
|
||||
|
||||
@api.depends('cnc_ids.tool_state')
|
||||
def _compute_tool_state_remark(self):
|
||||
for item in self:
|
||||
@@ -651,7 +653,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# 拼接工单对象属性值
|
||||
def json_workorder_str(self, k, production, route, item):
|
||||
# 计算预计时长duration_expected
|
||||
routing_types = ['切割', '装夹预调', 'CNC加工','解除装夹']
|
||||
routing_types = ['切割', '装夹预调', 'CNC加工', '解除装夹']
|
||||
if route.routing_type in routing_types:
|
||||
routing_workcenter = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', route.routing_type)])
|
||||
@@ -704,7 +706,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
item),
|
||||
# 'workpiece_delivery_ids': False if not route.routing_type == '装夹预调' else self._json_workpiece_delivery_list(
|
||||
# production)
|
||||
'reserved_duration': reserved_duration,
|
||||
'reserved_duration': reserved_duration,
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
@@ -1169,8 +1171,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
if record.routing_type == '装夹预调':
|
||||
if not record.rfid_code and record.is_rework is False:
|
||||
raise UserError("请扫RFID码进行绑定")
|
||||
if not record.material_center_point or record.X_deviation_angle <= 0:
|
||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||
# if record.is_rework is False:
|
||||
# if not record.material_center_point or record.X_deviation_angle <= 0:
|
||||
# raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||
record.process_state = '待加工'
|
||||
# record.write({'process_state': '待加工'})
|
||||
record.production_id.process_state = '待加工'
|
||||
|
||||
Reference in New Issue
Block a user