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
51c9aabc
Commit
51c9aabc
authored
Jan 20, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some update
parent
5f90d37a
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
697 additions
and
21 deletions
+697
-21
FixtureToolsAssemblyController.cs
...iger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
+42
-0
FixtureToolsController.cs
...r/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
+154
-10
FixtureToolsProductController.cs
...Siger.ApiACC/Controllers/FixtureToolsProductController.cs
+182
-0
RequestEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
+6
-0
siger_automation_fixture_tools_assembly.cs
...itory/Entities/siger_automation_fixture_tools_assembly.cs
+11
-6
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+30
-0
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+46
-0
AutomationFixtureToolsRepository.cs
...pository/Repositories/AutomationFixtureToolsRepository.cs
+55
-0
IAutomationFixtureToolsAssemblyRepository.cs
...es/Interface/IAutomationFixtureToolsAssemblyRepository.cs
+2
-1
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+2
-1
IAutomationFixtureToolsRepository.cs
...positories/Interface/IAutomationFixtureToolsRepository.cs
+3
-1
RequestFixtureToolsCategory.cs
...ayer.AccRepository/Request/RequestFixtureToolsCategory.cs
+68
-0
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+94
-0
DB.script
Server/Infrastructure/Script/DB.script
+2
-2
No files found.
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
0 → 100644
View file @
51c9aabc
using
System
;
using
System.Collections.Generic
;
using
System.Linq.Expressions
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.AccRepository.Request
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.Middlelayer.Repository
;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
namespace
Siger.ApiACC.Controllers
{
public
class
FixtureToolsAssemblyController
:
BaseController
{
private
readonly
IUnitOfWork
_unitOfWork
;
private
readonly
IAutomationFixtureToolsCategoryRepository
_toolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsRepository
_toolsRepository
;
private
readonly
IAutomationFixtureToolsAssemblyRepository
_toolsAssemblyRepository
;
public
FixtureToolsAssemblyController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationFixtureToolsAssemblyRepository
toolsAssemblyRepository
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
_toolsRepository
=
toolsRepository
;
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
}
public
IActionResult
GetPageList
(
string
category
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
}
}
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
View file @
51c9aabc
...
...
@@ -21,27 +21,172 @@ namespace Siger.ApiACC.Controllers
{
private
readonly
IUnitOfWork
_unitOfWork
;
private
readonly
IAutomationFixtureToolsCategoryRepository
_toolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsAssemblyRepository
_toolsAssemblyRepository
;
private
readonly
IAutomationFixtureToolsRepository
_toolsRepository
;
public
FixtureToolsController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureTools
AssemblyRepository
toolsAssemblyRepository
,
IAutomationFixtureTools
Repository
toolsRepository
)
public
FixtureToolsController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
_toolsRepository
=
toolsRepository
;
}
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
string
.
IsNullOrEmpty
(
state
)
?
-
1
:
state
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
[
HttpPost
]
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
data
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
name
==
req
.
name
||
q
.
code
==
req
.
code
||
q
.
partnumber
==
req
.
partnumber
));
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
category
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
id
==
req
.
categoryid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
category
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
entity
=
new
siger_automation_fixture_tools
{
guid
=
Guid
.
NewGuid
().
ToString
(),
category
=
category
.
guid
,
managetype
=
req
.
managetype
.
ToInt
(),
partnumber
=
req
.
partnumber
,
name
=
req
.
name
,
specifition
=
req
.
specifition
,
number
=
req
.
number
.
ToInt
(),
remark
=
req
.
remark
,
attachment
=
req
.
attachment
,
code
=
req
.
code
,
projectId
=
ProjectId
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
UserId
,
updator
=
UserId
,
};
_toolsRepository
.
Insert
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
req
.
id
<=
0
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
entity
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
id
);
var
data
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
name
==
req
.
name
||
q
.
code
==
req
.
code
||
q
.
partnumber
==
req
.
partnumber
)
&&
q
.
id
!=
req
.
id
);
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
category
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
id
==
req
.
categoryid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
category
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
entity
.
category
=
category
.
guid
;
entity
.
managetype
=
req
.
managetype
.
ToInt
();
entity
.
partnumber
=
req
.
partnumber
;
entity
.
name
=
req
.
name
;
entity
.
specifition
=
req
.
specifition
;
entity
.
number
=
req
.
number
.
ToInt
();
entity
.
remark
=
req
.
remark
;
entity
.
attachment
=
req
.
attachment
;
entity
.
code
=
req
.
code
;
entity
.
updatetime
=
DateTime
.
Now
;
entity
.
updator
=
UserId
;
_toolsRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpGet
]
public
IActionResult
GetPageList
(
int
id
,
int
page
,
int
pagesize
)
public
IActionResult
Delete
(
int
id
)
{
var
entity
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Delete
([
FromBody
]
RequestDeleteRange
req
)
{
if
(
req
.
ids
==
null
||
!
req
.
ids
.
Any
())
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
entities
=
_toolsRepository
.
GetList
(
t
=>
req
.
ids
.
Contains
(
t
.
id
)
&&
t
.
projectId
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
if
(!
entities
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
foreach
(
var
entity
in
entities
)
{
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsRepository
.
Update
(
entity
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
[
HttpGet
]
public
IActionResult
GetCategoryPageList
(
int
id
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
id
,
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
[
HttpPost
]
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureToolsCategory
req
)
public
IActionResult
Add
Category
([
FromBody
]
RequestAddFixtureToolsCategory
req
)
{
var
data
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
req
.
name
);
if
(
data
!=
null
)
...
...
@@ -83,7 +228,7 @@ namespace Siger.ApiACC.Controllers
}
[
HttpPost
]
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureToolsCategory
req
)
public
IActionResult
Update
Category
([
FromBody
]
RequestUpdateFixtureToolsCategory
req
)
{
var
entity
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
id
);
var
data
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
req
.
name
&&
...
...
@@ -108,7 +253,6 @@ namespace Siger.ApiACC.Controllers
entity
.
name
=
req
.
name
;
entity
.
parent
=
parent
;
entity
.
guid
=
Guid
.
NewGuid
().
ToString
();
entity
.
updatetime
=
DateTime
.
Now
;
_toolsCategoryRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
...
...
@@ -122,7 +266,7 @@ namespace Siger.ApiACC.Controllers
}
[
HttpGet
]
public
IActionResult
Delete
(
int
id
)
public
IActionResult
Delete
Category
(
int
id
)
{
var
entity
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
id
);
if
(
entity
==
null
)
...
...
@@ -143,7 +287,7 @@ namespace Siger.ApiACC.Controllers
}
[
HttpPost
]
public
IActionResult
Deletes
([
FromBody
]
RequestDeleteRange
req
)
public
IActionResult
Delete
Category
s
([
FromBody
]
RequestDeleteRange
req
)
{
if
(
req
.
ids
==
null
||
!
req
.
ids
.
Any
())
{
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsProductController.cs
0 → 100644
View file @
51c9aabc
using
System
;
using
System.Collections.Generic
;
using
System.Linq.Expressions
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.AccRepository.Request
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.Middlelayer.Repository
;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
namespace
Siger.ApiACC.Controllers
{
public
class
FixtureToolsProductController
:
BaseController
{
private
readonly
IUnitOfWork
_unitOfWork
;
private
readonly
IAutomationFixtureToolsCategoryRepository
_toolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsRepository
_toolsRepository
;
private
readonly
IAutomationFixtureToolsProductRepository
_toolsProductRepository
;
private
readonly
ISigerProjectProductRepository
_productRepository
;
public
FixtureToolsProductController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationFixtureToolsProductRepository
toolsProductRepository
,
ISigerProjectProductRepository
productRepository
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
_toolsRepository
=
toolsRepository
;
_toolsProductRepository
=
toolsProductRepository
;
_productRepository
=
productRepository
;
}
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
[
HttpPost
]
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureToolsProduct
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
fixturetoolid
)
||
string
.
IsNullOrEmpty
(
req
.
productid
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
fixtureTool
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
fixturetoolid
.
ToInt
());
if
(
fixtureTool
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolCatgeoryNotFound
);
}
var
product
=
_productRepository
.
Get
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
productid
.
ToInt
());
if
(
product
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
ProductNotFound
);
}
var
data
=
_toolsProductRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixtureTool
.
guid
||
q
.
productid
==
req
.
productid
.
ToInt
()));
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
entity
=
new
siger_automation_fixture_tools_product
{
guid
=
Guid
.
NewGuid
().
ToString
(),
fixturetools
=
fixtureTool
.
guid
,
remark
=
req
.
remark
,
productid
=
req
.
productid
.
ToInt
(),
projectId
=
ProjectId
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
UserId
,
updator
=
UserId
,
};
_toolsProductRepository
.
Insert
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureToolsProduct
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
fixturetoolid
)
||
string
.
IsNullOrEmpty
(
req
.
productid
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
entity
=
_toolsProductRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
fixtureTool
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
fixturetoolid
.
ToInt
());
if
(
fixtureTool
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolCatgeoryNotFound
);
}
var
product
=
_productRepository
.
Get
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
productid
.
ToInt
());
if
(
product
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
ProductNotFound
);
}
var
data
=
_toolsProductRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixtureTool
.
guid
||
q
.
productid
==
req
.
productid
.
ToInt
())
&&
q
.
id
!=
req
.
id
);
if
(
data
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
entity
.
fixturetools
=
fixtureTool
.
guid
;
entity
.
remark
=
req
.
remark
;
entity
.
productid
=
req
.
productid
.
ToInt
();
entity
.
updatetime
=
DateTime
.
Now
;
entity
.
updator
=
UserId
;
_toolsProductRepository
.
Insert
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpGet
]
public
IActionResult
Delete
(
int
id
)
{
var
entity
=
_toolsProductRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsProductRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
[
HttpPost
]
public
IActionResult
Delete
([
FromBody
]
RequestDeleteRange
req
)
{
if
(
req
.
ids
==
null
||
!
req
.
ids
.
Any
())
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
var
entities
=
_toolsProductRepository
.
GetList
(
t
=>
req
.
ids
.
Contains
(
t
.
id
)
&&
t
.
projectId
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
if
(!
entities
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
foreach
(
var
entity
in
entities
)
{
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsProductRepository
.
Update
(
entity
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
View file @
51c9aabc
...
...
@@ -1464,5 +1464,11 @@ namespace Siger.Middlelayer.Common
[
Description
(
"未找到储位类别"
)]
LocationTypeNotFound
,
[
Description
(
"未找到工装类别"
)]
FixtureToolCatgeoryNotFound
,
[
Description
(
"未找到工装信息"
)]
FixtureToolNotFound
,
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_assembly.cs
View file @
51c9aabc
...
...
@@ -4,20 +4,25 @@ using System.Text;
namespace
Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工装装配信息
/// </summary>
public
class
siger_automation_fixture_tools_assembly
:
AccEntityBase
{
public
string
name
{
get
;
set
;
}
public
string
guid
{
get
;
set
;
}
/// <summary>
/// 父工装GUID
/// </summary>
public
string
parent
{
get
;
set
;
}
/// <summary>
/// 工装GUID
/// </summary>
public
string
son
{
get
;
set
;
}
public
int
creator
{
get
;
set
;
}
public
DateTime
create
T
ime
{
get
;
set
;
}
public
DateTime
create
t
ime
{
get
;
set
;
}
public
int
updator
{
get
;
set
;
}
public
DateTime
?
update
T
ime
{
get
;
set
;
}
public
DateTime
?
update
t
ime
{
get
;
set
;
}
public
string
extend1
{
get
;
set
;
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
51c9aabc
...
...
@@ -4,7 +4,10 @@ using System.Linq.Expressions;
using
Microsoft.EntityFrameworkCore
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
namespace
Siger.Middlelayer.AccRepository.Repositories
...
...
@@ -16,5 +19,32 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
categor
,
int
projectid
,
int
page
,
int
pagesize
)
{
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
from
t1
in
tt1
.
DefaultIfEmpty
()
join
c1
in
_context
.
siger_automation_fixture_tools_category
on
t1
.
category
equals
c1
.
guid
join
t2
in
_context
.
siger_automation_fixture_tools
on
q
.
son
equals
t2
.
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
from
u
in
uu
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAumationFixtureToolsAssembly
{
id
=
q
.
id
,
parentid
=
t1
==
null
?
0
:
t1
.
id
,
parentname
=
t1
.
name
??
""
,
sonid
=
t2
.
id
,
sonname
=
t2
.
name
??
""
,
updator
=
u
.
name
??
""
,
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
51c9aabc
...
...
@@ -4,7 +4,10 @@ using System.Linq.Expressions;
using
Microsoft.EntityFrameworkCore
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
namespace
Siger.Middlelayer.AccRepository.Repositories
...
...
@@ -16,5 +19,48 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_product
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
join
c
in
_context
.
siger_automation_fixture_tools_category
on
t
.
category
equals
c
.
guid
join
p
in
_context
.
siger_project_product
on
q
.
productid
equals
p
.
id
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
from
u
in
uu
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAumationFixtureToolsProduct
{
id
=
q
.
id
,
categoryid
=
c
.
id
,
categoryname
=
c
.
name
,
fixturetoolid
=
t
.
id
,
fixturetool
=
t
.
name
,
productid
=
q
.
productid
,
productname
=
p
.
name
,
remark
=
q
.
remark
,
updator
=
q
.
updator
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
Expression
<
Func
<
ResponseAumationFixtureToolsProduct
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
}
Expression
<
Func
<
ResponseAumationFixtureToolsProduct
,
bool
>>
toolExpression
=
f
=>
true
;
if
(
tool
>
0
)
{
toolExpression
=
q
=>
q
.
fixturetoolid
==
tool
;
}
Expression
<
Func
<
ResponseAumationFixtureToolsProduct
,
bool
>>
productExpression
=
f
=>
true
;
if
(
product
>
0
)
{
productExpression
=
q
=>
q
.
productid
==
product
;
}
var
expression
=
categoryExpression
.
And
(
toolExpression
).
And
(
productExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsRepository.cs
View file @
51c9aabc
...
...
@@ -4,7 +4,10 @@ using System.Linq.Expressions;
using
Microsoft.EntityFrameworkCore
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
namespace
Siger.Middlelayer.AccRepository.Repositories
...
...
@@ -16,5 +19,57 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
state
,
int
projectid
,
int
page
,
int
pagesize
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
join
p
in
_context
.
siger_automation_fixture_tools_category
on
q
.
category
equals
p
.
guid
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
from
u
in
uu
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseFixtureTools
{
id
=
q
.
id
,
name
=
q
.
name
,
guid
=
q
.
guid
,
categoryid
=
p
.
id
,
category
=
p
.
name
,
managetype
=
q
.
managetype
,
partnumber
=
q
.
partnumber
,
specifition
=
q
.
specifition
,
number
=
q
.
number
,
remark
=
q
.
remark
,
attachment
=
q
.
attachment
,
code
=
q
.
code
,
updator
=
u
.
name
??
""
,
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
}
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
{
categoryExpression
=
q
=>
q
.
code
.
Contains
(
code
);
}
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
nameExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
name
))
{
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
}
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
stateExpression
=
f
=>
true
;
if
(
state
>=
0
)
{
stateExpression
=
q
=>
q
.
status
==
state
;
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseFixtureTools
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsAssemblyRepository.cs
View file @
51c9aabc
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -6,6 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsAssemblyRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_assembly
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
categor
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
51c9aabc
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -6,6 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsProductRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_product
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsRepository.cs
View file @
51c9aabc
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -6,6 +7,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools
>
{
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
state
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestFixtureToolsCategory.cs
View file @
51c9aabc
...
...
@@ -22,4 +22,72 @@ namespace Siger.Middlelayer.AccRepository.Request
{
public
List
<
int
>
ids
{
get
;
set
;
}
=
new
List
<
int
>();
}
public
class
RequestAddFixtureTools
{
/// <summary>
/// 工装类别
/// </summary>
public
string
categoryid
{
get
;
set
;
}
/// <summary>
/// 管理类型
/// </summary>
public
string
managetype
{
get
;
set
;
}
/// <summary>
/// 工装料号
/// </summary>
public
string
partnumber
{
get
;
set
;
}
/// <summary>
/// 工装名称
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 规格型号
/// </summary>
public
string
specifition
{
get
;
set
;
}
/// <summary>
/// 数量
/// </summary>
public
string
number
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
remark
{
get
;
set
;
}
/// <summary>
/// 附件
/// </summary>
public
string
attachment
{
get
;
set
;
}
/// <summary>
/// 工装编号
/// </summary>
public
string
code
{
get
;
set
;
}
}
public
class
RequestUpdateFixtureTools
:
RequestAddFixtureTools
{
public
int
id
{
get
;
set
;
}
}
public
class
RequestAddFixtureToolsProduct
{
/// <summary>
/// 工装ID
/// </summary>
public
string
fixturetoolid
{
get
;
set
;
}
/// <summary>
/// 产品ID
/// </summary>
public
string
productid
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
remark
{
get
;
set
;
}
}
public
class
RequestUpdateFixtureToolsProduct
:
RequestAddFixtureToolsProduct
{
public
int
id
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/FixtureToolsCategory.cs
View file @
51c9aabc
...
...
@@ -25,4 +25,98 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
extend1
{
get
;
set
;
}
}
public
class
ResponseFixtureTools
{
public
int
id
{
get
;
set
;
}
public
string
guid
{
get
;
set
;
}
/// <summary>
/// 工装类别ID
/// </summary>
public
int
categoryid
{
get
;
set
;
}
/// <summary>
/// 工装类别名称
/// </summary>
public
string
category
{
get
;
set
;
}
/// <summary>
/// 管理类型
/// </summary>
public
int
managetype
{
get
;
set
;
}
/// <summary>
/// 工装料号
/// </summary>
public
string
partnumber
{
get
;
set
;
}
/// <summary>
/// 工装名称
/// </summary>
public
string
name
{
get
;
set
;
}
/// <summary>
/// 规格型号
/// </summary>
public
string
specifition
{
get
;
set
;
}
/// <summary>
/// 数量
/// </summary>
public
int
number
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
remark
{
get
;
set
;
}
/// <summary>
/// 附件
/// </summary>
public
string
attachment
{
get
;
set
;
}
/// <summary>
/// 工装编号
/// </summary>
public
string
code
{
get
;
set
;
}
public
string
updator
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
string
updatetime
{
get
;
set
;
}
}
public
class
ResponseAumationFixtureToolsProduct
{
public
int
id
{
get
;
set
;
}
public
int
categoryid
{
get
;
set
;
}
public
string
categoryname
{
get
;
set
;
}
/// <summary>
/// 工装ID
/// </summary>
public
int
fixturetoolid
{
get
;
set
;
}
public
string
fixturetool
{
get
;
set
;
}
/// <summary>
/// 产品ID
/// </summary>
public
int
productid
{
get
;
set
;
}
public
string
productname
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
remark
{
get
;
set
;
}
public
int
updator
{
get
;
set
;
}
public
string
updatetime
{
get
;
set
;
}
}
public
class
ResponseAumationFixtureToolsAssembly
{
public
int
id
{
get
;
set
;
}
public
int
parentid
{
get
;
set
;
}
public
string
parentname
{
get
;
set
;
}
public
int
sonid
{
get
;
set
;
}
public
string
sonname
{
get
;
set
;
}
public
string
partnumber
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
string
specfication
{
get
;
set
;
}
public
string
code
{
get
;
set
;
}
public
string
updator
{
get
;
set
;
}
public
string
updatetime
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
}
}
Server/Infrastructure/Script/DB.script
View file @
51c9aabc
...
...
@@ -223,13 +223,13 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_assembly` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`parent` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '父类工装GUID',
`son` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '
子类
工装GUID',
`son` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`projectid` int(11) NOT NULL DEFAULT 0,
`status` int(11) NOT NULL DEFAULT 1,
`creator` int(11) NOT NULL DEFAULT 0,
`createtime` datetime(0) NOT NULL,
`updator` int(11) NOT NULL DEFAULT 0,
`update
T
ime` datetime(0) NULL DEFAULT NULL,
`update
t
ime` datetime(0) NULL DEFAULT NULL,
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
...
...
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