Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
a708b1e2
Commit
a708b1e2
authored
Feb 25, 2022
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/核算序号' into develop
parents
c325f1ac
5016b565
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
18 deletions
+62
-18
performance/Performance.Api/Controllers/ConfigController.cs
+14
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.EntityModels/Entity/cof_accounting.cs
+5
-0
performance/Performance.Services/ConfigService.cs
+38
-18
No files found.
performance/Performance.Api/Controllers/ConfigController.cs
View file @
a708b1e2
...
@@ -683,6 +683,20 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
...
@@ -683,6 +683,20 @@ public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
/// <param name="allotId"></param>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <param name="request"></param>
/// <returns></returns>
/// <returns></returns>
[
Route
(
"BatchCheckAccounting/{allotId}"
)]
[
HttpPost
]
public
ApiResponse
BatchCheckAccounting
(
int
allotId
,
[
FromBody
]
SaveCollectData
request
)
{
var
result
=
_configService
.
BatchSaveAccounting
(
allotId
,
request
,
false
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"校验通过"
);
}
/// <summary>
/// 核算单元及组别批量添加
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"BatchSaveAccounting/{allotId}"
)]
[
Route
(
"BatchSaveAccounting/{allotId}"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
BatchSaveAccounting
(
int
allotId
,
[
FromBody
]
SaveCollectData
request
)
public
ApiResponse
BatchSaveAccounting
(
int
allotId
,
[
FromBody
]
SaveCollectData
request
)
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
a708b1e2
...
@@ -1630,6 +1630,11 @@
...
@@ -1630,6 +1630,11 @@
核算单元
核算单元
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.cof_accounting.Code"
>
<summary>
核算单元编码
</summary>
</member>
<member
name=
"T:Performance.EntityModels.cof_again"
>
<member
name=
"T:Performance.EntityModels.cof_again"
>
<summary>
<summary>
...
...
performance/Performance.EntityModels/Entity/cof_accounting.cs
View file @
a708b1e2
...
@@ -34,5 +34,10 @@ public class cof_accounting
...
@@ -34,5 +34,10 @@ public class cof_accounting
/// 核算单元
/// 核算单元
/// </summary>
/// </summary>
public
string
AccountingUnit
{
get
;
set
;
}
public
string
AccountingUnit
{
get
;
set
;
}
/// <summary>
/// 核算单元编码
/// </summary>
public
string
Code
{
get
;
set
;
}
}
}
}
}
performance/Performance.Services/ConfigService.cs
View file @
a708b1e2
...
@@ -786,7 +786,7 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
...
@@ -786,7 +786,7 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
if
(
request
.
Type
==
(
int
)
AccountTypeEnum
.
AccountingUnit
&&
!
string
.
IsNullOrEmpty
(
request
.
UnitType
))
if
(
request
.
Type
==
(
int
)
AccountTypeEnum
.
AccountingUnit
&&
!
string
.
IsNullOrEmpty
(
request
.
UnitType
))
exp
=
exp
.
And
(
t
=>
t
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
)
==
request
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
));
exp
=
exp
.
And
(
t
=>
t
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
)
==
request
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
));
return
cofaccountingRepository
.
GetEntities
(
exp
)
??
new
List
<
cof_accounting
>();
return
cofaccountingRepository
.
GetEntities
(
exp
)
?.
OrderBy
(
t
=>
ConvertHelper
.
To
<
int
>(
t
.
Code
)).
ToList
()
??
new
List
<
cof_accounting
>();
}
}
/// <summary>
/// <summary>
...
@@ -853,47 +853,67 @@ public HandsonTable GetBatchAccountingStructrue(int AllotId)
...
@@ -853,47 +853,67 @@ public HandsonTable GetBatchAccountingStructrue(int AllotId)
{
{
foreach
(
var
column
in
result
.
Columns
)
foreach
(
var
column
in
result
.
Columns
)
{
{
if
(
column
.
Data
==
"核算组别"
)
if
(
column
.
Data
==
"核算组别"
)
{
{
column
.
Type
=
"autocomplete"
;
column
.
Type
=
"autocomplete"
;
column
.
Source
=
EnumHelper
.
GetItems
<
UnitType
>().
Select
(
w
=>
w
.
Description
.
Replace
(
"行政后勤"
,
"行政工勤"
)).
ToArray
();
column
.
Source
=
EnumHelper
.
GetItems
<
UnitType
>().
Select
(
w
=>
w
.
Description
.
Replace
(
"行政后勤"
,
"行政工勤"
)).
ToArray
();
column
.
Strict
=
true
;
column
.
Strict
=
true
;
}
}
if
(
column
.
Data
==
"核算单元编码"
)
{
column
.
Type
=
"text"
;
column
.
NumericFormat
=
null
;
}
}
}
}
}
return
result
;
return
result
;
}
}
public
bool
BatchSaveAccounting
(
int
allotId
,
SaveCollectData
request
)
public
bool
BatchSaveAccounting
(
int
allotId
,
SaveCollectData
request
,
bool
isSave
=
true
)
{
{
var
dicData
=
CreateDataRow
(
0
,
allotId
,
request
,
Accounting
);
var
dicData
=
CreateDataRow
(
0
,
allotId
,
request
,
Accounting
);
var
getAccounts
=
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
);
if
(
dicData
==
null
||
!
dicData
.
Any
())
throw
new
PerformanceException
(
"未提交数据"
);
var
getAccounts
=
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allotId
)
??
new
List
<
cof_accounting
>();
var
unitType
=
EnumHelper
.
GetItems
<
UnitType
>().
Select
(
w
=>
w
.
Description
.
Replace
(
"行政后勤"
,
"行政工勤"
)).
ToArray
();
var
unitType
=
EnumHelper
.
GetItems
<
UnitType
>().
Select
(
w
=>
w
.
Description
.
Replace
(
"行政后勤"
,
"行政工勤"
)).
ToArray
();
List
<
cof_accounting
>
accounts
=
new
List
<
cof_accounting
>();
foreach
(
var
item
in
dicData
)
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
cof_accounting
>(
json
);
data
.
AllotId
=
allotId
;
if
(!
unitType
.
Contains
(
data
?.
UnitType
)
&&
!
string
.
IsNullOrEmpty
(
data
?.
UnitType
))
return
false
;
var
json
=
JsonHelper
.
Serialize
(
dicData
)
;
if
(
getAccounts
!=
null
)
var
accounts
=
JsonHelper
.
Deserialize
<
List
<
cof_accounting
>>(
json
);
if
(
getAccounts
.
Any
(
t
=>
t
.
AccountingUnit
==
data
?.
AccountingUnit
&&
t
.
UnitType
==
data
?.
UnitType
))
continue
;
var
any
=
accounts
.
Any
(
t
=>
t
.
AccountingUnit
==
data
?.
AccountingUnit
&&
t
.
UnitType
==
data
?.
UnitType
);
if
(
accounts
.
Any
(
w
=>
string
.
IsNullOrEmpty
(
w
.
Code
)))
throw
new
PerformanceException
(
"核算单元编码有空值"
);
if
(!
string
.
IsNullOrEmpty
(
data
.
AccountingUnit
)
&&
!
string
.
IsNullOrEmpty
(
data
.
UnitType
)
&&
!
any
)
if
(
accounts
.
GroupBy
(
t
=>
t
.
Code
).
Any
(
w
=>
w
.
Count
()
>
1
))
throw
new
PerformanceException
(
"核算单元编码有重复值"
);
if
(
accounts
.
Any
(
w
=>
string
.
IsNullOrEmpty
(
w
.
AccountingUnit
)))
throw
new
PerformanceException
(
"核算单元有空值"
);
if
(
accounts
.
Any
(
w
=>
string
.
IsNullOrEmpty
(
w
.
UnitType
)))
throw
new
PerformanceException
(
"核算单元类型有空值"
);
var
grouped
=
accounts
.
GroupBy
(
t
=>
new
{
t
.
AccountingUnit
,
t
.
UnitType
});
if
(
grouped
.
Any
(
w
=>
w
.
Count
()
>
1
))
throw
new
PerformanceException
(
"核算单元、核算单元类型有重复值"
);
if
(
isSave
)
{
var
delAccounts
=
new
List
<
cof_accounting
>();
foreach
(
var
item
in
accounts
)
{
{
accounts
.
Add
(
data
);
var
account
=
getAccounts
.
FirstOrDefault
(
w
=>
w
.
Code
==
item
.
Code
);
if
(
account
!=
null
)
delAccounts
.
Add
(
account
);
}
}
if
(
delAccounts
!=
null
&&
delAccounts
.
Any
())
cofaccountingRepository
.
RemoveRange
(
delAccounts
.
ToArray
());
if
(
accounts
!=
null
&&
accounts
.
Any
())
cofaccountingRepository
.
AddRange
(
accounts
.
ToArray
());
}
}
if
(
accounts
.
Any
())
cofaccountingRepository
.
AddRange
(
accounts
.
ToArray
());
return
true
;
return
true
;
}
}
public
static
Dictionary
<
string
,
string
>
Accounting
{
get
;
}
=
new
Dictionary
<
string
,
string
>
public
static
Dictionary
<
string
,
string
>
Accounting
{
get
;
}
=
new
Dictionary
<
string
,
string
>
{
{
{
nameof
(
cof_accounting
.
Code
),
"核算单元编码"
},
{
nameof
(
cof_accounting
.
AccountingUnit
),
"核算单元"
},
{
nameof
(
cof_accounting
.
AccountingUnit
),
"核算单元"
},
{
nameof
(
cof_accounting
.
UnitType
),
"核算组别"
},
{
nameof
(
cof_accounting
.
UnitType
),
"核算组别"
},
};
};
...
...
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