1、新增装夹预调工单扫拖盘Rfid绑定托盘;2、删除工单的Rfid字段的customRFID样式;3、修改序列号模型的Rfid字段的隐藏条件;4、优化刀柄、托盘物料采购时绑定Rfid的判断条件

This commit is contained in:
yuxianghui
2024-04-03 16:52:16 +08:00
parent aac5195b4d
commit 02e5972272
5 changed files with 89 additions and 61 deletions

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import re
import datetime
import logging
import base64
@@ -424,7 +426,7 @@ class Sf_stock_move_line(models.Model):
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
rfid = fields.Char('Rfid')
rfid = fields.Char('Rfid', readonly=True)
def action_revert_inventory(self):
# 检查用户是否有执行操作的权限
@@ -746,7 +748,8 @@ class SfStockPicking(models.Model):
line.current_location_id.location_status = '空闲'
for move in self.move_ids:
if move and move.product_id.cutting_tool_material_id.name == '刀柄':
if move and move.product_id.cutting_tool_material_id.name == '刀柄' or '托盘' in (
move.product_id.fixture_material_id.name or ''):
for item in move.move_line_nosuggest_ids:
if item.location_dest_id.name == '进货':
if not item.rfid:
@@ -950,16 +953,22 @@ class CustomStockMove(models.Model):
"""
for record in self:
if record:
if '刀柄' in record.product_id.cutting_tool_material_id.name:
if '刀柄' in (record.product_id.cutting_tool_material_id.name or '') or '托盘' in (
record.product_id.fixture_material_id.name or ''):
for move_line_nosuggest_id in record.move_line_nosuggest_ids:
if move_line_nosuggest_id.rfid:
if move_line_nosuggest_id.rfid == barcode:
raise ValidationError('该刀柄的rfid已经录入请勿重复录入')
if record.product_id.cutting_tool_material_id.name:
raise ValidationError('该刀柄的Rfid已经录入请勿重复录入')
else:
raise ValidationError('该托盘的Rfid已经录入请勿重复录入')
else:
move_line_nosuggest_id.sudo().rfid = barcode
line_id = int(re.sub(r"\D", "", str(move_line_nosuggest_id.id)))
self.env['stock.move.line'].sudo().search([('id', '=', line_id)]).write({'rfid': barcode})
move_line_nosuggest_id.rfid = barcode
break
else:
raise ValidationError('该产品不是刀柄')
raise ValidationError('该产品不需要录入Rfid')
def action_assign_serial_show_details(self):
# 首先执行原有逻辑