diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index f255d28b..b68b0ea0 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -222,6 +222,22 @@ class ProductionLot(models.Model):
_name = 'stock.lot'
_inherit = ['stock.lot', 'printing.utils']
+ rfid = fields.Char('Rfid', readonly=True)
+ product_material_name = fields.Char('刀具产品物料名称', related='product_id.cutting_tool_material_id.name')
+ product_specification = fields.Char('规格', compute='_compute_product_specification', store=True)
+
+ @api.depends('product_id')
+ def _compute_product_specification(self):
+ for stock in self:
+ if stock:
+ if stock.product_id:
+ if stock.product_id.categ_id.name in '刀具':
+ stock.product_specification = stock.product_id.specification_id.name
+ elif stock.product_id.categ_id.name in '夹具':
+ stock.product_specification = stock.product_id.specification_fixture_id.name
+ else:
+ stock.product_specification = stock.product_id.default_code
+
@api.model
def generate_lot_names1(self, display_name, first_lot, count):
"""Generate `lot_names` from a string."""
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index 0ae0d95f..6ba78573 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -422,7 +422,8 @@
规格:
-
+
+
[]
diff --git a/sf_manufacturing/views/stock_lot_views.xml b/sf_manufacturing/views/stock_lot_views.xml
index bd04005c..f7ef9c9b 100644
--- a/sf_manufacturing/views/stock_lot_views.xml
+++ b/sf_manufacturing/views/stock_lot_views.xml
@@ -13,6 +13,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 2228d2d5..3667c62c 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -424,6 +424,8 @@ 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')
+
def action_revert_inventory(self):
# 检查用户是否有执行操作的权限
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
@@ -742,6 +744,12 @@ class SfStockPicking(models.Model):
if line.current_location_id:
line.current_location_id.product_sn_id = False
line.current_location_id.location_status = '空闲'
+
+ for move in self.move_ids:
+ if move and move.product_id.cutting_tool_material_id.name in '刀柄':
+ for item in move.move_line_nosuggest_ids:
+ if item:
+ self.env['stock.lot'].search([('name', '=', item.lot_name)]).write({'rfid': item.rfid})
return res
# def print_all_barcode(self):
@@ -932,7 +940,24 @@ class SfStockScrap(models.Model):
class CustomStockMove(models.Model):
_name = 'stock.move'
- _inherit = ['stock.move', 'printing.utils']
+ _inherit = ['stock.move', 'printing.utils', 'barcodes.barcode_events_mixin']
+
+ def on_barcode_scanned(self, barcode):
+ """
+ 采购入库扫码绑定Rfid码
+ """
+ for record in self:
+ if record:
+ if '刀柄' in record.product_id.cutting_tool_material_id.name:
+ 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已经录入,请勿重复录入!!!')
+ else:
+ move_line_nosuggest_id.sudo().rfid = barcode
+ break
+ else:
+ raise ValidationError('该产品不是刀柄!!!')
def action_assign_serial_show_details(self):
# 首先执行原有逻辑
diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml
index cc4213c6..0875fa12 100644
--- a/sf_warehouse/views/change_stock_move_views.xml
+++ b/sf_warehouse/views/change_stock_move_views.xml
@@ -31,15 +31,16 @@
-
-
-
+
+
+
-
+
+
sf.stock.move.line.form
stock.move.line
@@ -63,6 +64,9 @@
stock.move.line
+
+
+
@@ -103,10 +107,10 @@
groups="sf_warehouse.group_sf_stock_user" data-hotkey="k"/>
-
-
-
-
+
+
+
+
@@ -145,11 +149,23 @@
stock.move
-
-
-
+
+
+
- -->
+
+ -->
+
+
+
+
+
+ mrp.subcontracting.stock.move.barcode.scanned.form
+ stock.move
+
+
+
+