大陆黄色一级片-大陆黄色网-大陆精品偷拍视频在线播放-大杳蕉伊人狼人久久一本线-国产精品国产三级国产普通-国产精品国产三级国产普通话对白

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

Mobox低代碼平臺(tái)- 主類(lèi)及子類(lèi)數(shù)據(jù)導(dǎo)入實(shí)現(xiàn) Mobox低代碼平臺(tái)- 主類(lèi)及子類(lèi)數(shù)據(jù)導(dǎo)入實(shí)現(xiàn)

Mobox低代碼平臺(tái)- 主類(lèi)及子類(lèi)數(shù)據(jù)導(dǎo)入實(shí)現(xiàn)

我們?cè)诰扌枪に囅到y(tǒng)里面遇到,用戶需要將產(chǎn)品工藝一次性導(dǎo)入的需求

軟件系統(tǒng)架構(gòu)圖:

數(shù)據(jù)對(duì)象介紹

產(chǎn)品及工藝導(dǎo)入,我們提供了一個(gè)excel模板

定義導(dǎo)入腳本(自定義腳本)

–[[

??? 編碼: CappImport

??? 名稱(chēng): 產(chǎn)品及工藝信息導(dǎo)入

??? 作者:whx???

??? 入口函數(shù):ImportCapp

 

??? 功能說(shuō)明:

??????? 產(chǎn)品及工藝的導(dǎo)入,在導(dǎo)入的時(shí)候判斷一下產(chǎn)品是否存在?如果不存在要新創(chuàng)建

??????? 導(dǎo)入格式見(jiàn)《產(chǎn)品-工藝-導(dǎo)入test.xlsx》

??? 變更歷史:

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

 

??? 數(shù)據(jù)結(jié)構(gòu)說(shuō)明

???????? 產(chǎn)品

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

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

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

???????? 其中,有數(shù)據(jù)對(duì)象《產(chǎn)品》 子類(lèi) 《工藝》 (S_GDS_CODE 為關(guān)聯(lián)字段)

???????? 使用前,將2個(gè)對(duì)象的所有字段 對(duì)應(yīng)的變量都定義一下? 《參考代碼里面的? 產(chǎn)品字段對(duì)應(yīng)變量定義;工藝字段對(duì)應(yīng)變量定義》

–]]

 

json? = require(“json”)

mobox = require(“OILua_JavelinExt”)

require(“oi_basestrfunc”)

 

function ImportCapp(strLuaDEID)

??? local nRet, strRetInfo

? ??— 獲取導(dǎo)入的數(shù)據(jù), 返回 [{“attr”:”xx”,”value”:””},…]

???

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

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

 

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

??????? mobox.error(strLuaDEID, “無(wú)法獲取導(dǎo)入數(shù)據(jù)!”)

??????? return

??? end

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

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

???

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

???

??? local n, nCount, nValue

??? local strAddAttr = ”

 

??? — 產(chǎn)品字段對(duì)應(yīng)變量定義

??? local strGDSCode = ”

 

??? local strGDSName = ”

??? local strGDSClass = ”

??? local strGDSSeries = ”

??? local strGDSSpec = ”

??? local strGDSDescribe = ”

 

??? — 工藝字段對(duì)應(yīng)變量定義

??? local strMPName = ”

??? local strMPCode = ”

??? local strMPDescrive = ”

??? local strN_On = ”

 

??? — 步驟1 獲取從excel導(dǎo)入的一行數(shù)據(jù),根據(jù)excel的產(chǎn)品規(guī)格定義進(jìn)行屬性組合 strAddAttr

??? nCount = #input

??? for n = 1, nCount do

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

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

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

 

??????????? — 根據(jù)導(dǎo)入的excel產(chǎn)品規(guī)格頭名稱(chēng)進(jìn)行判斷

??????????? — 關(guān)鍵屬性判斷

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

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

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

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

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

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

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

 

??????????? elseif (strAttr == “產(chǎn)品名稱(chēng)”) then

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

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

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

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

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

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

 

??????????? elseif (strAttr == “過(guò)程名稱(chēng)”) then

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

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

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

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

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

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

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

??????????? elseif (strAttr == “過(guò)程編號(hào)”) then

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

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

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

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

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

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

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

??????????? — 常規(guī)屬性

 

??????????? elseif (strAttr == “產(chǎn)品分類(lèi)”) then

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

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

 

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

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

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

 

????????? ??elseif (strAttr == “產(chǎn)品規(guī)格”) then

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

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

 

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

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

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

 

??????????? elseif (strAttr == “序號(hào)”) then

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

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

 

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

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

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

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

??????? end

 

??? end

??? –去除最后一個(gè),

??? local strAddAttr1 = trim_laster_char(strAddAttr)

 

??? — 步驟2 根據(jù)(產(chǎn)品編碼 + 過(guò)程名稱(chēng)) 來(lái)判斷導(dǎo)入的工藝步驟是否已經(jīng)存在

??? —?????? 如果已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋

??? —?????? 如果不存在需要?jiǎng)?chuàng)建

??? 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, “在檢查工藝是否存在時(shí)失敗! ” .. strRetInfo)

??? ????return

??? end

 

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

??????? — 已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋

??????? 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, “創(chuàng)建工藝失敗! ” .. strRetInfo)

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

???????? end

 

???????? ?— 導(dǎo)入的工藝不存在的時(shí)候,就需要判斷一下 產(chǎn)品是否存在

???????? — 如果不存在需要?jiǎng)?chuàng)建

???????? — 判斷產(chǎn)品是否存在

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

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

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

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

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

???????? end

 

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

???????? — 新增產(chǎn)品

 

?????????????????? 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, “產(chǎn)品”, attrs)

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

??????????????????????????? mobox.error(strLuaDEID, “創(chuàng)建產(chǎn)品失敗! ” .. strRetInfo)

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

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

?? ? end

 

??? end

 

end

定義導(dǎo)入命令

設(shè)置導(dǎo)入命令的相關(guān)參數(shù)

 

我們可以通過(guò)excel批量導(dǎo)入企業(yè)的工藝信息

標(biāo)簽:方案腳本 上一篇: 下一篇:
展開(kāi)更多
預(yù)約軟件體驗(yàn)

loading...

主站蜘蛛池模板: 久久99久久成人免费播放 | 日韩一区二区三区不卡视频 | 香港aa三级久久三级老师 | 2022年国产精品久久久久 | 小泽玛利亚的一级毛片的 | 全国男人的天堂网站 | 免费一级欧美大片视频在线 | 在线观看毛片视频 | 在线播放成人高清免费视频 | 亚洲成av人影片在线观看 | 91大神在线精品视频一区 | 香港aa三级久久三级 | 国产精品日产三级在线观看 | 性欧美videos高清精品 | 欧美亚洲国产成人精品 | 美女很黄很黄免费的 | 欧美 自拍 | 成人免费观看永久24小时 | 免费国产成人高清在线看软件 | 色九九 | 久久精品国产影库免费看 | 欧美成人精品大片免费流量 | 日韩成人午夜 | 欧日韩美香蕉在线观看 | 日韩中文字幕在线看 | 一级做a级爰片性色毛片视频 | 欧美jizzhd精品欧美高清 | 波多野结衣在线免费观看视频 | 国产不卡精品一区二区三区 | 亚洲一级成人 | 午夜丝袜美腿福利视频在线看 | 国产精品色内内在线播放 | 国产v片成人影院在线观看 国产v片在线播放免费观 | 亚洲精品日本高清中文字幕 | 国产美女野外做爰 | 国产一线视频在线观看高清 | 成人欧美精品一区二区不卡 | 亚洲国产日韩综合久久精品 | 精品精品国产自在久久高清 | 在线观看 a国v | 国产一区二区三区在线观看视频 |