增加扫码点击按钮功能

This commit is contained in:
mgw
2024-09-19 09:04:05 +08:00
parent 258e3bdb9f
commit 27da7639b2
2 changed files with 14 additions and 8 deletions

View File

@@ -603,6 +603,8 @@ class ResMrpWorkOrder(models.Model):
print("(%.2f,%.2f)" % (x, y))
self.material_center_point = ("(%.2f,%.2f,%.2f)" % (x, y, z))
self.X_deviation_angle = jdz
logging.info("坯料中心点坐标:(%.2f,%.2f)" % (x, y))
logging.info("X轴偏差度数:%.2f" % jdz)
# 将补偿值写入CNC加工工单
workorder = self.env['mrp.workorder'].browse(self.ids)
work = workorder.production_id.workorder_ids
@@ -1183,8 +1185,10 @@ class ResMrpWorkOrder(models.Model):
if not record.rfid_code and record.is_rework is False:
raise UserError("请扫RFID码进行绑定")
if record.is_rework is False:
if not record.material_center_point or record.X_deviation_angle <= 0:
raise UserError("坯料中心点为空或X偏差角度小于等于0")
if not record.material_center_point:
raise UserError("坯料中心点为空,请检查")
if record.X_deviation_angle <= 0:
raise UserError("X偏差角度小于等于0请检查本次计算的X偏差角度为%s" % record.X_deviation_angle)
record.process_state = '待加工'
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待加工'
@@ -1565,6 +1569,8 @@ class SfWorkOrderBarcodes(models.Model):
def on_barcode_scanned(self, barcode):
logging.info('Rfid:%s' % barcode)
if 'O-CMD' in barcode:
return None
workorder = self.env['mrp.workorder'].browse(self.ids)
# workorder_preset = self.env['mrp.workorder'].search(
# [('routing_type', '=', '装夹预调'), ('rfid_code', '=', barcode)])