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
6b9ef721
Commit
6b9ef721
authored
May 04, 2022
by
solho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:補缺檔
parent
a3c8d153
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
0 deletions
+102
-0
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
+97
-0
WebAPI/libman.json
WebAPI/libman.json
+5
-0
No files found.
WebAPI/Controllers/Esn_Subitem/Esn_todos_SettleController.cs
View file @
6b9ef721
...
...
@@ -25,6 +25,103 @@ namespace WebAPI.Controllers
response
=
new
CommonResponseMsg
();
connString
=
ConfigurationManager
.
ConnectionStrings
[
"DefaultConnection"
].
ConnectionString
;
}
/// <summary>
/// 取得關帳最早日期
/// </summary>
/// <para ></param>
/// <returns></returns>
///
[
Route
(
"getSettleDateN"
)]
[
CorsHandle
]
[
HttpPost
]
public
HttpResponseMessage
get_Settle_DateN
(
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
))
{
;
String
@wherecase1
=
""
,
@wherecase2
=
""
;
SqlCommand
cmd
=
new
SqlCommand
(
""
,
Conn
);
String
strsql
=
""
;
strsql
+=
@"
SELECT top 1 CONVERT(varchar(7),Settle_Date,126) Settle_Month,(
SELECT top 1 CONVERT(varchar(7),Settle_Date,126) Settle_Month 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
left join @
where 1=1 @wherecase1
order by Settle_Date
) as minSettle_Month 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 @wherecase2
"
;
if
(
obj_input
[
"Permission_furtherSql"
]
!=
null
)
{
JObject
objPermission_furtherSql
=
JObject
.
Parse
(
obj_input
[
"Permission_furtherSql"
].
ToString
());
if
(
objPermission_furtherSql
[
"firmID"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"firmID"
].
ToString
()))
{
@wherecase1
+=
" and b.ID in(@DSid)"
;
@wherecase2
+=
" and b.ID in(@DSid)"
;
@wherecase1
=
@wherecase1
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
@wherecase2
=
@wherecase2
.
Replace
(
"@DSid"
,
objPermission_furtherSql
[
"firmID"
].
ToString
());
//cmd.Parameters.Add("@DSid", objPermission_furtherSql["firmID"].ToString());
}
if
(
objPermission_furtherSql
[
"option"
]
!=
null
&&
!
String
.
IsNullOrEmpty
(
objPermission_furtherSql
[
"option"
].
ToString
()))
{
if
(
objPermission_furtherSql
[
"option"
].
ToString
().
Contains
(
"2485762"
))
//內管 OPTION為 ALL
{
@wherecase1
=
""
;
@wherecase2
=
""
;
}
}
}
if
(
obj_input
[
"Settle_Date"
]
!=
null
)
{
@wherecase2
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
strsql
+=
" and Settle_Date between @Settle_Date and @Settle_Date "
;
cmd
.
Parameters
.
AddWithValue
(
"@Settle_Date"
,
obj_input
[
"Settle_Date"
].
ToString
());
}
if
(
obj_input
[
"isClosed"
]
!=
null
)
{
@wherecase2
+=
" and isClosed=@isClosed "
;
cmd
.
Parameters
.
AddWithValue
(
"@isClosed"
,
(
obj_input
[
"isClosed"
].
ToString
()
==
"1"
?
true
:
false
));
}
strsql
=
strsql
.
Replace
(
"@wherecase1"
,
@wherecase1
).
Replace
(
"@wherecase2"
,
@wherecase2
);
strsql
+=
" order by a.Settle_Date"
;
response
.
Code
=
"1"
;
cmd
.
CommandText
=
strsql
;
DataTable
dt
=
SqlToDt
(
cmd
);
response
.
Msg
=
JsonConvert
.
SerializeObject
(
dt
);
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>
/// 取得關帳最早日期
/// </summary>
...
...
WebAPI/libman.json
0 → 100644
View file @
6b9ef721
{
"version"
:
"1.0"
,
"defaultProvider"
:
"cdnjs"
,
"libraries"
:
[]
}
\ No newline at end of file
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