增加agv调度系统
This commit is contained in:
@@ -18,15 +18,40 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
||||
route_id = fields.Many2one('sf.agv.task.route', '任务路线', domain=[('route_type', 'in', ['上产线', '下产线'])])
|
||||
feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
|
||||
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
|
||||
type = fields.Selection(
|
||||
[('上产线', '上产线'), ('下产线', '下产线'), ('运送空料架', '运送空料架')], string='类型')
|
||||
workcenter_id = fields.Many2one(string='所属区域', comodel_name='mrp.workcenter', tracking=True)
|
||||
|
||||
@api.onchange('type')
|
||||
def _onchange_type(self):
|
||||
routes = self.env['sf.agv.task.route'].search([('route_type', '=', self.type)])
|
||||
if self.type:
|
||||
start_site_ids = routes.mapped('start_site_id.id')
|
||||
workcenter_ids = routes.mapped('end_site_id.workcenter_id.id')
|
||||
if workcenter_ids:
|
||||
self.workcenter_id = workcenter_ids[0]
|
||||
return {
|
||||
'domain':
|
||||
{
|
||||
'feeder_station_start_id': [('id', 'in', start_site_ids)],
|
||||
'workcenter_id': [('id', 'in', workcenter_ids)],
|
||||
}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'domain':
|
||||
{
|
||||
'feeder_station_start_id': [],
|
||||
'workcenter_id': [],
|
||||
}
|
||||
}
|
||||
|
||||
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='类型')
|
||||
|
||||
def confirm(self):
|
||||
if self.type != '运送空料架':
|
||||
if not self.route_id:
|
||||
raise UserError('请选择路线')
|
||||
if self.workorder_id:
|
||||
self.workorder_id.workpiece_delivery_ids[0]._delivery_avg()
|
||||
self.workorder_id.workpiece_delivery_ids[0].agv_dispatch_id()
|
||||
else:
|
||||
is_not_production_line = 0
|
||||
same_production_line_id = None
|
||||
@@ -40,7 +65,14 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
||||
if is_not_production_line >= 1:
|
||||
raise UserError('制造订单号为%s的目的生产线不一致' % notsame_production_line_str)
|
||||
else:
|
||||
self.delivery_ids._delivery_avg()
|
||||
# self.delivery_ids._delivery_avg()
|
||||
agv_dispatch_id = self.env['sf.agv.dispatch'].add_queue(
|
||||
agv_start_site_id=self.feeder_station_start_id.id,
|
||||
agv_route_type=self.type,
|
||||
production_ids=self.production_ids,
|
||||
delivery_ids=self.delivery_ids.ids
|
||||
)
|
||||
self.delivery_ids.agv_dispatch_id = agv_dispatch_id
|
||||
|
||||
def recognize_production(self):
|
||||
# production_ids = []
|
||||
|
||||
Reference in New Issue
Block a user