From 28659bfc95fba809a555ca42f17620dd066d9d5e Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 23 Feb 2023 08:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=88=E5=B9=B6=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E5=90=91=E5=AF=BC=EF=BC=8C=E5=A2=9E=E5=8A=A0cnc?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=9A=84=E7=BC=BA=E7=9C=81tree=E8=A7=86?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/__init__.py | 3 +- sf_machine_connect/__manifest__.py | 7 ++ sf_machine_connect/models/ftp_client.py | 19 ++- .../security/ir.model.access.csv | 3 +- sf_machine_connect/views/cnc.xml | 27 ++++ sf_machine_connect/views/compensation.xml | 6 +- sf_machine_connect/views/delivery_record.xml | 32 +++++ sf_machine_connect/views/ftp_button.xml | 13 ++ sf_machine_connect/wizard/__init__.py | 1 + sf_machine_connect/wizard/action_up.py | 116 ++++++++++++++++++ sf_machine_connect/wizard/up_select.xml | 34 +++++ sf_manufacturing/models/mrp_workorder.py | 3 + sf_manufacturing/views/mrp_workorder_view.xml | 5 +- 13 files changed, 260 insertions(+), 9 deletions(-) create mode 100644 sf_machine_connect/views/cnc.xml create mode 100644 sf_machine_connect/views/delivery_record.xml create mode 100644 sf_machine_connect/wizard/__init__.py create mode 100644 sf_machine_connect/wizard/action_up.py create mode 100644 sf_machine_connect/wizard/up_select.xml diff --git a/sf_machine_connect/__init__.py b/sf_machine_connect/__init__.py index 9a7e03ed..c536983e 100644 --- a/sf_machine_connect/__init__.py +++ b/sf_machine_connect/__init__.py @@ -1 +1,2 @@ -from . import models \ No newline at end of file +from . import models +from . import wizard \ No newline at end of file diff --git a/sf_machine_connect/__manifest__.py b/sf_machine_connect/__manifest__.py index 646a9403..2a78595b 100644 --- a/sf_machine_connect/__manifest__.py +++ b/sf_machine_connect/__manifest__.py @@ -16,13 +16,20 @@ 'data': [ # 定义权限组放在最上面 # 权限组 + 'security/ir.model.access.csv', + 'wizard/up_select.xml', + 'views/cnc.xml', + 'views/compensation.xml', 'views/ftp_button.xml', + 'views/SfWorkOrderBarcodes.xml', 'views/WorkCenterBarcodes.xml', 'views/Stock_picking_Barcodes.xml', 'views/machine_monitor.xml', 'views/machine_info_present.xml', + 'views/delivery_record.xml', + ], 'assets': { diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py index 40c7ca3c..49868871 100644 --- a/sf_machine_connect/models/ftp_client.py +++ b/sf_machine_connect/models/ftp_client.py @@ -23,7 +23,6 @@ _logger = logging.getLogger(__name__) class FtpButton(models.Model): _inherit = 'sf.cnc.processing' - button_state = fields.Boolean(string='是否已经下发') user_permissions = fields.Boolean(string='权限', related='workorder_id.user_permissions') state = fields.Selection(string='状态', related='workorder_id.state') @@ -301,12 +300,13 @@ class WorkCenterBarcode(models.Model): # 存在本地的文件下发到机床 _logger.info("=====================11================") ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local) + item.button_state = True # _logger.info("=====================22================") except Exception as e: _logger.info("=====================================", e) raise UserError('NC下发执行超时, 请检查下发状态') - # 下发都执行完毕后,按钮标志位变为true - self.button_up_all_state = True + # # 下发都执行完毕后,按钮标志位变为true + # self.cnc_ids.button_state = True def get__state(self): pay_time = str(datetime.now()) @@ -338,3 +338,16 @@ class WorkCenterBarcode(models.Model): } url = 'https://bfm.cs.jikimo.com/api/get/state' requests.post(url, json=json, data=None) + + def action_up_select(self): + return { + 'name': '选择要下发的程序文件', + 'view_mode': 'tree,form', + # 'res_model': self._name, + 'res_model': 'sf_tray_form_inherit', + 'target': 'main', # 打开方式 + # 'domain': [('project_num', '=', self.project_num), ('state', '=', 'done')], # 域 + 'type': 'ir.actions.act_window', # 返回的类型 + } + + diff --git a/sf_machine_connect/security/ir.model.access.csv b/sf_machine_connect/security/ir.model.access.csv index 53d13813..97e855f9 100644 --- a/sf_machine_connect/security/ir.model.access.csv +++ b/sf_machine_connect/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_ftp_client,ftp.client,model_ftp_client,base.group_user,1,1,1,1 + +access_up_select_wizard,up.select.wizard,model_up_select_wizard,base.group_user,1,1,1,1 diff --git a/sf_machine_connect/views/cnc.xml b/sf_machine_connect/views/cnc.xml new file mode 100644 index 00000000..1883d496 --- /dev/null +++ b/sf_machine_connect/views/cnc.xml @@ -0,0 +1,27 @@ + + + + + + sf.cnc.tree + sf.cnc.processing + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sf_machine_connect/views/compensation.xml b/sf_machine_connect/views/compensation.xml index 77ee1012..54652138 100644 --- a/sf_machine_connect/views/compensation.xml +++ b/sf_machine_connect/views/compensation.xml @@ -19,11 +19,13 @@ class="btn-primary" attrs='{"invisible": ["|", ("state","!=","progress"),("user_permissions","=",False)]}'/> - + +