修复coding问题,增加机床类型返回

This commit is contained in:
mgw
2024-08-26 13:23:44 +08:00
parent 064397b32b
commit 78d00e9157
4 changed files with 30 additions and 9 deletions

View File

@@ -163,6 +163,7 @@ class Sf_Dashboard_Connect(http.Controller):
# 停机时间:关机时间 - 运行时间
# 停机时长:关机时间 - 初次上线时间
'img': f'data:image/png;base64,{machine_data.machine_tool_picture.decode("utf-8")}',
'equipment_type': machine_data.category_id.name,
})
return json.dumps(res)

View File

@@ -1154,7 +1154,7 @@ class ResMrpWorkOrder(models.Model):
def button_finish(self):
for record in self:
if record.routing_type == '装夹预调':
if not record.material_center_point and record.X_deviation_angle > 0:
if not record.material_center_point or record.X_deviation_angle <= 0:
raise UserError("请对前置三元检测定位参数进行计算定位")
if not record.rfid_code and record.is_rework is False:
raise UserError("请扫RFID码进行绑定")
@@ -1257,15 +1257,14 @@ class ResMrpWorkOrder(models.Model):
# 解绑托盘
def unbind_tray(self):
self.write({
self.production_id.workorder_ids.write({
'rfid_code': False,
'tray_serial_number': False,
'tray_product_id': False,
'tray_brand_id': False,
'tray_type_id': False,
'tray_model_id': False,
'is_trayed': False
})
'is_trayed': False})
# 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath):

View File

@@ -3,13 +3,34 @@ $(document).off('keydown')
$(document).on('keydown', 'body.o_web_client', function (e) {
setTimeout(() => {
RFID = ''
}, 200)
}, 200)
if(e.key == 'Enter' && e.keyCode == 13 || e.key == 'Tab' && e.keyCode == 9){
let fieldValue1 = $('[name="routing_type"]');
console.log('字段值:', fieldValue1.text());
console.log(RFID)
if(!RFID || RFID.length <= 3) return;
$('[name="button_start"]').trigger('click')
RFID = ''
let fieldValue2 = $('[name="rfid_code"]');
console.log('字段值2:', fieldValue2.text());
// if(!RFID || RFID.length <= 3) return;
// $('[name="button_start"]').trigger('click')
// setTimeout(() => {
// $('.o_dialog .modal-footer .btn-primary').trigger('click')
// }, 50)
// RFID = ''
// return;
// fieldValue2.val() === '')
// 检查字段值是否等于“装夹预调”
if (fieldValue1.text() === '装夹预调') {
if (!RFID || RFID.length <= 3) return;
$('[name="button_start"]').trigger('click');
setTimeout(() => {
$('.o_dialog .modal-footer .btn-primary').trigger('click');
}, 100);
}
RFID = '';
return;
}
RFID += e.key

View File

@@ -195,7 +195,7 @@
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('state','!=','progress'),('is_rework','=',True)]}"/>
<button name="unbind_tray" type="object" string="解绑托盘"
class="btn-primary"
attrs="{'invisible': ['|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False)]}"/>
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
</xpath>