diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 9ea3bb60..e84b34cc 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -43,6 +43,7 @@ 'sf_manufacturing/static/src/js/kanban_change.js', 'sf_manufacturing/static/src/scss/kanban_change.scss', 'sf_manufacturing/static/src/xml/button_show_on_tree.xml', + 'sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js', ] }, diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 84ee9f46..4c5788ef 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -458,7 +458,7 @@ class Manufacturing_Connect(http.Controller): if f'RfidCode{i}' in ret: rfid_code = ret[f'RfidCode{i}'] logging.info('RfidCode:%s' % rfid_code) - if rfid_code is not None: + if rfid_code is not None and rfid_code != '': rfid_codes.append(rfid_code) domain = [ ('rfid_code', '=', rfid_code), @@ -531,7 +531,7 @@ class Manufacturing_Connect(http.Controller): if f'RfidCode{i}' in ret: rfid_code = ret[f'RfidCode{i}'] logging.info('RfidCode:%s' % rfid_code) - if rfid_code is not None: + if rfid_code is not None and rfid_code != '': domain = [ ('rfid_code', '=', rfid_code), ('routing_type', '=', 'CNC加工'), ('state', '!=', 'rework') diff --git a/sf_manufacturing/models/agv_scheduling.py b/sf_manufacturing/models/agv_scheduling.py index c84f741d..4fbfbf8d 100644 --- a/sf_manufacturing/models/agv_scheduling.py +++ b/sf_manufacturing/models/agv_scheduling.py @@ -88,6 +88,7 @@ class AgvScheduling(models.Model): agv_route_type: AGV任务类型 workorders: 工单 """ + _logger.info('创建AGV调度任务\r\n起点为【%s】,任务类型为【%s】,工单为【%s】' % (agv_start_site_name, agv_route_type, workorders)) if not workorders: raise UserError(_('工单不能为空')) agv_start_site = self.env['sf.agv.site'].sudo().search([('name', '=', agv_start_site_name)], limit=1) diff --git a/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js b/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js new file mode 100644 index 00000000..cb044955 --- /dev/null +++ b/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js @@ -0,0 +1,53 @@ +odoo.define('sf_manufacturing.action_dispatch_confirm', function (require) { + const core = require('web.core'); + const ajax = require('web.ajax'); + const Dialog = require('web.Dialog'); + var rpc = require('web.rpc'); + var _t = core._t; + + async function dispatch_confirm(parent, {params}) { + console.log(params, 'params') + console.log("
本次下发的工件数量为:" + params.workorder_count + ",是否确认?
", 'content') + const dialog = new Dialog(parent, { + title: "确认", + $content: $('
').append("请确认是否仅配送" + params.workorder_count + "个工件?"), + buttons: [ + { text: "确认", classes: 'btn-primary', close: true, click: () => dispatchConfirmed(parent, params) }, + { text: "取消", close: true }, + ], + }); + dialog.open(); + + + async function dispatchConfirmed(parent, params) { + console.log(parent, 'parent') + rpc.query({ + model: 'sf.workpiece.delivery.wizard', + method: 'confirm', + args: [params.active_id] + , + kwargs: { + context: params.context, + } + }).then(res => { + console.log(res, 'res') + console.log(res.name, 'res') + parent.services.action.doAction({ + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'target': 'new', + 'params': { + 'message': '任务下发成功!AGV任务调度编号为【' + res.name + '】', + 'type': 'success', + 'sticky': false, + 'next': {'type': 'ir.actions.act_window_close'}, + } + }); + }) + + } + } + + core.action_registry.add('dispatch_confirm', dispatch_confirm); + return dispatch_confirm; +}); diff --git a/sf_manufacturing/views/agv_scheduling_views.xml b/sf_manufacturing/views/agv_scheduling_views.xml index be7b35cf..ef932e54 100644 --- a/sf_manufacturing/views/agv_scheduling_views.xml +++ b/sf_manufacturing/views/agv_scheduling_views.xml @@ -73,6 +73,7 @@ sequence="28" action="action_agv_scheduling_tree" parent="mrp.menu_mrp_manufacturing" + groups="sf_base.group_sf_order_user,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user" /> \ No newline at end of file diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index b0815ed5..12b15968 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -835,5 +835,11 @@ tree [('type','in',['运送空料架']),('name','not ilike','WDO')] + + diff --git a/sf_manufacturing/wizard/workpiece_delivery_views.xml b/sf_manufacturing/wizard/workpiece_delivery_views.xml index cec33be9..a4723b6b 100644 --- a/sf_manufacturing/wizard/workpiece_delivery_views.xml +++ b/sf_manufacturing/wizard/workpiece_delivery_views.xml @@ -18,8 +18,8 @@