1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
| --[[
| 编码: AMS-101-12
| 名称: 物料编码变化后
| 作者:LZH
| 日期:2025-05-14
|
| 函数: AfterItemCodeInput
| 功能:
|
| 更改记录:
|
| --]]
|
| json = require("json")
| mobox = require("OILua_JavelinExt")
| m3 = require("oi_base_mobox")
|
| function AfterItemCodeInput(strLuaDEID)
| local nRet, strRetInfo
| local material
| local inbound_detail_array
|
| -- 先获取表头扫描数据
| nRet, strRetInfo = m3.GetSysInputParameter(strLuaDEID)
| if (nRet ~= 0) then
| lua.Error(strLuaDEID, debug.getinfo(1), "获取扫描数据失败!" .. strRetInfo)
| end
| -- lua.Debug(strLuaDEID, debug.getinfo(1), '物料编码变化后:', strRetInfo)
|
| local item_code = m3.KeyValueAttrsToObjAttr(strRetInfo).S_ITEM_CODE -- 物料标签
|
| if (item_code == "" or item_code == nil) then
| mobox.setInfo(strLuaDEID, "请先扫描物料标签!")
| return
| end
|
| -- 查询物料表获取物料属性, 如果是托盘库物料, 则提示报错
| nRet, material = m3.GetDataObjByCondition(strLuaDEID, "SKU", "S_ITEM_CODE = '" .. item_code .. "'")
| if (nRet ~= 0) then
| lua.Error(strLuaDEID, debug.getinfo(1), material)
| end
|
| inbound_detail_array = {
| {
| attrs = {
| {
| attr = "S_ITEM_CODE",
| value = material.item_code
| }, {
| attr = "S_ITEM_NAME",
| value = material.item_name
| }, {
| attr = "F_SAFETY_QTY",
| value = 0
| }
| }
| }
| }
|
| -- 创建页面数据
| local action_array = {}
|
| -- 设置正在码盘页面数据
| action_array[1] = {
| action_type = "insert_subtable_page_row",
| value = {
| page_name = "正在码盘",
| row = inbound_detail_array
| }
| }
|
| -- 物料标签输入框清空
| action_array[2] = {
| action_type = "set_dlg_attr",
| value = {
| {
| attr = "S_ITEM_CODE",
| value = ""
| }
| }
| }
| -- lua.Debug(strLuaDEID, debug.getinfo(1), 'action_array:', action_array)
|
| nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
| if (nRet ~= 0) then
| Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo)
| end
| end
|
|