国产美女一级A作爱在线,国产污污污十八 在线精品观看,久久国产丝袜视频,国产网曝门99视频在线看 http://www.zhangjiangyi.com PDM產(chǎn)品數(shù)據(jù)管理軟件、項(xiàng)目管理系統(tǒng) Sun, 22 Jun 2025 02:12:37 +0000 zh-Hans hourly 1 https://wordpress.org/?v=6.8.3 http://www.zhangjiangyi.com/wp-content/uploads/2022/11/cropped-plmico512-32x32.png 腳本 – 共好plm系統(tǒng) http://www.zhangjiangyi.com 32 32 SQLServer數(shù)據(jù)庫(kù)安全漏洞的防護(hù)(最重要一步) http://www.zhangjiangyi.com/3183/ Sun, 22 Jun 2025 01:46:03 +0000 http://www.zhangjiangyi.com/?p=3183 SQLServer數(shù)據(jù)庫(kù)安全漏洞攻擊思路

1.以管理員身份運(yùn)行數(shù)據(jù)庫(kù)服務(wù)

2.已經(jīng)獲得SQL數(shù)據(jù)庫(kù)的sysadmin權(quán)限

3.可以連接數(shù)據(jù)庫(kù)

SQLserver 的核心漏洞:MSSQL提權(quán)的關(guān)鍵是利用xp-cmdshell這個(gè)存儲(chǔ)過(guò)程

SQLServer 數(shù)據(jù)庫(kù)漏洞安全防護(hù)最基本的調(diào)整

考慮安全,一般可以禁用 sa 賬號(hào);連接數(shù)據(jù)庫(kù)的賬號(hào)密碼的強(qiáng)度也要足夠

一)禁用 xp_cmdshell

— 1. 查看 xp_cmdshell 是否啟用 (若 run_value 為 1 表示已啟用,為 0 表示已禁用

EXEC sp_configure ‘show advanced options’, 1;

RECONFIGURE;

EXEC sp_configure ‘xp_cmdshell’;


— 1) 啟用高級(jí)選項(xiàng)(若未啟用)

EXEC sp_configure ‘show advanced options’, 1;

RECONFIGURE;

— 2) 禁用 xp_cmdshell

EXEC sp_configure ‘xp_cmdshell’, 0;

RECONFIGURE;


二)禁用 xp_regwrite

USE master;

GO

— 撤銷(xiāo) PUBLIC 角色對(duì) xp_regwrite 的執(zhí)行權(quán)限

DENY EXECUTE ON xp_regwrite TO PUBLIC;

GO


三)禁用 Ole Automation Procedures

EXEC sp_configure ‘show advanced options’, 1;

RECONFIGURE; — 立即生效

GO

EXEC sp_configure ‘Ole Automation Procedures’, 0;

RECONFIGURE; — 立即生效

GO


最后: 重啟 sqlserver

 

]]>
mobox3 格式化日期 http://www.zhangjiangyi.com/3144/ Thu, 16 Jan 2025 07:04:46 +0000 http://www.zhangjiangyi.com/?p=3144  

–[[ 格式日期 2024-03-25T16:00:00.000Z 格式化為 2024-03-25?]]

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

]]>
mobox3自定義參數(shù)的定義及獲取 http://www.zhangjiangyi.com/3084/ Sun, 08 Sep 2024 06:42:31 +0000 http://www.zhangjiangyi.com/?p=3084 mobox3運(yùn)行過(guò)程中系統(tǒng)可以定義很多運(yùn)行參數(shù)。這種運(yùn)行參數(shù)可以匹配企業(yè)個(gè)性化需求。在這個(gè)基礎(chǔ)上mobox3開(kāi)放了一些非系統(tǒng)參數(shù)自定義配置方式。舉例

這個(gè)用戶(hù)部署了 Gungho系統(tǒng) ,而這個(gè)系統(tǒng)需要使用微信小程序。所以系統(tǒng)就會(huì)用到 gunghoAPI服務(wù)。(這個(gè)服務(wù)不是系統(tǒng)默認(rèn)安裝的服務(wù),需要手工單獨(dú)部署過(guò))

這個(gè)服務(wù)部署后,我們客戶(hù)端怎樣去調(diào)用這個(gè)服務(wù),我們就可以通過(guò)定義一個(gè)自定義參數(shù)來(lái)描述 gunghoAPI的的 IP及端口,方便客戶(hù)端調(diào)用

配置過(guò)程如下

這樣,我們就定義了一個(gè)編號(hào)為 9001 的參數(shù)。 這個(gè)參數(shù)可以通過(guò) lua腳本來(lái)獲取

lua 獲取自定義編號(hào)的參數(shù)定義

nRet, strCanSu= mobox.getParameter(strLuaDEID, ‘9001’)

 

]]>
mobox3對(duì)excel導(dǎo)入(表頭帶分組) http://www.zhangjiangyi.com/3079/ Thu, 05 Sep 2024 07:26:12 +0000 http://www.zhangjiangyi.com/?p=3079 mobox3對(duì)excel數(shù)據(jù)導(dǎo)入是一個(gè)非常重要的及常見(jiàn)的工作。但用戶(hù)為了excel更直觀,有可能會(huì)對(duì)excel表頭設(shè)置分組。參考下圖

我們可以看到,excel第一行是分組行(項(xiàng)目基礎(chǔ)信息,P1,P2)

在P1 下面有 計(jì)劃日期;在P2下面也有 計(jì)劃日期 ,2個(gè)字段名稱(chēng)是一樣的。我們做讀取數(shù)據(jù)的時(shí)候必須要依賴(lài)分組 P1P2的定義才能區(qū)分

我們?cè)谧鰁xcel導(dǎo)入的時(shí)候,針對(duì)這類(lèi)表格。我們需要如下處理

1、導(dǎo)入按鈕設(shè)置

 

2、在導(dǎo)入腳本的地方主要通過(guò)分組屬性來(lái)區(qū)分字段

?if (strAttr == ‘計(jì)劃日期’) then
?strValue = ProcessDayTimeStr(strValue) –日期格式轉(zhuǎn)換
?if (ext_col_info[1]==”P0″) then? ? ? ? ? — 判斷是哪個(gè)分組的
strP0 = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”D_PX”,”value”:”‘ .. strP0 .. ‘”},’
elseif (ext_col_info[1] == ‘P1’) then
strP1 = strValue
strAddAttr = strAddAttr .. ‘{“attr”:”D_P1″,”value”:”‘ .. strP1 .. ‘”},’
end
end
]]>
AM群消息歷史記錄服務(wù)器端清理 http://www.zhangjiangyi.com/2903/ Mon, 01 Jul 2024 04:11:03 +0000 http://www.zhangjiangyi.com/?p=2903 AM群消息默認(rèn)是永久保留,但數(shù)據(jù)過(guò)大后可能會(huì)影響速度。我們可以分析一下要保留的年限,按需要可以對(duì)群消息記錄做一下清理操作

Declare @strSQL as nvarchar(1024)
Declare @strTable as nchar(19)
Declare @nOrder as int
Declare @strTabOrder as nvarchar(3)
Set @nOrder = 1
While @nOrder < 1000
Begin
Set @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 @strSQL
Set @nOrder = @nOrder + 1
End
腳本里面的 ”2017-10-07”’ ,是需要自己改的,意思是清理掉這個(gè)日期之前的記錄

 

]]>
Mobox數(shù)據(jù)庫(kù)版本的查看 http://www.zhangjiangyi.com/2875/ Thu, 20 Jun 2024 01:45:06 +0000 http://www.zhangjiangyi.com/?p=2875 Mobox數(shù)據(jù)庫(kù)版本的查看

— 20171220 以后用這個(gè)查詢(xún),以前的用 showdbver20171226 – oldziduan.txt 查詢(xún)

— 使用前 請(qǐng)修改 老的數(shù)據(jù)庫(kù)名稱(chēng) 目前用的是 OIOrg.dbo OIAm.dbo OIFile.dbo OIMobox.dbo (老庫(kù)用 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ù)庫(kù)版本日期’
print @OIOrgDBVer
print @AMDBVer
print @OIFileDBVer
print @DMSDBVer
print ‘———————- Mobox3Ver 20240613’
print @GunghoVer
— print @CODEDBVer
print @WMSDBVer
— print @ISSUEDBVer
print @PRINTDBVer

 

]]>
Mobox 3000功能點(diǎn)頁(yè)面按鈕隱藏的lua實(shí)現(xiàn)方法 http://www.zhangjiangyi.com/2590/ Thu, 18 Apr 2024 03:06:07 +0000 http://www.zhangjiangyi.com/?p=2590 需求,我們有一個(gè)任務(wù)執(zhí)行后,需要對(duì)這個(gè)任務(wù)做后做評(píng)價(jià)。為此與任務(wù)系統(tǒng)集成通過(guò)3000功能點(diǎn)定義了一個(gè)任務(wù)評(píng)分的功能點(diǎn)。任務(wù)評(píng)分后,不能通過(guò)新增,對(duì)這個(gè)任務(wù)再次增加一個(gè)評(píng)分。因此第一個(gè)任務(wù)評(píng)分后,需要將頁(yè)面按鈕(新增)隱藏掉

腳本列子

— 功能:
— 3000 功能點(diǎn) 列出與某一個(gè)taskid相關(guān)的數(shù)據(jù)
— 若列出數(shù)據(jù)已經(jīng)有,將 新增 頁(yè)面按鈕屏蔽 (這個(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ú)法獲取任務(wù)號(hào) “..strRetInfo )
return
end
local input_paramter = json.decode( strRetInfo )
local strTaskID = input_paramter[1].value

local strCondition
strCondition = "G_TASK_ID='"..strTaskID.."'"

--增加隱藏按鈕的依據(jù)-通過(guò)條件查詢(xún)返回符合數(shù)據(jù)>0 既隱藏
-- local strQeuryCondition="S_TESTITEM='X'" (定義grid某一個(gè)字段內(nèi)有某些數(shù)值 這里沒(méi)有啟用)
nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, strClsID, strCondition)
if (nRet ~= 0 ) then
    mobox.error(strLuaDEID, "得到數(shù)據(jù)數(shù)量失敗,原因:" .. strRetInfo)
    return
end

--轉(zhuǎn)為整數(shù)類(lèi)型
local nDataCount = tonumber(strRetInfo)
if (nDataCount >0) then
    bHidden=true
end

--隱藏頁(yè)面按鈕 “新增”
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è)列子也可以用于別的一些非法字符串的處理
]]>
lua 對(duì)回車(chē)(%3Cbr%3E)處理方法 http://www.zhangjiangyi.com/2537/ Thu, 11 Apr 2024 05:02:28 +0000 http://www.zhangjiangyi.com/?p=2537 我們?cè)贕ird列出數(shù)據(jù)的時(shí)候,若數(shù)據(jù)內(nèi)帶%3Cbr%3E,其實(shí)是回車(chē)的意思,若grid讀出數(shù)據(jù)不做任何處理,那么就會(huì)影響系統(tǒng)表達(dá)

為了解決這個(gè)問(wèn)題,我們可以編輯一個(gè)lua腳本,將這個(gè)數(shù)據(jù)做處理后再顯示(在顯示前事件里面定義這個(gè)lua腳本)

腳本列子

–[[
? ? 功能說(shuō)明:
? ? ? ? 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, “無(wú)法獲取數(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=”
? ? ? ? — 開(kāi)始過(guò)濾顯示數(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è)列子也可以用于別的一些非法字符串的處理
]]>
SQLServer 2008 以上版本數(shù)據(jù)庫(kù)日志清理(親測(cè)) http://www.zhangjiangyi.com/2393/ Sun, 24 Mar 2024 07:54:25 +0000 http://www.zhangjiangyi.com/?p=2393 當(dāng)數(shù)據(jù)庫(kù)的日志文件太大的情況下,SQLServer 2008 以上版本進(jìn)行數(shù)據(jù)庫(kù)日志清理,需要采用的方法如下(執(zhí)行前 將數(shù)據(jù)庫(kù)名 改成你需要清理的數(shù)據(jù)名稱(chēng))


–1)查詢(xún)指定數(shù)據(jù)庫(kù)的 <數(shù)據(jù)庫(kù)日志文件名稱(chēng)>? ,通過(guò)下面的sql的語(yǔ)句查詢(xún)到<數(shù)據(jù)庫(kù)日志文件名稱(chēng)>,替換到下面sql的<數(shù)據(jù)庫(kù)日志文件名稱(chēng)>
USE [數(shù)據(jù)庫(kù)名]
GO
SELECT name FROM SYS.database_files WHERE type_desc=’LOG’

–2)執(zhí)行后清理該數(shù)據(jù)庫(kù)日志文件
USE [master]
GO
ALTER DATABASE [數(shù)據(jù)庫(kù)名] SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [數(shù)據(jù)庫(kù)名] SET RECOVERY SIMPLE
GO
USE [數(shù)據(jù)庫(kù)名]
GO
DBCC SHRINKFILE (N’數(shù)據(jù)庫(kù)日志文件名稱(chēng)‘ , 0,TRUNCATEONLY)
GO
USE [master]
GO
ALTER DATABASE [數(shù)據(jù)庫(kù)名] SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE [數(shù)據(jù)庫(kù)名] SET RECOVERY FULL
GO
]]>
Gungho任務(wù)二次開(kāi)發(fā)-任務(wù)分類(lèi)集成3000功能的擴(kuò)展屬性excel導(dǎo)入 http://www.zhangjiangyi.com/2176/ Mon, 26 Feb 2024 05:43:40 +0000 http://www.zhangjiangyi.com/?p=2176 Gungho任務(wù)二次開(kāi)發(fā)-任務(wù)分類(lèi)集成3000功能的清單導(dǎo)入

這個(gè)是一個(gè)標(biāo)準(zhǔn)的導(dǎo)入模板 ,使用前可以通過(guò)修改 表名,字段名稱(chēng),字段中文名,字段對(duì)應(yīng)賦值變量名稱(chēng)。

–[[

這個(gè)是一個(gè)標(biāo)準(zhǔn)的腳本,可以

1、修改里面的數(shù)據(jù)對(duì)象名稱(chēng) 樣品技術(shù)參數(shù)

2、字段相關(guān)名稱(chēng)(字段中文名、字段名稱(chēng)、字段賦值變量名稱(chēng))

字段名稱(chēng)? ? ? ? ? ? ? ? ? ? ? ? ? ? 字段中文名? ? ? ? ? 字段對(duì)應(yīng)賦值變量名

N_SN? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?序號(hào)? ? ? ? ? ? ? ? ? ? ?nSN

S_ITEM_NAME? ? ? ? ? ? ? ? ?名稱(chēng)? ? ? ? ? ? ? ? ? ? ?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)整)

–]]

功能說(shuō)明: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)無(wú)法獲取全局變量 “..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, “無(wú)法獲取導(dǎo)入數(shù)據(jù)!”..strRetInfo)

return

end

local n, nCount, nValue

local strAddAttr = ”

local strAttr = ”

local strSetSQL = ”

— 一些關(guān)鍵屬性 (腳本 后期只需要改字段名稱(chēng)就可以)

local nSN? ? ? ? ? ? ? ? ? ? ? ? ? ?— 對(duì)應(yīng) 序號(hào) N_SN

local strItemName = ”? ? ? ? — 對(duì)應(yīng) 名稱(chē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)前條寫(xiě)入 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列頭名稱(chēng)進(jìn)行判斷

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

if (strAttr == “名稱(chēng)”) 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ù) (名稱(chēng)+編號(hào)+taskid) 來(lái)判斷導(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 ) then

mobox.error(strLuaDEID, “在檢查樣品技術(shù)參數(shù)是否存在時(shí)失敗! ” .. strRetInfo)

return
end

if (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
end

end
end

 

function
]]>
国产性高爱潮有声视频免费,无码国产精品午夜不卡,国产在线一级特黄aa大片,国产AV永久无码天堂影院