Merge branch 'feature/坯料采购-外协与自加工流程BUG' into feature/解决工单Rfid相关bug

This commit is contained in:
yuxianghui
2024-05-08 16:53:00 +08:00
5 changed files with 16 additions and 12 deletions

View File

@@ -1051,10 +1051,11 @@ class SfWorkOrderBarcodes(models.Model):
workorder = self.env['mrp.workorder'].browse(self.ids)
# workorder_preset = self.env['mrp.workorder'].search(
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
if workorder_old:
workorder_olds = self.env['mrp.workorder'].search(
[('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])
if workorder_olds:
name = ''
for workorder in workorder_old:
for workorder in workorder_olds:
name = '%s %s' % (name, workorder.production_id.name)
raise UserError('该托盘已绑定【%s】制造订单,请先解除绑定!!!' % name)
if workorder:
@@ -1084,6 +1085,8 @@ class SfWorkOrderBarcodes(models.Model):
for item in workorder_rfid:
item.write({'rfid_code': barcode})
logging.info("Rfid绑定成功")
else:
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
self.process_state = '待检测'
self.date_start = datetime.now()
else: