四虎永久在线精品免费无码-亚洲欧美国产精品无码中文字-久久久噜噜噜www成人网-中文字幕av一区乱码-成人国产精品一区二区网站公司

產品中心 業內新聞 案例中心 視頻中心

Mobox低代碼平臺- 主類及子類數據導入實現 Mobox低代碼平臺- 主類及子類數據導入實現

Mobox低代碼平臺- 主類及子類數據導入實現

我們在巨星工藝系統里面遇到,用戶需要將產品工藝一次性導入的需求

軟件系統架構圖:

數據對象介紹

產品及工藝導入,我們提供了一個excel模板

定義導入腳本(自定義腳本)

–[[

??? 編碼: CappImport

??? 名稱: 產品及工藝信息導入

??? 作者:whx???

??? 入口函數:ImportCapp

 

??? 功能說明:

??????? 產品及工藝的導入,在導入的時候判斷一下產品是否存在?如果不存在要新創建

??????? 導入格式見《產品-工藝-導入test.xlsx》

??? 變更歷史:

??????? V1.0? whx??? 2023-4-12????? 新建

 

??? 數據結構說明

???????? 產品

?????????????????? 工藝1

?????????????????? 工藝2

?????????????????? 工藝…

???????? 其中,有數據對象《產品》 子類 《工藝》 (S_GDS_CODE 為關聯字段)

???????? 使用前,將2個對象的所有字段 對應的變量都定義一下? 《參考代碼里面的? 產品字段對應變量定義;工藝字段對應變量定義》

–]]

 

json? = require(“json”)

mobox = require(“OILua_JavelinExt”)

require(“oi_basestrfunc”)

 

function ImportCapp(strLuaDEID)

??? local nRet, strRetInfo

? ??— 獲取導入的數據, 返回 [{“attr”:”xx”,”value”:””},…]

???

??? nRet, strRetInfo = mobox.getInputParameter(strLuaDEID)

??? –mobox.writeSysLog(“nRet”,nRet)

 

??? if (nRet ~= 0 or strRetInfo == ”) then

??????? mobox.error(strLuaDEID, “無法獲取導入數據!”)

??????? return

??? end

??? –mobox.writeSysLog(“strRetInfo”,strRetInfo)

??? local retJson = json.decode(strRetInfo)

???

??? local input = retJson[“parameter”]

???

??? local n, nCount, nValue

??? local strAddAttr = ”

 

??? — 產品字段對應變量定義

??? local strGDSCode = ”

 

??? local strGDSName = ”

??? local strGDSClass = ”

??? local strGDSSeries = ”

??? local strGDSSpec = ”

??? local strGDSDescribe = ”

 

??? — 工藝字段對應變量定義

??? local strMPName = ”

??? local strMPCode = ”

??? local strMPDescrive = ”

??? local strN_On = ”

 

??? — 步驟1 獲取從excel導入的一行數據,根據excel的產品規格定義進行屬性組合 strAddAttr

??? nCount = #input

??? for n = 1, nCount do

??????? strAttr = input[n].attr

??????? strValue = input[n].value

??????? if (strAttr ~= ” and strValue ~= ”) then

 

??????????? — 根據導入的excel產品規格頭名稱進行判斷

??????????? — 關鍵屬性判斷

??????????? if (strAttr == “產品編碼”) then

??????????????? if (strValue == ”) then

??????????????????? mobox.error(strLuaDEID, strAttr .. “不能為空!”)

??????????????????? return

??????????????? end

??????????????? strGDSCode = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_CODE”,”value”:”‘ .. strGDSCode .. ‘”},’

 

??????????? elseif (strAttr == “產品名稱”) then

??????????????? if (strValue == ”) then

??????????????????? mobox.error(strLuaDEID, strAttr .. “不能為空!”)

??????? ????????????return

??????????????? end

??????????????? strGDSName = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_NAME”,”value”:”‘ .. strGDSName .. ‘”},’

 

??????????? elseif (strAttr == “過程名稱”) then

??????????????? if (strValue == ”) then

??????????????????? mobox.error(strLuaDEID, strAttr .. “不能為空!”)

??????????????????? return

??????????????? end

??????????????? strMPName = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_MP_NAME”,”value”:”‘ .. strMPName .. ‘”},’

???????????????

??????????? elseif (strAttr == “過程編號”) then

??????????????? if (strValue == ”) then

??????????????????? mobox.error(strLuaDEID, strAttr .. “不能為空!”)

??????????????????? return

??????????????? end

??????????????? strMPCode = strValue

????? ??????????strAddAttr = strAddAttr .. ‘{“attr”:”S_MP_CODE”,”value”:”‘ .. strMPCode .. ‘”},’

???????????????

??????????? — 常規屬性

 

??????????? elseif (strAttr == “產品分類”) then

??????????????? strGDSClass = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_CLASS”,”value”:”‘ .. strGDSClass .. ‘”},’

 

??????????? elseif (strAttr == “產品系列”) then

??????????????? strGDSSeries = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_SERIES”,”value”:”‘ .. strGDSSeries .. ‘”},’

 

????????? ??elseif (strAttr == “產品規格”) then

??????????????? strGDSSpec = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_SPEC”,”value”:”‘ .. strGDSSpec .. ‘”},’

 

??????????? elseif (strAttr == “產品描述”) then

??????????????? strGDSDescribe = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_GDS_DESCRIBE”,”value”:”‘ .. strGDSDescribe .. ‘”},’

 

??????????? elseif (strAttr == “序號”) then

??????????????? strN_On = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”N_ON”,”value”:”‘ .. strN_On .. ‘”},’

 

??????????? elseif (strAttr == “過程描述”) then

??????????????? strMPDescrive = strValue

??????????????? strAddAttr = strAddAttr .. ‘{“attr”:”S_MP_DESCRIBE”,”value”:”‘ .. strMPDescrive .. ‘”},’

??????????? end

??????? end

 

??? end

??? –去除最后一個,

??? local strAddAttr1 = trim_laster_char(strAddAttr)

 

??? — 步驟2 根據(產品編碼 + 過程名稱) 來判斷導入的工藝步驟是否已經存在

??? —?????? 如果已經存在,根據導入的數據進行覆蓋

??? —?????? 如果不存在需要創建

??? local attrs

??? local strCondition = “S_GDS_CODE='” .. strGDSCode .. “‘ and S_MP_NAME = ‘” .. strMPName .. “‘ “

??? nRet, strRetInfo = mobox.existThisData(strLuaDEID, “工藝”, strCondition)

??? if (nRet ~= 0) then

??????? mobox.error(strLuaDEID, “在檢查工藝是否存在時失敗! ” .. strRetInfo)

??? ????return

??? end

 

??? if (strRetInfo == ‘yes’) then

??????? — 已經存在,根據導入的數據進行覆蓋

??????? strCondition = “S_GDS_CODE='” .. strGDSCode .. “‘ and S_MP_NAME = ‘” .. strMPName .. “‘ “

 

??????? strSetSQL = “S_GDS_CODE = ‘” ..strGDSCode ..”‘ , S_MP_DESCRIBE ='” ..strMPDescrive ..

??????????? “‘ , S_MP_NAME = ‘” .. strMPName .. “‘ , S_MP_CODE = ‘” .. strMPCode .. “‘ , N_ON = ‘” .. strN_On ..”‘ “

 

??????? nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, “工藝”, strCondition, strSetSQL)

??????? if (nRet ~= 0) then

??????????? mobox.error(strLuaDEID, strRetInfo)

??????????? return

??????? end

??????? return

 

???? elseif (strRetInfo == ‘no’) then

???? — 新增工藝

???????? attrs = ‘[{“attr”:”S_GDS_CODE”,”value”:”‘ .. strGDSCode .. ‘”},’

???????? .. ‘{“attr”:”S_MP_NAME”,”value”:”‘ .. strMPName .. ‘”},’

???????? .. ‘{“attr”:”N_ON”,”value”:”‘ .. strN_On .. ‘”},’

???????? .. ‘{“attr”:”S_MP_CODE”,”value”:”‘ .. strMPCode .. ‘”},’

???????? .. ‘{“attr”:”S_MP_DESCRIBE”,”value”:”‘ ..? strMPDescrive .. ‘”}]’

 

??? — mobox.writeSysLog(“attrs”,attrs)

???

???????? nRet, strRetInfo = mobox.createDataObj(strLuaDEID, “工藝”, attrs)

???????? if (nRet ~= 0) then

?????????????????? mobox.error(strLuaDEID, “創建工藝失敗! ” .. strRetInfo)

?????????????????? return

???????? end

 

???????? ?— 導入的工藝不存在的時候,就需要判斷一下 產品是否存在

???????? — 如果不存在需要創建

???????? — 判斷產品是否存在

???????? strCondition = “S_GDS_CODE='” .. strGDSCode .. “‘”

???????? nRet, strRetInfo = mobox.existThisData(strLuaDEID, “產品”, strCondition)

???????? if (nRet ~= 0) then

?????????????????? mobox.error(strLuaDEID, “在檢查產品是否存在時失敗! ” .. strRetInfo)

?????????????????? return

???????? end

 

???????? if (strRetInfo == ‘no’) then

???????? — 新增產品

 

?????????????????? attrs = ‘[{“attr”:”S_GDS_CODE”,”value”:”‘ .. strGDSCode .. ‘”},’

?????????????????? .. ‘{“attr”:”S_GDS_NAME”,”value”:”‘ .. strGDSName .. ‘”},’

?????????????????? .. ‘{“attr”:”S_GDS_CLASS”,”value”:”‘ .. strGDSClass .. ‘”},’

?????????????????? .. ‘{“attr”:”S_GDS_SERIES”,”value”:”‘ .. strGDSSeries .. ‘”},’

?????????????????? .. ‘{“attr”:”S_GDS_SPEC”,”value”:”‘ .. strGDSSpec .. ‘”},’

?????????????????? .. ‘{“attr”:”S_GDS_DESCRIBE”,”value”:”‘ .. strGDSDescribe .. ‘”}]’

 

?????????????????? –mobox.writeSysLog(“attrs”,attrs)

?????????????????? nRet, strRetInfo = mobox.createDataObj(strLuaDEID, “產品”, attrs)

?????????????????? if (nRet ~= 0) then

??????????????????????????? mobox.error(strLuaDEID, “創建產品失敗! ” .. strRetInfo)

??????????????????????????? return

?????????????????? end

?? ? end

 

??? end

 

end

定義導入命令

設置導入命令的相關參數

 

我們可以通過excel批量導入企業的工藝信息

標簽:方案腳本 上一篇: 下一篇:
展開更多
預約軟件體驗

loading...

主站蜘蛛池模板: 国产a∨精品一区二区三区不卡| 欧美人妻日韩精品| 国产va免费精品高清在线30页| 久久久久久无码午夜精品直播| 性色av免费网站| 成人无码h在线观看网站| 国产成人精品a视频一区| 丰满人妻中伦妇伦精品app| 在厨房拨开内裤进入毛片| 亚洲欧美日韩国产精品专区| 成人va亚洲va欧美天堂| 久久精品中文字幕第一页| 精品国产人妻一区二区三区| 色欲久久久天天天综合网精品| 欧美人与性囗牲恔配| 丁香婷婷综合激情五月色| 美女无遮挡免费视频网站| 四虎影视在线永久免费观看| 亚洲午夜成人精品无码色欲| 成年片色大黄全免费网站久久 | 国产乱子乱人伦电影在线观看| 少妇激情一区二区三区视频小说 | 亚洲色无码播放| 亚洲国产精品无码久久久秋霞2| 成人禁片免费播放35分钟| 国产粉嫩馒头无套内在线观看免费 | 国产精品美女www爽爽爽视频 | 中文字幕婷婷日韩欧美亚洲| 亚洲国产欧美日本视频| 久久中文字幕人妻丝袜系列| 亚洲专区+欧美专区+自拍| 自偷自拍亚洲综合精品第一页| 日本人妻中文字幕乱码系列| 亚洲精品国产一区黑色丝袜| 秋霞在线观看秋| a国产在线v的不卡视频| 国产精品无码永久免费不卡| 无码东京热一区二区三区| av无码中出一区二区三区| 在线看片免费人成视频福利| 亚洲性无码av在线欣赏网|