Dim cmd As New SQLCommand
Dim val, val00, val11, val22 , val33, val44 , val55, val66, val77 As Double
Dim val1 , val2 , val3 As Integer
cmd.Con nec tio nName = "主数据源" '记得设置数据源名称
cmd.CommandText = "Se lect 项目,标准,活动名称,案件名称,卷宗名称,资料名称,评查活动id,评查案件id,材料id,卷宗id,一piao否决,案件阶段,评分,guid,细则,分值类型,评分人 From {评查资料评分明细} where 评查活动id is not null "
Dim dt As DataTable = cmd.ExecuteReader
Dim dt1 As DataTable
Dim ja As New JArray
For Each ss As String() In dt.getvalues("评查活动id|评查案件id|活动名称|案件名称|评分人")
Dim jo As New JObject
jo("评查活动id") = ss(0)
jo("评查案件id") = ss(1)
jo("案件名称") = ss(3)
jo("活动名称") = ss(2)
jo("评分人") = ss(4)
cmd.CommandText = "Sel ec t count(guid) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "' and 一piao否决='是'"
val1 = cmd.ExecuteScalar()
jo("一piao否决数") = val1
cmd.CommandText = "S el e ct 活动名称,开始日期,结束日期,评查人员 From {评查活动} where guid='" & ss(0) & "'"
dt1 = cmd.ExecuteReader
For Each pchd As String() In dt1.getvalues("活动名称|开始日期|结束日期|评查人员")
jo("活动名称") = pchd(0)
jo("开始日期") = pchd(1)
jo("结束日期") = pchd(2)
jo("评查人员") = pchd(3)
cmd.CommandText = "Se le ct 姓名 From {评查活动评查人员} where 评查活动id='" & ss(0) & "'"
dt1 = cmd.ExecuteReader
For Each pcry As String In dt1.getvalues("姓名")
cmd.CommandText = "Se l ect count(*) From {评查活动评查人员} where 评查活动id='" & ss(0) & "'"
val2 = cmd.ExecuteScalar()
jo("评查人数") = val2
Next
Next
cmd.CommandText = "Sel e ct 案件名称 From {评查活动案件} where 活动id='" & ss(0) & "'"
dt1 = cmd.ExecuteReader
Dim s As String
s = dt1.GetComboListString("案件名称")
jo("案件id集合") = s.Replace("|", ",")
cmd.CommandText = "S el ec t count(*) From {评查活动案件} where 活动id='" & ss(0) & "'"
val3 = cmd.ExecuteScalar()
jo("案件数量") = val3
For Each ss22 As String In dt.getvalues("标准", "评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'")
cmd.CommandText = "S ele ct sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "' and 一piao否决='否' and 标准='" & ss22 & "'"
val55 = cmd.ExecuteScalar()
jo("【标准】" + ss22 + "得分") = val55
For Each ss33 As String In dt.getvalues("项目", "标准='" & ss22 & "' and 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'")
cmd.CommandText = "Sel e ct sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "' and 一piao否决='否' and 标准='" & ss22 & "'and 项目='" & ss33 & "'"
val66 = cmd.ExecuteScalar()
jo("【项目】" + ss33 + "得分") = val66
For Each ss44 As String In dt.getvalues("细则", "标准='" & ss22 & "' and 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'and 项目='" & ss33 & "'")
cmd.CommandText = "Se le ct Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "' and 一piao否决='否' and 标准='" & ss22 & "'and 项目='" & ss33 & "'and 细则='" & ss44 & "'"
val77 = cmd.ExecuteScalar()
jo("【细则】" + ss44 + "得分") = val77
Next
Next
Next
cmd.CommandText = "Se lec t Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'"
val00 = cmd.ExecuteScalar()
jo("评分总分") = val00
cmd.CommandText = "Sel e ct Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'and 案件阶段='审查调查阶段'"
val11 = cmd.ExecuteScalar()
jo("审查调查总分") = val11
jo("审查调查得分") = 50 - val11
cmd.CommandText = "Sel e ct Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'and 案件阶段='审理阶段'"
val22 = cmd.ExecuteScalar()
jo("审理总分") = val22
jo("审理得分") = 50 - val22
cmd.CommandText = "Se le ct Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'and 案件阶段='审理阶段' and 分值类型='加分'"
val33 = cmd.ExecuteScalar()
If val33 > 10 Then
val33 = 10
Else If val33 > 0 And val33 < 2 Then
val33 = 2
End If
jo("加分") = val33
cmd.CommandText = "Se l ect Sum(评分) From {评查资料评分明细} Where 评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'and 案件阶段='审理阶段'and 分值类型='加倍扣分'"
val44 = cmd.ExecuteScalar()
If val44 > 10 Then
val44 = 10
Else If val44 > 0 And val44 < 1 Then
val44 = 1
End If
jo("加倍扣分") = val44
val = (50 - val11) + (50 - val22) + val33 - val44
jo("最终得分") = val
Dim dengci As String
If val > 90 And val1 <= 0 Then
dengci = "优秀"
Else If val > 75 And val < 90 And val1 <= 0 Then
dengci = "合格"
Else If val > 60 And val < 75 And val1 <= 0 Then
dengci = "瑕疵"
Else If val < 60 Or val1 > 0 Then
dengci = "不合格"
End If
jo("评查等次") = dengci
ja.Add(jo)
Dim ja1 As New JArray
For Each ss2 As String() In dt.getvalues("材料id|一piao否决|案件阶段|评分|guid|细则|卷宗id|资料名称|卷宗名称|分值类型", "评查活动id='" & ss(0) & "'and 评查案件id='" & ss(1) & "'")
Dim jo1 As New JObject
jo1("卷宗id") = ss2(6)
jo1("卷宗名称") = ss2(8)
jo1("材料id") = ss2(0)
jo1("资料名称") = ss2(7)
jo1("扣分id") = ss2(4)
jo1("一piao否决") = ss2(1)
jo1("案件阶段") = ss2(2)
jo1("参考规则") = ss2(5)
jo1("分值类型") = ss2(9)
jo1("评分") = ss2(3)
ja1.Add(jo1)
Next
jo("children") = ja1
Next
'Output.Show(ja.ToString)
msg(ja.ToString)
Dim json As String = ja.ToString
Dim ja12 As JArray = Jarray.Parse(json)
Dim sss As String
Dim ssss As String
Dim wenben As String
Dim time As String
Dim aa As Integer
Dim bb As Integer
For i As Integer = 0 To ja12.Count - 1
bb = 0
aa = 0
sss = ""
ssss = ""
' & ja12(i)("开始日期").ToString() & "至"& ja12(i)("结束日期").ToString() & ",对" & ja12(i)("案件id集合").ToString() & "等" & ja12(i)("案件数量").ToString() & "件案事件进行评查评分,组织" & ja12(i)("评查人员").ToString() & "等" & ja12(i)("评查人数").ToString() & "人参与评查活动。" & Chr(13) & Chr(10)
sss = "在" & ja12(i)("活动名称").ToString() & "活动中,从" & Chr(13) & Chr(10)
bb = bb + 1
ssss &= bb & "、由" & ja12(i)("评分人").ToString() & "对" & ja12(i)("案件名称").ToString() & "案件进行评查打分,其中:审查调查阶段得分" & ja12(i)("审查调查得分").ToString() & "分,审理阶段得分" & ja12(i)("审理得分").ToString() & "分,加分" & ja12(i)("加分").ToString() & "分,加倍扣分" & ja12(i)("加倍扣分").ToString() & "分,总分为:" & ja12(i)("最终得分").ToString() & "分,评为:" & ja12(i)("评查等次").ToString() & "案件。" & Chr(13) & Chr(10)
ssss &= "评审及分值明细为:" & Chr(13) & Chr(10)
Dim ja121 As JArray = Jarray.Parse(ja12(i)("children").ToString())
For i121 As Integer = 0 To ja121.Count - 1
aa = aa + 1
ssss &= "(" & aa & ")、" & ja121(i121)("卷宗名称").ToString() & "卷中" & ja121(i121)("资料名称").ToString().Replace(".pdf", "").Replace(".png", "") & "的材料因" & ja121(i121)("参考规则").ToString() & "(" & ja121(i121)("分值类型").ToString().Replace("分", "") & ja121(i121)("评分").ToString() & "分);" & Chr(13) & Chr(10)
Next
wenben = sss & ssss
Output.Show(wenben)
time = Format(Date.now, "yyyyMMddHHmmss")
Dim s22 As String = wenben
FileSys.WriteAllText(ProjectPath & "/Reports/wenben" & time & ".txt", s22, True, Encoding.UTF8)
Next