From 05dac9fb0ca8683b45b41bc107524541ffed3ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 20 Feb 2025 13:36:05 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product_template_management_view.xml | 12 +++-- sf_manufacturing/models/mrp_production.py | 6 ++- sf_manufacturing/models/product_template.py | 49 ++++++++++++------- sf_manufacturing/models/sale_order.py | 4 +- sf_manufacturing/views/sale_order_views.xml | 4 -- sf_sale/models/sale_order.py | 10 +++- sf_sale/views/sale_order_view.xml | 6 +-- .../static/src/js/3d_viewer.js | 15 +++--- 8 files changed, 66 insertions(+), 40 deletions(-) diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index 1f3dc50b..f575b9cf 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -16,13 +16,16 @@ + - + - + + @@ -68,6 +71,7 @@ + - - + + diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.js b/web_widget_model_viewer/static/src/js/3d_viewer.js index 4ed9dcc1..8cd9ba87 100644 --- a/web_widget_model_viewer/static/src/js/3d_viewer.js +++ b/web_widget_model_viewer/static/src/js/3d_viewer.js @@ -27,7 +27,10 @@ export class StepViewer extends Component { formatUrl() { var url = ''; if (this.props.value) { - if (this.props.value.slice(-1) == 'b' && !isNaN(this.props.value.split(' ')[0])) { + if (this.props.value.startsWith('http')) { + // 从url读取文件内容 + url = this.props.value; + } else if (this.props.value.slice(-1) == 'b' && !isNaN(this.props.value.split(' ')[0])) { var url_props = { base_url: session['web.base.url'], model: this.props.record.resModel, @@ -37,21 +40,19 @@ export class StepViewer extends Component { url = url_props['base_url'].replace('http://', 'https://') + '/web/content/' + url_props['model'] + '/' + url_props['id'] + '/' + url_props['field'] + '?download=true'; // url = 'http://localhost:8069'+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true' // console.log('url111111', url) - return url; + } else { url = "data:model/gltf-binary;base64," + this.props.value; // console.log('url2', url) - return url; + // localStorage.setItem('url',url) // let new_url = localStorage.getItem(('url')) // var oViewer = document.getElementsByTagName('model-viewer')[0]; // return new_url // url = "web_widget_model_viewer/static/src/images/not_model.png"; } - } else { - // var oImg = document.getElementsByClassName('test')[0] - // console.log(oImg) - } + } + return url; } } From 2409dab8b037fa0e1bca617ef85485a6f3ca679e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Wed, 5 Mar 2025 14:27:41 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9D=9E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E5=8E=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/sale_order.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sf_manufacturing/models/sale_order.py b/sf_manufacturing/models/sale_order.py index 39066f14..dbd06e6a 100644 --- a/sf_manufacturing/models/sale_order.py +++ b/sf_manufacturing/models/sale_order.py @@ -190,3 +190,16 @@ class SaleOrderLine(models.Model): if vals['supply_method'] == 'purchase' and line.is_incoming_material: raise UserError('当前(%s)产品为客供料,不能选择外购' % ','.join(line.mapped('product_id.name'))) return super(SaleOrderLine, self).write(vals) + + cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True) + cancel_auto_machining_reason = fields.Char('非自动化加工原因') + + def _compute_cancel_auto_machining(self): + for line in self: + line.cancel_auto_machining = True if line.product_id.auto_machining \ + and line.supply_method != 'automation' else False + + @api.onchange('product_id') + def _onchange_product_id_set_supply_method(self): + if self.product_id.auto_machining: + self.supply_method = 'automation' From cb645aa1b9a6c632be8314d56816e60196bf693b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 6 Mar 2025 13:59:14 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E4=BA=A7=E7=BA=BF=E7=9A=84=E9=9B=B6=E4=BB=B6=E4=BE=9B?= =?UTF-8?q?=E8=B4=A7=E8=B7=AF=E7=BA=BF=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=BA?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E4=BA=A7=E7=BA=BF=E5=8A=A0=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/sale_order.py | 11 ++++++----- sf_manufacturing/views/sale_order_views.xml | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/sale_order.py b/sf_manufacturing/models/sale_order.py index dbd06e6a..d46c1baf 100644 --- a/sf_manufacturing/models/sale_order.py +++ b/sf_manufacturing/models/sale_order.py @@ -22,6 +22,9 @@ class SaleOrder(models.Model): def confirm_to_supply_method(self): self.state = 'supply method' + for line in self.order_line: + if line.product_id.auto_machining: + line.supply_method = 'automation' def action_confirm(self): if self._get_forbidden_state_confirm() & set(self.mapped('state')): @@ -192,14 +195,12 @@ class SaleOrderLine(models.Model): return super(SaleOrderLine, self).write(vals) cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True) - cancel_auto_machining_reason = fields.Char('非自动化加工原因') + cancel_auto_machining_reason = fields.Char('更改供货原因') + @api.depends('product_id', 'supply_method') def _compute_cancel_auto_machining(self): for line in self: line.cancel_auto_machining = True if line.product_id.auto_machining \ and line.supply_method != 'automation' else False - @api.onchange('product_id') - def _onchange_product_id_set_supply_method(self): - if self.product_id.auto_machining: - self.supply_method = 'automation' + diff --git a/sf_manufacturing/views/sale_order_views.xml b/sf_manufacturing/views/sale_order_views.xml index 4d7a0c41..e0f9e097 100644 --- a/sf_manufacturing/views/sale_order_views.xml +++ b/sf_manufacturing/views/sale_order_views.xml @@ -21,6 +21,10 @@ + + + + From b276f616e59b1d7d304bc6f3dd9b76dad8898e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Thu, 6 Mar 2025 14:03:31 +0800 Subject: [PATCH 04/30] =?UTF-8?q?=E6=88=90=E5=93=81=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E9=BB=98=E8=AE=A4=E5=8F=96=E6=A8=A1=E6=9D=BF=E4=B8=AD?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_sale_multiple_supply_methods/models/mrp_bom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jikimo_sale_multiple_supply_methods/models/mrp_bom.py b/jikimo_sale_multiple_supply_methods/models/mrp_bom.py index 2528d0a4..aa9d6c60 100644 --- a/jikimo_sale_multiple_supply_methods/models/mrp_bom.py +++ b/jikimo_sale_multiple_supply_methods/models/mrp_bom.py @@ -9,5 +9,6 @@ class MrpBom(models.Model): # 成品的供应商从模板中获取 if product_type == 'product': - bom_id.subcontractor_id = product.product_tmpl_id.seller_ids.partner_id.id + if product.product_tmpl_id.seller_ids: + bom_id.subcontractor_id = product.product_tmpl_id.seller_ids[-1].partner_id.id return bom_id From 29337bfcebde0a281e4b0a17e16681b682d0df73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Wed, 12 Mar 2025 17:05:29 +0800 Subject: [PATCH 05/30] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/fixture.py | 1 + sf_base/views/fixture_view.xml | 2 ++ sf_dlm/models/product_template.py | 2 +- .../views/product_template_management_view.xml | 3 +++ sf_manufacturing/models/mrp_production.py | 2 ++ sf_manufacturing/models/mrp_workorder.py | 1 + sf_manufacturing/models/product_template.py | 1 + sf_manufacturing/views/mrp_workcenter_views.xml | 4 +++- sf_quality/models/quality.py | 1 + sf_quality/models/quality_cnc_test.py | 1 + sf_quality/views/quality_check_view.xml | 2 ++ sf_quality/views/quality_cnc_test_view.xml | 3 ++- sf_sale/models/sale_order.py | 4 +++- sf_sale/views/quick_easy_order_view.xml | 6 +++++- 14 files changed, 28 insertions(+), 5 deletions(-) diff --git a/sf_base/models/fixture.py b/sf_base/models/fixture.py index f64fe473..264878e9 100644 --- a/sf_base/models/fixture.py +++ b/sf_base/models/fixture.py @@ -32,6 +32,7 @@ class FixtureModel(models.Model): multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型") brand_id = fields.Many2one('sf.machine.brand', string="品牌") model_file = fields.Binary(string="图片") + glb_url = fields.Char(string="图片") status = fields.Boolean('状态') active = fields.Boolean('有效', default=False) diff --git a/sf_base/views/fixture_view.xml b/sf_base/views/fixture_view.xml index 07dadd33..1149875d 100644 --- a/sf_base/views/fixture_view.xml +++ b/sf_base/views/fixture_view.xml @@ -158,6 +158,8 @@ + diff --git a/sf_dlm/models/product_template.py b/sf_dlm/models/product_template.py index 1e37be2b..f9825c88 100644 --- a/sf_dlm/models/product_template.py +++ b/sf_dlm/models/product_template.py @@ -44,7 +44,7 @@ class ResProductTemplate(models.Model): else: return self.env.ref('sf_dlm.product_uom_cubic_millimeter') - # model_file = fields.Binary('模型文件') + model_file = fields.Binary('模型文件') # 胚料的库存路线设置 # def _get_routes(self, route_type): diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml index f575b9cf..01c2f51b 100644 --- a/sf_dlm_management/views/product_template_management_view.xml +++ b/sf_dlm_management/views/product_template_management_view.xml @@ -22,12 +22,15 @@ + + - + + diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 970292b7..a0adf70f 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -26,6 +26,7 @@ class QualityCheck(models.Model): string='生产线') equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备') model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型') + glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型') detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告') test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果", diff --git a/sf_quality/models/quality_cnc_test.py b/sf_quality/models/quality_cnc_test.py index 9810b0e0..1e89ef92 100644 --- a/sf_quality/models/quality_cnc_test.py +++ b/sf_quality/models/quality_cnc_test.py @@ -12,6 +12,7 @@ class SfQualityCncTest(models.Model): production_id = fields.Many2one(related='workorder_id.production_id', string='制造订单') product_id = fields.Many2one(related='workorder_id.product_id', string='产品') model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型') + glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型') processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面') equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备') production_line_id = fields.Many2one(related='workorder_id.production_line_id', diff --git a/sf_quality/views/quality_check_view.xml b/sf_quality/views/quality_check_view.xml index 83ffcbca..fa88b48c 100644 --- a/sf_quality/views/quality_check_view.xml +++ b/sf_quality/views/quality_check_view.xml @@ -13,6 +13,8 @@ + diff --git a/sf_quality/views/quality_cnc_test_view.xml b/sf_quality/views/quality_cnc_test_view.xml index d2d37686..188ff7be 100644 --- a/sf_quality/views/quality_cnc_test_view.xml +++ b/sf_quality/views/quality_cnc_test_view.xml @@ -87,7 +87,8 @@ - + + diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 259928bc..be61a3a7 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -248,6 +248,7 @@ class ResaleOrderLine(models.Model): # part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True) model_glb_file = fields.Binary('模型的glb文件', compute='_compute_model_glb_file', store=True) + glb_url = fields.Char('glb文件地址', compute='_compute_model_glb_file', store=True) # product_template_id = fields.Many2one( # string="产品", # comodel_name='product.template', @@ -265,7 +266,6 @@ class ResaleOrderLine(models.Model): embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余') manual_quotation = fields.Boolean('人工编程', default=False) model_url = fields.Char('模型文件地址') - glb_url = fields.Char('glb文件地址') model_id = fields.Char('模型id') @api.depends('embryo_redundancy_id') @@ -279,6 +279,8 @@ class ResaleOrderLine(models.Model): if line.product_template_id: if not line.model_glb_file: line.model_glb_file = line.product_id.product_tmpl_id.model_file + if not line.glb_url: + line.glb_url = line.product_id.product_tmpl_id.glb_url if not line.price_unit: line.price_unit = line.product_id.product_tmpl_id.list_price diff --git a/sf_sale/views/quick_easy_order_view.xml b/sf_sale/views/quick_easy_order_view.xml index 89792a49..d8af409a 100644 --- a/sf_sale/views/quick_easy_order_view.xml +++ b/sf_sale/views/quick_easy_order_view.xml @@ -50,9 +50,13 @@ - + + +