亚州av一区二区_1区在线_国产精品久久久久久久_亚洲国产视频一区_在线观看免费av网_精品少妇一区二区三区在线播放

產(chǎn)品中心 業(yè)內(nèi)新聞 案例中心 視頻中心

Excel數(shù)據(jù)導(dǎo)入Mobox低代碼平臺 Excel數(shù)據(jù)導(dǎo)入Mobox低代碼平臺

Excel數(shù)據(jù)導(dǎo)入Mobox低代碼平臺

Excel數(shù)據(jù)導(dǎo)入Mobox低代碼平臺

 

我們系統(tǒng)上線的時候,原先的歷史數(shù)據(jù)是沒有的,為了快速接軌企業(yè)已有數(shù)據(jù),我們可以通過excel 對歷史數(shù)據(jù)進(jìn)行導(dǎo)入操作。導(dǎo)入一般可以通過腳本做一些定制開發(fā)來實現(xiàn)

 

列子:

數(shù)據(jù)導(dǎo)入的sheet 要求

這個系統(tǒng)只能導(dǎo)入,左邊第一個sheet (命名無所謂)(注意:若數(shù)據(jù)列表 這個sheet左邊還有隱藏的sheet,那么系統(tǒng)也不能獲取 數(shù)據(jù)列表sheet頁的數(shù)據(jù))

對Excel單元格的要求

單元個里面的數(shù)據(jù),只能是字符串或數(shù)值。若是計算公式或函數(shù) ,將無法獲取

另外,單元個內(nèi)容 不能出現(xiàn) /\<> & 符號,不能有換行或大量空格

分析excel格式

1、字段分3類:

  • 關(guān)鍵字段

如,產(chǎn)品名稱 ,這個是必須有數(shù)值的

  • 屬性字段

用于登記各種屬性信息

  • 計算字段

若有數(shù)據(jù),則直接獲取

若沒有,可以通過lua腳本計算生成

這種字段,一般也是必須有數(shù)值的

2、第一行是表頭行,數(shù)據(jù)行從第二行開始

 

定義導(dǎo)入功能

通過Mobox 3000 功能點進(jìn)行定義,設(shè)置界面如下:

導(dǎo)入腳本,參考:

json? = require(“json”)
mobox = require(“OILua_JavelinExt”)
require(“oi_basestrfunc”)
function ImportKA(strLuaDEID)
? ? local nRet, strRetInfo
? ? — 獲取導(dǎo)入的數(shù)據(jù), 返回 [[{“attr”:”xx”,”value”:””},…]]
? ? — V2.0
? ? nRet, strRetInfo = mobox.getCurEditDataPacket(strLuaDEID)
? ? if (nRet ~= 0 or strRetInfo == ”) then
? ? ? ? mobox.error(strLuaDEID, “無法獲取導(dǎo)入數(shù)據(jù)!”)
? ? ? ? return
? ? end
? ? local input_rows = json.decode(strRetInfo)
? ? local n, nCount, nValue, nMaxRow, nRow
? ? local strAddAttr = ”
? ? — 一些關(guān)鍵屬性
? ? local strKAName = ”
? ? local strKAType = ”
? ? local strArea = ”
? ? — 步驟1 獲取從excel導(dǎo)入的一行數(shù)據(jù),根據(jù)excel的列定義進(jìn)行屬性組合 strAddAttr
? ? nMaxRow = #input_rows
? ? for nRow = 1, nMaxRow do
? ? ? ? input = input_rows[nRow]
? ? ? ? nCount = #input
? ? ? ? — V2.1
? ? ? ? strAddAttr = ”
? ? ? ? strKAName = ”
? ? ? ? strKAType = ”
? ? ? ? strArea = ”
? ? ? ? for n = 1, nCount do
? ? ? ? ? ? strAttr = input[n].attr
? ? ? ? ? ? strValue = input[n].value
? ? ? ? ? ? if (strAttr ~= ” and strValue ~= ”) then
? ? ? ? ? ? ? ? — 根據(jù)導(dǎo)入的excel列頭名稱進(jìn)行判斷
? ? ? ? ? ? ? ? — 關(guān)鍵屬性判斷
? ? ? ? ? ? ? ? if (strAttr == “客戶名稱”) then
? ? ? ? ? ? ? ? ? ? if (strValue == ”) then
? ? ? ? ? ? ? ? ? ? ? ? mobox.error(strLuaDEID, strAttr .. “不能為空!”)
? ? ? ? ? ? ? ? ? ? ? ? return
? ? ? ? ? ? ? ? ? ? end
? ? ? ? ? ? ? ? ? ? strKAName = strValue
? ? ? ? ? ? ? ? ? ? strAddAttr = strAddAttr .. ‘{“attr”:”S_KA_NAME”,”value”:”‘ .. strKAName .. ‘”},’
? ? ? ? ? ? ? ?— 常規(guī)屬性
? ? ? ? ? ? ? ? elseif (strAttr == “所屬地區(qū)”) then
? ? ? ? ? ? ? ? ? ? strArea = strValue
? ? ? ? ? ? ? ? ? ? strAddAttr = strAddAttr .. ‘{“attr”:”S_AREA”,”value”:”‘ .. strArea .. ‘”},’
? ? ? ? ? ? ? ? elseif (strAttr == “客戶類型”) then
? ? ? ? ? ? ? ? ? ? strKAType = strValue
? ? ? ? ? ? ? ? ? ? strAddAttr = strAddAttr .. ‘{“attr”:”S_KA_TYPE”,”value”:”‘ .. strKAType .. ‘”},’
? ? ? ? ? ? ? ? end
? ? ? ? ? ? end
? ? ? ? end
? ? ? ? –去除最后一個,
? ? ? ? local strAddAttr1 = trim_laster_char(strAddAttr)
? ? ? ? — 步驟2 根據(jù)客戶名稱來判斷導(dǎo)入的客戶是否已經(jīng)存在
? ? ? ? —? ? ? ?如果已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋
? ? ? ? —? ? ? ?如果不存在需要創(chuàng)建
? ? ? ? local attrs
? ? ? ? local strCondition = “S_KA_NAME='” .. strKAName .. “‘”
? ? ? ? nRet, strRetInfo = mobox.existThisData(strLuaDEID, “客戶”, strCondition)
? ? ? ? if (nRet ~= 0) then
? ? ? ? ? ? mobox.error(strLuaDEID, “在檢查客戶是否存在時失敗! ” .. strRetInfo)
? ? ? ? ? ? return
? ? ? ? end
? ? ? ? if (strRetInfo == ‘yes’) then
? ? ? ? ? ? — 已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋
? ? ? ? ? ? strCondition = “S_KA_NAME='” .. strKAName .. “‘”
? ? ? ? ? ? strSetSQL =? “S_KA_NAME = ‘” .. strKAName ..”‘ , S_KA_TYPE ='” ..strKAType .. “‘ , S_AREA = ‘” .. strArea ..”‘ “
? ? ? ? ? ? nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, “客戶”, strCondition, strSetSQL)
? ? ? ? ? ? if (nRet ~= 0) then
? ? ? ? ? ? ? ? mobox.error(strLuaDEID, strRetInfo)
? ? ? ? ? ? ? ? return
? ? ? ? ? ? end
? ? ? ? elseif (strRetInfo == ‘no’) then
? ? ? ? ? ? — 創(chuàng)建客戶
? ? ? ? ? ? –mobox.writeSysLog(“strAddAttr1”, strAddAttr1)
? ? ? ? ? ? strAddAttr1 = ‘[‘ .. strAddAttr1 .. ‘]’
? ? ? ? ? ? –mobox.writeSysLog(“strAddAttr2”, strAddAttr1)
? ? ? ? ? ? nRet, strRetInfo = mobox.createDataObj(strLuaDEID, “客戶”, strAddAttr1)
? ? ? ? ? ? if (nRet ~= 0) then
? ? ? ? ? ? ? ? mobox.error(strLuaDEID, “創(chuàng)建客戶失敗! ” .. strRetInfo )
? ? ? ? ? ? ? ? return
? ? ? ? ? ? end
? ? ? ? end
? ? end
end
標(biāo)簽:低代碼腳本 上一篇: 下一篇:
展開更多
預(yù)約軟件體驗

loading...

主站蜘蛛池模板: 午夜看看 | 亚洲毛片一区二区 | 国产精品一区二区在线 | 欧美v片| 美日韩中文字幕 | 一区二区三区视频免费观看 | 亚洲免费在线 | 中文字幕日本一区二区 | 日本三级全黄三级a | 欧美久久国产精品 | 日韩电影中文字幕 | 久久久久久国产精品 | 亚洲精精品 | 亚洲一区二区三区在线视频 | 亚洲综合一区二区三区 | 色吊丝2| 久久精品日产第一区二区三区 | 日韩av在线一区 | 亚洲啪啪| 亚洲精品久久久久久久久久久 | 激情毛片| 9191在线播放 | 国产91综合 | 天天射影院 | av二区三区 | 日韩一级不卡 | 999久久久精品 | 国产美女永久免费无遮挡 | 亚洲精品福利视频 | 91免费看片| 国产九一精品 | 国产我和子的乱视频网站 | 中文字幕第十一页 | 欧美在线日韩 | 国产三级精品三级在线观看四季网 | 国产成人麻豆免费观看 | 99久久成人 | 色综合久久88色综合天天 | 蜜桃av一区二区三区 | 日本粉嫩一区二区三区视频 | av天空|