1、优化品牌同步接口,2、内部调拨作业详情添加Rfid字段;

This commit is contained in:
yuxianghui
2024-04-17 17:01:01 +08:00
parent 7897e6e55b
commit 22c388f52c
4 changed files with 12 additions and 2 deletions

View File

@@ -992,6 +992,7 @@ class SfWorkOrderBarcodes(models.Model):
work_state = {'done': '已完工'} work_state = {'done': '已完工'}
raise UserError('装夹%s,请勿重复扫码' % work_state.get(workorder.state)) raise UserError('装夹%s,请勿重复扫码' % work_state.get(workorder.state))
lots = self.env['stock.lot'].sudo().search([('rfid', '=', barcode)]) lots = self.env['stock.lot'].sudo().search([('rfid', '=', barcode)])
logging.info("托盘信息:%s" % lots)
if lots: if lots:
for lot in lots: for lot in lots:
if lot.product_id.categ_type == '夹具': if lot.product_id.categ_type == '夹具':
@@ -1010,6 +1011,7 @@ class SfWorkOrderBarcodes(models.Model):
if workorder_rfid: if workorder_rfid:
for item in workorder_rfid: for item in workorder_rfid:
item.write({'rfid_code': barcode}) item.write({'rfid_code': barcode})
logging.info("Rfid绑定成功")
else: else:
embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)]) embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)])
if embryo_stock_lot: if embryo_stock_lot:
@@ -1043,7 +1045,7 @@ class SfWorkOrderBarcodes(models.Model):
for item in workorder_rfid: for item in workorder_rfid:
if item.state == "progress": if item.state == "progress":
item.write({'rfid_code': barcode}) item.write({'rfid_code': barcode})
raise UserError('该托盘信息不存在!!!') # raise UserError('该托盘信息不存在!!!')
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)]) # stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
# if stock_move_line.product_id.categ_type == '夹具': # if stock_move_line.product_id.categ_type == '夹具':
# workorder.write({ # workorder.write({

View File

@@ -591,6 +591,7 @@ class MachineBrand(models.Model):
if not brand: if not brand:
self.create({ self.create({
"name": item['name'], "name": item['name'],
"active": item['active'],
"code": item['code'], "code": item['code'],
"remark": item['remark'], "remark": item['remark'],
"image_brand": '' if not item['image_brand'] else base64.b64decode(item['image_brand']), "image_brand": '' if not item['image_brand'] else base64.b64decode(item['image_brand']),
@@ -599,6 +600,7 @@ class MachineBrand(models.Model):
}) })
else: else:
brand.name = item['name'] brand.name = item['name']
brand.active = item['active']
brand.remark = item['remark'] brand.remark = item['remark']
brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand']) brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand'])
brand.tag_ids = self.env['sf.machine.brand.tags'].search( brand.tag_ids = self.env['sf.machine.brand.tags'].search(

View File

@@ -439,6 +439,12 @@ class Sf_stock_move_line(models.Model):
there_is_no_sn = fields.Boolean('是否有序列号', default=False) there_is_no_sn = fields.Boolean('是否有序列号', default=False)
rfid = fields.Char('Rfid', readonly=True) rfid = fields.Char('Rfid', readonly=True)
rfid_barcode = fields.Char('Rfid', compute='_compute_rfid')
@api.depends('lot_id')
def _compute_rfid(self):
for item in self:
item.rfid_barcode = item.lot_id.rfid
def action_revert_inventory(self): def action_revert_inventory(self):
# 检查用户是否有执行操作的权限 # 检查用户是否有执行操作的权限

View File

@@ -20,7 +20,7 @@
<field name="destination_location_id" domain="[('location_id', '=', location_dest_id_value), '|', <field name="destination_location_id" domain="[('location_id', '=', location_dest_id_value), '|',
('location_status', '=', '空闲'), ('product_id', '=', current_product_id), ('product_sn_id', ('location_status', '=', '空闲'), ('product_id', '=', current_product_id), ('product_sn_id',
'=', there_is_no_sn)]"/> '=', there_is_no_sn)]"/>
<field name="rfid_barcode" string="Rfid"/>
<!-- <field name="location_dest_id_product_type"/> --> <!-- <field name="location_dest_id_product_type"/> -->
<!-- <field name="location_dest_id"/> --> <!-- <field name="location_dest_id"/> -->