Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
Laisi_AutoMES2
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiawei.su
Laisi_AutoMES2
Commits
0c0e5e09
Commit
0c0e5e09
authored
Jan 27, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
9da6bfad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
23 deletions
+73
-23
FixtureToolsAssemblyController.cs
...iger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
+14
-3
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+49
-18
IAutomationFixtureToolsAssemblyRepository.cs
...es/Interface/IAutomationFixtureToolsAssemblyRepository.cs
+2
-2
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+8
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
View file @
0c0e5e09
...
@@ -38,12 +38,23 @@ namespace Siger.ApiACC.Controllers
...
@@ -38,12 +38,23 @@ namespace Siger.ApiACC.Controllers
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
}
}
/// <summary>
///TODO 子类查询可优化掉
/// </summary>
/// <param name="category"></param>
/// <param name="code"></param>
/// <param name="name"></param>
/// <param name="state"></param>
/// <param name="page"></param>
/// <param name="pagesize"></param>
/// <param name="toexcel"></param>
/// <returns></returns>
[
HttpGet
]
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
{
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
state
,
ProjectId
,
page
,
pagesize
,
toexcel
);
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
state
,
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
s
>();
foreach
(
var
item
in
data
.
Data
)
foreach
(
var
item
in
data
.
Data
)
{
{
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
...
@@ -57,7 +68,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -57,7 +68,7 @@ namespace Siger.ApiACC.Controllers
item
.
parentcategoryids
=
parentcateIds
;
item
.
parentcategoryids
=
parentcateIds
;
var
models
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
var
models
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
var
details
=
_toolsAssemblyRepository
.
GetDetailList
(
item
.
fixtureguid
,
ProjectId
);
var
details
=
_toolsAssemblyRepository
.
GetDetailList
(
item
.
fixtureguid
,
category
.
ToInt
(),
code
,
name
,
state
,
ProjectId
);
foreach
(
var
model
in
details
)
foreach
(
var
model
in
details
)
{
{
var
cates1
=
GetParentCategoryList
(
model
.
cate_guid
,
categorys
);
var
cates1
=
GetParentCategoryList
(
model
.
cate_guid
,
categorys
);
...
@@ -172,7 +183,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -172,7 +183,7 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
[
HttpGet
]
public
IActionResult
GetDetail
(
string
guid
)
public
IActionResult
GetDetail
(
string
guid
)
{
{
var
data
=
_toolsAssemblyRepository
.
GetDetailList
(
guid
,
ProjectId
);
var
data
=
_toolsAssemblyRepository
.
GetDetailList
(
guid
,
0
,
""
,
""
,
""
,
ProjectId
);
return
new
ObjectResult
(
data
);
return
new
ObjectResult
(
data
);
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
0c0e5e09
...
@@ -24,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -24,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
_context
=
context
;
}
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
...
@@ -35,8 +35,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -35,8 +35,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join
c2
in
_context
.
siger_automation_fixture_tools_category
on
t2
.
category
equals
c2
.
guid
join
c2
in
_context
.
siger_automation_fixture_tools_category
on
t2
.
category
equals
c2
.
guid
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
from
u
in
uu
.
DefaultIfEmpty
()
from
u
in
uu
.
DefaultIfEmpty
()
join
s
in
_context
.
siger_automation_fixture_tools_assembly
on
q
.
son
equals
s
.
parent
into
ss
from
s
in
ss
.
DefaultIfEmpty
()
join
st2
in
_context
.
siger_automation_fixture_tools
on
s
.
son
equals
st2
.
guid
into
stt2
from
st2
in
stt2
.
DefaultIfEmpty
()
join
sc2
in
_context
.
siger_automation_fixture_tools_category
on
st2
.
category
equals
sc2
.
guid
into
scc2
from
sc2
in
scc2
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
string
.
IsNullOrEmpty
(
q
.
parent
)
where
q
.
projectId
==
projectid
&&
string
.
IsNullOrEmpty
(
q
.
parent
)
select
new
ResponseAumationFixtureToolsAssembly
select
new
ResponseAumationFixtureToolsAssembly
s
{
{
id
=
q
.
id
,
id
=
q
.
id
,
parentid
=
t1
==
null
?
0
:
t1
.
id
,
parentid
=
t1
==
null
?
0
:
t1
.
id
,
...
@@ -62,43 +68,47 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -62,43 +68,47 @@ namespace Siger.Middlelayer.AccRepository.Repositories
parentcategory
=
c1
.
name
??
""
,
parentcategory
=
c1
.
name
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentspecfication
=
t1
.
specification
??
""
,
parentspecfication
=
t1
.
specification
??
""
,
parentcode
=
t1
.
code
??
""
parentcode
=
t1
.
code
??
""
,
son_code
=
st2
.
code
??
""
,
son_name
=
st2
.
code
??
""
,
son_categoryid
=
sc2
==
null
?
0
:
sc2
.
id
,
son_status
=
s
==
null
?
-
1
:
s
.
status
,
};
};
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
if
(
category
>
0
)
{
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
categoryExpression
=
q
=>
(
q
.
categoryid
==
category
||
q
.
son_categoryid
==
category
)
;
}
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
codeExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
if
(!
string
.
IsNullOrEmpty
(
code
))
{
{
c
ategoryExpression
=
q
=>
q
.
code
.
Contains
(
code
);
c
odeExpression
=
q
=>
(
q
.
code
.
Contains
(
code
)
||
q
.
son_code
.
Contains
(
code
)
);
}
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
nameExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
nameExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
name
))
if
(!
string
.
IsNullOrEmpty
(
name
))
{
{
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
nameExpression
=
q
=>
(
q
.
name
.
Contains
(
name
)
||
q
.
son_name
.
Contains
(
name
)
);
}
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
stateExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
stateExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
state
))
if
(!
string
.
IsNullOrEmpty
(
state
))
{
{
stateExpression
=
q
=>
q
.
status
==
state
.
ToInt
(
);
stateExpression
=
q
=>
(
q
.
status
==
state
.
ToInt
()
||
q
.
son_status
==
state
.
ToInt
()
);
}
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
if
(
toexcel
.
ToInt
()
==
1
)
{
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
var
entities
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
entities
.
Count
);
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>(
entities
,
entities
.
Count
);
}
}
else
else
{
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
entities
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
var
totalCount
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
totalCount
);
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>(
entities
,
totalCount
);
}
}
}
}
public
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
)
public
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
)
{
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
...
@@ -137,7 +147,28 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -137,7 +147,28 @@ namespace Siger.Middlelayer.AccRepository.Repositories
parentspecfication
=
t1
.
specification
??
""
,
parentspecfication
=
t1
.
specification
??
""
,
parentcode
=
t1
.
code
??
""
parentcode
=
t1
.
code
??
""
};
};
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
{
codeExpression
=
q
=>
q
.
code
.
Contains
(
code
);
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
nameExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
name
))
{
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
stateExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
state
))
{
stateExpression
=
q
=>
q
.
status
==
state
.
ToInt
();
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
entities
;
return
entities
;
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsAssemblyRepository.cs
View file @
0c0e5e09
...
@@ -9,9 +9,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -9,9 +9,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
{
public
interface
IAutomationFixtureToolsAssemblyRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_assembly
>
public
interface
IAutomationFixtureToolsAssemblyRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_assembly
>
{
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
);
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/FixtureToolsCategory.cs
View file @
0c0e5e09
...
@@ -154,4 +154,12 @@ namespace Siger.Middlelayer.AccRepository.Response
...
@@ -154,4 +154,12 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
parentspecfication
{
get
;
set
;
}
public
string
parentspecfication
{
get
;
set
;
}
public
string
parentcode
{
get
;
set
;
}
public
string
parentcode
{
get
;
set
;
}
}
}
public
class
ResponseAumationFixtureToolsAssemblys
:
ResponseAumationFixtureToolsAssembly
{
public
string
son_code
{
get
;
set
;
}
public
string
son_name
{
get
;
set
;
}
public
int
son_categoryid
{
get
;
set
;
}
public
int
son_status
{
get
;
set
;
}
}
}
}
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