1、注释action_apply_inventory()方法;2、功能刀具安全库存添加one2many类型的功能刀具废弃many2many类型的关联字段并优化代码,并在功能刀具模型添加功能按钮用来绑定功能刀具和对应的功能刀具安全库存;3、优化根据库存创建功能刀具组装单的方法断定条件;4、优化刀具注册接口的报错处理;5、优化组装流程
This commit is contained in:
@@ -715,15 +715,15 @@ class ReStockMove(models.Model):
|
|||||||
class ReStockQuant(models.Model):
|
class ReStockQuant(models.Model):
|
||||||
_inherit = 'stock.quant'
|
_inherit = 'stock.quant'
|
||||||
|
|
||||||
def action_apply_inventory(self):
|
# def action_apply_inventory(self):
|
||||||
inventory_diff_quantity = self.inventory_diff_quantity
|
# inventory_diff_quantity = self.inventory_diff_quantity
|
||||||
super(ReStockQuant, self).action_apply_inventory()
|
# super(ReStockQuant, self).action_apply_inventory()
|
||||||
if inventory_diff_quantity >= 1:
|
# if inventory_diff_quantity >= 1:
|
||||||
stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
|
# stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
|
||||||
('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
|
# ('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
|
||||||
limit=1, order='id desc')
|
# limit=1, order='id desc')
|
||||||
if self.product_id.categ_type == '夹具':
|
# if self.product_id.categ_type == '夹具':
|
||||||
stock._register_fixture()
|
# stock._register_fixture()
|
||||||
elif self.product_id.categ_type == '刀具':
|
# elif self.product_id.categ_type == '刀具':
|
||||||
stock._register_cutting_tool()
|
# stock._register_cutting_tool()
|
||||||
return True
|
# return True
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from odoo import SUPERUSER_ID
|
from odoo import SUPERUSER_ID
|
||||||
@@ -46,6 +48,16 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
|
|
||||||
active = fields.Boolean(string='已归档', default=True)
|
active = fields.Boolean(string='已归档', default=True)
|
||||||
|
|
||||||
|
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
|
||||||
|
string='功能刀具安全库存', readonly=True)
|
||||||
|
|
||||||
|
def button_safe_inventory_id(self):
|
||||||
|
"""更新功能刀具关联的安全库存记录"""
|
||||||
|
tool_is = self.search([])
|
||||||
|
for item in tool_is:
|
||||||
|
item.safe_inventory_id = self.env['sf.real.time.distribution.of.functional.tools'].search(
|
||||||
|
[('functional_name_id', '=', item.tool_name_id.id)])[0]
|
||||||
|
|
||||||
@api.depends('barcode_id.quant_ids', 'functional_tool_status')
|
@api.depends('barcode_id.quant_ids', 'functional_tool_status')
|
||||||
def _compute_current_location_id(self):
|
def _compute_current_location_id(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
@@ -136,13 +148,11 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
def _compute_maintenance_equipment_image(self):
|
def _compute_maintenance_equipment_image(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.cutting_tool_integral_model_id:
|
if record.cutting_tool_integral_model_id:
|
||||||
print(record.cutting_tool_integral_model_id)
|
|
||||||
record.sudo().suitable_machining_method_ids = record.cutting_tool_integral_model_id.suitable_machining_method_ids.ids
|
record.sudo().suitable_machining_method_ids = record.cutting_tool_integral_model_id.suitable_machining_method_ids.ids
|
||||||
record.sudo().blade_tip_characteristics_id = record.cutting_tool_integral_model_id.blade_tip_characteristics_id.id
|
record.sudo().blade_tip_characteristics_id = record.cutting_tool_integral_model_id.blade_tip_characteristics_id.id
|
||||||
record.sudo().handle_type_id = record.cutting_tool_integral_model_id.handle_type_id.id
|
record.sudo().handle_type_id = record.cutting_tool_integral_model_id.handle_type_id.id
|
||||||
record.sudo().cutting_direction_ids = record.cutting_tool_integral_model_id.cutting_direction_ids.ids
|
record.sudo().cutting_direction_ids = record.cutting_tool_integral_model_id.cutting_direction_ids.ids
|
||||||
record.sudo().suitable_coolant_ids = record.cutting_tool_integral_model_id.suitable_coolant_ids.ids
|
record.sudo().suitable_coolant_ids = record.cutting_tool_integral_model_id.suitable_coolant_ids.ids
|
||||||
print(record.cutting_tool_integral_model_id.blade_tip_characteristics_id.ids)
|
|
||||||
elif record.cutting_tool_blade_model_id:
|
elif record.cutting_tool_blade_model_id:
|
||||||
record.sudo().suitable_machining_method_ids = record.cutting_tool_blade_model_id.suitable_machining_method_ids.ids
|
record.sudo().suitable_machining_method_ids = record.cutting_tool_blade_model_id.suitable_machining_method_ids.ids
|
||||||
record.sudo().blade_tip_characteristics_id = record.cutting_tool_blade_model_id.blade_tip_characteristics_id.id
|
record.sudo().blade_tip_characteristics_id = record.cutting_tool_blade_model_id.blade_tip_characteristics_id.id
|
||||||
@@ -340,28 +350,31 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
suitable_machining_method_ids = fields.Many2many(
|
suitable_machining_method_ids = fields.Many2many(
|
||||||
'maintenance.equipment.image', 'rel_machining_product_template_distribution', '适合加工方式',
|
'maintenance.equipment.image', 'rel_machining_product_template_distribution', '适合加工方式',
|
||||||
domain=[('type', '=', '加工能力')],
|
domain=[('type', '=', '加工能力')],
|
||||||
related='sf_functional_cutting_tool_entity_ids.suitable_machining_method_ids')
|
related='sf_functional_tool_entity_ids.suitable_machining_method_ids')
|
||||||
blade_tip_characteristics_id = fields.Many2one(
|
blade_tip_characteristics_id = fields.Many2one(
|
||||||
'maintenance.equipment.image', '刀尖特征',
|
'maintenance.equipment.image', '刀尖特征',
|
||||||
domain=[('type', '=', '刀尖特征')],
|
domain=[('type', '=', '刀尖特征')],
|
||||||
related='sf_functional_cutting_tool_entity_ids.blade_tip_characteristics_id')
|
related='sf_functional_tool_entity_ids.blade_tip_characteristics_id')
|
||||||
handle_type_id = fields.Many2one(
|
handle_type_id = fields.Many2one(
|
||||||
'maintenance.equipment.image', '柄部类型',
|
'maintenance.equipment.image', '柄部类型',
|
||||||
domain=[('type', '=', '柄部类型')], related='sf_functional_cutting_tool_entity_ids.handle_type_id')
|
domain=[('type', '=', '柄部类型')], related='sf_functional_tool_entity_ids.handle_type_id')
|
||||||
cutting_direction_ids = fields.Many2many(
|
cutting_direction_ids = fields.Many2many(
|
||||||
'maintenance.equipment.image', 'rel_cutting_product_template_distribution', '走刀方向',
|
'maintenance.equipment.image', 'rel_cutting_product_template_distribution', '走刀方向',
|
||||||
domain=[('type', '=', '走刀方向')], related='sf_functional_cutting_tool_entity_ids.cutting_direction_ids')
|
domain=[('type', '=', '走刀方向')], related='sf_functional_tool_entity_ids.cutting_direction_ids')
|
||||||
suitable_coolant_ids = fields.Many2many(
|
suitable_coolant_ids = fields.Many2many(
|
||||||
'maintenance.equipment.image', 'rel_coolants_product_template_distribution', '适合冷却方式',
|
'maintenance.equipment.image', 'rel_coolants_product_template_distribution', '适合冷却方式',
|
||||||
domain=[('type', '=', '冷却方式')], related='sf_functional_cutting_tool_entity_ids.suitable_coolant_ids')
|
domain=[('type', '=', '冷却方式')], related='sf_functional_tool_entity_ids.suitable_coolant_ids')
|
||||||
|
|
||||||
sf_functional_cutting_tool_entity_ids = fields.Many2many('sf.functional.cutting.tool.entity',
|
sf_functional_cutting_tool_entity_ids = fields.Many2many('sf.functional.cutting.tool.entity',
|
||||||
'sf_functional_cutting_tool_entity_ref',
|
'sf_functional_cutting_tool_entity_ref',
|
||||||
string='功能刀具列表信息', readonly=True)
|
string='功能刀具列表信息')
|
||||||
|
|
||||||
sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref',
|
sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref',
|
||||||
'功能刀具组装单', readonly=True)
|
'功能刀具组装单', readonly=True)
|
||||||
|
|
||||||
|
sf_functional_tool_entity_ids = fields.One2many('sf.functional.cutting.tool.entity', 'safe_inventory_id',
|
||||||
|
string='功能刀具信息')
|
||||||
|
|
||||||
active = fields.Boolean(string='已归档', default=True)
|
active = fields.Boolean(string='已归档', default=True)
|
||||||
|
|
||||||
@api.onchange('functional_name_id')
|
@api.onchange('functional_name_id')
|
||||||
@@ -392,12 +405,11 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
mrs_cutting_tool_type_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
mrs_cutting_tool_type_ids = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
||||||
return categories.browse(mrs_cutting_tool_type_ids)
|
return categories.browse(mrs_cutting_tool_type_ids)
|
||||||
|
|
||||||
@api.depends('sf_functional_cutting_tool_entity_ids', 'min_stock_num', 'max_stock_num')
|
@api.depends('sf_functional_tool_entity_ids', 'min_stock_num', 'max_stock_num')
|
||||||
def _compute_batch_replenishment_num(self):
|
def _compute_batch_replenishment_num(self):
|
||||||
for tool in self:
|
for tool in self:
|
||||||
if tool:
|
if tool:
|
||||||
# 判断功能刀具组装单是否已经完成
|
# 计算刀具房数量、线边刀库数量、机内刀库数量
|
||||||
tool.sudo().estimate_functional_tool_assembly_ids(tool)
|
|
||||||
tool.sudo().get_stock_num(tool)
|
tool.sudo().get_stock_num(tool)
|
||||||
# 计算当前库存量
|
# 计算当前库存量
|
||||||
tool.sudo().tool_stock_total = tool.tool_stock_num + tool.side_shelf_num + tool.on_tool_stock_num
|
tool.sudo().tool_stock_total = tool.tool_stock_num + tool.side_shelf_num + tool.on_tool_stock_num
|
||||||
@@ -409,9 +421,10 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
计算批次补货量
|
计算批次补货量
|
||||||
"""
|
"""
|
||||||
if tool.tool_stock_total < tool.min_stock_num:
|
if tool.tool_stock_total < tool.min_stock_num:
|
||||||
tool.sudo().batch_replenishment_num = tool.max_stock_num - tool.tool_stock_total
|
|
||||||
# 根据判断创建功能刀具组装单
|
# 根据判断创建功能刀具组装单
|
||||||
if not tool.sf_functional_tool_assembly_ids and re.match(r'^\d+$', str(tool.id)):
|
if not tool.sf_functional_tool_assembly_ids.filtered(lambda item: item.assemble_status == '0') and re.match(
|
||||||
|
r'^\d+$', str(tool.id)):
|
||||||
|
tool.sudo().batch_replenishment_num = tool.max_stock_num - tool.tool_stock_total
|
||||||
for i in range(tool.batch_replenishment_num):
|
for i in range(tool.batch_replenishment_num):
|
||||||
tool.sudo().create_functional_tool_assembly(tool)
|
tool.sudo().create_functional_tool_assembly(tool)
|
||||||
print(i, ": ", tool.sf_functional_tool_assembly_ids)
|
print(i, ": ", tool.sf_functional_tool_assembly_ids)
|
||||||
@@ -438,15 +451,6 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
})
|
})
|
||||||
tool.sudo().sf_functional_tool_assembly_ids = [(4, functional_tool_assembly.id)]
|
tool.sudo().sf_functional_tool_assembly_ids = [(4, functional_tool_assembly.id)]
|
||||||
|
|
||||||
def estimate_functional_tool_assembly_ids(self, tool):
|
|
||||||
"""
|
|
||||||
判断功能刀具组装单是否完成,如果全部完成清空sf_functional_tool_assembly_ids的数据
|
|
||||||
"""
|
|
||||||
for sf_functional_tool_assembly_id in tool.sf_functional_tool_assembly_ids:
|
|
||||||
if sf_functional_tool_assembly_id.assemble_status == '0':
|
|
||||||
return False
|
|
||||||
tool.sudo().sf_functional_tool_assembly_ids = []
|
|
||||||
|
|
||||||
def get_stock_num(self, tool):
|
def get_stock_num(self, tool):
|
||||||
"""
|
"""
|
||||||
计算刀具房数量、线边刀库数量、机内刀库数量
|
计算刀具房数量、线边刀库数量、机内刀库数量
|
||||||
@@ -455,16 +459,20 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
tool.tool_stock_num = 0
|
tool.tool_stock_num = 0
|
||||||
tool.side_shelf_num = 0
|
tool.side_shelf_num = 0
|
||||||
tool.on_tool_stock_num = 0
|
tool.on_tool_stock_num = 0
|
||||||
if tool.sf_functional_cutting_tool_entity_ids:
|
if tool.sf_functional_tool_entity_ids:
|
||||||
for cutting_tool in tool.sf_functional_cutting_tool_entity_ids:
|
for cutting_tool in tool.sf_functional_tool_entity_ids:
|
||||||
if cutting_tool.tool_room_num > 0:
|
if cutting_tool.tool_room_num > 0:
|
||||||
tool.tool_stock_num += 1
|
tool.tool_stock_num += 1
|
||||||
elif cutting_tool.line_edge_knife_library_num > 0:
|
elif cutting_tool.line_edge_knife_library_num > 0:
|
||||||
tool.side_shelf_num += 1
|
tool.side_shelf_num += 1
|
||||||
elif cutting_tool.machine_knife_library_num > 0:
|
elif cutting_tool.machine_knife_library_num > 0:
|
||||||
tool.on_tool_stock_num += 1
|
tool.on_tool_stock_num += 1
|
||||||
|
else:
|
||||||
|
tool.tool_stock_num = 0
|
||||||
|
tool.side_shelf_num = 0
|
||||||
|
tool.on_tool_stock_num = 0
|
||||||
|
|
||||||
def create_or_edit_safety_stock(self, vals, sf_functional_cutting_tool_entity_ids):
|
def create_or_edit_safety_stock(self, vals, sf_functional_tool_entity_ids):
|
||||||
"""
|
"""
|
||||||
根据传入的信息新增或者更新功能刀具安全库存的信息
|
根据传入的信息新增或者更新功能刀具安全库存的信息
|
||||||
"""
|
"""
|
||||||
@@ -473,9 +481,9 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
[('functional_name_id', '=', vals['functional_name_id'])])
|
[('functional_name_id', '=', vals['functional_name_id'])])
|
||||||
if len(record) > 0:
|
if len(record) > 0:
|
||||||
for obj in record:
|
for obj in record:
|
||||||
obj.write({'sf_functional_cutting_tool_entity_ids': [(4, sf_functional_cutting_tool_entity_ids.id)]})
|
obj.write({'sf_functional_tool_entity_ids': [(4, sf_functional_tool_entity_ids.id)]})
|
||||||
else:
|
else:
|
||||||
vals['sf_functional_cutting_tool_entity_ids'] = sf_functional_cutting_tool_entity_ids.ids
|
vals['sf_functional_tool_entity_ids'] = sf_functional_tool_entity_ids.ids
|
||||||
self.env['sf.real.time.distribution.of.functional.tools'].create(vals)
|
self.env['sf.real.time.distribution.of.functional.tools'].create(vals)
|
||||||
|
|
||||||
status_create = fields.Boolean('是否是新增状态', default=True)
|
status_create = fields.Boolean('是否是新增状态', default=True)
|
||||||
|
|||||||
@@ -81,22 +81,25 @@ class StockLot(models.Model):
|
|||||||
|
|
||||||
def _get_sync_stock_lot(self, objs_all, str_url, token, headers):
|
def _get_sync_stock_lot(self, objs_all, str_url, token, headers):
|
||||||
tool_material_stock_list = []
|
tool_material_stock_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
val = {
|
for item in objs_all:
|
||||||
'name': item.name,
|
val = {
|
||||||
'tool_material_status': item.tool_material_status,
|
'name': item.name,
|
||||||
'location': [] if not item.quant_ids else item.quant_ids[-1].location_id.name,
|
'tool_material_status': item.tool_material_status,
|
||||||
'tool_material_search_id': item.tool_material_search_id.id,
|
'location': [] if not item.quant_ids else item.quant_ids[-1].location_id.name,
|
||||||
}
|
'tool_material_search_id': item.tool_material_search_id.id,
|
||||||
tool_material_stock_list.append(val)
|
}
|
||||||
kw = json.dumps(tool_material_stock_list, ensure_ascii=False)
|
tool_material_stock_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(tool_material_stock_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return '刀具物料序列号注册成功'
|
if ret.get('code') == 200:
|
||||||
else:
|
return '刀具物料序列号注册成功'
|
||||||
logging.info("没有注册刀具物料序列号信息")
|
else:
|
||||||
|
logging.info("没有注册刀具物料序列号信息")
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
|
|
||||||
class ToolMaterial(models.Model):
|
class ToolMaterial(models.Model):
|
||||||
@@ -127,28 +130,31 @@ class ToolMaterial(models.Model):
|
|||||||
|
|
||||||
def _get_sync_tool_material_search(self, objs_all, str_url, token, headers):
|
def _get_sync_tool_material_search(self, objs_all, str_url, token, headers):
|
||||||
tool_material_list = []
|
tool_material_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
val = {
|
for item in objs_all:
|
||||||
'name': item.name,
|
val = {
|
||||||
'id': item.id,
|
'name': item.name,
|
||||||
'cutting_tool_material_code': item.cutting_tool_material_id.code,
|
'id': item.id,
|
||||||
'cutting_tool_standard_library_code': item.cutting_tool_standard_library_id.code,
|
'cutting_tool_material_code': item.cutting_tool_material_id.code,
|
||||||
'specification_name': item.specification_id.name,
|
'cutting_tool_standard_library_code': item.cutting_tool_standard_library_id.code,
|
||||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
'specification_name': item.specification_id.name,
|
||||||
'number': item.number,
|
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||||
'usable_num': item.usable_num,
|
'number': item.number,
|
||||||
'have_been_used_num': item.have_been_used_num,
|
'usable_num': item.usable_num,
|
||||||
'scrap_num': item.scrap_num
|
'have_been_used_num': item.have_been_used_num,
|
||||||
}
|
'scrap_num': item.scrap_num
|
||||||
tool_material_list.append(val)
|
}
|
||||||
kw = json.dumps(tool_material_list, ensure_ascii=False)
|
tool_material_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(tool_material_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return '刀具物料注册成功'
|
if ret.get('code') == 200:
|
||||||
else:
|
return '刀具物料注册成功'
|
||||||
logging.info('没有注册刀具物料信息')
|
else:
|
||||||
|
logging.info('没有注册刀具物料信息')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
@@ -188,56 +194,59 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
|
|
||||||
def _get_sync_functional_cutting_tool_entity(self, objs_all, str_url, token, headers):
|
def _get_sync_functional_cutting_tool_entity(self, objs_all, str_url, token, headers):
|
||||||
functional_tool_list = []
|
functional_tool_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
val = {
|
for item in objs_all:
|
||||||
'id': item.id,
|
val = {
|
||||||
'code': item.code,
|
'id': item.id,
|
||||||
'name': item.name,
|
'code': item.code,
|
||||||
'rfid': item.rfid,
|
'name': item.name,
|
||||||
'tool_groups_name': item.tool_groups_id.name,
|
'rfid': item.rfid,
|
||||||
'barcode': item.barcode_id.name,
|
'tool_groups_name': item.tool_groups_id.name,
|
||||||
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
'barcode': item.barcode_id.name,
|
||||||
'functional_tool_diameter': item.functional_tool_diameter,
|
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
||||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
'functional_tool_diameter': item.functional_tool_diameter,
|
||||||
'coarse_middle_thin': item.coarse_middle_thin,
|
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||||
'new_former': item.new_former,
|
'coarse_middle_thin': item.coarse_middle_thin,
|
||||||
'tool_loading_length': item.tool_loading_length,
|
'new_former': item.new_former,
|
||||||
'functional_tool_length': item.functional_tool_length,
|
'tool_loading_length': item.tool_loading_length,
|
||||||
'effective_length': item.effective_length,
|
'functional_tool_length': item.functional_tool_length,
|
||||||
'max_lifetime_value': item.max_lifetime_value,
|
'effective_length': item.effective_length,
|
||||||
'alarm_value': item.alarm_value,
|
'max_lifetime_value': item.max_lifetime_value,
|
||||||
'used_value': item.used_value,
|
'alarm_value': item.alarm_value,
|
||||||
'functional_tool_status': item.functional_tool_status,
|
'used_value': item.used_value,
|
||||||
'current_location': item.current_location,
|
'functional_tool_status': item.functional_tool_status,
|
||||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
'current_location': item.current_location,
|
||||||
'whether_standard_knife': item.whether_standard_knife,
|
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||||
'L_D_number': item.L_D_number,
|
'whether_standard_knife': item.whether_standard_knife,
|
||||||
'hiding_length': item.hiding_length,
|
'L_D_number': item.L_D_number,
|
||||||
'cut_time': item.cut_time,
|
'hiding_length': item.hiding_length,
|
||||||
'cut_length': item.cut_length,
|
'cut_time': item.cut_time,
|
||||||
'cut_number': item.cut_number,
|
'cut_length': item.cut_length,
|
||||||
'cutting_tool_integral_model_id': item.cutting_tool_integral_model_id.tool_material_id,
|
'cut_number': item.cut_number,
|
||||||
'cutting_tool_blade_model_id': item.cutting_tool_blade_model_id.tool_material_id,
|
'cutting_tool_integral_model_id': item.cutting_tool_integral_model_id.tool_material_id,
|
||||||
'cutting_tool_cutterbar_model_id': item.cutting_tool_cutterbar_model_id.tool_material_id,
|
'cutting_tool_blade_model_id': item.cutting_tool_blade_model_id.tool_material_id,
|
||||||
'cutting_tool_cutterpad_model_id': item.cutting_tool_cutterpad_model_id.tool_material_id,
|
'cutting_tool_cutterbar_model_id': item.cutting_tool_cutterbar_model_id.tool_material_id,
|
||||||
'cutting_tool_cutterhandle_model_id': item.cutting_tool_cutterhandle_model_id.tool_material_id,
|
'cutting_tool_cutterpad_model_id': item.cutting_tool_cutterpad_model_id.tool_material_id,
|
||||||
'cutting_tool_cutterhead_model_id': item.cutting_tool_cutterhead_model_id.tool_material_id,
|
'cutting_tool_cutterhandle_model_id': item.cutting_tool_cutterhandle_model_id.tool_material_id,
|
||||||
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
'cutting_tool_cutterhead_model_id': item.cutting_tool_cutterhead_model_id.tool_material_id,
|
||||||
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
||||||
'handle_type_name': item.handle_type_id.name,
|
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
||||||
'cutting_direction_names': get_cutting_direction_names(item),
|
'handle_type_name': item.handle_type_id.name,
|
||||||
'suitable_coolant_names': get_suitable_coolant_names(item),
|
'cutting_direction_names': get_cutting_direction_names(item),
|
||||||
'active': item.active,
|
'suitable_coolant_names': get_suitable_coolant_names(item),
|
||||||
}
|
'active': item.active,
|
||||||
functional_tool_list.append(val)
|
}
|
||||||
kw = json.dumps(functional_tool_list, ensure_ascii=False)
|
functional_tool_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(functional_tool_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return "功能刀具注册成功"
|
if ret.get('code') == 200:
|
||||||
else:
|
return "功能刀具注册成功"
|
||||||
logging.info('没有注册功能刀具信息')
|
else:
|
||||||
|
logging.info('没有注册功能刀具信息')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
@@ -283,42 +292,45 @@ class FunctionalToolWarning(models.Model):
|
|||||||
|
|
||||||
def get_sync_functional_tool_warning(self, objs_all, str_url, token, headers):
|
def get_sync_functional_tool_warning(self, objs_all, str_url, token, headers):
|
||||||
tool_warning_list = []
|
tool_warning_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
val = {
|
for item in objs_all:
|
||||||
'id': item.id,
|
val = {
|
||||||
'name': item.name,
|
'id': item.id,
|
||||||
'code': item.code,
|
'name': item.name,
|
||||||
'rfid': item.rfid,
|
'code': item.code,
|
||||||
'tool_groups_name': item.tool_groups_id.name,
|
'rfid': item.rfid,
|
||||||
'production_line': item.production_line_id.name,
|
'tool_groups_name': item.tool_groups_id.name,
|
||||||
'machine_tool_id': item.maintenance_equipment_id.code,
|
'production_line': item.production_line_id.name,
|
||||||
'machine_tool_code': item.machine_tool_code,
|
'machine_tool_id': item.maintenance_equipment_id.code,
|
||||||
'cutter_spacing_code': item.cutter_spacing_code_id.code,
|
'machine_tool_code': item.machine_tool_code,
|
||||||
'functional_tool_name': item.name,
|
'cutter_spacing_code': item.cutter_spacing_code_id.code,
|
||||||
'barcode': item.barcode_id.name,
|
'functional_tool_name': item.name,
|
||||||
'mrs_cutting_tool_type_code': item.mrs_cutting_tool_type_id.code,
|
'barcode': item.barcode_id.name,
|
||||||
'diameter': item.diameter,
|
'mrs_cutting_tool_type_code': item.mrs_cutting_tool_type_id.code,
|
||||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
'diameter': item.diameter,
|
||||||
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||||
'on_board_time': item.on_board_time.strftime('%Y-%m-%d %H:%M:%S'),
|
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'max_lifetime_value': item.max_lifetime_value,
|
'on_board_time': item.on_board_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'alarm_value': item.alarm_value,
|
'max_lifetime_value': item.max_lifetime_value,
|
||||||
'used_value': item.used_value,
|
'alarm_value': item.alarm_value,
|
||||||
'functional_tool_status': item.functional_tool_status,
|
'used_value': item.used_value,
|
||||||
'alarm_time': item.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),
|
'functional_tool_status': item.functional_tool_status,
|
||||||
'dispose_user': item.dispose_user,
|
'alarm_time': item.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'dispose_time': item.dispose_time,
|
'dispose_user': item.dispose_user,
|
||||||
'dispose_func': item.dispose_func,
|
'dispose_time': item.dispose_time,
|
||||||
}
|
'dispose_func': item.dispose_func,
|
||||||
tool_warning_list.append(val)
|
}
|
||||||
kw = json.dumps(tool_warning_list, ensure_ascii=False)
|
tool_warning_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(tool_warning_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return "功能刀具预警注册成功"
|
if ret.get('code') == 200:
|
||||||
else:
|
return "功能刀具预警注册成功"
|
||||||
logging.info('没有注册功能刀具预警信息')
|
else:
|
||||||
|
logging.info('没有注册功能刀具预警信息')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
@@ -358,33 +370,36 @@ class StockMoveLine(models.Model):
|
|||||||
|
|
||||||
def get_sync_stock_move_line(self, objs_all, str_url, token, headers):
|
def get_sync_stock_move_line(self, objs_all, str_url, token, headers):
|
||||||
tool_stock_list = []
|
tool_stock_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
val = {
|
for item in objs_all:
|
||||||
'id': item.id,
|
val = {
|
||||||
'name': item.functional_tool_name,
|
'id': item.id,
|
||||||
'code': item.code,
|
'name': item.functional_tool_name,
|
||||||
'rfid': item.rfid,
|
'code': item.code,
|
||||||
'tool_groups_name': item.tool_groups_id.name,
|
'rfid': item.rfid,
|
||||||
'reference': item.reference,
|
'tool_groups_name': item.tool_groups_id.name,
|
||||||
'barcode': item.lot_id.name,
|
'reference': item.reference,
|
||||||
'functional_tool_type_code': item.functional_tool_type_id.code,
|
'barcode': item.lot_id.name,
|
||||||
'diameter': item.diameter,
|
'functional_tool_type_code': item.functional_tool_type_id.code,
|
||||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
'diameter': item.diameter,
|
||||||
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||||
'location_id': item.location_id.name,
|
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'location_dest_name': item.location_dest_id.name,
|
'location_id': item.location_id.name,
|
||||||
'date': item.date.strftime('%Y-%m-%d %H:%M:%S'),
|
'location_dest_name': item.location_dest_id.name,
|
||||||
'qty_done': item.qty_done,
|
'date': item.date.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
}
|
'qty_done': item.qty_done,
|
||||||
tool_stock_list.append(val)
|
}
|
||||||
kw = json.dumps(tool_stock_list, ensure_ascii=False)
|
tool_stock_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(tool_stock_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return "功能刀具出入库记录注册成功"
|
if ret.get('code') == 200:
|
||||||
else:
|
return "功能刀具出入库记录注册成功"
|
||||||
logging.info('没有注册功能刀具出入库记录信息')
|
else:
|
||||||
|
logging.info('没有注册功能刀具出入库记录信息')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
@@ -424,45 +439,48 @@ class RealTimeDistributionFunctionalTools(models.Model):
|
|||||||
|
|
||||||
def get_sync_real_time_distribution_functional_tools(self, objs_all, str_url, token, headers):
|
def get_sync_real_time_distribution_functional_tools(self, objs_all, str_url, token, headers):
|
||||||
tool_distribution_list = []
|
tool_distribution_list = []
|
||||||
if objs_all:
|
try:
|
||||||
for item in objs_all:
|
if objs_all:
|
||||||
functional_tool_codes = []
|
for item in objs_all:
|
||||||
for obj in item.sf_functional_cutting_tool_entity_ids:
|
functional_tool_codes = []
|
||||||
functional_tool_codes.append(obj.code)
|
for obj in item.sf_functional_tool_entity_ids:
|
||||||
val = {
|
functional_tool_codes.append(obj.code)
|
||||||
'id': item.id,
|
val = {
|
||||||
'name': item.name,
|
'id': item.id,
|
||||||
'tool_groups_name': item.tool_groups_id.name,
|
'name': item.name,
|
||||||
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
'tool_groups_name': item.tool_groups_id.name,
|
||||||
'diameter': item.diameter,
|
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
||||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
'diameter': item.diameter,
|
||||||
'tool_stock_num': item.tool_stock_num,
|
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||||
'side_shelf_num': item.side_shelf_num,
|
'tool_stock_num': item.tool_stock_num,
|
||||||
'on_tool_stock_num': item.on_tool_stock_num,
|
'side_shelf_num': item.side_shelf_num,
|
||||||
'tool_stock_total': item.tool_stock_total,
|
'on_tool_stock_num': item.on_tool_stock_num,
|
||||||
'min_stock_num': item.min_stock_num,
|
'tool_stock_total': item.tool_stock_total,
|
||||||
'max_stock_num': item.max_stock_num,
|
'min_stock_num': item.min_stock_num,
|
||||||
'batch_replenishment_num': item.batch_replenishment_num,
|
'max_stock_num': item.max_stock_num,
|
||||||
'unit': item.unit,
|
'batch_replenishment_num': item.batch_replenishment_num,
|
||||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
'unit': item.unit,
|
||||||
'functional_tool_codes': str(functional_tool_codes),
|
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||||
'coarse_middle_thin': item.coarse_middle_thin,
|
'functional_tool_codes': str(functional_tool_codes),
|
||||||
'whether_standard_knife': item.whether_standard_knife,
|
'coarse_middle_thin': item.coarse_middle_thin,
|
||||||
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
'whether_standard_knife': item.whether_standard_knife,
|
||||||
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
||||||
'handle_type_name': item.handle_type_id.name,
|
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
||||||
'cutting_direction_names': get_cutting_direction_names(item),
|
'handle_type_name': item.handle_type_id.name,
|
||||||
'suitable_coolant_names': get_suitable_coolant_names(item),
|
'cutting_direction_names': get_cutting_direction_names(item),
|
||||||
'active': item.active
|
'suitable_coolant_names': get_suitable_coolant_names(item),
|
||||||
}
|
'active': item.active
|
||||||
tool_distribution_list.append(val)
|
}
|
||||||
kw = json.dumps(tool_distribution_list, ensure_ascii=False)
|
tool_distribution_list.append(val)
|
||||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
kw = json.dumps(tool_distribution_list, ensure_ascii=False)
|
||||||
ret = r.json()
|
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||||
if ret.get('code') == 200:
|
ret = r.json()
|
||||||
return "功能刀具出入库记录注册成功"
|
if ret.get('code') == 200:
|
||||||
else:
|
return "功能刀具出入库记录注册成功"
|
||||||
logging.info('没有注册功能刀具出入库记录信息')
|
else:
|
||||||
|
logging.info('没有注册功能刀具出入库记录信息')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("捕获错误信息:%s" % e)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
@@ -474,6 +492,6 @@ class RealTimeDistributionFunctionalTools(models.Model):
|
|||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
res = super().write(vals)
|
res = super().write(vals)
|
||||||
if vals.get('sf_functional_cutting_tool_entity_ids') or vals.get('min_stock_num') or vals.get('max_stock_num'):
|
if vals.get('sf_functional_tool_entity_ids') or vals.get('min_stock_num') or vals.get('max_stock_num'):
|
||||||
self.enroll_functional_tool_real_time_distribution()
|
self.enroll_functional_tool_real_time_distribution()
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_button_box" name="button_box">
|
<div class="oe_button_box" name="button_box">
|
||||||
|
<button name="button_safe_inventory_id" string="更新功能刀具关联的安全库存记录"
|
||||||
|
type="object" class="btn-primary"/>
|
||||||
<button class="oe_stat_button" groups="sf_base.group_sf_mrp_user"
|
<button class="oe_stat_button" groups="sf_base.group_sf_mrp_user"
|
||||||
name="open_functional_tool_warning"
|
name="open_functional_tool_warning"
|
||||||
icon="fa-list-ul"
|
icon="fa-list-ul"
|
||||||
@@ -89,9 +91,9 @@
|
|||||||
attrs="{'invisible': [('functional_tool_status', '=', '已拆除')]}"/>
|
attrs="{'invisible': [('functional_tool_status', '=', '已拆除')]}"/>
|
||||||
<field name="rfid_dismantle" readonly="1"
|
<field name="rfid_dismantle" readonly="1"
|
||||||
attrs="{'invisible': [('functional_tool_status', '!=', '已拆除')]}"/>
|
attrs="{'invisible': [('functional_tool_status', '!=', '已拆除')]}"/>
|
||||||
<field name="tool_name_id" invisible="0"
|
<field name="tool_name_id" invisible="0" readonly="1"
|
||||||
placeholder="请输入20字以内的名称"/>
|
placeholder="请输入20字以内的名称"/>
|
||||||
<field name="sf_cutting_tool_type_id"/>
|
<field name="sf_cutting_tool_type_id" readonly="1"/>
|
||||||
<field name="tool_groups_id"/>
|
<field name="tool_groups_id"/>
|
||||||
<field name="cutting_tool_integral_model_id"
|
<field name="cutting_tool_integral_model_id"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"
|
options="{'no_create': True, 'no_quick_create': True}"
|
||||||
@@ -113,6 +115,7 @@
|
|||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
<field name="cutting_tool_cutterhead_model_id"
|
<field name="cutting_tool_cutterhead_model_id"
|
||||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||||
|
<field name="safe_inventory_id" readonly="0"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="image" nolabel="1" widget="image"/>
|
<field name="image" nolabel="1" widget="image"/>
|
||||||
@@ -188,7 +191,8 @@
|
|||||||
<field name="tool_name_id"/>
|
<field name="tool_name_id"/>
|
||||||
<field name="functional_tool_diameter"/>
|
<field name="functional_tool_diameter"/>
|
||||||
<field name="knife_tip_r_angle"/>
|
<field name="knife_tip_r_angle"/>
|
||||||
<filter string="未拆除" name="no_state_removed" domain="[('functional_tool_status', '!=', '已拆除')]"/>
|
<filter string="未拆除" name="no_state_removed"
|
||||||
|
domain="[('functional_tool_status', '!=', '已拆除')]"/>
|
||||||
<filter string="已拆除" name="state_removed" domain="[('functional_tool_status', '=', '已拆除')]"/>
|
<filter string="已拆除" name="state_removed" domain="[('functional_tool_status', '=', '已拆除')]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter string="已归档" name="inactive" domain="[('active', '=', False)]"/>
|
<filter string="已归档" name="inactive" domain="[('active', '=', False)]"/>
|
||||||
@@ -385,7 +389,8 @@
|
|||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="刀具信息">
|
<page string="刀具信息">
|
||||||
<field name="sf_functional_cutting_tool_entity_ids" widget="many2many">
|
<field name="sf_functional_cutting_tool_entity_ids" invisible="1" widget="many2many"/>
|
||||||
|
<field name="sf_functional_tool_entity_ids" widget="one2many">
|
||||||
<tree edit="0" create="0" delete="0">
|
<tree edit="0" create="0" delete="0">
|
||||||
<field name="rfid"/>
|
<field name="rfid"/>
|
||||||
<field name="tool_name_id"/>
|
<field name="tool_name_id"/>
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
# 对物料做必填判断
|
# 对物料做必填判断
|
||||||
self.materials_must_be_judged()
|
self.materials_must_be_judged()
|
||||||
|
|
||||||
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
product_id = self.env['product.product']
|
||||||
# 创建组装入库单
|
# 创建组装入库单
|
||||||
# 创建功能刀具批次/序列号记录
|
# 创建功能刀具批次/序列号记录
|
||||||
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly, self)
|
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly, self)
|
||||||
@@ -617,15 +617,15 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
if self.handle_code_id:
|
if self.handle_code_id:
|
||||||
product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code)
|
product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code)
|
||||||
if self.integral_product_id:
|
if self.integral_product_id:
|
||||||
self.integral_product_id.material_stock_moves(self.integral_freight_barcode,self.assembly_order_code)
|
self.integral_product_id.material_stock_moves(self.integral_freight_barcode, self.assembly_order_code)
|
||||||
if self.blade_product_id:
|
if self.blade_product_id:
|
||||||
self.blade_product_id.material_stock_moves(self.blade_freight_barcode,self.assembly_order_code)
|
self.blade_product_id.material_stock_moves(self.blade_freight_barcode, self.assembly_order_code)
|
||||||
if self.bar_product_id:
|
if self.bar_product_id:
|
||||||
self.bar_product_id.material_stock_moves(self.bar_freight_barcode,self.assembly_order_code)
|
self.bar_product_id.material_stock_moves(self.bar_freight_barcode, self.assembly_order_code)
|
||||||
if self.pad_product_id:
|
if self.pad_product_id:
|
||||||
self.pad_product_id.material_stock_moves(self.pad_freight_barcode,self.assembly_order_code)
|
self.pad_product_id.material_stock_moves(self.pad_freight_barcode, self.assembly_order_code)
|
||||||
if self.chuck_product_id:
|
if self.chuck_product_id:
|
||||||
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode,self.assembly_order_code)
|
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode, self.assembly_order_code)
|
||||||
|
|
||||||
# ============================创建功能刀具列表、安全库存记录===============================
|
# ============================创建功能刀具列表、安全库存记录===============================
|
||||||
# 封装功能刀具数据
|
# 封装功能刀具数据
|
||||||
@@ -803,8 +803,8 @@ class ProductProduct(models.Model):
|
|||||||
创建功能刀具批次/序列号记录
|
创建功能刀具批次/序列号记录
|
||||||
"""
|
"""
|
||||||
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
|
||||||
|
if not product_id:
|
||||||
logging.info("product_id: %s" % product_id)
|
logging.info('没有搜索到功能刀具产品:%s' % product_id)
|
||||||
stock_lot = self.env['stock.lot'].create({
|
stock_lot = self.env['stock.lot'].create({
|
||||||
'name': self.get_stock_lot_name(tool_assembly_order_id),
|
'name': self.get_stock_lot_name(tool_assembly_order_id),
|
||||||
'product_id': product_id.id,
|
'product_id': product_id.id,
|
||||||
@@ -849,7 +849,8 @@ class ProductProduct(models.Model):
|
|||||||
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
||||||
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False, False)
|
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False,
|
||||||
|
False)
|
||||||
|
|
||||||
def material_stock_moves(self, shelf_location_barcode, assembly_order_code):
|
def material_stock_moves(self, shelf_location_barcode, assembly_order_code):
|
||||||
# 创建库存移动记录
|
# 创建库存移动记录
|
||||||
|
|||||||
Reference in New Issue
Block a user