function DayFromat(dateTimeStr) local formattedDateStr ="" if (dateTimeStr == "" or dateTimeStr==nil ) then return formattedDateStr end dateTimeStr = string.gsub(dateTimeStr, "T", " ") print(dateTimeStr) -- 使用模式匹配提取日期和時(shí)間部分 local dateStr, timeStr = dateTimeStr:match("(%d+-%d+-%d+) (%d+:%d+:%d+)") if (dateStr == nil) then formattedDateStr ="Date Format Error" return formattedDateStr end -- 提取日期部分的年、月、日 local year, month, day = dateStr:match("(%d+)-(%d+)-(%d+)") -- 將提取的月、日格式化為兩位數(shù)的字符串 month = string.format("%02d", tonumber(month)) day = string.format("%02d", tonumber(day)) -- 組合格式化后的日期和原始時(shí)間部分 local formattedDateStr = string.format("%s-%s-%s", year, month, day) local formattedDateTime = string.format("%s %s", formattedDateStr, timeStr) return formattedDateStr end
— 示例使用
local date = “2024-03-25T16:00:00.000Z”
local formattedDate = DayFromat(date)
print(formattedDate) — 輸出: 2024-03-25
這個(gè)用戶部署了 Gungho系統(tǒng) ,而這個(gè)系統(tǒng)需要使用微信小程序。所以系統(tǒng)就會(huì)用到 gunghoAPI服務(wù)。(這個(gè)服務(wù)不是系統(tǒng)默認(rèn)安裝的服務(wù),需要手工單獨(dú)部署過)
這個(gè)服務(wù)部署后,我們客戶端怎樣去調(diào)用這個(gè)服務(wù),我們就可以通過定義一個(gè)自定義參數(shù)來描述 gunghoAPI的的 IP及端口,方便客戶端調(diào)用
配置過程如下
這樣,我們就定義了一個(gè)編號(hào)為 9001 的參數(shù)。 這個(gè)參數(shù)可以通過 lua腳本來獲取
nRet, strCanSu= mobox.getParameter(strLuaDEID, ‘9001’)
]]>
我們可以看到,excel第一行是分組行(項(xiàng)目基礎(chǔ)信息,P1,P2)
在P1 下面有 計(jì)劃日期;在P2下面也有 計(jì)劃日期 ,2個(gè)字段名稱是一樣的。我們做讀取數(shù)據(jù)的時(shí)候必須要依賴分組 P1、P2的定義才能區(qū)分
我們?cè)谧鰁xcel導(dǎo)入的時(shí)候,針對(duì)這類表格。我們需要如下處理
1、導(dǎo)入按鈕設(shè)置
2、在導(dǎo)入腳本的地方主要通過分組屬性來區(qū)分字段
Declare @strSQL as nvarchar(1024)Declare @strTable as nchar(19)Declare @nOrder as intDeclare @strTabOrder as nvarchar(3)Set @nOrder = 1While @nOrder < 1000BeginSet @strTabOrder = REPLACE( str( @nOrder, 3 ), N’ ‘, N’0’ )Set @strTable= N’OI_CROWD_C_MSG_T’ + @strTabOrder— 判斷數(shù)據(jù)表是否存在,不存在就結(jié)束IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[‘ + @strTable + ‘]’) AND OBJECTPROPERTY(id, N’IsUserTable’) = 1)RETURN— 執(zhí)行刪除記錄,刪除指定日期之前的記錄Set @strSQL = N’Delete ‘ + @strTable + N’ Where T_C5 < ”2017-10-07”’EXECUTE sp_executesql @strSQLSet @nOrder = @nOrder + 1End
]]>
— 20171220 以后用這個(gè)查詢,以前的用 showdbver20171226 – oldziduan.txt 查詢
— 使用前 請(qǐng)修改 老的數(shù)據(jù)庫名稱 目前用的是 OIOrg.dbo OIAm.dbo OIFile.dbo OIMobox.dbo (老庫用 DMS.dbo)
declare @OIOrgDBVer varchar(40)
declare @AMDBVer varchar(40)
declare @OIFileDBVer varchar(40)
declare @DMSDBVer varchar(40)
declare @CODEDBVer varchar(40)
declare @GunghoVer varchar(40)
declare @REMINDDBVer varchar(40)
declare @WMSDBVer varchar(40)
declare @ISSUEDBVer varchar(40)
declare @PRINTDBVer varchar(40)
select @OIOrgDBVer = ‘OIOrgDB ‘ +(select S_C1 from OIOrg.dbo.OI_ORG_DBVER) + ‘ New- 20230327’
select @AMDBVer = ‘AM8DB ‘ +(select S_C1 from OIAm.dbo.OI_STK_DBVER) + ‘ New- 20200327’
select @OIFileDBVer = ‘OIFileDB ‘ +(select S_C1 from OIFile.dbo.OI_FILE_DBVER) + ‘ New- 20151106’
select @DMSDBVer = ‘DMSDB ‘ +(select CN_S_DMS from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20240321’
select @GunghoVer = ‘GunghoDB ‘ +(select CN_S_GUNGHO from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20240516’
select @WMSDBVer = ‘WMSDB ‘ +(select CN_S_WMS from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20240419’
— select @ISSUEDBVer= ‘ISSUEDB ‘ +(select CN_S_ISSUE from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20171110’
select @PRINTDBVer = ‘PRINT ‘ +(select CN_S_PRINT from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20171110’
— select @CODEDBVer = ‘CODEDB ‘ +(select CN_S_CODE from OIMobox.dbo.OI_SYS_DBVER) + ‘ New- 20171110’
print ‘列出目前所有數(shù)據(jù)庫版本日期’
print @OIOrgDBVer
print @AMDBVer
print @OIFileDBVer
print @DMSDBVer
print ‘———————- Mobox3Ver 20240613’
print @GunghoVer
— print @CODEDBVer
print @WMSDBVer
— print @ISSUEDBVer
print @PRINTDBVer
]]>
— 功能:
— 3000 功能點(diǎn) 列出與某一個(gè)taskid相關(guān)的數(shù)據(jù)
— 若列出數(shù)據(jù)已經(jīng)有,將 新增 頁面按鈕屏蔽 (這個(gè)功能是做任務(wù)評(píng)測(cè)結(jié)果的,結(jié)果只能有一個(gè),不可能多個(gè))
————————————————————————–
json = require (“json”)
mobox = require (“OILua_JavelinExt”)function shownowtaskdata ( strLuaDEID )local nRet, strRetInfo local nType local strTaskID local bHidden=false local strClsID=""--拿到數(shù)據(jù)對(duì)象標(biāo)識(shí) nRet, strRetInfo = mobox.getCurEditExtInfo( strLuaDEID ) if ( nRet ~= 0 ) then mobox.error( strLuaDEID, "系統(tǒng)獲取擴(kuò)展屬性失敗 "..strRetInfo ) return end if ( strRetInfo =='' or strRetInfo==nil or strRetInfo=='{}' ) then mobox.error( strLuaDEID, "系統(tǒng)獲取擴(kuò)展屬性為空!" ) return end local extinfo = json.decode( strRetInfo ) strClsID=extinfo.cls_id -- 得到當(dāng)前cls的id ,下面操作需要— 獲取任務(wù)全局屬性 (這個(gè)案例是與 Gungho任務(wù)系統(tǒng)集成,所以需要這個(gè)參數(shù),別的環(huán)境這個(gè)可以忽略
nRet, strRetInfo = mobox.getGlobalAttr( strLuaDEID, “task_id” )
if ( nRet ~= 0 or strRetInfo == ” ) then
mobox.error( strLuaDEID, “系統(tǒng)無法獲取任務(wù)號(hào) “..strRetInfo )
return
end
local input_paramter = json.decode( strRetInfo )
local strTaskID = input_paramter[1].valuelocal strCondition strCondition = "G_TASK_ID='"..strTaskID.."'" --增加隱藏按鈕的依據(jù)-通過條件查詢返回符合數(shù)據(jù)>0 既隱藏 -- local strQeuryCondition="S_TESTITEM='X'" (定義grid某一個(gè)字段內(nèi)有某些數(shù)值 這里沒有啟用) nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, strClsID, strCondition) if (nRet ~= 0 ) then mobox.error(strLuaDEID, "得到數(shù)據(jù)數(shù)量失敗,原因:" .. strRetInfo) return end --轉(zhuǎn)為整數(shù)類型 local nDataCount = tonumber(strRetInfo) if (nDataCount >0) then bHidden=true end --隱藏頁面按鈕 “新增” local strHiddenButton = '' if (bHidden) then strHiddenButton = ',{"action_type":"hidden_button","value":[{"name":"新增"}]}' end local strAction = '[{"action_type":"set_query_condition","value":{"where":"' .. strCondition .. '","order":""}}' strAction = strAction .. strHiddenButton .. ']' mobox.setAction( strLuaDEID, strAction )end
這個(gè)列子也可以用于別的一些非法字符串的處理
]]>為了解決這個(gè)問題,我們可以編輯一個(gè)lua腳本,將這個(gè)數(shù)據(jù)做處理后再顯示(在顯示前事件里面定義這個(gè)lua腳本)
–[[? ? 功能說明:? ? ? ? 1) 顯示前做一些字段的處理? ? ? ? 2)前端導(dǎo)入,新增有換行符號(hào) %%3Cbr%%3E ,替換成 <br> 前端html支持的換行內(nèi)容? ? ? ? 3)內(nèi)容中有&,替換成 & 前端解析 &不支持,最好在輸入時(shí)進(jìn)行替換–]]json = require(“json”)mobox = require(“OILua_JavelinExt”)require(“oi_basestrfunc”)function BeforeGridShow(strLuaDEID)? ? local nRet, strRetInfo? ? local arobjs, attrs, success? ? — 獲取輸入的DataJson數(shù)據(jù)包? ? nRet, strRetInfo = mobox.getCurEditDataPacket(strLuaDEID)? ? if (nRet ~= 0) then? ? ? ? mobox.error(strLuaDEID, “無法獲取數(shù)據(jù)包!”)? ? ? ? return? ? end? ? if (strRetInfo == ” or strRetInfo == nil) then? ? ? ? return? ? end? ? — 解析數(shù)據(jù)包,數(shù)據(jù)包格式? ? — [{“id”:””,”attrs”:[{“attr”:””,”value”:””},..]},..]? ? local n, nCount? ? success, arobjs = pcall(json.decode, strRetInfo)? ? if (success == false) then? ? ? ? mobox.error(strLuaDEID, “非法的JSON格式!”)? ? ? ? return? ? end? ? nCount = #arobjs? ? if (nCount == 0) then? ? ? ? return? ? end? ? local obj, attrs? ? local nattr_count? ? local strRow, strAttr, strItem? ? local strDataJson? ? local id, strValue? ? local strAttrs? ? strDataJson = ‘[‘? ? local seg = {}? ? local nSegCount = 0? ? for n = 1, nCount do? ? ? ? obj = arobjs[n]? ? ? ? attrs = obj.attrs? ? ? ? nattr_count = #attrs? ? ? ? id = obj.id? ? ? ? strAttrs=”? ? ? ? — 開始過濾顯示數(shù)據(jù)對(duì)象屬性? ? ? ? for nIndex = 1, nattr_count do? ? ? ? ? ? strAttr = attrs[nIndex].attr? ? ? ? ? ? strValue = attrs[nIndex].value? ? ? ? ? ? strValue = strValue:gsub(“%%3Cbr%%3E”, “<br>”)? ? ? ? ? ? strValue = strValue:gsub(“&”, “&”)? ? ? ? ? ? strItem = ‘{“attr”:”‘ .. strAttr .. ‘”,”value”:”‘ .. strValue .. ‘”},’? ? ? ? ? ? strAttrs = strAttrs .. strItem? ? ? ? end? ? ? ? — 取消最后一個(gè),號(hào)? ? ? ? strAttrs = trim_laster_char(strAttrs)? ? ? ? strRow = ‘{“id”:”‘ .. id .. ‘”,”attrs”:[‘ .. strAttrs .. ‘]},’? ? ? ? strDataJson = strDataJson .. strRow? ? end? ? — 取消最后一個(gè),號(hào)? ? strDataJson = trim_laster_char(strDataJson)? ? strDataJson = strDataJson .. ‘]’? ? local strAction = ‘[{“action_type”:”reset_data_attr”,”value”:’ .. strDataJson .. ‘}]’? ? mobox.setAction(strLuaDEID, strAction)end
這個(gè)列子也可以用于別的一些非法字符串的處理
]]>這個(gè)是一個(gè)標(biāo)準(zhǔn)的導(dǎo)入模板 ,使用前可以通過修改 表名,字段名稱,字段中文名,字段對(duì)應(yīng)賦值變量名稱。
–[[
這個(gè)是一個(gè)標(biāo)準(zhǔn)的腳本,可以
1、修改里面的數(shù)據(jù)對(duì)象名稱 樣品技術(shù)參數(shù)
2、字段相關(guān)名稱(字段中文名、字段名稱、字段賦值變量名稱)
字段名稱? ? ? ? ? ? ? ? ? ? ? ? ? ? 字段中文名? ? ? ? ? 字段對(duì)應(yīng)賦值變量名
N_SN? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?序號(hào)? ? ? ? ? ? ? ? ? ? ?nSN
S_ITEM_NAME? ? ? ? ? ? ? ? ?名稱? ? ? ? ? ? ? ? ? ? ?strItemName
S_ITEM_M_S_N? ? ? ? ? ? ? ?型號(hào)_規(guī)格_數(shù)量? ?strItemMSN
S_ITEM_CODE? ? ? ? ? ? ? ? ?編號(hào)? ? ? ? ? ? ? ? ? ? ?strItemCode
S_MANUFACTURER? ? ? ? 生產(chǎn)單位? ? ? ? ? ? ? strFacturer
3、若字段不夠多,或太多,需要調(diào)整程序
4、里面的唯一性判斷是 task_id + S_ITEM_NAME + S_ITEM_CODE (需要根據(jù)情況調(diào)整)
–]]
功能說明:json = require(“json”)
mobox = require(“OILua_JavelinExt”)
require(“oi_basestrfunc”)
function ImportExcle(strLuaDEID)
local nRet, strRetInfo
local strPrjID = ”
local strTaskID = ”
— 獲取全局變量 prj_id, task_id
nRet, strRetInfo = mobox.getGlobalAttr( strLuaDEID, “task_id”,”prj_id” )
if ( nRet ~= 0 or strRetInfo == ” ) then
mobox.error( strLuaDEID, “系統(tǒng)無法獲取全局變量 “..strRetInfo )
return
end
local input_paramter = json.decode( strRetInfo )
strTaskID = input_paramter[1].value
strPrjID = input_paramter[2].value
if ( strTaskID == ” ) then
mobox.error( strLuaDEID, “必須要有項(xiàng)目及任務(wù)相關(guān)信息” )
return
end
— 獲取導(dǎo)入的單條數(shù)據(jù), 返回 {“id”:”xxx”,”attrs”:[{“attr”:”attr1″,”value”:”xxx1″},{“attr”:”attr2″,”value”:”xxx2″}, …]}
nRet, strRetInfo = mobox.getInputParameter(strLuaDEID)
if (nRet ~= 0 or strRetInfo == ” ) then
mobox.error(strLuaDEID, “無法獲取導(dǎo)入數(shù)據(jù)!”..strRetInfo)
return
end
local n, nCount, nValue
local strAddAttr = ”
local strAttr = ”
local strSetSQL = ”
— 一些關(guān)鍵屬性 (腳本 后期只需要改字段名稱就可以)
local nSN? ? ? ? ? ? ? ? ? ? ? ? ? ?— 對(duì)應(yīng) 序號(hào) N_SN
local strItemName = ”? ? ? ? — 對(duì)應(yīng) 名稱 S_ITEM_NAME
local strItemMSN = ”? ? ? ? ?— 對(duì)應(yīng) 型號(hào)_規(guī)格_數(shù)量 S_ITEM_M_S_N
local strItemCode = ”? ? ? ? ?— 對(duì)應(yīng) 編號(hào) S_ITEM_CODE
local strFacturer = ”? ? ? ? ? ? — 對(duì)應(yīng) 生產(chǎn)單位 S_MANUFACTURER
— 因?yàn)槊看螌?dǎo)入只傳一條記錄,所以當(dāng)前條寫入 prj_id 及 task_id
strAddAttr = strAddAttr .. ‘{“attr”:”G_TASK_ID”,”value”:”‘ .. strTaskID .. ‘”},’
strAddAttr = strAddAttr .. ‘{“attr”:”G_PRJ_ID”,”value”:”‘ .. strPrjID .. ‘”},’
local retJson =json.decode(strRetInfo)
local input_rows =retJson[“parameter”]
— 步驟1 獲取從excel導(dǎo)入的一行數(shù)據(jù),根據(jù)excel的列定義進(jìn)行屬性組合 strAddAttr
nCount = #input_rows
for n = 1, nCount do
strAttr = input_rows[n].attr
strValue = input_rows[n].value
— 根據(jù)導(dǎo)入的excel列頭名稱進(jìn)行判斷
— 關(guān)鍵屬性判斷
if (strAttr == “名稱”) then
if (strValue == ”) then
mobox.error(strLuaDEID, strAttr .. “不能為空!”)
return
end
strItemName = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”S_ITEM_NAME”,”value”:”‘ .. strItemName .. ‘”},’
— 常規(guī)屬性
elseif (strAttr == “序號(hào)”) then
nSN = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”N_SN”,”value”:”‘ .. nSN .. ‘”},’elseif (strAttr == “型號(hào)_規(guī)格_數(shù)量”) then
strItemMSN = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”S_ITEM_M_S_N”,”value”:”‘ .. strItemMSN .. ‘”},’elseif (strAttr == “編 號(hào)”) then
strItemCode= strValue
strAddAttr = strAddAttr .. ‘{“attr”:”S_ITEM_CODE”,”value”:”‘ .. strItemCode .. ‘”},’elseif (strAttr == “生產(chǎn)廠家”) then
strFacturer = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”S_MANUFACTURER”,”value”:”‘ .. strFacturer .. ‘”},’end
end
–去除最后一個(gè),
local strAddAttr1 = trim_laster_char(strAddAttr)— 步驟2 根據(jù) (名稱+編號(hào)+taskid) 來判斷導(dǎo)入的檢測(cè)數(shù)據(jù)是否已經(jīng)存在
— 如果已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋
— 如果不存在需要?jiǎng)?chuàng)建
local attrs
local strCondition = “S_ITEM_NAME='” .. strItemName .. “‘ and G_TASK_ID='”..strTaskID..”‘ and S_ITEM_CODE='” .. strItemCode.. “‘”
nRet, strRetInfo = mobox.existThisData(strLuaDEID, “樣品技術(shù)參數(shù)”, strCondition)
if (nRet ~= 0 ) thenmobox.error(strLuaDEID, “在檢查樣品技術(shù)參數(shù)是否存在時(shí)失敗! ” .. strRetInfo)
return
endif (strRetInfo == ‘yes’) then
— 已經(jīng)存在,根據(jù)導(dǎo)入的數(shù)據(jù)進(jìn)行覆蓋
strCondition = “S_ITEM_NAME='” .. strItemName .. “‘ and G_TASK_ID='”..strTaskID..”‘ and S_ITEM_CODE='” .. strItemCode.. “‘”
strSetSQL = “N_SN='” ..nSN.. “‘, S_ITEM_NAME = ‘” .. strItemName ..”‘ , S_ITEM_CODE ='” ..strItemCode .. “‘ , S_ITEM_M_S_N = ‘” .. strItemMSN ..”‘ “
nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, “樣品技術(shù)參數(shù)”, strCondition, strSetSQL)
if (nRet ~= 0) then
mobox.error(strLuaDEID, strRetInfo)
return
end
elseif (strRetInfo == ‘no’) then
— 創(chuàng)建 樣品技術(shù)參數(shù)
— mobox.writeSysLog(“strAddAttr1”, strAddAttr1)
strAddAttr1 = ‘[‘ .. strAddAttr1 .. ‘]’
mobox.writeSysLog(“strAddAttr2”, strAddAttr1)
nRet, strRetInfo = mobox.createDataObj(strLuaDEID, “樣品技術(shù)參數(shù)”, strAddAttr1)
if (nRet ~= 0) then
mobox.error(strLuaDEID, “創(chuàng)建樣品技術(shù)參數(shù)失敗! ” .. strRetInfo )
return
endend
end
function
]]>
我們?cè)趯?shí)施Gungho項(xiàng)目管理系統(tǒng)剛上線的時(shí)候,其實(shí)用戶手上有很多的歷史項(xiàng)目需要導(dǎo)入進(jìn)來。而且用戶的項(xiàng)目屬性與我們標(biāo)準(zhǔn)的項(xiàng)目屬性差異很大。為此,我們需要對(duì)Gungho的項(xiàng)目數(shù)據(jù)屬性進(jìn)行擴(kuò)延。而這個(gè)擴(kuò)延設(shè)置是在Mobox數(shù)據(jù)平臺(tái)來完成的。為此我們需要做2個(gè)事情:
給項(xiàng)目設(shè)置擴(kuò)展屬性,用于對(duì)用戶需求的適應(yīng)
需要將企業(yè)歷史項(xiàng)目清單一次性導(dǎo)入
因?yàn)?,我們是為Gungho的項(xiàng)目管理做配套,所以在mobox建立數(shù)據(jù)模型的時(shí)候,有類型需要選擇? ,業(yè)務(wù)類型必須是 “項(xiàng)目”
目的,定義適用企業(yè)個(gè)性需求的項(xiàng)目管理功能及界面
根據(jù)需求 自定義功能
根據(jù)需求,加入對(duì)應(yīng)腳本
方法一: ?(這個(gè)一般在mobox數(shù)據(jù)對(duì)象創(chuàng)建后事件調(diào)用)
Mobox 數(shù)據(jù)對(duì)象先創(chuàng)建 –》之后通過腳本生成Gungho的項(xiàng)目 –》得到Gungho項(xiàng)目的prj_id –》更新mobox數(shù)據(jù)對(duì)象的 G_PRJ_ID
local strPrjInfo
strPrjInfo = ‘{“type“:”漢和項(xiàng)目”,”name“:”‘ .. strPrjName .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”pm_login“:”‘ .. strPMID .. ‘”,”pm_name“:”‘ .. strPMName .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”pd_login“:”‘ .. strPDID .. ‘”,”pd_name“:”‘ .. strPDName .. ‘”,’
— type:定義了項(xiàng)目類型? ? ? ?name:項(xiàng)目名稱
strPrjInfo = strPrjInfo .. ‘”class_name“:”項(xiàng)目”,”obj_id“:”‘ .. strObjID .. ‘”,’
— class_name:數(shù)據(jù)對(duì)象名稱? obj_id:數(shù)據(jù)對(duì)象ID ,Mobox數(shù)據(jù)創(chuàng)建后獲取
strPrjInfo = strPrjInfo .. ‘”code“:”‘ .. strPrjCode .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”role“:[{“name”:”項(xiàng)目總監(jiān)”,”user”:[{“login”:”‘ .. strPDID .. ‘”,”name”:”‘ ..?strPDName .. ‘”}]}’ .. strPrjRoleMember .. ‘]}’
— code:項(xiàng)目編號(hào)? role:角色相關(guān)
— 向共好系統(tǒng)創(chuàng)建一個(gè)項(xiàng)目
nRet, strRetInfo = mobox.createProject(strLuaDEID, strPrjInfo)
— strRetInfo:返回的是gungho創(chuàng)建項(xiàng)目的ID (prj_id)
if (nRet ~= 0) then
mobox.error(strLuaDEID, strRetInfo)
return
end
— strRetInfo:這個(gè)要回寫Mobox數(shù)據(jù)對(duì)象的 G_PRJ_ID
— 得到prj_id 將信息寫入mobox數(shù)據(jù)對(duì)象的代碼,這里就不展現(xiàn)了
方法二: ?(這個(gè)一般在mobox數(shù)據(jù)對(duì)象的自定義事件入“項(xiàng)目導(dǎo)入”調(diào)用)
Gungho的項(xiàng)目所需的所有信息(包括擴(kuò)展信息)全部定義好,一次性創(chuàng)建Gungho及Mobox所有數(shù)據(jù)及其相關(guān)性
?strPrjInfo = ‘{“type”:”漢和項(xiàng)目”,”class_name”:”項(xiàng)目”,”name”:”‘ .. strPrjName .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”pm_login”:”‘ .. strPMID .. ‘”,”pm_name”:”‘ .. strPMName .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”pd_login”:”‘ .. strPDID .. ‘”,”pd_name”:”‘ .. strPDName .. ‘”,’
strPrjInfo = strPrjInfo .. ‘”code”:”‘ .. strPrjCode .. ‘”,’
— 拼接項(xiàng)目的角色屬性
strPrjInfo = strPrjInfo .. ‘”role”:[{“name”:”項(xiàng)目總監(jiān)”,”user”:[{“login”:”‘ .. strPDID .. ‘”,”name”:”‘ ..? strPDName .. ‘”}]}’ .. strPrjRoleMember .. ‘],’
— 拼接項(xiàng)目的擴(kuò)展項(xiàng)目屬性
strPrjInfo = strPrjInfo .. ‘”ext_obj_attr“:[‘ .. strAddAttr1 .. ‘]}’
— ext_obj_attr 項(xiàng)目創(chuàng)建的時(shí)候,帶擴(kuò)展屬性(strAddAttr1 變量事先拼接好了)
— 帶擴(kuò)展屬性,會(huì)同時(shí)將mobox數(shù)據(jù)對(duì)象及gungho的項(xiàng)目都創(chuàng)建起來,并關(guān)聯(lián)好
nRet, strRetInfo = mobox.createProject(strLuaDEID, strPrjInfo)
–strRetInfo 返回參數(shù) 為兩個(gè)GUID :項(xiàng)目ID ;
— 返回的內(nèi)容如:
— ‘{A52E97CF-BDBE-4EA7-AAD6-949AD5707BF3};{1CB2B481-CA23-42DB-B7A2-546C1EA05364}’