diff --git a/sf_manufacturing/wizard/workpiece_delivery_views.xml b/sf_manufacturing/wizard/workpiece_delivery_views.xml
index 699fff53..e895d39e 100644
--- a/sf_manufacturing/wizard/workpiece_delivery_views.xml
+++ b/sf_manufacturing/wizard/workpiece_delivery_views.xml
@@ -18,8 +18,8 @@
diff --git a/sf_manufacturing/wizard/workpiece_delivery_wizard.py b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
index 4645d45f..a84612ff 100644
--- a/sf_manufacturing/wizard/workpiece_delivery_wizard.py
+++ b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
@@ -87,21 +87,9 @@ class WorkpieceDeliveryWizard(models.TransientModel):
}
def confirm(self):
try:
- # if self.workorder_id:
- # self.workorder_id.workpiece_delivery_ids[0].agv_scheduling_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)
- # else:
+ if not self.workorder_ids:
+ raise UserError('制造订单不能为空')
+
scheduling = self.env['sf.agv.scheduling'].add_scheduling(
agv_start_site_name=self.feeder_station_start_id.name,
agv_route_type=self.delivery_type,
@@ -129,7 +117,18 @@ class WorkpieceDeliveryWizard(models.TransientModel):
item.button_start()
item.button_finish()
- return scheduling.read()[0]
+ # return scheduling.read()[0]
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'target': 'new',
+ 'params': {
+ 'message': '任务下发成功!AGV任务调度编号为【%s】' % scheduling.name,
+ 'type': 'success',
+ 'sticky': False,
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ }
except Exception as e:
logging.info('%s任务下发失败:%s' % (self.delivery_type, e))
raise UserError('%s任务下发失败:%s' % (self.delivery_type, e))
@@ -189,7 +188,7 @@ class WorkpieceDeliveryWizard(models.TransientModel):
self.feeder_station_start_id = agv_site.id
else:
if self.feeder_station_start_id.id != agv_site.id:
- raise UserError('接驳站不匹配!')
+ raise UserError('起点接驳站不匹配!')
return
delivery_type = self.env.context.get('default_delivery_type')
if delivery_type == '上产线':