登录脚本(welcome)

  1. //退出逻辑
  2. @slot
  3. function laborQuit() {
  4. labor.launch({},"");
  5. labor.release();
  6. }
  7. //获取设备对象
  8. var labor = laborService.getLabor();
  9. // 扫码指令,使用需要换成自己页面
  10. var locationCode = labor.scan("PAGE@0.0.0", {
  11. header_title: "登录",
  12. guide_text: "扫码登录账号",
  13. bottom_tip: "< 按左键可手动输入"
  14. });
  15. //提示指令
  16. labor.tipsWithJump({success:true, code:"输入内容", message:locationCode});
  17. //内置函数,获取app列表
  18. var apps = appService.getAppList();
  19. //组装桌面菜单选项对象
  20. var optionMap = {};
  21. optionMap.退出 = "laborQuit";
  22. //启动桌面指令
  23. var res = labor.launch(apps, "测试用户", optionMap);
  24. //退出,结束流程
  25. labor.release();
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- 文档地址: https://yuque.antfin-inc.com/docs/share/47a4bc15-aa6e-4461-8945-e94772879539 -->
  3. <profile xmlns="http://cainiao-inc.com/iot/binding"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://cainiao-inc.com/iot/binding profile_binding.xsd">
  6. <localService name="sys" interface="com.cainiao.digit.edge.driver.SystemService"></localService>
  7. <localService name="laborService" interface="com.cainiao.digit.edge.driver.lemo.LaborService"></localService>
  8. <localService name="appService" interface="com.cainiao.digit.edge.driver.lemo.LemoAppListService"></localService>
  9. </profile>

业务脚本

  1. function beginWork() {
  2. // 扫码指令,使用需要换成自己页面
  3. var locationCode = labor.scan("PAGE@0.0.0", {
  4. header_title: "扫运单",
  5. guide_text: "扫运单条码 领取拣选任务",
  6. bottom_tip: "< 按左键可手动输入"
  7. });
  8. // 弹窗提示
  9. labor.tipsWithJump({
  10. success: true,
  11. code: "完成扫运单",
  12. message: locationCode
  13. });
  14. // 扫码指令,使用需要换成自己页面
  15. locationCode = labor.scan("PAGE@0.0.0", {
  16. "header_title": "扫容器",
  17. "maincard_title": "推荐容器",
  18. "maincard_content": "总拣容器",
  19. "maincard_desc": "",
  20. "subcard_title": "拣选总件数",
  21. "subcard_context": "360"
  22. });
  23. // 弹窗提示
  24. labor.tipsWithJump({
  25. success: true,
  26. code: "完成扫容器",
  27. message: locationCode
  28. });
  29. // 菜单选项
  30. var optionMap = {分支流程: "slotFunc"}
  31. // 扫码指令,使用需要换成自己页面
  32. locationCode = labor.scan("PAGE@0.0.0", {
  33. "header_title": "扫商品",
  34. "skucard_title": "待拣件数",
  35. "skucard_num": "8 件",
  36. "skucard_num_last": "(8972)",
  37. "skucard_name": "欧莱雅红石榴眼霜滋润眼部精华霜【120g】",
  38. "skucard_info1": "商品条码:3456 6756 5678",
  39. "skucard_info2": "箱规: 10个/箱",
  40. "skucard_tag_list": [{
  41. "txt": "20件/箱"
  42. },
  43. {
  44. "txt": "易碎"
  45. }],
  46. "subcard_title": "来源库位",
  47. "subcard_context": "BN06-12-A03"
  48. },
  49. optionMap);
  50. // 弹窗提示
  51. labor.tipsWithJump({
  52. success: true,
  53. code: "完成扫商品",
  54. message: locationCode
  55. });
  56. // 结束流程
  57. labor.release();
  58. }
  59. // slot 语法参考 https://www.yuque.com/bzruq0/tntug6/kxqfpc#7hSAQ
  60. @slot
  61. function slotFunc() {
  62. labor.tipsWithJump({
  63. success: true,
  64. code: "进入分支",
  65. message: "回到扫运单"
  66. });
  67. }
  68. //流程开始
  69. var labor = laborService.getLabor();
  70. beginWork();
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- 文档地址: https://www.yuque.com/bzruq0/tntug6/zfb62g -->
  3. <profile xmlns="http://cainiao-inc.com/iot/binding"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://cainiao-inc.com/iot/binding profile_binding.xsd">
  6. <localService name="sys" interface="com.cainiao.digit.edge.driver.SystemService"></localService>
  7. <localService name="laborService" interface="com.cainiao.digit.edge.driver.lemo.LaborService"></localService>
  8. </profile>

image.png