- 1.數(shù)據(jù)屬性獲取/設(shè)置
- 1.1 getCurEditDataObjAttr
- 1.2 setCurEditDataObjAttr
- 2.數(shù)據(jù)創(chuàng)建/修改
1. 數(shù)據(jù)屬性獲取/設(shè)置
1.1 getCurEditDataObjAttr
說明:獲取當前Lua腳本正在處理的數(shù)據(jù)對象屬性
使用頻次:高
getCurEditDataObjAttr?(strLuaDEID, strAttrName1, strAttrName2,… )
輸入?yún)?shù):
序號 | 參數(shù) | 必有 | 說明 |
---|---|---|---|
1 | strLuaDEID | Y | Lua C++數(shù)據(jù)交換區(qū)標識, 是一個GUID |
2 | strAttrName1 | N | 數(shù)據(jù)屬性1 |
3 | strAttrName2 | N | 數(shù)據(jù)屬性2 |
注意: 如果只輸入一個參數(shù),系統(tǒng)返回當前編輯數(shù)據(jù)對象中所有屬性
輸出參數(shù):
-
- nRet?= 0 表示成功, 非零失敗
-
- strRetInfo?返回結(jié)果
[ {"attr":"attr1","value":"xxx1"}, {"attr":"attr2","value":"xxx2"}, ... ]
Example
-- 獲取入庫原材料批次號、紅票重量 local nRet, strRetInfo nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_B_CODE","F_RT_WEIGHT" ) if ( nRet ~= 0 or strRetInfo == '' ) then mobox.error( strLuaDEID, "無法獲取入庫原材料批次號!") return end local retAttrs = json.decode( strRetInfo ) local strBCode = retAttrs[1].value -- 原材料批次號 local fRTWeight = tonumber( retAttrs[2].value ) -- 重量