基本流程:
一、数据库配置:
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
;
}