外协流程更改
This commit is contained in:
@@ -106,11 +106,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
record.back_button_display = False
|
||||
# tag_type
|
||||
if cur_workorder.is_subcontract or cur_workorder.routing_type == '解除装夹' or cur_workorder.routing_type == '切割' or any(
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and
|
||||
detection_result.routing_type == cur_workorder.routing_type and
|
||||
cur_workorder.tag_type !='重新加工' and
|
||||
detection_result.test_results != '合格'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and
|
||||
detection_result.routing_type == cur_workorder.routing_type and
|
||||
cur_workorder.tag_type != '重新加工' and
|
||||
detection_result.test_results != '合格'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
):
|
||||
record.back_button_display = False
|
||||
else:
|
||||
@@ -122,11 +122,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract or cur_workorder.routing_type == '解除装夹' or cur_workorder.routing_type == '切割' or any(
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and
|
||||
detection_result.routing_type == cur_workorder.routing_type and
|
||||
cur_workorder.tag_type !='重新加工' and
|
||||
detection_result.test_results != '合格'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
detection_result.processing_panel == cur_workorder.processing_panel and
|
||||
detection_result.routing_type == cur_workorder.routing_type and
|
||||
cur_workorder.tag_type != '重新加工' and
|
||||
detection_result.test_results != '合格'
|
||||
for detection_result in cur_workorder.production_id.detection_result_ids
|
||||
):
|
||||
record.back_button_display = False
|
||||
|
||||
@@ -429,9 +429,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
def _compute_surface_technics_purchase_ids(self):
|
||||
for order in self:
|
||||
if order.routing_type == '表面工艺' and order.state not in ['cancel']:
|
||||
domain = [('purchase_type', '=', 'consignment'),
|
||||
('origin', 'like', '%' + self.production_id.name + '%'),
|
||||
('state', '!=', 'cancel')]
|
||||
domain = [('group_id', '=', self.production_id.procurement_group_id.id),
|
||||
('purchase_type', '=', 'consignment'), ('state', '!=', 'cancel')]
|
||||
# domain = [('purchase_type', '=', 'consignment'),
|
||||
# ('origin', 'like', '%' + self.production_id.name + '%'),
|
||||
# ('state', '!=', 'cancel')]
|
||||
purchase = self.env['purchase.order'].search(domain)
|
||||
order.surface_technics_purchase_count = 0
|
||||
if not purchase:
|
||||
@@ -472,14 +474,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
return result
|
||||
|
||||
def _get_surface_technics_purchase_ids(self):
|
||||
domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
||||
purchase_orders = self.env['purchase.order'].search(domain)
|
||||
# domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')]
|
||||
domain = [('group_id', '=', self.production_id.procurement_group_id.id), ('purchase_type', '=', 'consignment')]
|
||||
purchase_orders = self.env['purchase.order'].search(domain, order='id desc', # 按创建时间降序(最新的在前)
|
||||
limit=1)
|
||||
purchase_orders_id = self.env['purchase.order']
|
||||
for po in purchase_orders:
|
||||
for line in po.order_line:
|
||||
if line.product_id.server_product_process_parameters_id == self.surface_technics_parameters_id:
|
||||
if line.product_qty == 1:
|
||||
purchase_orders_id = line.order_id
|
||||
purchase_orders_id = line.order_id
|
||||
return purchase_orders_id
|
||||
|
||||
supplier_id = fields.Many2one('res.partner', string='外协供应商')
|
||||
@@ -1200,6 +1203,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'cmm_ids': production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').cmm_ids,
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
def _process_compute_state(self):
|
||||
for workorder in self:
|
||||
# 如果工单的工序没有进行排序则跳出循环
|
||||
@@ -1224,7 +1228,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
and workorder.production_id.schedule_state == '已排'
|
||||
and len(workorder.production_id.picking_ids.filtered(
|
||||
lambda w: w.state not in ['done', 'cancel'])) == 0):
|
||||
# and workorder.production_id.programming_state == '已编程'
|
||||
# and workorder.production_id.programming_state == '已编程'
|
||||
if workorder.is_subcontract is True:
|
||||
if workorder.production_id.state == 'rework':
|
||||
workorder.state = 'waiting'
|
||||
@@ -1287,6 +1291,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
mo.get_move_line(workorder.production_id, workorder))
|
||||
else:
|
||||
workorder.state = 'waiting'
|
||||
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state',
|
||||
'production_id.tool_state', 'production_id.schedule_state', 'sequence',
|
||||
'production_id.programming_state')
|
||||
@@ -1301,6 +1306,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
for check_id in workorder.check_ids:
|
||||
if not check_id.is_inspect:
|
||||
check_id.quality_state = 'none'
|
||||
|
||||
# 重写工单开始按钮方法
|
||||
def button_start(self):
|
||||
# 判断工单状态是否为等待组件
|
||||
@@ -1534,7 +1540,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# workorder.rfid_code_old = rfid_code
|
||||
# workorder.rfid_code = False
|
||||
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
|
||||
|
||||
|
||||
if is_production_id is True:
|
||||
logging.info('product_qty:%s' % record.production_id.product_qty)
|
||||
for move_raw_id in record.production_id.move_raw_ids:
|
||||
@@ -1552,7 +1558,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
# 如果工单包含了外协工序,需要预留数量
|
||||
if self.move_raw_ids.move_orig_ids.subcontract_workorder_id:
|
||||
location_id = self.move_raw_ids.location_id
|
||||
quant = self.move_raw_ids.lot_ids.quant_ids.filtered(lambda q: q.location_id.id == location_id.id)
|
||||
quant = self.move_raw_ids.lot_ids.quant_ids.filtered(
|
||||
lambda q: q.location_id.id == location_id.id)
|
||||
if quant.reserved_quantity == 0:
|
||||
self.env['stock.quant']._update_reserved_quantity(
|
||||
self.move_raw_ids.product_id,
|
||||
@@ -1706,7 +1713,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
store=True, string='工序作业')
|
||||
individuation_page_ids = fields.Many2many('sf.work.individuation.page', string='个性化记录',
|
||||
related='routing_work_center_id.individuation_page_ids')
|
||||
individuation_page_list = fields.Char('个性化记录', default='', compute='_compute_individuation_page_ids', store=True)
|
||||
individuation_page_list = fields.Char('个性化记录', default='', compute='_compute_individuation_page_ids',
|
||||
store=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_routing_work_center_id(self):
|
||||
@@ -1727,6 +1735,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
individuation_page_list = [item.code for item in mw.individuation_page_ids]
|
||||
if individuation_page_list:
|
||||
mw.individuation_page_list = list(set(individuation_page_list))
|
||||
|
||||
# =============================================================================================
|
||||
|
||||
is_inspect = fields.Boolean('需送检', compute='_compute_is_inspect', store=True, default=False)
|
||||
@@ -2040,6 +2049,7 @@ class WorkPieceDelivery(models.Model):
|
||||
|
||||
def _get_agv_route_type_selection(self):
|
||||
return self.env['sf.agv.task.route'].fields_get(['route_type'])['route_type']['selection']
|
||||
|
||||
type = fields.Selection(selection=_get_agv_route_type_selection, string='类型')
|
||||
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
|
||||
status = fields.Selection(
|
||||
|
||||
Reference in New Issue
Block a user