修改AGV调度系统

This commit is contained in:
胡尧
2024-08-09 17:32:46 +08:00
parent a79500d0ad
commit 9dbea66b73
14 changed files with 349 additions and 169 deletions

View File

@@ -17,7 +17,7 @@
<button name="recognize_production" string="识别" type="object" class="oe_highlight"/>
</div>
<field name="type" readonly="1"/>
<field name="feeder_station_start_id" options="{'no_create': True}" require="1"/>
<field name="feeder_station_start_id" options="{'no_create': True}" required="1"/>
<field name="workcenter_id" options="{'no_create': True}"/>
</group>
<footer>

View File

@@ -50,29 +50,33 @@ class WorkpieceDeliveryWizard(models.TransientModel):
type = fields.Selection(selection=_get_agv_route_type_selection, string='类型')
def confirm(self):
if self.workorder_id:
self.workorder_id.workpiece_delivery_ids[0].agv_dispatch_id()
else:
is_not_production_line = 0
same_production_line_id = None
notsame_production_line_arr = []
for item in self.production_ids:
if same_production_line_id is None:
same_production_line_id = item.production_line_id.id
if item.production_line_id.id != same_production_line_id:
notsame_production_line_arr.append(item.name)
notsame_production_line_str = ','.join(map(str, notsame_production_line_arr))
if is_not_production_line >= 1:
raise UserError('制造订单号为%s的目的生产线不一致' % notsame_production_line_str)
try:
if self.workorder_id:
self.workorder_id.workpiece_delivery_ids[0].agv_scheduling_id()
else:
# 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
is_not_production_line = 0
same_production_line_id = None
notsame_production_line_arr = []
for item in self.production_ids:
if same_production_line_id is None:
same_production_line_id = item.production_line_id.id
if item.production_line_id.id != same_production_line_id:
notsame_production_line_arr.append(item.name)
notsame_production_line_str = ','.join(map(str, notsame_production_line_arr))
if is_not_production_line >= 1:
raise UserError('制造订单号为%s的目的生产线不一致' % notsame_production_line_str)
else:
# self.delivery_ids._delivery_avg()
agv_scheduling_id = self.env['sf.agv.scheduling'].add_scheduling(
agv_start_site_id=self.feeder_station_start_id.id,
agv_route_type=self.type,
productions=self.production_ids,
deliveries=self.delivery_ids
)
self.delivery_ids.agv_scheduling_id = agv_scheduling_id
except Exception as e:
logging.info('工件配送任务下发失败:%s' % e)
raise UserError('工件配送任务下发失败:%s' % e)
def recognize_production(self):
# production_ids = []