Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug
# Conflicts: # sf_manufacturing/models/stock.py
This commit is contained in:
@@ -165,7 +165,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
||||
(y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4))
|
||||
x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / (
|
||||
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8));
|
||||
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8))
|
||||
y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / (
|
||||
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
||||
x = (x0 + x1) / 2
|
||||
@@ -189,19 +189,26 @@ class ResMrpWorkOrder(models.Model):
|
||||
def json_workorder_str(self, k, production, route):
|
||||
# 计算预计时长duration_expected
|
||||
if route.routing_type == '切割':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '切割')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '切割')]).time_cycle
|
||||
elif route.routing_type == '获取CNC加工程序':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '获取CNC加工程序')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '获取CNC加工程序')]).time_cycle
|
||||
elif route.routing_type == '工件装夹':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '工件装夹')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '工件装夹')]).time_cycle
|
||||
elif route.routing_type == '前置三元定位检测':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '前置三元定位检测')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '前置三元定位检测')]).time_cycle
|
||||
elif route.routing_type == 'CNC加工':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', 'CNC加工')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle
|
||||
elif route.routing_type == '后置三元质量检测':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '后置三元质量检测')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '后置三元质量检测')]).time_cycle
|
||||
elif route.routing_type == '解除装夹':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '解除装夹')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '解除装夹')]).time_cycle
|
||||
else:
|
||||
duration_expected = 60
|
||||
workorders_values_str = [0, '', {
|
||||
|
||||
@@ -151,33 +151,35 @@ class ResProductMo(models.Model):
|
||||
item.cutting_speed_ids = False
|
||||
item.feed_per_tooth_ids = False
|
||||
|
||||
def choice(self):
|
||||
if self.cutting_tool_type == '整体式刀具':
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
||||
elif self.cutting_tool_type == '刀片':
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
||||
elif self.cutting_tool_type == '刀杆':
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
||||
elif self.cutting_tool_type == '刀盘':
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
elif self.cutting_tool_type == '刀柄':
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
else:
|
||||
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
return {
|
||||
'name': _('规格'),
|
||||
'view_mode': 'list',
|
||||
'view_id': tree_view.id,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.tool.materials.basic.parameters',
|
||||
'target': 'new',
|
||||
'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
||||
('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
||||
}
|
||||
# def choice(self):
|
||||
# if self.cutting_tool_type == '整体式刀具':
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
|
||||
# elif self.cutting_tool_type == '刀片':
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
|
||||
# elif self.cutting_tool_type == '刀杆':
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
|
||||
# elif self.cutting_tool_type == '刀盘':
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
# elif self.cutting_tool_type == '刀柄':
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
# else:
|
||||
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
|
||||
# return {
|
||||
# 'name': _('规格'),
|
||||
# 'view_mode': 'list',
|
||||
# 'view_id': tree_view.id,
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'res_model': 'sf.tool.materials.basic.parameters',
|
||||
# 'target': 'new',
|
||||
# 'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
|
||||
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
||||
# }
|
||||
|
||||
@api.onchange('specification_id')
|
||||
def _onchange_specification(self):
|
||||
if self.specification_id:
|
||||
self.cutting_speed_ids = False
|
||||
self.feed_per_tooth_ids = False
|
||||
self.cutting_tool_type_id = self.cutting_tool_model_id.cutting_tool_type_id.id
|
||||
self.brand_id = self.cutting_tool_model_id.brand_id.id
|
||||
self.tool_hardness = self.cutting_tool_model_id.tool_hardness
|
||||
@@ -202,14 +204,18 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
||||
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
||||
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
||||
self.feed_per_tooth_ids = [(0, 0, {'product_template_id': product_template.id,
|
||||
'cutting_speed': product_template.cutting_speed,
|
||||
'machining_method': product_template.machining_method,
|
||||
'blade_diameter': product_template.blade_diameter,
|
||||
'materials_type_id': product_template.materials_type_id.id}) for
|
||||
product_template in
|
||||
self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
||||
lambda r: r.blade_diameter == self.specification_id.blade_diameter)]
|
||||
# # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.
|
||||
# for tooth in self.cutting_tool_model_id.feed_per_tooth_ids:
|
||||
# print(int(tooth.blade_diameter))
|
||||
# print(int(self.specification_id.blade_diameter))
|
||||
# if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter):
|
||||
# self.feed_per_tooth_ids = [(0, 0, {
|
||||
# 'cutting_speed': tooth.cutting_speed,
|
||||
# 'machining_method': tooth.machining_method,
|
||||
# 'blade_diameter': tooth.blade_diameter,
|
||||
# 'materials_type_id': tooth.materials_type_id.id})]
|
||||
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
||||
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
||||
elif self.cutting_tool_type == '夹头':
|
||||
self.cutting_tool_clamping_length = self.specification_id.clamping_length
|
||||
self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance
|
||||
@@ -284,8 +290,8 @@ class ResProductMo(models.Model):
|
||||
elif self.cutting_tool_type == '刀柄':
|
||||
self.cutting_tool_total_length = self.specification_id.total_length
|
||||
self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed
|
||||
self.cutting_tool_speed_max = self.specification_id.speed_max
|
||||
self.cutting_tool_change_time = self.specification_id.change_time
|
||||
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
|
||||
self.cutting_tool_change_time = self.specification_id.tool_changing_time
|
||||
self.cutting_tool_total_length = self.specification_id.total_length
|
||||
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
|
||||
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
|
||||
@@ -313,6 +319,44 @@ class ResProductMo(models.Model):
|
||||
self.compaction_way_ids = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.compaction_way_ids else [
|
||||
(6, 0, self.cutting_tool_model_id.compaction_way_ids.ids)]
|
||||
else:
|
||||
self.cutting_tool_type_id = False
|
||||
self.brand_id = False
|
||||
self.tool_hardness = False
|
||||
self.cutting_tool_run_out_accuracy_max = False
|
||||
self.cutting_tool_run_out_accuracy_min = False
|
||||
self.materials_type_id = False
|
||||
self.cutting_tool_blade_type = False
|
||||
self.cutting_tool_total_length = False
|
||||
self.cutting_tool_clamping_way = False
|
||||
self.cutting_tool_blade_diameter = False
|
||||
self.cutting_tool_shank_length = False
|
||||
self.cutting_tool_blade_length = False
|
||||
self.cutting_tool_blade_number = False
|
||||
self.cutting_tool_neck_length = False
|
||||
self.cutting_tool_neck_diameter = False
|
||||
self.cutting_tool_shank_diameter = False
|
||||
self.cutting_tool_blade_tip_diameter = False
|
||||
self.cutting_tool_blade_tip_taper = False
|
||||
self.cutting_tool_blade_helix_angle = False
|
||||
self.cutting_tool_blade_type = False
|
||||
self.cutting_tool_pitch = False
|
||||
self.cutting_tool_blade_width = False
|
||||
self.cutting_tool_blade_depth = False
|
||||
self.cutting_tool_cut_depth = False
|
||||
self.cutting_tool_coarse_medium_fine = False
|
||||
self.cutting_tool_run_out_accuracy_max = False
|
||||
self.cutting_tool_run_out_accuracy_min = False
|
||||
self.cutting_tool_blade_tip_working_size = False
|
||||
self.fit_blade_shape_id = False
|
||||
self.suitable_machining_method_ids = False
|
||||
self.blade_tip_characteristics_id = False
|
||||
self.handle_type_ids = False
|
||||
self.cutting_direction_ids = False
|
||||
self.suitable_coolant_ids = False
|
||||
self.compaction_way_ids = False
|
||||
self.cutting_speed_ids = False
|
||||
self.feed_per_tooth_ids = False
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
@@ -899,7 +943,8 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
_description = '机床刀位'
|
||||
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||
product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
|
||||
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
|
||||
domain="[('categ_type', '=', '刀具')]")
|
||||
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
|
||||
categ_type = fields.Char(string='功能刀具类型')
|
||||
diameter = fields.Char('直径')
|
||||
@@ -911,5 +956,3 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
alarm_value = fields.Char('报警值')
|
||||
used_value = fields.Char('已使用值')
|
||||
code = fields.Char('机床刀位号')
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
import base64
|
||||
from collections import defaultdict, namedtuple
|
||||
import requests
|
||||
from re import findall as regex_findall
|
||||
from datetime import datetime, timedelta
|
||||
from re import split as regex_split
|
||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||
from odoo.tools import float_compare
|
||||
from collections import defaultdict, namedtuple
|
||||
from odoo.addons.stock.models.stock_rule import ProcurementException
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import UserError
|
||||
@@ -306,12 +306,12 @@ class StockPicking(models.Model):
|
||||
|
||||
res = super().button_validate()
|
||||
# 采购单验证(夹具)
|
||||
for item in self.move_ids_without_package:
|
||||
if item.quantity_done > 0:
|
||||
if item.product_id.categ_type == '夹具':
|
||||
item._register_fixture()
|
||||
elif item.product_id.categ_type == '刀具':
|
||||
item._register_cutting_tool()
|
||||
# for item in self.move_ids_without_package:
|
||||
# if item.quantity_done > 0:
|
||||
# if item.product_id.categ_type == '夹具':
|
||||
# item._register_fixture()
|
||||
# elif item.product_id.categ_type == '刀具':
|
||||
# item._register_cutting_tool()
|
||||
return res
|
||||
|
||||
# 创建 外协出库入单
|
||||
|
||||
@@ -16,12 +16,12 @@ class CustomKanbanController extends KanbanController {
|
||||
console.log('99999999111');
|
||||
this.workOrders = await this.getAllWorkOrders();
|
||||
this.workOrdersNew = this.workOrders;
|
||||
console.log('lines222222222', this.workOrders);
|
||||
|
||||
console.log(typeof this.workOrders);
|
||||
console.log(Array.isArray(this.workOrders));
|
||||
|
||||
console.log(this.workOrders.every(order => typeof order === 'object' && order.id !== undefined));
|
||||
// console.log('lines222222222', this.workOrders);
|
||||
//
|
||||
// console.log(typeof this.workOrders);
|
||||
// console.log(Array.isArray(this.workOrders));
|
||||
//
|
||||
// console.log(this.workOrders.every(order => typeof order === 'object' && order.id !== undefined));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -104,5 +104,56 @@
|
||||
<!-- <filter string="草稿" name="filter_draft" domain="[('state', '=', 'draft')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
|
||||
|
||||
<!-- 产品模板修改>>>增加“规格”字段specification_id -->
|
||||
<record id="custom_product_template_kanban_view" model="ir.ui.view">
|
||||
<field name="name">custom.Product.template.product.kanban</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//kanban" position="replace">
|
||||
<kanban sample="1" class="o_kanban_product_template">
|
||||
<field name="id"/>
|
||||
<field name="product_variant_count"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="activity_state"/>
|
||||
<progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_card oe_kanban_global_click">
|
||||
<div class="o_kanban_image me-1">
|
||||
<img t-att-src="kanban_image('product.template', 'image_128', record.id.raw_value)" alt="Product" class="o_image_64_contain"/>
|
||||
</div>
|
||||
<div class="oe_kanban_details">
|
||||
<div class="o_kanban_record_top mb-0">
|
||||
<div class="o_kanban_record_headings">
|
||||
<strong class="o_kanban_record_title">
|
||||
<field name="name"/>
|
||||
</strong>
|
||||
</div>
|
||||
<field name="priority" widget="priority"/>
|
||||
</div>
|
||||
|
||||
<div name="product_specification_id" class="mt-1">
|
||||
规格: <field name="specification_id"></field>
|
||||
</div>
|
||||
<t t-if="record.default_code.value">[<field name="default_code"/>]</t>
|
||||
<div t-if="record.product_variant_count.value > 1" groups="product.group_product_variant">
|
||||
<strong>
|
||||
<t t-esc="record.product_variant_count.value"/> Variants
|
||||
</strong>
|
||||
</div>
|
||||
<div name="product_lst_price" class="mt-1">
|
||||
价格: <field name="list_price" widget="monetary" options="{'currency_field': 'currency_id', 'field_digits': True}"></field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user