Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
code
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
solho
code
Commits
833fa398
Commit
833fa398
authored
Jun 07, 2021
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
身分驗證取消
INSERT確認問題修正
parent
e2b8fe5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
9 deletions
+142
-9
WebAPI/Controllers/Esn_Subitem/Esn_Todos_FlowController.cs
WebAPI/Controllers/Esn_Subitem/Esn_Todos_FlowController.cs
+142
-9
No files found.
WebAPI/Controllers/Esn_Subitem/Esn_Todos_FlowController.cs
View file @
833fa398
...
...
@@ -28,11 +28,14 @@ namespace WebAPI.Controllers
HttpResponseMessage
result
;
CommonResponseMsg
response
;
MessageList_ETF
Outmsg
;
String
connString
;
public
Esn_Todos_FlowController
()
{
if
(
Outmsg
==
null
)
Outmsg
=
new
MessageList_ETF
();
result
=
new
HttpResponseMessage
(
HttpStatusCode
.
OK
);
response
=
new
CommonResponseMsg
();
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
}
...
...
@@ -50,7 +53,6 @@ namespace WebAPI.Controllers
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
String
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
List
<
Esn_Todos_FlowModel
>
Hislist
=
new
List
<
Esn_Todos_FlowModel
>();
...
...
@@ -127,7 +129,6 @@ namespace WebAPI.Controllers
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
String
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
List
<
Esn_Todos_FlowModel
>
Hislist
=
new
List
<
Esn_Todos_FlowModel
>();
...
...
@@ -191,6 +192,138 @@ namespace WebAPI.Controllers
return
result
;
}
/// <summary>
/// 取得EHR匯出歷史
/// </summary>
/// <param name="Get_ehr_his"></param>
/// <returns></returns>
[
Route
(
"GetExportEHRhis"
)]
[
CorsHandle
]
[
HttpPost
]
//[HttpGet]
public
HttpResponseMessage
Get_ExportEHR_his
(
ParamModel
param
)
{
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
try
{
List
<
ExportEHR_hisModel
>
Hislist
=
new
List
<
ExportEHR_hisModel
>();
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
ExportEHR_hisModel
hisT
;
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
)
{
CommandText
=
@"select b.cn_name, a.* from esn_todos_SettleLog a
left join s_user_info b on a.Create_user_id=b.user_id
where a.Create_user_id=@Create_user_id "
};
cmd
.
Parameters
.
AddWithValue
(
"@Create_user_id"
,
obj_input
[
"gUserID_wade"
].
ToString
());
DataSet
ds
=
SqlToDs
(
cmd
);
foreach
(
DataRow
dr
in
ds
.
Tables
[
0
].
Rows
)
{
hisT
=
new
ExportEHR_hisModel
()
{
id
=
(
int
)
dr
[
"id"
],
SaveData
=
dr
[
"SaveData"
].
ToString
(),
update_time
=(
DateTime
?)
dr
[
"update_time"
]
,
update_user_id
=
dr
[
"update_user_id"
].
ToString
(),
Create_time
=
(
DateTime
?)
dr
[
"Create_time"
],
Create_user_id
=
dr
[
"Create_user_id"
].
ToString
(),
cn_name
=
dr
[
"cn_name"
].
ToString
(),
};
Hislist
.
Add
(
hisT
);
}
}
response
.
Code
=
"1"
;
response
.
Msg
=
Hislist
;
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
}
catch
(
Exception
e
)
{
response
.
Code
=
"0"
;
response
.
Msg
=
"Exception:"
+
e
.
StackTrace
;
}
}
else
{
response
.
Code
=
"0"
;
response
.
Msg
=
"no input or format error"
;
}
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
return
result
;
}
/// <summary>
/// 取得EHR匯出歷史
/// </summary>
/// <param name="Get_ehr_his"></param>
/// <returns></returns>
[
Route
(
"GetExportEHRhis_Detail"
)]
[
CorsHandle
]
[
HttpPost
]
//[HttpGet]
public
HttpResponseMessage
Get_ExportEHR_hisDetail
(
ParamModel
param
)
{
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
try
{
List
<
ExportEHR_hisModel
>
Hislist
=
new
List
<
ExportEHR_hisModel
>();
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
ExportEHR_hisModel
hisT
;
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
)
{
CommandText
=
@"select b.cn_name, a.* from esn_todos_SettleLog a
left join s_user_info b on a.Create_user_id=b.user_id
where a.Create_user_id=@Create_user_id "
};
cmd
.
Parameters
.
AddWithValue
(
"@Create_user_id"
,
obj_input
[
"gUserID_wade"
].
ToString
());
DataSet
ds
=
SqlToDs
(
cmd
);
foreach
(
DataRow
dr
in
ds
.
Tables
[
0
].
Rows
)
{
hisT
=
new
ExportEHR_hisModel
()
{
id
=
(
int
)
dr
[
"id"
],
SaveData
=
dr
[
"SaveData"
].
ToString
(),
update_time
=
(
DateTime
?)
dr
[
"update_time"
],
update_user_id
=
dr
[
"update_user_id"
].
ToString
(),
Create_time
=
(
DateTime
?)
dr
[
"Create_time"
],
Create_user_id
=
dr
[
"Create_user_id"
].
ToString
(),
cn_name
=
dr
[
"cn_name"
].
ToString
(),
};
Hislist
.
Add
(
hisT
);
}
}
response
.
Code
=
"1"
;
response
.
Msg
=
Hislist
;
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
}
catch
(
Exception
e
)
{
response
.
Code
=
"0"
;
response
.
Msg
=
"Exception:"
+
e
.
StackTrace
;
}
}
else
{
response
.
Code
=
"0"
;
response
.
Msg
=
"no input or format error"
;
}
result
.
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
response
),
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
return
result
;
}
[
Route
(
"SaveEsnTodosFlow"
)]
[
CorsHandle
]
[
HttpPost
]
...
...
@@ -200,7 +333,6 @@ namespace WebAPI.Controllers
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
String
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
try
{
...
...
@@ -294,12 +426,14 @@ namespace WebAPI.Controllers
//StepType_id_next = Convert.ToInt32(dr["StepType_id_next"]);
StepType_id
=
dr
[
"StepType_id"
]
==
DBNull
.
Value
?
0
:
Convert
.
ToInt32
(
dr
[
"StepType_id"
]);
Esn_Todos_Flow_StepTypeModel
CStepTypeNext
=
new
Esn_Todos_Flow_StepTypeModel
(),
CStepTypeCur
=
new
Esn_Todos_Flow_StepTypeModel
();
JtSn
=
obj_input
.
SelectToken
(
"$.Sns[?(@.todos_sn == '"
+
dr
[
"Sn"
]
+
"')]"
);
if
(
dr
[
"esn_todos_sn"
]
==
DBNull
.
Value
)
//insert
{
CStepTypeCur
=
AllStepType
.
Where
(
p
=>
p
.
Map_Class
.
Contains
(
JtSn
[
"validclass"
].
ToString
())).
FirstOrDefault
();
StepType_idHis
=
CStepTypeCur
.
id
;
CStepTypeNext
=
AllStepType
.
Where
(
p
=>
p
.
Map_Class
.
Contains
(
"PE"
)).
FirstOrDefault
();
CStepTypeCur
=
CStepTypeNext
;
//
CStepTypeCur = CStepTypeNext;
Tsql
=
@"insert into esn_todos_Flow(esn_todos_sn,[StepType_id],["
+
CStepTypeCur
.
Map_Class
+
@"_IsConfirm],StepType_id_Previous,Description,[create_user_id],[Create_time],update_user_id,update_time) "
+
" OUTPUT Inserted.id into @TempTable "
...
...
@@ -309,7 +443,6 @@ namespace WebAPI.Controllers
}
else
//update
{
JtSn
=
obj_input
.
SelectToken
(
"$.Sns[?(@.todos_sn == '"
+
dr
[
"Sn"
]
+
"')]"
);
String
Map_Class
=
dr
[
"Map_Class"
].
ToString
();
#
region
驗證
//if (Map_Class != JtSn["validclass"].ToString())
...
...
@@ -319,7 +452,7 @@ namespace WebAPI.Controllers
if
(
Confirm_Method
==
"CF"
&&
!
Confirm_Class
.
Contains
(
Map_Class
))
{
return_msg_error
.
Add
(
dr
[
"esn_todos_sn"
]
+
":無可審核該筆身分"
);
//
return_msg_error.Add(dr["esn_todos_sn"] + ":無可審核該筆身分");
}
#
endregion
...
...
@@ -402,7 +535,6 @@ namespace WebAPI.Controllers
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
string
input
=
param
.
Input
.
ToString
();
String
connString
=
ConfigurationManager
.
ConnectionStrings
[
"eflow_cur"
].
ConnectionString
;
try
{
JObject
obj_input
=
JObject
.
Parse
(
input
.
ToString
());
...
...
@@ -412,11 +544,12 @@ namespace WebAPI.Controllers
{
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
)
{
CommandText
=
@"Insert into esn_todos_SettleLog([SaveData],[
update_time],[update_user_id]
)
values(@SaveData,getdate(),@gUserID_wade)"
CommandText
=
@"Insert into esn_todos_SettleLog([SaveData],[
Country],[update_time],[update_user_id],Create_time,Create_user_id
)
values(@SaveData,
@Country,getdate(),@gUserID_wade,
getdate(),@gUserID_wade)"
};
cmd
.
Parameters
.
AddWithValue
(
"@SaveData"
,
obj_input
[
"SaveData"
].
ToString
());
cmd
.
Parameters
.
AddWithValue
(
"@gUserID_wade"
,
obj_input
[
"gUserID_wade"
].
ToString
());
cmd
.
Parameters
.
AddWithValue
(
"@Country"
,
obj_input
[
"Country"
].
ToString
());
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Code
=
"1"
;
response
.
Msg
=
"匯出完畢"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment