跳到主要内容

获取票据类型

命令说明

获取通用多票据识别结果中的票据类型

命令原型

sRet = Mage.ExtractInvoiceType(value)

命令参数

参数必选类型默认值说明
valueTrueexpressionvalue使用"屏幕多票据识别"、"图像多票据识别"、"PDF多票据识别"等命令输出到的变量并循环遍历的值

返回结果

sRet,将命令运行后的结果赋值给此变量。

运行实例

/**********************获取票据类型**********************
命令原型:
sRet = Mage.ExtractInvoiceType(value)
入参:
value--票据识别结果
出参:
sRet--函数调用的输出保存到的变量
****************************************************/
Rem 测试数据
Dim value = {"ai_function" : "ocr_invoice","class" : 3,"goods" : [],"image_angle" : 0,"items" : [{"description" : "火车票红色编码","key" : "ticket_number","positions" : [{"x" : 46,"y" : 25},{"x" : 195,"y" : 25},{"x" : 195,"y" : 59},{"x" : 46,"y" : 59}],"value" : "H014366"},{"description" : "检票口","key" : "boarding_gate","positions" : [{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0}],"value" : ""},{"description" : "检票口","key" : "check","positions" : [{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0},{"x" : 0,"y" : 0}],"value" : ""},{"description" : "出发地","key" : "departure_station","positions" : [{"x" : 70,"y" : 67},{"x" : 203,"y" : 67},{"x" : 203,"y" : 108},{"x" : 70,"y" : 108}],"value" : "北京北站"},{"description" : "车次号","key" : "train_number","positions" : [{"x" : 257,"y" : 74},{"x" : 374,"y" : 74},{"x" : 374,"y" : 109},{"x" : 257,"y" : 109}],"value" : "G9103"},{"description" : "目的地","key" : "arrival_station","positions" : [{"x" : 391,"y" : 67},{"x" : 523,"y" : 67},{"x" : 523,"y" : 108},{"x" : 391,"y" : 108}],"value" : "张家口站"},{"description" : "乘车时间","key" : "departure_date","positions" : [{"x" : 49,"y" : 133},{"x" : 343,"y" : 133},{"x" : 343,"y" : 165},{"x" : 49,"y" : 165}],"value" : "2019-12-30 17:53"},{"description" : "座位号","key" : "seat_number","positions" : [{"x" : 382,"y" : 135},{"x" : 505,"y" : 135},{"x" : 505,"y" : 164},{"x" : 382,"y" : 164}],"value" : "05车06C号"},{"description" : "价格","key" : "price","positions" : [{"x" : 82,"y" : 173},{"x" : 151,"y" : 172},{"x" : 151,"y" : 195},{"x" : 82,"y" : 195}],"value" : "110.0"},{"description" : "座位类别","key" : "class","positions" : [{"x" : 426,"y" : 167},{"x" : 531,"y" : 167},{"x" : 531,"y" : 196},{"x" : 426,"y" : 196}],"value" : "多功能座"},{"description" : "乘客身份证","key" : "passenger_id","positions" : [{"x" : 51,"y" : 260},{"x" : 398,"y" : 260},{"x" : 398,"y" : 293},{"x" : 51,"y" : 293}],"value" : "4330261954****0012"},{"description" : "乘客名称","key" : "passenger_name","positions" : [{"x" : 51,"y" : 260},{"x" : 398,"y" : 260},{"x" : 398,"y" : 293},{"x" : 51,"y" : 293}],"value" : "刘建华"},{"description" : "火车票ID","key" : "ticket_id","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "65678301011231H014366"},{"description" : "发票代码","key" : "code","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "65678301011231"},{"description" : "火车票红色编码","key" : "number","positions" : [{"x" : 57,"y" : 360},{"x" : 399,"y" : 360},{"x" : 399,"y" : 389},{"x" : 57,"y" : 389}],"value" : "H014366"}],"kind" : 2,"page_number" : 1,"rotated_image_height" : 408,"rotated_image_width" : 632,"type" : 20,"type_description" : "火车票","type_key" : "train_ticket"} // 测试数据
Dim sRet="" // 输出结果

sRet = Mage.ExtractInvoiceType(value)
Traceprint(sRet)

可视化样例