2015-8-27浦东环监项目-相关性配置记录
在static table下面的 TEST_MANAGER下面
表名:DATA_RELATION_CHECK |
|
字段名; |
描述: |
DATALC_NAME |
相关性配置的名字 |
DATALC_DESCRIPTION |
相关性配置的描述 |
DATALC_DATE |
公式更改的日期 |
DATALC_CALCNAME |
公式的名字,和CALCS_ACTIONS中的CALCDESC对应 |
DATALC_CALCUL |
公式内容,和CALCS_ACTIONS的CALCUL对应 |
|
|
Form
主Form, DataRelationCheck。
添加公式Form, AddDLCheck
编辑公式Form, Dlc_CalcName
Server Script:
- ADD_DLCheck 功能:添加公式,可以返回origrec定位
1 :PARAMETERS DLCName , DLCDesription; 2 3 :DEFAULT DLCName ,"1" ; 4 :DEFAULT DLCDesription ,"2"; 5 6 :DECLARE strSql ,bSuccess , cSuccess; 7 8 strSql :="insert into DATA_RELATION_CHECK (DATALC_NAME, DATALC_DESCRIPTION) 9 values (?DLCName?,?DLCDesription?)"; 10 11 bSuccess := SQLEXECUTE(strSql); 12 13 :IF(bSuccess); 14 cSuccess := sqlexecute("select ORIGREC 15 from DATA_RELATION_CHECK 16 where DATALC_NAME = ?DLCName?"); 17 :RETURN {.T.,cSuccess[1,1]}; 18 :ELSE; 19 :RETURN {.F.}; 20 :ENDIF;
- SS_UpdateDLCTime 功能:在公式更新时,日期更新操作
1 :PARAMETERS ORIGREC; 2 3 :DEFAULT ORIGREC,"3"; 4 5 :DECLARE StrSql, bSuccess; 6 7 StrSql :=" update DATA_RELATION_CHECK 8 set DATALC_DATE = getdate() 9 where ORIGREC = ?ORIGREC?"; 10 11 bSuccess := sqlexecute(StrSql); 12 :RETURN bSuccess;
-
DLCName_Check 功能:查询要添加的名字是否已经存在
1 :PARAMETERS DLCNAME ; 2 3 :DEFAULT DLCNAME,"11"; 4 5 :DECLARE strSql, bSuccess; 6 7 strSql := " select ORIGREC 8 from DATA_RELATION_CHECK 9 where DATALC_NAME =?DLCNAME?"; 10 11 bSuccess := SqlExecute(strSql); 12 13 :IF .not. empty(bSuccess) .and. len(bSuccess) > 0 ; 14 :RETURN .T.; 15 :ELSE; 16 :RETURN .F.; 17 :ENDIF;
- SS_Update_Calculation 功能:更新操作,实现自动增加公式标示
1 :PARAMETERS CalcName, Calculation, origrec, CALCDESC; 2 :DEFAULT CalcName, ""; 3 :DEFAULT Calculation, ""; 4 :DEFAULT origrec, -1; 5 :DEFAULT CALCDESC, ""; 6 7 :DECLARE CalcNames, CurrCalcName,CurrTestCodeAnalyte,CurrTestCode,CurrAnalyte,anaTestCode,testAnalyte,analyteMethod; 8 9 /*region add/update calculation; 10 :IF Empty(CALCDESC); 11 :IF Empty(CalcName); 12 CalcNames := SqlExecute("select Max(CALCNAME) from CALCS_ACTIONS where CALCNAME like 'CALC%'"); 13 14 //如果是全新的,表格为空,则设置初始值为CALC-00001 15 :IF Empty(CalcNames[1,1]); 16 CurrCalcName := "CALC-" + "00001"; 17 :ELSE; 18 //Right(取最右边的几个字符) 19 CurrCalcName := Val(Right(CalcNames[1,1], 5)) + 1;//val()基本意思是将字符串类型转换为数字类型 20 CurrCalcName := "CALC-" + StrZero(CurrCalcName, 5, 0); 21 :ENDIF; 22 SqlExecute("insert into CALCS_ACTIONS (CALCNAME, CALCUL, CALCDESC, FROMDATE) 23 values (?CurrCalcName?, ?Calculation?, ?CurrCalcName?, ?Today()?)"); 24 25 SqlExecute("update DATA_RELATION_CHECK set DATALC_CALCNAME = ?CurrCalcName? where ORIGREC = ?origrec?"); 26 27 :ELSE; 28 SqlExecute("update CALCS_ACTIONS set CALCUL = ?Calculation? where CALCNAME = ?CalcName?"); 29 SqlExecute("update DATA_RELATION_CHECK set DATALC_CALCUL = ?Calculation? where DATALC_CALCNAME = ?CalcName?"); 30 :ENDIF; 31 :ELSE; 32 CalcNames := SqlExecute("select Max(CALCNAME) from CALCS_ACTIONS where CALCNAME Like 'CALC%'"); 33 34 CurrCalcName := Val(Right(CalcNames[1,1], 5)) + 1; 35 CurrCalcName := "CALC-" + StrZero(CurrCalcName, 5, 0); 36 37 SqlExecute("insert into CALCS_ACTIONS (CALCNAME, CALCDESC, CALCUL,FROMDATE) 38 select ?CurrCalcName?, ?CALCDESC?, CALCUL,?Today()? 39 from CALCS_ACTIONS 40 where ORIGREC = (select max(ORIGREC) 41 from CALCS_ACTIONS 42 where CALCDESC=?CALCDESC?)"); 43 SqlExecute("update DATA_RELATION_CHECK set DATALC_CALCUL = ?Calculation? where DATALC_CALCNAME = ?CalcName?"); 44 SqlExecute("update DATA_RELATION_CHECK set DATALC_CALCNAME = ?CurrCalcName? where ORIGREC = ?origrec?"); 45 :ENDIF; 46 47 :RETURN CurrCalcName;
Data Sources:
- DS_GET_DLCheck 功能:获取新建表格的数据。