扫码执行一键合并下发按钮已完成

This commit is contained in:
mgw
2023-03-20 15:06:59 +08:00
parent 2c81aaab1f
commit 1505c56513
2 changed files with 51 additions and 19 deletions

View File

@@ -561,21 +561,48 @@ class SfWorkOrderBarcodes(models.Model):
def on_barcode_scanned(self, barcode):
workorder = self.env['mrp.workorder'].browse(self.ids)
if "*" not in barcode:
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
self.tray_code = tray_code.code
self.tray_id = workorder.gettray_auto(barcode)
if self.routing_type == '装夹':
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
self.tray_code = tray_code.code
self.tray_id = workorder.gettray_auto(barcode)
elif self.routing_type == '前置三元定位检测':
print('我是前置三元检测')
logging.info('我是前置三元检测')
elif self.routing_type == 'CNC加工':
if barcode == 'UP-ALL':
print("我是一键合并下发")
logging.info('我是一键合并下发')
self.up_merge_all()
else:
print('CNC加工')
# print(barcode)
# a = self.env['sf.tray'].search([('code', '=', barcode)])
# print(a)
# # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)], limit=1)
# workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)])
# e = workorder_obj.id
# print(workorder_obj)
# action = {
# 'name': '工单',
# 'type': 'ir.actions.act_window',
# # 'view_type': 'form',
# 'view_mode': 'form',
# 'res_model': 'mrp.workorder',
# 'view_id': self.env.ref('mrp.mrp_production_workorder_form_view_inherit').id,
# # 'res_id': workorder_obj.id,
# 'res_id': 1023,
# 'target': 'current',
# # 'context': self.env.context,
# # 'flags': {'initial_mode': 'edit'},
# }
# return action
elif self.routing_type == '后置三元质量检测':
print('后置三元检测')
elif self.routing_type == '解除装夹':
print("我是解除装夹")
else:
pass
else:
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
# return {
# 'type': 'ir.actions.act_window',
# 'name': '工单',
# 'res_model': 'mrp.workorder',
# 'view_mode': 'form',
# 'context': {'active_id': self.id},
# # 'target': 'current',
# }
self.pro_code_ok = workorder.pro_code_is_ok(barcode)