From 5a60eed5b19dd2c44c86007493a6dce2d3d5d24c Mon Sep 17 00:00:00 2001 From: hujiaying Date: Wed, 14 Aug 2024 12:48:40 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E8=81=94=E8=B0=83=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BB=8E=E5=BE=85=E7=A1=AE=E8=AE=A4=E5=88=B0?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E4=B8=AD=EF=BC=8C=E7=BB=8F=E8=BF=87=E7=9A=84?= =?UTF-8?q?=E5=86=85=E9=83=A8=E7=AE=A1=E7=90=86=E7=B3=BB=E7=BB=9F=EF=BC=8C?= =?UTF-8?q?bfm,sf=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E8=81=94=E8=B0=83?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AF=B9=E5=BA=94=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E5=80=BC=E6=94=B9=E5=8F=98=E3=80=82?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=8A=A0=E5=B7=A5=E4=B8=AD?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=88=B0=E5=86=85=E9=83=A8=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=88=99=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=B0=E5=90=8C=E6=AD=A5=E8=A1=A8=EF=BC=8C=E7=94=B1?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=A1=A8=E5=AE=9A=E6=97=B6=E5=8F=91=E8=B5=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/models/process_status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py index 9c939edd..d0657a83 100644 --- a/sf_bf_connect/models/process_status.py +++ b/sf_bf_connect/models/process_status.py @@ -31,7 +31,7 @@ class StatusChange(models.Model): res = super(StatusChange, self).action_confirm() # 原有方法执行后,进行额外的操作(如调用外部API) - process_start_time = str(datetime.now()) + process_start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') config = self.env['res.config.settings'].get_values() json1 = { 'params': { From 7fee98cdee64f599f8a4d46c07135eeb782c8486 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 23 Aug 2024 16:13:03 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=BA=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/product_template.py | 4 ++-- sf_manufacturing/models/stock.py | 25 +++++++++++---------- sf_sale/models/quick_easy_order.py | 4 ++-- sf_sale/models/quick_easy_order_old.py | 4 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 071f1167..37fa02bd 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index f53d7056..a6aa3e96 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -151,6 +151,8 @@ class StockRule(models.Model): list2.append(item) for procurement, rule in list2: + logging.info(rule) + logging.info(rule.procure_method) procure_method = rule.procure_method if rule.procure_method == 'mts_else_mto': qty_needed = procurement.product_uom._compute_quantity(procurement.product_qty, @@ -169,7 +171,6 @@ class StockRule(models.Model): else: forecasted_qties_by_loc[rule.location_src_id][procurement.product_id.id] -= qty_needed procure_method = 'make_to_stock' - move_values = rule._get_stock_move_values(*procurement) move_values['procure_method'] = procure_method moves_values_by_company[procurement.company_id.id].append(move_values) @@ -350,17 +351,17 @@ class StockRule(models.Model): product_id_to_production_names) # # 同一个产品多个制造订单对应一个编程单和模型库 # # 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递 - if not production_item.programming_no: - production_programming = self.env['mrp.production'].search( - [('product_id.id', '=', production_item.product_id.id), - ('origin', '=', production_item.origin)], - limit=1, order='id asc') - if not production_programming.programming_no: - production_item.fetchCNC( - ', '.join(product_id_to_production_names[production_item.product_id.id])) - else: - production_item.write({'programming_no': production_programming.programming_no, - 'programming_state': '编程中'}) + # if not production_item.programming_no: + # production_programming = self.env['mrp.production'].search( + # [('product_id.id', '=', production_item.product_id.id), + # ('origin', '=', production_item.origin)], + # limit=1, order='id asc') + # if not production_programming.programming_no: + # production_item.fetchCNC( + # ', '.join(product_id_to_production_names[production_item.product_id.id])) + # else: + # production_item.write({'programming_no': production_programming.programming_no, + # 'programming_state': '编程中'}) return True diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 081807a4..cb1886a1 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -8,8 +8,8 @@ from datetime import datetime import requests from odoo import http from odoo.http import request -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 3ae65db3..92f6cda2 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -6,8 +6,8 @@ import os from datetime import datetime from stl import mesh # from OCC.Core.GProp import GProp_GProps -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file from odoo.addons.sf_base.commons.common import Common from odoo import models, fields, api from odoo.modules import get_resource_path From f1780181faf1d7fac121e79ec770b234b1f37b68 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 25 Aug 2024 17:36:07 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=BA=9F?= =?UTF-8?q?=E5=90=91=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 12 ++++++------ sf_manufacturing/models/mrp_production.py | 9 ++++++--- sf_manufacturing/wizard/production_wizard.py | 1 + sf_manufacturing/wizard/production_wizard_views.xml | 11 +++++++++++ sf_sale/models/sale_order.py | 6 +++--- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 23be7d38..376101c9 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -620,12 +620,12 @@ class Manufacturing_Connect(http.Controller): # if is_free is True: # delivery_workpiece._delivery_avg() # logging.info('agv下发下产线任务下发完成') - if ret['IsComplete'] is True: - # 向AGV任务调度下发下产线任务 - workorders = request.env['mrp.workorder'].browse(workorder_ids) - request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) - else: - res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} + # if ret['IsComplete'] is True: + # # 向AGV任务调度下发下产线任务 + # workorders = request.env['mrp.workorder'].browse(workorder_ids) + # request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) + # else: + # res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} except RepeatTaskException as e: logging.info('AGVToProduct error:%s' % e) except Exception as e: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 8e1f7199..964f34fe 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -241,7 +241,10 @@ class MrpProduction(models.Model): res = {'programming_no': programming_no_str} logging.info('res=%s:' % res) configsettings = self.env['res.config.settings'].get_values() - config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) + configsettings['token'] = 'ba301c9b-2216-11ef-9d97-f8b54deb92c1' + # configsettings['sf_secret_key'] = 'rAalgsVOhDpxIWzR' + # configsettings['sf_url'] = 'http://localhost:7069' + # config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) url = '/api/intelligent_programming/get_state' config_url = configsettings['sf_url'] + url ret = requests.post(config_url, json=res, data=None, headers=config_header) @@ -808,8 +811,8 @@ class MrpProduction(models.Model): 'target': 'new', 'context': { 'default_production_id': self.id, - 'default_programming_state': '编程中' if cloud_programming[ - 'programming_state'] != '已下发' else '已下发', + 'default_reprogramming_num': cloud_programming['reprogramming_num'], + 'default_programming_state': cloud_programming['programming_state'], 'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False } } diff --git a/sf_manufacturing/wizard/production_wizard.py b/sf_manufacturing/wizard/production_wizard.py index 5700ea68..323db518 100644 --- a/sf_manufacturing/wizard/production_wizard.py +++ b/sf_manufacturing/wizard/production_wizard.py @@ -13,6 +13,7 @@ class ProductionWizard(models.TransientModel): _description = '制造订单向导' production_id = fields.Many2one('mrp.production', string='制造订单号') + reprogramming_num = fields.Integer('重新编程次数', default=0) is_reprogramming = fields.Boolean(string='申请重新编程', default=False) is_remanufacture = fields.Boolean(string='重新生成制造订单', default=True) programming_state = fields.Selection( diff --git a/sf_manufacturing/wizard/production_wizard_views.xml b/sf_manufacturing/wizard/production_wizard_views.xml index 1efef116..b6619811 100644 --- a/sf_manufacturing/wizard/production_wizard_views.xml +++ b/sf_manufacturing/wizard/production_wizard_views.xml @@ -12,6 +12,17 @@ 重新生成制造订单 +
+ 注意: 该制造订单产品已申请重新编程次数为,且当前编程状态为 + +
申请重新编程 = 1: self.env['purchase.order'].sudo().create({ 'partner_id': server_product.seller_ids.partner_id.id, 'origin': ','.join(production_process), From c703012ec42e26783d346fa27729cb7c243d884b Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 26 Aug 2024 10:08:40 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E4=BC=9A=E8=AE=A1=E5=87=AD=E8=AF=81?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_account_process/__init__.py | 4 +++ jikimo_account_process/__manifest__.py | 35 +++++++++++++++++++ .../controllers/__init__.py | 3 ++ .../controllers/controllers.py | 21 +++++++++++ jikimo_account_process/models/__init__.py | 4 +++ jikimo_account_process/models/account_move.py | 15 ++++++++ jikimo_account_process/models/models.py | 18 ++++++++++ 7 files changed, 100 insertions(+) create mode 100644 jikimo_account_process/__init__.py create mode 100644 jikimo_account_process/__manifest__.py create mode 100644 jikimo_account_process/controllers/__init__.py create mode 100644 jikimo_account_process/controllers/controllers.py create mode 100644 jikimo_account_process/models/__init__.py create mode 100644 jikimo_account_process/models/account_move.py create mode 100644 jikimo_account_process/models/models.py diff --git a/jikimo_account_process/__init__.py b/jikimo_account_process/__init__.py new file mode 100644 index 00000000..511a0ca3 --- /dev/null +++ b/jikimo_account_process/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import controllers +from . import models \ No newline at end of file diff --git a/jikimo_account_process/__manifest__.py b/jikimo_account_process/__manifest__.py new file mode 100644 index 00000000..f701deb7 --- /dev/null +++ b/jikimo_account_process/__manifest__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +{ + 'name': "jikimo_account_process", + + 'summary': """ + Short (1 phrase/line) summary of the module's purpose, used as + subtitle on modules listing or apps.openerp.com""", + + 'description': """ + Long description of module's purpose + """, + + 'author': "My Company", + 'website': "https://www.yourcompany.com", + + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/16.0/odoo/addons/base/data/ir_module_category_data.xml + # for the full list + 'category': 'Uncategorized', + 'version': '0.1', + + # any module necessary for this one to work correctly + 'depends': ['base', 'account'], + + # always loaded + 'data': [ + # 'security/ir.model.access.csv', + # 'views/views.xml', + # 'views/templates.xml', + ], + # only loaded in demonstration mode + 'demo': [ + # 'demo/demo.xml', + ], +} diff --git a/jikimo_account_process/controllers/__init__.py b/jikimo_account_process/controllers/__init__.py new file mode 100644 index 00000000..457bae27 --- /dev/null +++ b/jikimo_account_process/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import controllers \ No newline at end of file diff --git a/jikimo_account_process/controllers/controllers.py b/jikimo_account_process/controllers/controllers.py new file mode 100644 index 00000000..88f9332a --- /dev/null +++ b/jikimo_account_process/controllers/controllers.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# from odoo import http + + +# class JikimoAccountProcess(http.Controller): +# @http.route('/jikimo_account_process/jikimo_account_process', auth='public') +# def index(self, **kw): +# return "Hello, world" + +# @http.route('/jikimo_account_process/jikimo_account_process/objects', auth='public') +# def list(self, **kw): +# return http.request.render('jikimo_account_process.listing', { +# 'root': '/jikimo_account_process/jikimo_account_process', +# 'objects': http.request.env['jikimo_account_process.jikimo_account_process'].search([]), +# }) + +# @http.route('/jikimo_account_process/jikimo_account_process/objects/', auth='public') +# def object(self, obj, **kw): +# return http.request.render('jikimo_account_process.object', { +# 'object': obj +# }) diff --git a/jikimo_account_process/models/__init__.py b/jikimo_account_process/models/__init__.py new file mode 100644 index 00000000..bef2bae9 --- /dev/null +++ b/jikimo_account_process/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import models +from . import account_move \ No newline at end of file diff --git a/jikimo_account_process/models/account_move.py b/jikimo_account_process/models/account_move.py new file mode 100644 index 00000000..e85d4e16 --- /dev/null +++ b/jikimo_account_process/models/account_move.py @@ -0,0 +1,15 @@ +from odoo import models, fields, api + +from odoo.exceptions import ValidationError + + +class CustomAccountMoveLine(models.Model): + _inherit = 'account.move' + _description = "account move line" + + @api.model_create_multi + def create(self, vals): + for val in vals: + val['name'] = self.env['ir.sequence'].next_by_code('account.move') or '/' + # 因为供应商与客户支付创建流程是先创建move line在修改来填充account_payment与move line的关联 + return super(CustomAccountMoveLine, self).create(vals) \ No newline at end of file diff --git a/jikimo_account_process/models/models.py b/jikimo_account_process/models/models.py new file mode 100644 index 00000000..ea14f4a4 --- /dev/null +++ b/jikimo_account_process/models/models.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# from odoo import models, fields, api + + +# class jikimo_account_process(models.Model): +# _name = 'jikimo_account_process.jikimo_account_process' +# _description = 'jikimo_account_process.jikimo_account_process' + +# name = fields.Char() +# value = fields.Integer() +# value2 = fields.Float(compute="_value_pc", store=True) +# description = fields.Text() +# +# @api.depends('value') +# def _value_pc(self): +# for record in self: +# record.value2 = float(record.value) / 100 From deef246a6d6b9a4f49d576266e4b7fb8701da770 Mon Sep 17 00:00:00 2001 From: hujiaying Date: Mon, 26 Aug 2024 11:10:52 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E9=9D=A2?= =?UTF-8?q?=E5=B7=A5=E8=89=BA=E5=AD=97=E6=AE=B5=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/common.py | 3 ++- sf_mrs_connect/models/sync_common.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 65dfe13d..9553c60c 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -96,7 +96,7 @@ class MrsProductionProcess(models.Model): # workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_process', required=True) processing_day = fields.Float('加工天数/d') travel_day = fields.Float('路途天数/d') - + sequence = fields.Integer('排序') # class MrsProcessingTechnology(models.Model): # _name = 'sf.processing.technology' @@ -148,6 +148,7 @@ class MrsProductionProcessParameter(models.Model): processing_day = fields.Float('加工天数/d') travel_day = fields.Float('路途天数/d') active = fields.Boolean('有效', default=True) + processing_mm = fields.Char('加工厚度/mm') def name_get(self): result = [] diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index e37d460a..e812bd03 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -329,6 +329,7 @@ class sfProductionProcess(models.Model): production_process.processing_day = item['processing_day'] production_process.travel_day = item['travel_day'] production_process.active = item['active'] + production_process.sequence = item['sequence'] else: self.create({ "name": item['name'], @@ -338,6 +339,7 @@ class sfProductionProcess(models.Model): "processing_day": item['processing_day'], "travel_day": item['travel_day'], "active": item['active'], + "sequence": item['sequence'] }) else: raise ValidationError("表面工艺认证未通过") @@ -365,6 +367,7 @@ class sfProductionProcess(models.Model): "processing_day": item['processing_day'], "travel_day": item['travel_day'], "active": item['active'], + "sequence": item['sequence'] }) else: production_process.name = item['name'] @@ -373,6 +376,7 @@ class sfProductionProcess(models.Model): production_process.processing_day = item['processing_day'] production_process.travel_day = item['travel_day'] production_process.active = item['active'] + production_process.sequence = item['sequence'] else: raise ValidationError("表面工艺认证未通过") @@ -1088,6 +1092,7 @@ class sfProductionProcessParameter(models.Model): production_process_parameter.process_id = process.id production_process_parameter.materials_model_ids = self.env['sf.materials.model'].search( [('materials_no', 'in', item['materials_model_ids_codes'])]) + production_process_parameter.processing_mm = item['processing_mm'] else: self.create({ "name": item['name'], @@ -1099,6 +1104,7 @@ class sfProductionProcessParameter(models.Model): "process_id": process.id, "materials_model_ids": self.env['sf.materials.model'].search( [('materials_no', 'in', item['materials_model_ids_codes'])]), + "processing_mm": item['processing_mm'] }) else: raise ValidationError("表面工艺可选参数认证未通过") # 定时同步表面工艺 @@ -1129,6 +1135,7 @@ class sfProductionProcessParameter(models.Model): "process_id": process.id, 'materials_model_ids': self.env['sf.materials.model'].search( [('materials_no', 'in', item['materials_model_ids_codes'])]), + 'processing_mm': item['processing_mm'] }) else: production_process_parameter.name = item['name'] @@ -1139,6 +1146,7 @@ class sfProductionProcessParameter(models.Model): production_process_parameter.materials_model_ids = self.env['sf.materials.model'].search( [('materials_no', 'in', item['materials_model_ids_codes'])]) production_process_parameter.active = item['active'] + production_process_parameter.processing_mm = item['processing_mm'] else: raise ValidationError("表面工艺可选参数认证未通过") From 89cb61f244ce9c145fa8d6ffc257e89ecf0c308d Mon Sep 17 00:00:00 2001 From: hujiaying Date: Mon, 26 Aug 2024 12:47:15 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E5=B7=A5=E8=89=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/views/common_view.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index 533a3e04..ed39f9a4 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -16,7 +16,7 @@ sf.production.process.parameter -
+

@@ -33,11 +33,12 @@ + - + @@ -163,7 +164,8 @@ sf.production.process - + + @@ -174,7 +176,7 @@ sf.production.process - +

@@ -192,11 +194,11 @@ - - - + + + - + From 78d00e9157214a6b0a19c3576867b7c0cbac9b3c Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 26 Aug 2024 13:23:44 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcoding=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9C=BA=E5=BA=8A=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/controllers/controllers.py | 1 + sf_manufacturing/models/mrp_workorder.py | 7 ++--- sf_manufacturing/static/src/js/customRFID.js | 29 ++++++++++++++++--- sf_manufacturing/views/mrp_workorder_view.xml | 2 +- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index 946bb78c..94c0fdcb 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -163,6 +163,7 @@ class Sf_Dashboard_Connect(http.Controller): # 停机时间:关机时间 - 运行时间 # 停机时长:关机时间 - 初次上线时间 'img': f'data:image/png;base64,{machine_data.machine_tool_picture.decode("utf-8")}', + 'equipment_type': machine_data.category_id.name, }) return json.dumps(res) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 066cb133..095c1ab1 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1154,7 +1154,7 @@ class ResMrpWorkOrder(models.Model): def button_finish(self): for record in self: if record.routing_type == '装夹预调': - if not record.material_center_point and record.X_deviation_angle > 0: + if not record.material_center_point or record.X_deviation_angle <= 0: raise UserError("请对前置三元检测定位参数进行计算定位") if not record.rfid_code and record.is_rework is False: raise UserError("请扫RFID码进行绑定") @@ -1257,15 +1257,14 @@ class ResMrpWorkOrder(models.Model): # 解绑托盘 def unbind_tray(self): - self.write({ + self.production_id.workorder_ids.write({ 'rfid_code': False, 'tray_serial_number': False, 'tray_product_id': False, 'tray_brand_id': False, 'tray_type_id': False, 'tray_model_id': False, - 'is_trayed': False - }) + 'is_trayed': False}) # 将FTP的检测报告文件下载到临时目录 def download_reportfile_tmp(self, workorder, reportpath): diff --git a/sf_manufacturing/static/src/js/customRFID.js b/sf_manufacturing/static/src/js/customRFID.js index eaa07d8a..cb58b3ea 100644 --- a/sf_manufacturing/static/src/js/customRFID.js +++ b/sf_manufacturing/static/src/js/customRFID.js @@ -3,13 +3,34 @@ $(document).off('keydown') $(document).on('keydown', 'body.o_web_client', function (e) { setTimeout(() => { RFID = '' - }, 200) + }, 200) if(e.key == 'Enter' && e.keyCode == 13 || e.key == 'Tab' && e.keyCode == 9){ + + let fieldValue1 = $('[name="routing_type"]'); + console.log('字段值:', fieldValue1.text()); console.log(RFID) - if(!RFID || RFID.length <= 3) return; - $('[name="button_start"]').trigger('click') - RFID = '' + let fieldValue2 = $('[name="rfid_code"]'); + console.log('字段值2:', fieldValue2.text()); + // if(!RFID || RFID.length <= 3) return; + // $('[name="button_start"]').trigger('click') + // setTimeout(() => { + // $('.o_dialog .modal-footer .btn-primary').trigger('click') + // }, 50) + // RFID = '' + // return; + + // fieldValue2.val() === '') + // 检查字段值是否等于“装夹预调” + if (fieldValue1.text() === '装夹预调') { + if (!RFID || RFID.length <= 3) return; + $('[name="button_start"]').trigger('click'); + setTimeout(() => { + $('.o_dialog .modal-footer .btn-primary').trigger('click'); + }, 100); + } + + RFID = ''; return; } RFID += e.key diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index eab42424..2c43a601 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -195,7 +195,7 @@ attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>

AGV参数配置

-
+
From b40a87df88032859b671905de7070fcbbbc7a949 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 27 Aug 2024 11:24:04 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=BA=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 12 +-- sf_manufacturing/models/mrp_production.py | 4 +- sf_manufacturing/models/mrp_workorder.py | 4 +- sf_manufacturing/models/product_template.py | 4 +- sf_manufacturing/models/stock.py | 4 - .../views/mrp_production_addional_change.xml | 26 +++--- sf_manufacturing/wizard/production_wizard.py | 9 +- sf_mrs_connect/controllers/controllers.py | 82 +++++++++---------- sf_sale/models/quick_easy_order.py | 4 +- sf_sale/models/quick_easy_order_old.py | 4 +- 10 files changed, 75 insertions(+), 78 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 376101c9..23be7d38 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -620,12 +620,12 @@ class Manufacturing_Connect(http.Controller): # if is_free is True: # delivery_workpiece._delivery_avg() # logging.info('agv下发下产线任务下发完成') - # if ret['IsComplete'] is True: - # # 向AGV任务调度下发下产线任务 - # workorders = request.env['mrp.workorder'].browse(workorder_ids) - # request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) - # else: - # res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} + if ret['IsComplete'] is True: + # 向AGV任务调度下发下产线任务 + workorders = request.env['mrp.workorder'].browse(workorder_ids) + request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} except RepeatTaskException as e: logging.info('AGVToProduct error:%s' % e) except Exception as e: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 0f26a6d7..1d011dd7 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -142,13 +142,13 @@ class MrpProduction(models.Model): def action_view_remanufacture_productions(self): self.ensure_one() - mrp_production_ids = self.env['mrp.production'].search( + mrp_production = self.env['mrp.production'].search( [('id', '=', self.remanufacture_production_id.id)]) action = { 'res_model': 'mrp.production', 'type': 'ir.actions.act_window', 'view_mode': 'form', - 'res_id': mrp_production_ids[0], + 'res_id': mrp_production.id, } return action diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 095c1ab1..1b315e46 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1154,8 +1154,8 @@ class ResMrpWorkOrder(models.Model): def button_finish(self): for record in self: if record.routing_type == '装夹预调': - if not record.material_center_point or record.X_deviation_angle <= 0: - raise UserError("请对前置三元检测定位参数进行计算定位") + # if not record.material_center_point or record.X_deviation_angle <= 0: + # raise UserError("请对前置三元检测定位参数进行计算定位") if not record.rfid_code and record.is_rework is False: raise UserError("请扫RFID码进行绑定") record.process_state = '待加工' diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 37fa02bd..071f1167 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError from odoo.modules import get_resource_path -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index a0da7ba3..27ce925a 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -151,8 +151,6 @@ class StockRule(models.Model): list2.append(item) for procurement, rule in list2: - logging.info(rule) - logging.info(rule.procure_method) procure_method = rule.procure_method if rule.procure_method == 'mts_else_mto': qty_needed = procurement.product_uom._compute_quantity(procurement.product_qty, @@ -178,10 +176,8 @@ class StockRule(models.Model): for company_id, moves_values in moves_values_by_company.items(): # create the move as SUPERUSER because the current user may not have the rights to do it (mto product # launched by a sale for example) - logging.info(moves_values) moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( moves_values) - logging.info(moves) # Since action_confirm launch following procurement_group we should activate it. moves._action_confirm() return True diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 8213f483..6fa14a6f 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -127,7 +127,7 @@ confirm="是否确认更新程序" attrs="{'invisible': ['|',('state', '!=', 'rework'),('programming_state', '!=', '已编程未下发')]}"/> +