Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化Rfid绑定工单
# Conflicts: # sf_manufacturing/models/mrp_workorder.py # sf_manufacturing/models/product_template.py # sf_manufacturing/views/mrp_workorder_view.xml
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import base64
|
||||
@@ -417,6 +419,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', readonly=True)
|
||||
|
||||
def action_revert_inventory(self):
|
||||
# 检查用户是否有执行操作的权限
|
||||
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
|
||||
@@ -468,7 +472,7 @@ class Sf_stock_move_line(models.Model):
|
||||
# port = 9100 # 可以根据实际情况修改
|
||||
|
||||
# 获取默认打印机配置
|
||||
printer_config = self.env['printer.configuration'].search([('model', '=', self._name)], limit=1)
|
||||
printer_config = self.env['printer.configuration'].sudo().search([('model', '=', self._name)], limit=1)
|
||||
if not printer_config:
|
||||
raise UserError('请先配置打印机')
|
||||
host = printer_config.printer_id.ip_address
|
||||
@@ -735,6 +739,15 @@ 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 == '刀柄' 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:
|
||||
raise ValidationError('你需要提供%s的Rfid' % move.product_id.name)
|
||||
self.env['stock.lot'].search([('name', '=', item.lot_name)]).write({'rfid': item.rfid})
|
||||
return res
|
||||
|
||||
# def print_all_barcode(self):
|
||||
@@ -828,7 +841,30 @@ class SfPickingType(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 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:
|
||||
if record.product_id.cutting_tool_material_id.name:
|
||||
raise ValidationError('该刀柄的Rfid已经录入,请勿重复录入!!!')
|
||||
else:
|
||||
raise ValidationError('该托盘的Rfid已经录入,请勿重复录入!!!')
|
||||
else:
|
||||
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('该产品不需要录入Rfid!!!')
|
||||
|
||||
def action_assign_serial_show_details(self):
|
||||
# 首先执行原有逻辑
|
||||
@@ -879,7 +915,7 @@ class CustomStockMove(models.Model):
|
||||
# port = 9100 # 可以根据实际情况修改
|
||||
|
||||
# 获取默认打印机配置
|
||||
printer_config = self.env['printer.configuration'].search([('model', '=', self._name)], limit=1)
|
||||
printer_config = self.env['printer.configuration'].sudo().search([('model', '=', self._name)], limit=1)
|
||||
if not printer_config:
|
||||
raise UserError('请先配置打印机')
|
||||
host = printer_config.printer_id.ip_address
|
||||
|
||||
Reference in New Issue
Block a user