登录脚本(welcome)
//退出逻辑
@slot
function laborQuit() {
labor.launch({},"");
labor.release();
}
//获取设备对象
var labor = laborService.getLabor();
// 扫码指令,使用需要换成自己页面
var locationCode = labor.scan("PAGE@0.0.0", {
header_title: "登录",
guide_text: "扫码登录账号",
bottom_tip: "< 按左键可手动输入"
});
//提示指令
labor.tipsWithJump({success:true, code:"输入内容", message:locationCode});
//内置函数,获取app列表
var apps = appService.getAppList();
//组装桌面菜单选项对象
var optionMap = {};
optionMap.退出 = "laborQuit";
//启动桌面指令
var res = labor.launch(apps, "测试用户", optionMap);
//退出,结束流程
labor.release();
<?xml version="1.0" encoding="UTF-8"?>
<!-- 文档地址: https://yuque.antfin-inc.com/docs/share/47a4bc15-aa6e-4461-8945-e94772879539 -->
<profile xmlns="http://cainiao-inc.com/iot/binding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cainiao-inc.com/iot/binding profile_binding.xsd">
<localService name="sys" interface="com.cainiao.digit.edge.driver.SystemService"></localService>
<localService name="laborService" interface="com.cainiao.digit.edge.driver.lemo.LaborService"></localService>
<localService name="appService" interface="com.cainiao.digit.edge.driver.lemo.LemoAppListService"></localService>
</profile>
业务脚本
function beginWork() {
// 扫码指令,使用需要换成自己页面
var locationCode = labor.scan("PAGE@0.0.0", {
header_title: "扫运单",
guide_text: "扫运单条码 领取拣选任务",
bottom_tip: "< 按左键可手动输入"
});
// 弹窗提示
labor.tipsWithJump({
success: true,
code: "完成扫运单",
message: locationCode
});
// 扫码指令,使用需要换成自己页面
locationCode = labor.scan("PAGE@0.0.0", {
"header_title": "扫容器",
"maincard_title": "推荐容器",
"maincard_content": "总拣容器",
"maincard_desc": "",
"subcard_title": "拣选总件数",
"subcard_context": "360"
});
// 弹窗提示
labor.tipsWithJump({
success: true,
code: "完成扫容器",
message: locationCode
});
// 菜单选项
var optionMap = {分支流程: "slotFunc"}
// 扫码指令,使用需要换成自己页面
locationCode = labor.scan("PAGE@0.0.0", {
"header_title": "扫商品",
"skucard_title": "待拣件数",
"skucard_num": "8 件",
"skucard_num_last": "(8972)",
"skucard_name": "欧莱雅红石榴眼霜滋润眼部精华霜【120g】",
"skucard_info1": "商品条码:3456 6756 5678",
"skucard_info2": "箱规: 10个/箱",
"skucard_tag_list": [{
"txt": "20件/箱"
},
{
"txt": "易碎"
}],
"subcard_title": "来源库位",
"subcard_context": "BN06-12-A03"
},
optionMap);
// 弹窗提示
labor.tipsWithJump({
success: true,
code: "完成扫商品",
message: locationCode
});
// 结束流程
labor.release();
}
// slot 语法参考 https://www.yuque.com/bzruq0/tntug6/kxqfpc#7hSAQ
@slot
function slotFunc() {
labor.tipsWithJump({
success: true,
code: "进入分支",
message: "回到扫运单"
});
}
//流程开始
var labor = laborService.getLabor();
beginWork();
<?xml version="1.0" encoding="UTF-8"?>
<!-- 文档地址: https://www.yuque.com/bzruq0/tntug6/zfb62g -->
<profile xmlns="http://cainiao-inc.com/iot/binding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cainiao-inc.com/iot/binding profile_binding.xsd">
<localService name="sys" interface="com.cainiao.digit.edge.driver.SystemService"></localService>
<localService name="laborService" interface="com.cainiao.digit.edge.driver.lemo.LaborService"></localService>
</profile>