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
a5c390d1
Commit
a5c390d1
authored
Jan 25, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://test.siger-data.com:9000/jiawei.su/Laisi_AutoMES2
parents
3b969146
b6c5a9ae
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
280 additions
and
0 deletions
+280
-0
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+1
-0
AutomationStateController.cs
...pis/Siger.ApiACC/Controllers/AutomationStateController.cs
+89
-0
AutomationMachineStatusRepository.cs
...ository/Repositories/AutomationMachineStatusRepository.cs
+30
-0
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+86
-0
IAutomationMachineStatus.cs
...sitory/Repositories/Interface/IAutomationMachineStatus.cs
+2
-0
IAutomationTaskListRepository.cs
...y/Repositories/Interface/IAutomationTaskListRepository.cs
+5
-0
ResponseAutomationMachineStatus.cs
...AccRepository/Response/ResponseAutomationMachineStatus.cs
+21
-0
ResponseAutomationTasklist.cs
...ayer.AccRepository/Response/ResponseAutomationTasklist.cs
+46
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
a5c390d1
...
@@ -387,6 +387,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -387,6 +387,7 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
}
/// <summary>
/// <summary>
/// 准备下料
/// 准备下料
/// </summary>
/// </summary>
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationStateController.cs
0 → 100644
View file @
a5c390d1
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.ApiCommon.Filters
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.ApiCommon.Result
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace
Siger.ApiACC.Controllers
{
public
class
AutomationStateController
:
BaseController
{
private
readonly
ISigerProjectLevelSectionRepository
_sigerProjectLevelSection
;
private
readonly
IAutomationMachineStatus
_automationMachineStatus
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
public
AutomationStateController
(
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationMachineStatus
automationMachineStatus
,
IAutomationTaskListRepository
automationTaskList
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
{
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_automationMachineStatus
=
automationMachineStatus
;
_automationTaskList
=
automationTaskList
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
}
/// <summary>
/// 产线监控管理
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
[
HttpGet
]
public
IActionResult
GetStationMonitor
(
int
section
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
data
=
_automationMachineStatus
.
GetSectionStatus
(
ProjectId
,
section
,
ids
);
var
result
=
new
List
<
ResponseAutomationMachineStatus
>();
foreach
(
var
d
in
data
)
{
var
item
=
new
ResponseAutomationMachineStatus
{
sectionid
=
d
.
sectionid
,
section
=
d
.
section
,
enable
=
d
.
enable
,
product
=
""
,
location
=
0
,
sn
=
""
,
fixtureCode
=
""
,
fixtureName
=
""
,
lastupdate
=
""
,
status
=
0
,
};
var
fixture
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
d
.
sectionid
);
if
(
fixture
!=
null
)
{
item
.
product
=
fixture
.
productName
;
item
.
location
=
fixture
.
locationId
;
item
.
sn
=
fixture
.
sn
;
item
.
fixtureCode
=
fixture
.
fixtureguid
;
item
.
fixtureName
=
fixture
.
fixturename
;
}
result
.
Add
(
item
);
}
return
new
ObjectResult
(
result
);
}
[
HttpGet
]
public
IActionResult
GetTasklist
(
int
section
,
int
tasktype
,
string
productCode
,
string
taskno
,
string
sn
,
int
status
,
int
actionType
,
string
triggertime
,
string
complatetime
,
int
page
,
int
pageSize
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
resulst
=
_automationTaskList
.
GetTasklistPagedList
(
ids
,
tasktype
,
productCode
,
taskno
,
sn
,
status
,
actionType
,
triggertime
,
complatetime
,
ProjectId
,
page
,
pageSize
);
return
new
PagedObjectResult
(
resulst
,
resulst
.
Total
,
page
,
pageSize
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationMachineStatusRepository.cs
View file @
a5c390d1
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System
;
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
using
System.Linq.Expressions
;
namespace
Siger.Middlelayer.AccRepository.Repositories
namespace
Siger.Middlelayer.AccRepository.Repositories
{
{
internal
class
AutomationMachineStatusRepository
:
AccRepositoryBase
<
siger_automation_machine_status
>,
IAutomationMachineStatus
internal
class
AutomationMachineStatusRepository
:
AccRepositoryBase
<
siger_automation_machine_status
>,
IAutomationMachineStatus
{
{
private
ApiAccDbContext
_context
;
public
AutomationMachineStatusRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
public
AutomationMachineStatusRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
{
_context
=
context
;
}
public
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
)
{
var
data
=
from
lv
in
_context
.
siger_project_level_section
join
ms
in
_context
.
siger_automation_machine_status
on
lv
.
id
equals
ms
.
section
into
mstemp
join
plv
in
_context
.
siger_project_level_section
on
lv
.
parentid
equals
plv
.
id
from
ms
in
mstemp
.
DefaultIfEmpty
()
select
new
ResponseAutomationMachineStatus
{
sectionid
=
lv
.
id
,
section
=
$"
{
plv
.
title
}
-
{
lv
.
title
}
"
,
lastupdate
=
ms
!=
null
?
ms
.
updatetime
.
ToString
():
""
,
enable
=
ms
!=
null
?
ms
.
enable
:
1
,
status
=
ms
!=
null
?
ms
.
status
:
1
,
};
Expression
<
Func
<
ResponseAutomationMachineStatus
,
bool
>>
sectionsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectionsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
return
data
.
Where
(
sectionsExpression
);
}
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
a5c390d1
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
...
@@ -55,5 +59,87 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -55,5 +59,87 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var
randon
=
new
Random
().
Next
(
1000
,
9999
);
var
randon
=
new
Random
().
Next
(
1000
,
9999
);
return
$"
{
productCode
}{
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)}{
serinum
}{
randon
}
"
;
return
$"
{
productCode
}{
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)}{
serinum
}{
randon
}
"
;
}
}
public
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
tiggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
)
{
var
query
=
from
q
in
_context
.
siger_automation_task_list
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixtureguid
equals
t
.
guid
join
s
in
_context
.
siger_project_level_section
on
q
.
sectionid
equals
s
.
id
join
lv
in
_context
.
siger_project_level_section
on
s
.
parentid
equals
lv
.
id
where
q
.
projectId
==
projectid
select
new
ResponseAutomationTasklist
{
taskno
=
q
.
no
,
sectionid
=
q
.
sectionid
,
section
=
$"
{
lv
.
title
}
-
{
s
.
title
}
"
,
trigger
=
EnumHelper
.
GetEnumDesc
(
q
.
trigger
),
triggervalue
=
q
.
triggertime
,
triggerTime
=
q
.
triggertime
==
DateTime
.
MinValue
?
""
:
q
.
triggertime
.
ToString
(),
complatevalue
=
q
.
completetime
,
complatetime
=
q
.
completetime
==
DateTime
.
MinValue
?
""
:
q
.
completetime
.
ToString
(),
action
=
EnumHelper
.
GetEnumDesc
(
q
.
action
),
actionType
=
EnumHelper
.
GetEnumDesc
(
q
.
actiontype
),
fixtureCode
=
t
.
code
,
fixtureName
=
t
.
name
,
location
=
q
.
locationid
.
ToString
(),
sn
=
q
.
sn
,
ordernumber
=
q
.
ordercode
,
productCode
=
q
.
productcode
,
program
=
q
.
programnumber
,
route
=
q
.
remark
,
tasktype
=
EnumHelper
.
GetEnumDesc
(
q
.
tasktype
),
};
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
sectonsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectonsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
taskTypeExpression
=
f
=>
true
;
if
(
taskType
!=
0
)
{
taskTypeExpression
=
q
=>
q
.
tasktypeid
==
taskType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
productCodeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
productCode
))
{
productCodeExpression
=
q
=>
q
.
productCode
.
Contains
(
productCode
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
tasknoExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
TaskNo
))
{
tasknoExpression
=
q
=>
q
.
taskno
.
Contains
(
TaskNo
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
snExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
sn
))
{
snExpression
=
q
=>
q
.
sn
.
Contains
(
sn
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
actionTypeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
actionTypeExpression
=
q
=>
q
.
actionTypeid
==
actionType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
triggerTimeTypeExpression
=
f
=>
true
;
if
(
string
.
IsNullOrEmpty
(
tiggertime
))
{
triggerTimeTypeExpression
=
q
=>
q
.
triggervalue
==
tiggertime
.
ToDateTime
();
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
comptimeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
comptimeExpression
=
q
=>
q
.
complatevalue
==
comptime
.
ToDateTime
();
}
var
expression
=
sectonsExpression
.
And
(
taskTypeExpression
).
And
(
productCodeExpression
).
And
(
tasknoExpression
).
And
(
snExpression
)
.
And
(
actionTypeExpression
).
And
(
triggerTimeTypeExpression
).
And
(
comptimeExpression
);
var
entities
=
query
.
Where
(
expression
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
totalCount
);
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationMachineStatus.cs
View file @
a5c390d1
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
...
@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
{
public
interface
IAutomationMachineStatus
:
IAccRepositoryBase
<
siger_automation_machine_status
>
public
interface
IAutomationMachineStatus
:
IAccRepositoryBase
<
siger_automation_machine_status
>
{
{
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
);
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationTaskListRepository.cs
View file @
a5c390d1
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Repository.Paged
;
using
System.Collections.Generic
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
{
...
@@ -22,5 +24,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -22,5 +24,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
string
CreateRandonSn
(
string
productCode
);
string
CreateRandonSn
(
string
productCode
);
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
tiggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationMachineStatus.cs
0 → 100644
View file @
a5c390d1
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationMachineStatus
{
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
// public string machine { get; set; }
public
string
product
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
int
location
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
int
enable
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
string
lastupdate
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationTasklist.cs
0 → 100644
View file @
a5c390d1
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationTasklist
{
public
string
taskno
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
/// <summary>
/// 触发方式
/// </summary>
public
string
trigger
{
get
;
set
;
}
public
int
tasktypeid
{
get
;
set
;
}
/// <summary>
/// 任务类型
/// </summary>
public
string
tasktype
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
routeNo
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
string
program
{
get
;
set
;
}
/// <summary>
/// 储位ID
/// </summary>
public
string
location
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
string
action
{
get
;
set
;
}
public
int
actionTypeid
{
get
;
set
;
}
/// <summary>
/// 执行类型
/// </summary>
public
string
actionType
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
DateTime
triggervalue
{
get
;
set
;
}
public
string
triggerTime
{
get
;
set
;
}
public
DateTime
?
complatevalue
{
get
;
set
;
}
public
string
complatetime
{
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