1、刀具物料刀柄、夹具物料托盘搜索模型的序列号对象字段的list列表添加Rfid字段;2、制造单搜索看板添加记数功能;3、刀具组装岗添加货位的读写权限;4、功能刀具组装单弹窗添加手动输入五种物料的货位编码时,对该货位进行多项校验;

This commit is contained in:
yuxianghui
2024-04-28 17:20:11 +08:00
parent 761efbceaa
commit 9d9b454ba5
8 changed files with 73 additions and 16 deletions

View File

@@ -246,9 +246,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.integral_freight_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.integral_freight_barcode)])
if location:
self.integral_product_id = location.product_id.id
if not location.product_id:
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '整体式刀具':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.integral_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是整体式刀具,请重新选择!' % (
location.barcode, location.product_id.name))
else:
self.integral_product_id = False
raise ValidationError('编码为【%s】的货位不存在!' % self.integral_freight_barcode)
# ===============刀片型号====================
blade_freight_barcode = fields.Char('刀片货位')
@@ -265,9 +276,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.blade_freight_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.blade_freight_barcode)])
if location:
self.blade_product_id = location.product_id.id
if not location.product_id:
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀片':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.blade_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀片,请重新选择!' % (
location.barcode, location.product_id.name))
else:
self.blade_product_id = False
raise ValidationError('编码为【%s】的货位不存在!' % self.blade_freight_barcode)
# ====================刀杆型号==================
bar_freight_barcode = fields.Char('刀杆货位')
@@ -284,9 +306,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.bar_freight_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.bar_freight_barcode)])
if location:
self.bar_product_id = location.product_id.id
if not location.product_id:
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀杆':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.bar_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀杆,请重新选择!' % (
location.barcode, location.product_id.name))
else:
self.bar_product_id = False
raise ValidationError('编码为【%s】的货位不存在!' % self.bar_freight_barcode)
# ===============刀盘型号===================
pad_freight_barcode = fields.Char('刀盘货位')
@@ -303,9 +336,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.pad_freight_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.pad_freight_barcode)])
if location:
self.pad_product_id = location.product_id.id
if not location.product_id:
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀盘':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.pad_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀盘,请重新选择!' % (
location.barcode, location.product_id.name))
else:
self.pad_product_id = False
raise ValidationError('编码为【%s】的货位不存在!' % self.pad_freight_barcode)
# ================刀柄型号===============
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_rfid')
@@ -342,12 +386,22 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.chuck_freight_barcode:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.chuck_freight_barcode)])
if location:
self.chuck_product_id = location.product_id.id
if not location.product_id:
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '夹头':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.chuck_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是夹头,请重新选择!' % (
location.barcode, location.product_id.name))
else:
self.chuck_product_id = False
raise ValidationError('编码为【%s】的货位不存在!' % self.chuck_freight_barcode)
# ========================================
def on_barcode_scanned(self, barcode):
"""
智能工厂组装单处扫码绑定刀具物料