From f4a878ced97f92026877ed23b8fe2eeddf47c4db Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 24 Oct 2023 09:51:31 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/auto_quatotion_common.py | 24 ++++++++++++------------ sf_sale/models/quick_easy_order.py | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 09ea3f0f..2d34a76e 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -from quatotion import readSql, feature_recognize, auto_quatotion +#from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) @@ -24,14 +24,14 @@ class AutoQuatotion(models.Model): def get_process_time_db_path(self): return get_resource_path('sf_sale', 'models', 'process_time.db') - def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): - ''' - 通过打包好的.so库, - 以调用autoQuatotion库中Quatotion类, - 初始化后调用类的analyseShape方法对模型文件进行价格预测 - ''' - # 初始化自动报价类(输入特征数据库和加工时间数据库) - reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) - # 获取价格、加工时间、尺寸、XYZ、翻面次数 - feature_info = reader.analyseShape(stp_url, InfoJson={}) - return feature_info + # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): + # ''' + # 通过打包好的.so库, + # 以调用autoQuatotion库中Quatotion类, + # 初始化后调用类的analyseShape方法对模型文件进行价格预测 + # ''' + # # 初始化自动报价类(输入特征数据库和加工时间数据库) + # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) + # # 获取价格、加工时间、尺寸、XYZ、翻面次数 + # feature_info = reader.analyseShape(stp_url, InfoJson={}) + # return feature_info diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index b81c3b5e..0ce0b6d1 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -120,16 +120,16 @@ class QuickEasyOrder(models.Model): model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() logging.info("模型编码: %s" % model_code) item.model_file = self.transition_glb_file(report_path, model_code) - ret = self.feature_recognition(report_path, model_code) - logging.info("自动报价返回值: %s" % ret) - boxshape = ret['boxshape'].tolist() - logging.info("自动报价boxshape: %s" % boxshape) - logging.info('自动报价feature_infos:%s' % ret['feature_infos']) - item.model_length = boxshape[0] # 长 单位mm - item.model_width = boxshape[1] # 宽 - item.model_height = boxshape[2] # 高 - item.model_volume = boxshape[0] * boxshape[1] * boxshape[2] - item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False) + # ret = self.feature_recognition(report_path, model_code) + # logging.info("自动报价返回值: %s" % ret) + # boxshape = ret['boxshape'].tolist() + # logging.info("自动报价boxshape: %s" % boxshape) + # logging.info('自动报价feature_infos:%s' % ret['feature_infos']) + # item.model_length = boxshape[0] # 长 单位mm + # item.model_width = boxshape[1] # 宽 + # item.model_height = boxshape[2] # 高 + # item.model_volume = boxshape[0] * boxshape[1] * boxshape[2] + # item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False) # self._get_price(item) else: item.model_file = False @@ -237,7 +237,7 @@ class QuickEasyOrder(models.Model): product_bom_purchase.bom_create_line_has(purchase_embryo) order_id.with_user(self.env.ref("base.user_admin")).sale_order_create_line(product, item) except Exception as e: - self.cr.rollback() + # self.cr.rollback() return UserError('工厂创建销售订单和产品失败,请联系管理员') From 4ef82ee7cff77d2a0cb1039253de8e98e0985540 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 24 Oct 2023 10:29:10 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/auto_quatotion_common.py | 24 +++++++++++------------ sf_sale/models/quick_easy_order.py | 26 ++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 2d34a76e..09ea3f0f 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -#from quatotion import readSql, feature_recognize, auto_quatotion +from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) @@ -24,14 +24,14 @@ class AutoQuatotion(models.Model): def get_process_time_db_path(self): return get_resource_path('sf_sale', 'models', 'process_time.db') - # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): - # ''' - # 通过打包好的.so库, - # 以调用autoQuatotion库中Quatotion类, - # 初始化后调用类的analyseShape方法对模型文件进行价格预测 - # ''' - # # 初始化自动报价类(输入特征数据库和加工时间数据库) - # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) - # # 获取价格、加工时间、尺寸、XYZ、翻面次数 - # feature_info = reader.analyseShape(stp_url, InfoJson={}) - # return feature_info + def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): + ''' + 通过打包好的.so库, + 以调用autoQuatotion库中Quatotion类, + 初始化后调用类的analyseShape方法对模型文件进行价格预测 + ''' + # 初始化自动报价类(输入特征数据库和加工时间数据库) + reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) + # 获取价格、加工时间、尺寸、XYZ、翻面次数 + feature_info = reader.analyseShape(stp_url, InfoJson={}) + return feature_info diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 0ce0b6d1..54c37cc2 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -89,10 +89,10 @@ class QuickEasyOrder(models.Model): # 将attach的datas内容转为glb文件 def transition_glb_file(self, report_path, model_code): - # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl') + shapes = read_step_file(report_path) output_file = os.path.join('/tmp', str(model_code) + '.stl') + write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) # 转化为glb - # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb') output_glb_file = os.path.join('/tmp', str(model_code) + '.glb') util_path = get_resource_path('sf_dlm', 'static/util') cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file) @@ -120,17 +120,17 @@ class QuickEasyOrder(models.Model): model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() logging.info("模型编码: %s" % model_code) item.model_file = self.transition_glb_file(report_path, model_code) - # ret = self.feature_recognition(report_path, model_code) - # logging.info("自动报价返回值: %s" % ret) - # boxshape = ret['boxshape'].tolist() - # logging.info("自动报价boxshape: %s" % boxshape) - # logging.info('自动报价feature_infos:%s' % ret['feature_infos']) - # item.model_length = boxshape[0] # 长 单位mm - # item.model_width = boxshape[1] # 宽 - # item.model_height = boxshape[2] # 高 - # item.model_volume = boxshape[0] * boxshape[1] * boxshape[2] - # item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False) - # self._get_price(item) + ret = self.feature_recognition(report_path, model_code) + logging.info("自动报价返回值: %s" % ret) + boxshape = ret['boxshape'].tolist() + logging.info("自动报价boxshape: %s" % boxshape) + logging.info('自动报价feature_infos:%s' % ret['feature_infos']) + item.model_length = boxshape[0] # 长 单位mm + item.model_width = boxshape[1] # 宽 + item.model_height = boxshape[2] # 高 + item.model_volume = boxshape[0] * boxshape[1] * boxshape[2] + item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False) + self._get_price(item) else: item.model_file = False item.model_feature = False From acff814e9b8e6f1d015935bca05cfcf0bbe6cee9 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 24 Oct 2023 11:23:29 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/quick_easy_order.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 54c37cc2..94f70f0a 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -83,6 +83,7 @@ class QuickEasyOrder(models.Model): obj = super(QuickEasyOrder, self).create(vals) # self.model_coloring(obj) + logging.info('---------开始派单到工厂-------') self.distribute_to_factory(obj) obj.state = '待接单' return obj @@ -145,6 +146,7 @@ class QuickEasyOrder(models.Model): :return: """ try: + logging.info('---------派单到工厂-------') res = {'bfm_process_order_list': []} for item in obj: attachment = item.upload_model_file[0] @@ -185,6 +187,7 @@ class QuickEasyOrder(models.Model): i = 1 # 给sale_order的default_code字段赋值 aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)]) + logging.info('---------aa------- %s' % aa.name) aa.default_code = obj.name for item in res['bfm_process_order_list']: product = self.env['product.template'].sudo().product_create(product_id, item, order_id, From 575c856f27825cae23d22d746d8a40fdda260ad7 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 24 Oct 2023 14:43:11 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E9=94=80=E5=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/quick_easy_order.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 94f70f0a..f5e4f931 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -183,7 +183,7 @@ class QuickEasyOrder(models.Model): company_id = self.env.ref('base.main_company').sudo() # user_id = request.env.ref('base.user_admin').sudo() order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX', - str(datetime.now())) + str(datetime.now()), '现结', '支付') i = 1 # 给sale_order的default_code字段赋值 aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)]) @@ -243,8 +243,7 @@ class QuickEasyOrder(models.Model): # self.cr.rollback() return UserError('工厂创建销售订单和产品失败,请联系管理员') - -# 特征识别 + # 特征识别 def feature_recognition(self, report_path, model_code): feature_path = self.env['sf.auto_quatotion.common'].sudo().get_feature_full_path() process_time_db_path = self.env['sf.auto_quatotion.common'].sudo().get_process_time_db_path() From 076c4a2bcb5646e9a88120fddcfc23b8f607b6df Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 24 Oct 2023 14:55:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=80=E5=94=AE?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/quick_easy_order.py | 2 +- sf_sale/models/sale_order.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index f5e4f931..caadb6c2 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -183,7 +183,7 @@ class QuickEasyOrder(models.Model): company_id = self.env.ref('base.main_company').sudo() # user_id = request.env.ref('base.user_admin').sudo() order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX', - str(datetime.now()), '现结', '支付') + str(datetime.now()), '现结', '支付宝') i = 1 # 给sale_order的default_code字段赋值 aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)]) diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index c57aa780..35d877fe 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -1,6 +1,7 @@ from odoo import models, fields import datetime import base64 +import logging class ReSaleOrder(models.Model): @@ -16,6 +17,7 @@ class ReSaleOrder(models.Model): # 业务平台分配工厂后在智能工厂先创建销售订单 def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address, deadline_of_delivery, payments_way, pay_way): + logging.info('---------sale_order_create------') now_time = datetime.datetime.now() partner = self.get_customer() order_id = self.env['sale.order'].sudo().create({ From a953ca189e2e3f8ef28f1728352755811f6b0893 Mon Sep 17 00:00:00 2001 From: "JIKIMO-YXH\\xianghui" <3437689193@qq.com> Date: Tue, 24 Oct 2023 17:11:37 +0800 Subject: [PATCH 6/6] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=A8=A1=E5=9D=97=E4=B8=8B=E5=A4=B9=E5=85=B7=E7=B1=BB?= =?UTF-8?q?=E5=88=AB=E4=B8=8B=E7=9A=84=E9=9B=B6=E7=82=B9=E6=89=98=E7=9B=98?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=98=BE=E7=A4=BA=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E7=BB=84?= =?UTF-8?q?=E8=A3=85=E5=8D=95=E7=9A=84=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=B8=83=E5=B1=80=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_dlm/views/product_template_view.xml | 15 +- sf_tool_management/views/tool_base_views.xml | 149 ++++++------------- 2 files changed, 54 insertions(+), 110 deletions(-) diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml index fbc12cee..a1322117 100644 --- a/sf_dlm/views/product_template_view.xml +++ b/sf_dlm/views/product_template_view.xml @@ -398,11 +398,10 @@ - + - + @@ -453,10 +452,10 @@ + attrs='{"invisible": [("fixture_material_type","not in",("虎钳夹具","零点卡盘","零点托盘"))]}'/> + attrs='{"invisible": [("fixture_material_type","not in",("零点卡盘","零点托盘"))]}'/> diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 1e079896..0e9f7386 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -1101,6 +1101,8 @@ + + @@ -1125,78 +1127,58 @@ - -
- -
- - - - - - - - - - - - - - - - -
-
-
- - - -
- -
- - - - - - - - - - - - - - - - -
- - - + + + + - - - - - - - - - - + + +
+ +
+ + + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + + + +
@@ -1205,17 +1187,9 @@ - - - - - - - - - + @@ -1227,43 +1201,14 @@ - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - +
+