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
13e575a9
Commit
13e575a9
authored
Aug 05, 2021
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
關帳流程設定開關帳功能
parent
aa921c3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
4 deletions
+119
-4
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
+119
-4
No files found.
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
View file @
13e575a9
...
@@ -111,7 +111,122 @@ namespace WebAPI.Controllers
...
@@ -111,7 +111,122 @@ namespace WebAPI.Controllers
return
result
;
return
result
;
}
}
public
DataTable
get_Esn_todos_SettleData
(
String
gWadeID
,
bool
is_enabled
)
[
Route
(
"getesntodosSettle"
)]
[
CorsHandle
]
[
HttpPost
]
public
HttpResponseMessage
get_esn_todos_Settle
(
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
{
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
String
strsql
=
""
,
Permission_furtherSql
=
obj_input
[
"Permission_furtherSql"
].
ToString
();
strsql
+=
String
.
Format
(
@"select a.id, Settle_Date ,isClosed ,Emp_DS ,a.update_time from [esn_todos_Settle] a
left join [evw_qResult_EmpDS] b on a.DSNum=b.Emp_DSNum
left join [evw_qResult_Dept] c on a.DeptNum=c.targetID
left join [evw_qResult_EmpItem] d on a.ItemNum=d.Emp_ItemNum
where 1=1 "
);
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
obj_input
[
"Settle_Date"
]!=
null
)
{
strsql
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
cmd
.
Parameters
.
Add
(
"@Settle_Date"
,
obj_input
[
"Settle_Date"
].
ToString
());
}
if
(
obj_input
[
"isClosed"
]
!=
null
)
{
strsql
+=
" and isClosed=@isClosed "
;
cmd
.
Parameters
.
Add
(
"@isClosed"
,
(
obj_input
[
"isClosed"
].
ToString
()==
"1"
?
true
:
false
));
}
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
)
{
strsql
+=
" and b.ID in(@DSid)"
;
strsql
=
strsql
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
if
(
objPermission_furtherSql
[
"deptID"
]
!=
null
)
{
//strsql += " and DeptNum in(@DeptNum)";
//cmd.Parameters.Add("@DeptNum", objPermission_furtherSql["deptID"].ToString());
}
if
(
objPermission_furtherSql
[
"workGroupID"
]
!=
null
)
{
//strsql += " and ItemNum in(@ItemNum)";
//cmd.Parameters.Add("@ItemNum", objPermission_furtherSql["workGroupID"].ToString());
}
cmd
.
CommandText
=
strsql
;
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Msg
=
JsonConvert
.
SerializeObject
(
dt
);
response
.
Code
=
"1"
;
}
}
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
(
"updateesntodosSettle"
)]
[
CorsHandle
]
[
HttpPost
]
public
HttpResponseMessage
update_esn_todos_Settle
(
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
{
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
String
strsql
=
""
;
strsql
+=
String
.
Format
(
@"update [esn_todos_Settle] set isClosed=@isClosed , update_user_id=@gUserID_wade ,update_time=GETDATE()
where id in(@ids) "
);
cmd
.
Parameters
.
AddWithValue
(
"@gUserID_wade"
,
obj_input
[
"gUserID_wade"
].
ToString
());
cmd
.
Parameters
.
AddWithValue
(
"@isClosed"
,
obj_input
[
"isClosed"
].
ToString
()==
"1"
?
true
:
false
);
JArray
idsar
=
JArray
.
Parse
(
obj_input
[
"ids"
].
ToString
());
if
(
idsar
.
Count
>
0
)
{
string
t
=
String
.
Join
(
","
,
obj_input
[
"ids"
]);
strsql
=
strsql
.
Replace
(
"@ids"
,
t
);
}
cmd
.
CommandText
=
strsql
;
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Msg
=
"設定完成"
;
response
.
Code
=
"1"
;
}
}
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
;
}
public
DataTable
get_esn_todos_Settle_config
(
String
gWadeID
,
bool
is_enabled
)
{
{
DataTable
dt
=
null
;
DataTable
dt
=
null
;
try
try
...
@@ -140,10 +255,10 @@ namespace WebAPI.Controllers
...
@@ -140,10 +255,10 @@ namespace WebAPI.Controllers
}
}
[
Route
(
"
Update
EsntodosSettle"
)]
[
Route
(
"
insert
EsntodosSettle"
)]
[
CorsHandle
]
[
CorsHandle
]
[
HttpPost
]
[
HttpPost
]
public
HttpResponseMessage
Update
_Esn_todos_Settle
(
ParamModel
param
)
public
HttpResponseMessage
insert
_Esn_todos_Settle
(
ParamModel
param
)
{
{
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
if
(
param
!=
null
&&
param
.
Input
!=
null
&&
!
string
.
IsNullOrWhiteSpace
((
param
.
Input
.
ToString
())))
{
{
...
@@ -154,7 +269,7 @@ namespace WebAPI.Controllers
...
@@ -154,7 +269,7 @@ namespace WebAPI.Controllers
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
using
(
SqlConnection
Conn
=
new
SqlConnection
(
connString
))
{
{
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
DataTable
dtL1
=
get_
Esn_todos_SettleData
(
obj_input
[
"gWadeID"
].
ToString
(),
true
);
DataTable
dtL1
=
get_
esn_todos_Settle_config
(
obj_input
[
"gWadeID"
].
ToString
(),
true
);
String
strsql
=
""
,
wherecase
;
String
strsql
=
""
,
wherecase
;
DataRow
drL1
;
DataRow
drL1
;
if
(
dtL1
!=
null
)
if
(
dtL1
!=
null
)
...
...
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