agv调度开发

This commit is contained in:
胡尧
2024-08-15 11:34:38 +08:00
parent f7e4ce416a
commit 6c734eead4
4 changed files with 102 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
<!-- <field name="delivery_ids" invisible="True"/>-->
<field name="workorder_ids" invisible="True"/>
<field name="type" invisible="True"/>
<field name="confirm_button" invisible="1"/>
<field name="_barcode_scanned" widget="barcode_handler"/>
<group col="1">
<field name="production_ids" readonly="1" widget="many2many_tags" string="制造订单号"/>
@@ -17,7 +18,8 @@
<field name="workcenter_id" options="{'no_create': True}"/>
</group>
<footer>
<button string="配送" name="confirm" type="object" class="oe_highlight"/>
<button string="确认配送" name="confirm" type="object" class="oe_highlight" attrs="{'invisible': [('confirm_button', '!=', '确认配送')]}"/>
<button string="确认拆卸" name="confirm" type="object" class="oe_highlight" attrs="{'invisible': [('confirm_button', '!=', '确认拆卸')]}"/>
<button string="取消" class="btn btn-secondary" special="cancel"/>
</footer>
</sheet>

View File

@@ -20,11 +20,14 @@ class WorkpieceDeliveryWizard(models.TransientModel):
feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
workcenter_id = fields.Many2one(string='所属区域', comodel_name='mrp.workcenter', tracking=True)
confirm_button = fields.Char('按钮名称')
@api.onchange('type')
def _onchange_type(self):
routes = self.env['sf.agv.task.route'].search([('route_type', '=', self.type)])
if self.type:
routes = self.env['sf.agv.task.route'].search([('route_type', '=', self.type)])
if self.workcenter_id:
routes = routes.filtered(lambda a: a.start_site_id.workcenter_id.id == self.workcenter_id.id)
start_site_ids = routes.mapped('start_site_id.id')
workcenter_ids = routes.mapped('end_site_id.workcenter_id.id')
if workcenter_ids: