+
Date: Tue, 29 Aug 2023 15:49:14 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E5=A2=9E=E8=82=8COCC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/product_template.py | 32 ++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 16e65e85..dbeb7814 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -1,8 +1,8 @@
from odoo import models, fields, api
from odoo.exceptions import ValidationError
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
import logging
import base64
import hashlib
@@ -566,20 +566,20 @@ class ResProductMo(models.Model):
item.model_file = self.transition_glb_file(report_path, model_code)
# 将attach的datas内容转为glb文件
- # def transition_glb_file(self, report_path, code):
- # shapes = read_step_file(report_path)
- # output_file = os.path.join('/tmp', str(code) + '.stl')
- # write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
- # # 转化为glb
- # output_glb_file = os.path.join('/tmp', str(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)
- # os.system(cmd)
- # # 转base64
- # with open(output_glb_file, 'rb') as fileObj:
- # image_data = fileObj.read()
- # base64_data = base64.b64encode(image_data)
- # return base64_data
+ def transition_glb_file(self, report_path, code):
+ shapes = read_step_file(report_path)
+ output_file = os.path.join('/tmp', str(code) + '.stl')
+ write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
+ # 转化为glb
+ output_glb_file = os.path.join('/tmp', str(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)
+ os.system(cmd)
+ # 转base64
+ with open(output_glb_file, 'rb') as fileObj:
+ image_data = fileObj.read()
+ base64_data = base64.b64encode(image_data)
+ return base64_data
class ResMrpBomMo(models.Model):
From 5ea6158e8dea29f77b89dce276747134b876b449 Mon Sep 17 00:00:00 2001
From: yuxianghui <1608204036@qq.com>
Date: Tue, 29 Aug 2023 17:28:20 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AD=A6=E5=91=8A=E4=BF=A1=E6=81=AF=E5=A4=84?=
=?UTF-8?q?=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_warehouse/models/model.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index ea707463..eafdffac 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -10,7 +10,7 @@ class SfLocation(models.Model):
# 重写字段定义
name = fields.Char('Location Name', required=True, size=20)
- barcode = fields.Char('Barcode', copy=False, required=True, size=15)
+ barcode = fields.Char('Barcode', copy=False, size=15)
# 仓库类别(selection:库区、库位、货位)
location_type = fields.Selection([
@@ -34,14 +34,14 @@ class SfLocation(models.Model):
# 产品类别 (关联:product.category)
product_type = fields.Many2many('product.category', string='产品类别')
# 货架独有字段:通道、方向、货架高度(m)、货架层数、层数容量
- channel = fields.Char(string='通道', required=True)
+ channel = fields.Char(string='通道')
direction = fields.Selection([
('R', 'R'),
('L', 'L')
- ], string='方向', required=True)
+ ], string='方向')
shelf_height = fields.Float(string='货架高度(m)')
- shelf_layer = fields.Integer(string='货架层数', required=True)
- layer_capacity = fields.Integer(string='层数容量', required=True)
+ shelf_layer = fields.Integer(string='货架层数')
+ layer_capacity = fields.Integer(string='层数容量')
# 货位独有字段:货位状态、产品(关联产品对象)、产品序列号(关联产品序列号对象)
location_status = fields.Selection([
@@ -54,9 +54,9 @@ class SfLocation(models.Model):
product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
# time_test = fields.Char(string='time')
# 添加SQL约束
- _sql_constraints = [
- ('name_uniq', 'unique(name)', '位置名称必须唯一!'),
- ]
+ # _sql_constraints = [
+ # ('name_uniq', 'unique(name)', '位置名称必须唯一!'),
+ # ]
hide_location_type = fields.Boolean(compute='_compute_hide_what', string='隐藏仓库')
hide_area = fields.Boolean(compute='_compute_hide_what', string='隐藏库区')