基本流程:
一、數據庫配置:
1、在通知單QMIH里添加一些檢測網值班日志字段。
二、頁面定義:
1、新建(5個tab頁面: LM111列表G、LM112編輯E、LM113交通檢修機具G+E、LM114次日工作計劃G+E、考勤)
列表:一個頁面LM111?
頁面維護:表名 (彈出框選擇對應數據庫中的表)
字典信息:更多操作--- 同步數據字典
三、系統管理-- 配置:
1、功能頁面組合--新建一個功能頁面
110111頁面-- 功能頁面 (關聯一些/WebGroup/lm/lm114.js)-- 配置tab頁面(G+E、G模式)-- 頁面明細(每個tab頁面對應的頁面序號以及設置改頁面的類型、tab頁面激活事件、與主表關系)
?
2、首先,系統管理-- 配置-- 功能菜單-- 檢測網檢修管理-- 值班日志-- 新建列表
3、新建時所要配置序號、父代碼、功能代碼、頁面位置/Bsf/Web/Form/MainForm.aspx?PKID=110111(對應的是功能頁面組合里的頁面)
lm113.cs 后臺代碼:
using
?System;
using
?System.Collections.Generic;
using
?System.Data;
using
?Bsf;
namespace
?EAM.WebGroup.LM
{
????
public
?
class
?
lm113
?:?
BI
????{
????????
public
?
override
?
string
?insertBefore(
DataRow
?drOld,?
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
Dictionary
<
string
,?
object
>?result?=?Json;
????????????
string
?WCQK_ID?=?Json[
"wcqk_id__lm113"
]?==?
null
???
string
.Empty?:?Json[
"wcqk_id__lm113"
].ToString();
????????????
string
?QMIH_ID?=?Json[
"qmih_id__lm113"
]?==?
null
???
string
.Empty?:?Json[
"qmih_id__lm113"
].ToString();
????????????
string
?MSKH_ID?=?Json[
"mskh_id__lm113"
]?==?
null
???
string
.Empty?:?Json[
"mskh_id__lm113"
].ToString();
????????????
string
?WCGZL?=?Json[
"wcgzl__lm113"
]?==?
null
???
string
.Empty?:?Json[
"wcgzl__lm113"
].ToString();
????????????
if
?(WCQK_ID?==?
string
.Empty)
????????????{
????????????????WCQK_ID?=?
Guid
.NewGuid().ToString().Replace(
"-"
,?
""
);
????????????????
string
[]?names?=?
new
?
string
[4];
????????????????
string
[]?values?=?
new
?
string
[4];
????????????????names[0]?=?
"WCQK_ID"
;
????????????????values[0]?=?WCQK_ID;
????????????????names[1]?=?
"QMIH_ID"
;
????????????????values[1]?=?QMIH_ID;
????????????????names[2]?=?
"MSKH_ID"
;
????????????????values[2]?=?MSKH_ID;
????????????????names[3]?=?
"WCGZL"
;
????????????????values[3]?=?WCGZL;
????????????????
return
?
Dal
.Update(
"WCQK"
,?WCQK_ID,?names,?values);
????????????}
????????????
else
????????????{
????????????????
DataSet
?ds?=?(
DataSet
)
Dal
.Initialization(
"wcqk"
,?
""
,?
string
.Format(
"WCQK_ID='{0}'"
,?WCQK_ID));
????????????????
if
?(ds.Tables[0].Rows.Count?>?0)
????????????????{
????????????????????ds.Tables[0].Rows[0][
"wcgzl"
]?=?WCGZL;
????????????????????
return
?
Dal
.Update(
"WCQK"
,?ds);
????????????????}
????????????????
return
?
"error"
;
????????????}
????????}
????}
}
lm114.cs:
using
?System.Collections.Generic;
using
?Bsf;
namespace
?EAM.WebGroup.LM
{
????
public
?
class
?
lm114
?:?
BI
????{
????????
public
?
override
?
string
?updateBefore(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
return
?BeforOperator(drOld,?drNew,?Json);
????????}
????????
public
?
override
?
string
?updateAfter(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
return
?AfterOperator(drOld,?drNew,?Json);
????????}
????????
//判斷數據數據的合法性
????????
public
?
override
?
string
?insertBefore(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
return
?BeforOperator(drOld,?drNew,?Json);
????????}
????????
public
?
override
?
string
?insertAfter(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
return
?AfterOperator(drOld,?drNew,?Json);
????????}
????????
private
?
string
?AfterOperator(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
//出勤人數=現員人數-病假人數-事假人數。
????????????
//出工人數=出勤人數-調休人數-其它人數。
????????????
//上網人數:?當天執行的第一種工作票上的總人數。
????????????
//出勤率=出勤人數/現員人數×100%。
????????????
//出工率=出工人數/出勤人數×100%。
????????????
//上網率=?上網人數/(工區現員數-病假人數-事假人數-出差人數-調休人數)×100%?。
????????????
string
?INDENTITY_ID?=?drNew[
"qmih_id"
].ToString();
????????????
string
?XYRS?=?Json[
"xyrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"xyrs__lm114"
].ToString();
????????????
string
?BJRS?=?Json[
"bjrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"bjrs__lm114"
].ToString();
????????????
string
?CGRS?=?Json[
"cgrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"cgrs__lm114"
].ToString();
????????????
string
?CCRS?=?Json[
"ccrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"ccrs__lm114"
].ToString();
????????????
string
?CQRS?=?Json[
"cqrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"cqrs__lm114"
].ToString();
????????????
string
?QTRS?=?Json[
"qtrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"qtrs__lm114"
].ToString();
????????????
string
?SJRS?=?Json[
"sjrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"sjrs__lm114"
].ToString();
????????????
string
?SWRS?=?Json[
"swrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"swrs__lm114"
].ToString();
????????????
string
?TXRS?=?Json[
"txrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"txrs__lm114"
].ToString();
????????????
int
?cqrs?=?
int
.Parse(XYRS)?-?
int
.Parse(BJRS)?-?
int
.Parse(SJRS);
????????????
int
?cgrs?=?cqrs?-?
int
.Parse(TXRS)?-?
int
.Parse(QTRS);
????????????
double
?swl?=?(
double
.Parse(SWRS)?/?(
int
.Parse(XYRS)?-?
int
.Parse(BJRS)?-?
int
.Parse(TXRS)?-?
int
.Parse(SJRS)?-?
int
.Parse(CCRS)))?*?100;
????????????
double
?cql?=?((
double
)cqrs?/?
double
.Parse(XYRS))?*?100;
????????????
double
?cgl?=?((
double
)cgrs?/?cgrs)?*?100;
????????????
string
[]?names?=?
new
?
string
[4];
????????????
string
[]?values?=?
new
?
string
[4];
????????????names[0]?=?
"SWL"
;
????????????values[0]?=?swl.ToString(
"##.##"
)?+?
"%"
;
????????????names[1]?=?
"CQL"
;
????????????values[1]?=?cql.ToString(
"##.##"
)?+?
"%"
;?;
????????????names[2]?=?
"CGL"
;
????????????values[2]?=?cgl.ToString(
"##.##"
)?+?
"%"
;
????????????names[3]?=?
"CQRS"
;
????????????values[3]?=?(
int
.Parse(XYRS)?-?
int
.Parse(BJRS)?-?
int
.Parse(SJRS)).ToString();
????????????
Dal
.Update(
"rztable"
,?drNew[
"RZTABLE_ID"
].ToString(),?names,?values);
????????????
return
?
"e|reloadRZTABLE('"
?+?INDENTITY_ID?+?
"')"
;
????????}
????????
private
?
string
?BeforOperator(System.Data.
DataRow
?drOld,?System.Data.
DataRow
?drNew,?
Dictionary
<
string
,?
object
>?Json)
????????{
????????????
string
?INDENTITY_ID;
????????????
if
?(drNew?==?
null
)?{?INDENTITY_ID?=?Json[
"qmih_id__lm114"
].ToString();?}
????????????
else
?{?INDENTITY_ID?=?drNew[
"qmih_id"
].ToString();?}
????????????
string
?XYRS?=?Json[
"xyrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"xyrs__lm114"
].ToString();
????????????
string
?BJRS?=?Json[
"bjrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"bjrs__lm114"
].ToString();
????????????
string
?CGRS?=?Json[
"cgrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"cgrs__lm114"
].ToString();
????????????
string
?CCRS?=?Json[
"ccrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"ccrs__lm114"
].ToString();
????????????
string
?CQRS?=?Json[
"cqrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"cqrs__lm114"
].ToString();
????????????
string
?QTRS?=?Json[
"qtrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"xyrs__lm114"
].ToString();
????????????
string
?SJRS?=?Json[
"sjrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"sjrs__lm114"
].ToString();
????????????
string
?SWRS?=?Json[
"swrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"swrs__lm114"
].ToString();
????????????
string
?TXRS?=?Json[
"txrs__lm114"
]?==?
null
???
string
.Empty?:?Json[
"txrs__lm114"
].ToString();
????????????
if
?(XYRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入現員人數"
;
????????????}
????????????
if
?(BJRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入病假人數"
;
????????????}
????????????
if
?(SJRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入事假人數"
;
????????????}
????????????
if
?(CCRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入出差人數"
;
????????????}
????????????
if
?(TXRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入調休人數"
;
????????????}
????????????
if
?(QTRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入其他人數"
;
????????????}
????????????
if
?(SWRS?==?
string
.Empty)
????????????{
????????????????
return
?
"請輸入上網人數"
;
????????????}
????????????
//出勤人數
????????????
int
?cqrs;
????????????
//出勤人數數值的檢測
????????????
if
?(
int
.Parse(XYRS)?>?
int
.Parse(BJRS)?&&?
int
.Parse(XYRS)?-?
int
.Parse(BJRS)?-?
int
.Parse(SJRS)?>?0)
????????????{
????????????????cqrs?=?
int
.Parse(XYRS)?-?
int
.Parse(BJRS)?-?
int
.Parse(SJRS);
????????????}
????????????
else
????????????{
????????????????
return
?
"數值范圍有誤"
;
????????????}
????????????
if
?(
double
.Parse(XYRS)?!=?0)
????????????{
????????????????
double
?swl?=?(
double
.Parse(SWRS)?/?(
double
.Parse(XYRS)?-?
double
.Parse(BJRS)?-?
double
.Parse(TXRS)))?*?100;
????????????}
?????????
????????????
else
????????????{
????????????????
return
?
"除數不能為零"
;
????????????}
????????????
return
?
base
.insertBefore(drOld,?drNew,?Json);
????????}
????}
}
lm.js:
function
?loadRZTABLE()?{
????
var
?record?=?myApp.rcRecord(
'lm111'
);
????
var
?para?=?
"upper(qmih_id)?='"
?+?record.data[
'qmih_id__lm111'
].toUpperCase()?+?
"'"
;
????
var
?store?=?myApp.rcFormStore(
'lm114'
);
????store.reload({?params:?{?start:?0,?limit:?1,?pkid:?
'lm114'
,?para:?para,?filter:?
''
?},?callback:?
function
?()?{
????????
if
?(store.data.length?==?0)?{
????????????
var
?newrecord?=?myApp.createNewRecord(
'lm114'
,?
'qmih_id'
);
????????????myApp.rcForm(
'lm114'
).loadRecord(newrecord);
????????}
????????
else
?{
????????????myApp.rcForm(
'lm114'
).loadRecord(store.data.items[0]);
????????}
????}
????});
}
function
?reloadRZTABLE(qmih_id)?{
????
var
?para?=?
"upper(qmih_id)?='"
?+?qmih_id.toUpperCase()?+?
"'"
;
????
var
?store?=?myApp.rcFormStore(
'lm114'
);
????store.reload({?params:?{?start:?0,?limit:?1,?pkid:?
'lm114'
,?para:?para,?filter:?
''
?},?callback:?
function
?()?{
????????myApp.rcForm(
'lm114'
).loadRecord(store.data.items[0]);
????}
????});
}
//新增代碼后(設置默認值)
SetDefault_lm113?=?
function
?(rec)?{
????
var
?qmih_id?=?myApp.rcRecord(
"lm111"
).data[
"qmih_id__lm111"
];
????rec.data[
"qmih_id__lm113"
]?=?qmih_id;
}
isNew_lm114?=?
function
?()?{
????MessageBox(
"警告"
,?
"該處不允許此操作!"
);
????
return
?
false
;
}
isDelete_lm114?=?
function
?()?{
????MessageBox(
"警告"
,?
"該處不允許此操作!"
);
????
return
?
false
;
}
?