Merge branch refs/heads/develop into refs/heads/feature/修改机床参数bug
This commit is contained in:
@@ -1,3 +1 @@
|
||||
from . import models
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
'security/ir.model.access.csv',
|
||||
'views/mrp_views_menus.xml',
|
||||
'views/mrp_production_addional_change.xml',
|
||||
# 'views/mrp_maintenance_views.xml',
|
||||
'views/mrp_routing_workcenter_view.xml',
|
||||
'views/production_line_view.xml',
|
||||
'views/mrp_workcenter_views.xml',
|
||||
@@ -25,7 +24,6 @@
|
||||
'views/model_type_view.xml',
|
||||
'views/sf_maintenance_equipment.xml',
|
||||
|
||||
|
||||
],
|
||||
'assets': {
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class MrpProduction(models.Model):
|
||||
if i == 1 and route.routing_type == '获取CNC加工程序':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str('', production, route))
|
||||
if route.is_repeat == True:
|
||||
if route.is_repeat is True:
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||
if i == processing_panel_len and route.routing_type == '解除装夹':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from odoo import fields, models
|
||||
import logging
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResMrpRoutingWorkcenter(models.Model):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from odoo import api, fields, models
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
from collections import defaultdict
|
||||
from odoo import fields, models
|
||||
from odoo.addons.resource.models.resource import Intervals
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import os
|
||||
import json
|
||||
import base64
|
||||
import math
|
||||
import requests
|
||||
import logging
|
||||
import base64
|
||||
# import subprocess
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
@@ -304,7 +303,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
# 验证坯料序列号是否正确
|
||||
def pro_code_is_ok(self, barcode):
|
||||
if barcode != False:
|
||||
if barcode is not False:
|
||||
if barcode != self.pro_code:
|
||||
raise UserError('坯料序列号错误')
|
||||
return False
|
||||
@@ -623,7 +622,7 @@ class CNCprocessing(models.Model):
|
||||
if os.path.splitext(f)[1] == ".pdf":
|
||||
full_path = os.path.join(serverdir, root, f)
|
||||
logging.info('pdf:%s' % full_path)
|
||||
if full_path != False:
|
||||
if full_path is not False:
|
||||
if not cnc_processing.workorder_id.cnc_worksheet:
|
||||
cnc_processing.workorder_id.cnc_worksheet = base64.b64encode(
|
||||
open(full_path, 'rb').read())
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
import logging
|
||||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
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
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
@@ -204,16 +201,6 @@ 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 = 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 == '夹头':
|
||||
@@ -298,12 +285,12 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_flange_length = self.specification_id.flange_shank_length
|
||||
self.cutting_tool_shank_outer_diameter = self.specification_id.handle_external_diameter
|
||||
self.cutting_tool_shank_inner_diameter = self.specification_id.handle_inside_diameter
|
||||
self.suitable_machining_method_ids = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.suitable_machining_method_ids else [
|
||||
(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
|
||||
self.blade_tip_characteristics_id = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.blade_tip_characteristics_id else [
|
||||
(6, 0, self.cutting_tool_model_id.blade_tip_characteristics_id.ids)]
|
||||
self.suitable_machining_method_ids = [(6, 0, [])] if not \
|
||||
self.cutting_tool_model_id.suitable_machining_method_ids \
|
||||
else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
|
||||
self.blade_tip_characteristics_id = [(6, 0, [])] if not \
|
||||
self.cutting_tool_model_id.blade_tip_characteristics_id \
|
||||
else [(6, 0, self.cutting_tool_model_id.blade_tip_characteristics_id.ids)]
|
||||
|
||||
self.handle_type_ids = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.handle_type_ids else [
|
||||
@@ -358,89 +345,33 @@ class ResProductMo(models.Model):
|
||||
self.cutting_speed_ids = False
|
||||
self.feed_per_tooth_ids = False
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
#
|
||||
# @api.constrains('blade_tip_characteristics_ids')
|
||||
# def _check_blade_tip_characteristics_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征不能为空!")
|
||||
# if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刀尖特征只能单选!")
|
||||
#
|
||||
# @api.constrains('handle_type_ids')
|
||||
# def _check_handle_type_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型不能为空!")
|
||||
# if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部类型只能单选!")
|
||||
#
|
||||
# @api.constrains('cutting_direction_ids')
|
||||
# def _check_cutting_direction_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("走刀方向不能为空!")
|
||||
#
|
||||
# @api.constrains('suitable_coolant_ids')
|
||||
# def _check_suitable_coolant_ids(self):
|
||||
# for record in self:
|
||||
# if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合冷却液不能为空!")
|
||||
#
|
||||
# @api.constrains('cutting_tool_total_length')
|
||||
# def _check_cutting_tool_total_length(self):
|
||||
# if self.cutting_tool_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("总长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_shank_length')
|
||||
# def _check_cutting_tool_shank_length(self):
|
||||
# if self.cutting_tool_shank_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_blade_length')
|
||||
# def _check_cutting_tool_blade_length(self):
|
||||
# if self.cutting_tool_blade_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部长度不能为0")
|
||||
#
|
||||
# @api.constrains('cutting_tool_blade_number')
|
||||
# def _check_cutting_tool_blade_number(self):
|
||||
# if self.cutting_tool_blade_number <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃数不能为0")
|
||||
#
|
||||
# @api.constrains('integral_shank_diameter')
|
||||
# def _check_integral_shank_diameter(self):
|
||||
# if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("柄部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_blade_diameter')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("刃部直径不能为0")
|
||||
#
|
||||
# @api.constrains('integral_run_out_accuracy_min')
|
||||
# def _check_integral_blade_diameter(self):
|
||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
||||
@api.constrains('fit_blade_shape_id', 'suitable_machining_method_ids', 'blade_tip_characteristics_id',
|
||||
'handle_type_ids', 'cutting_direction_ids', 'suitable_coolant_ids', 'compaction_way_ids')
|
||||
def _check_cutting_tool_ability(self):
|
||||
if self.cutting_tool_type in ['整体式刀具', '刀片', '刀杆', '刀盘']:
|
||||
if self.cutting_tool_type in ['刀片', '刀杆', '刀盘']:
|
||||
if not self.fit_blade_shape_id:
|
||||
raise ValidationError("请选择适配刀片形状")
|
||||
if self.cutting_tool_type in ['刀杆', '刀盘']:
|
||||
if not self.compaction_way_ids:
|
||||
raise ValidationError("请选择压紧方式")
|
||||
if self.cutting_tool_type == '刀片':
|
||||
if not self.suitable_coolant_ids:
|
||||
raise ValidationError("请选择适合冷却液")
|
||||
elif self.cutting_tool_type == '整体式刀具':
|
||||
if not self.handle_type_ids:
|
||||
raise ValidationError("请选择柄部类型")
|
||||
if not self.suitable_coolant_ids:
|
||||
raise ValidationError("请选择适合冷却液")
|
||||
if not self.suitable_machining_method_ids:
|
||||
raise ValidationError("请选择适合加工方式")
|
||||
if not self.blade_tip_characteristics_id:
|
||||
raise ValidationError("请选择刀尖特征")
|
||||
if not self.cutting_direction_ids:
|
||||
raise ValidationError("请选择走刀方向")
|
||||
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
|
||||
# @api.constrains('integral_run_out_accuracy_max')
|
||||
# def _check_integral_run_out_accuracy_max(self):
|
||||
# if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最大(max)不能为0")
|
||||
|
||||
cutting_tool_diameter = fields.Float('直径(mm)')
|
||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||
@@ -758,26 +689,19 @@ class ResProductMo(models.Model):
|
||||
'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
'model_name': attachment.name,
|
||||
'upload_model_file': [(6, 0, [attachment.id])],
|
||||
# 'tag_ids': [(6, 0, [t.id for t in account_template.tag_ids])],
|
||||
# 'single_manufacturing': True,
|
||||
# 'tracking': 'serial',
|
||||
'list_price': item['price'],
|
||||
# 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id,
|
||||
'materials_id': self.env['sf.production.materials'].search(
|
||||
[('materials_no', '=', item['texture_code'])]).id,
|
||||
'materials_type_id': self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['texture_type_code'])]).id,
|
||||
# 'model_surface_process_ids': self.get_production_process_id(item['surface_process_code']),
|
||||
'model_process_parameters_ids': [(6, 0, [])] if not item.get(
|
||||
'process_parameters_code') else self.get_process_parameters_id(item['process_parameters_code']),
|
||||
'model_remark': item['remark'],
|
||||
'default_code': '%s-%s' % (order_number, i),
|
||||
# 'barcode': item['barcode'],
|
||||
'active': True,
|
||||
# 'route_ids': self._get_routes('')
|
||||
}
|
||||
copy_product_id.sudo().write(vals)
|
||||
# product_id.product_tmpl_id.active = False
|
||||
product_id.product_tmpl_id.active = False
|
||||
return copy_product_id
|
||||
|
||||
def _get_ids(self, param):
|
||||
@@ -833,12 +757,6 @@ class ResProductMo(models.Model):
|
||||
'materials_id': materials_id.id,
|
||||
'materials_type_id': materials_type_id.id,
|
||||
'is_bfm': True,
|
||||
# 'route_ids': self._get_routes(route_type),
|
||||
# 'categ_id': self.env.ref('sf_dlm.product_category_embryo_sf').id,
|
||||
# 'model_surface_process_id': self.env['sf.production.process'].search(
|
||||
# [('process_encode', '=', item['surface_process_code'])]).id,
|
||||
# 'model_process_parameters_id': self.env['sf.processing.technology'].search(
|
||||
# [('process_encode', '=', item['process_parameters_code'])]).id,
|
||||
'active': True
|
||||
}
|
||||
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
||||
@@ -850,8 +768,6 @@ class ResProductMo(models.Model):
|
||||
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||
partner.is_subcontractor = True
|
||||
no_bom_copy_product_id.write(vals)
|
||||
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
||||
# product_id.product_tmpl_id.active = False
|
||||
return no_bom_copy_product_id
|
||||
|
||||
@api.model_create_multi
|
||||
@@ -956,3 +872,11 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
alarm_value = fields.Char('报警值')
|
||||
used_value = fields.Char('已使用值')
|
||||
code = fields.Char('机床刀位号')
|
||||
|
||||
name = fields.Char('', compute='_compute_name')
|
||||
|
||||
@api.depends('code')
|
||||
def _compute_name(self):
|
||||
for record in self:
|
||||
if record.code:
|
||||
record.name = record.code
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
from collections import defaultdict, namedtuple
|
||||
import logging
|
||||
import json
|
||||
from re import split as regex_split
|
||||
from re import findall as regex_findall
|
||||
from datetime import datetime, timedelta
|
||||
from re import split as regex_split
|
||||
import requests
|
||||
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
|
||||
@@ -517,8 +518,8 @@ class ReStockMove(models.Model):
|
||||
'inner_diameter': item.product_id.cutting_tool_inner_diameter,
|
||||
'cooling_suit_type_ids': item.product_id.cooling_suit_type_ids,
|
||||
'er_size_model': item.product_id.cutting_tool_er_size_model,
|
||||
'image': '' if not item.product_id.image_1920 else base64.b64encode(item.product_id.image_1920).decode(
|
||||
'utf-8'),
|
||||
'image': '' if not item.product_id.image_1920 else
|
||||
base64.b64encode(item.product_id.image_1920).decode('utf-8'),
|
||||
}
|
||||
try:
|
||||
if item.product_id.industry_code:
|
||||
|
||||
@@ -13,15 +13,16 @@ class CustomKanbanController extends KanbanController {
|
||||
|
||||
async setup() {
|
||||
super.setup();
|
||||
console.log('99999999111');
|
||||
// console.log('99999999111');
|
||||
this.workOrders = await this.getAllWorkOrders();
|
||||
this.workOrdersNew = this.workOrders;
|
||||
// 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(this.workOrders.every(order =>
|
||||
// typeof order === 'object' && order.id !== undefined));
|
||||
|
||||
|
||||
|
||||
@@ -38,14 +39,14 @@ class CustomKanbanController extends KanbanController {
|
||||
const id = button.getAttribute('data-id');
|
||||
|
||||
console.log('true_id', id);
|
||||
const context = {production_line_show: 'shengchanxian1'}
|
||||
// const context = {production_line_show: 'shengchanxian1'}
|
||||
this.env.services.rpc('/web/dataset/call_kw', {
|
||||
model: 'mrp.workcenter',
|
||||
method: 'search_read',
|
||||
args: [[], ['id']],
|
||||
kwargs: {}
|
||||
}).then((records) => {
|
||||
console.log(records)
|
||||
// console.log(records)
|
||||
const ids = records.map(record => record.id);
|
||||
const context = {production_line_show: id};
|
||||
this.env.services.rpc('/web/dataset/call_kw', {
|
||||
@@ -54,7 +55,7 @@ class CustomKanbanController extends KanbanController {
|
||||
args: [ids, context],
|
||||
kwargs: {}
|
||||
}).then((response) => {
|
||||
console.log('response', response);
|
||||
// console.log('response', response);
|
||||
location.reload();
|
||||
window.onload = function () {
|
||||
button.classList.add('choose')
|
||||
@@ -76,7 +77,7 @@ class CustomKanbanController extends KanbanController {
|
||||
// args: [],
|
||||
// kwargs: {},
|
||||
// });
|
||||
console.log('response', response);
|
||||
// console.log('response', response);
|
||||
// console.log('response1', response1);
|
||||
// 你可以在这里处理响应,例如将其存储在控制器的状态中
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user