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
0b279d64
Commit
0b279d64
authored
Feb 05, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixedbug
parent
971259e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
79 deletions
+66
-79
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+36
-32
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+29
-46
siger_automation_machine_property.cs
...cRepository/Entities/siger_automation_machine_property.cs
+1
-1
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
0b279d64
...
@@ -41,10 +41,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -41,10 +41,11 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
private
readonly
IProductRouteRepository
_productRoute
;
private
readonly
IProductRouteRepository
_productRoute
;
private
readonly
IAutomationSectionPropertyRepository
_automationSectionProperty
;
public
AutomationController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationLineMode
automationLineMode
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerDict
sigerDict
,
IAutomationTaskListRepository
automationTaskList
,
public
AutomationController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationLineMode
automationLineMode
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerDict
sigerDict
,
IAutomationTaskListRepository
automationTaskList
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationLocationRepository
automationLocation
,
IProductionBeatSetRepository
productionBeatSet
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationLocationRepository
automationLocation
,
IProductionBeatSetRepository
productionBeatSet
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
,
IProductRouteRepository
productRoute
)
IAutomationFixtureToolsRepository
automationFixtureTools
,
IProductRouteRepository
productRoute
,
IAutomationSectionPropertyRepository
automationSectionProperty
)
{
{
_unitOfWork
=
unitOfWork
;
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
@@ -59,6 +60,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -59,6 +60,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureTools
=
automationFixtureTools
;
_automationFixtureTools
=
automationFixtureTools
;
_productRoute
=
productRoute
;
_productRoute
=
productRoute
;
_automationSectionProperty
=
automationSectionProperty
;
}
}
/// <summary>
/// <summary>
...
@@ -275,16 +277,19 @@ namespace Siger.ApiACC.Controllers
...
@@ -275,16 +277,19 @@ namespace Siger.ApiACC.Controllers
_automationTaskList
.
Update
(
taskObj
);
_automationTaskList
.
Update
(
taskObj
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
var
sectionProperty
=
_automationSectionProperty
.
Get
(
f
=>
f
.
sectionid
==
taskObj
.
sectionid
);
if
(
sectionProperty
==
null
)
{
Logger
.
WriteLineInfo
(
$"PlCfeeback 设备属性为维护"
);
throw
new
BadRequestException
(
AccEnum
.
SectionPropertyNull
);
}
//PLC 反馈结束.
//PLC 反馈结束.
if
(
status
==
(
int
)
TaskResultStatus
.
Complated
)
if
(
status
==
(
int
)
TaskResultStatus
.
Complated
)
{
{
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
uploadStation
.
Select
(
f
=>
f
.
dval
).
ToList
();
if
(
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
if
(
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
{
{
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if
(
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
taskObj
.
sectionid
.
ToString
()))
)
if
(
sectionProperty
.
propertytype
==
1
)
{
{
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
if
(
location
==
null
)
if
(
location
==
null
)
...
@@ -302,20 +307,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -302,20 +307,11 @@ namespace Siger.ApiACC.Controllers
location
.
status
=
(
int
)
LocationStatus
.
In
;
location
.
status
=
(
int
)
LocationStatus
.
In
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
}
}
if
(
monitor
!=
null
&&
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
if
(
monitor
!=
null
&&
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
{
{
monitor
.
section
=
0
;
monitor
.
section
=
0
;
}
}
//上料上下料设备状态为后台控制,CNC是PLC控制
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
&&
f
.
auto
==
0
);
if
(
machineStatus
!=
null
)
{
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
_automationMachineStatus
.
Update
(
machineStatus
);
}
}
}
if
(
monitor
!=
null
)
if
(
monitor
!=
null
)
...
@@ -355,41 +351,50 @@ namespace Siger.ApiACC.Controllers
...
@@ -355,41 +351,50 @@ namespace Siger.ApiACC.Controllers
//2.其他设备上料
//2.其他设备上料
//3.其他设备下料
//3.其他设备下料
*/
*/
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
//var updownDic= stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
/* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
//var uploadStations = updownDic.Select(f => f.dval.ToInt()).ToList();
var
dictClean
=
stationDicts
.
FirstOrDefault
(
s
=>
s
.
dkey
==
DictKeyValConst
.
CleanStation
);
///* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
if
(
dictClean
==
null
)
//var dictClean = stationDicts.FirstOrDefault(s=>s.dkey==DictKeyValConst.CleanStation);
{
//if (dictClean==null)
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置清洗机字典"
);
//{
// Logger.WriteLineInfo($"AutoProcess 未配置清洗机字典");
// return;
//}
var
sectionPropertys
=
_automationSectionProperty
.
GetList
(
f
=>
f
.
projectId
==
PID
).
ToList
();
if
(!
sectionPropertys
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 设备属性未配置"
);
return
;
return
;
}
}
var
cncStations
=
sectionPropertys
.
Where
(
s
=>
s
.
propertytype
==
2
).
Select
(
s
=>
s
.
sectionid
).
ToList
();
// 获取可用 设备状态列表 排除上料工位
// 获取可用 设备状态列表 排除上料工位
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
auto
==
1
&&
!
upload
Stations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
cnc
Stations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
if
(!
machineStatusList
.
Any
())
if
(!
machineStatusList
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
return
;
return
;
}
}
//优先级1 :清洗机完成 。待下料
//优先级1 :清洗机完成 。待下料
var
cleanMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
section
==
dictClean
.
dval
.
ToInt
());
var
cleanMachine
=
sectionPropertys
.
FirstOrDefault
(
f
=>
f
.
projectId
==
PID
&&
f
.
propertytype
==
4
);
if
(
cleanMachine
!=
null
)
if
(
cleanMachine
!=
null
)
{
{
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
}
完成,创建清洗机Task"
);
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
id
}
完成,创建清洗机Task"
);
if
(
tasklist
==
null
)
if
(
tasklist
==
null
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空"
);
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空"
);
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空,查找设备Monitor
{
cleanMachine
.
section
}
状态"
);
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空,查找设备Monitor
{
cleanMachine
.
section
id
}
状态"
);
var
machineMonitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
var
machineMonitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
id
);
if
(
machineMonitor
==
null
)
if
(
machineMonitor
==
null
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机
{
cleanMachine
.
section
}
machineMonitor 为空"
);
Logger
.
WriteLineError
(
$"AutoProcess 清洗机
{
cleanMachine
.
section
id
}
machineMonitor 为空"
);
return
;
return
;
}
}
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
machineMonitor
.
fixtureguid
,
machineMonitor
.
ordernumber
,
machineMonitor
.
sn
,
""
,
machineMonitor
.
productId
,
machineMonitor
.
productCode
,
machineMonitor
.
locationId
,
machineMonitor
.
route
);
CreateTask
(
cleanMachine
.
section
id
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
machineMonitor
.
fixtureguid
,
machineMonitor
.
ordernumber
,
machineMonitor
.
sn
,
""
,
machineMonitor
.
productId
,
machineMonitor
.
productCode
,
machineMonitor
.
locationId
,
machineMonitor
.
route
);
}
}
else
else
{
{
...
@@ -403,7 +408,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -403,7 +408,7 @@ namespace Siger.ApiACC.Controllers
locationObj
.
status
=
(
int
)
LocationStatus
.
In
;
locationObj
.
status
=
(
int
)
LocationStatus
.
In
;
_automationLocation
.
Update
(
locationObj
);
_automationLocation
.
Update
(
locationObj
);
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
tasklist
.
fixtureguid
,
tasklist
.
ordercode
,
tasklist
.
sn
,
"无程序"
,
tasklist
.
productid
,
tasklist
.
productcode
,
tasklist
.
locationid
,
tasklist
.
route
);
CreateTask
(
cleanMachine
.
section
id
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
tasklist
.
fixtureguid
,
tasklist
.
ordercode
,
tasklist
.
sn
,
"无程序"
,
tasklist
.
productid
,
tasklist
.
productcode
,
tasklist
.
locationid
,
tasklist
.
route
);
return
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
}
}
...
@@ -452,14 +457,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -452,14 +457,13 @@ namespace Siger.ApiACC.Controllers
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
)
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,创建普通设备下料到清洗机Task "
);
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,创建普通设备下料到清洗机Task "
);
//更新清洗机监控
//更新清洗机监控
var
monitor
=
_automationFixtureMonitor
.
Get
(
cleanMachine
.
section
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
cleanMachine
.
section
id
);
if
(
monitor
==
null
)
if
(
monitor
==
null
)
{
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
{
section
=
cleanMachine
.
section
,
section
=
cleanMachine
.
section
id
,
fixtureguid
=
tasklist
.
fixtureguid
,
fixtureguid
=
tasklist
.
fixtureguid
,
fixturename
=
tasklist
.
fixturename
,
fixturename
=
tasklist
.
fixturename
,
productCode
=
tasklist
.
productcode
,
productCode
=
tasklist
.
productcode
,
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
0b279d64
...
@@ -82,70 +82,53 @@ namespace Siger.ApiACC.Controllers
...
@@ -82,70 +82,53 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置设备类型字典"
);
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置设备类型字典"
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
}
var
loadStation
=
new
List
<
string
>();
var
loadStation
=
new
List
<
string
>();
//上下料
if
(
type
==
0
)
if
(
type
==
0
)
{
{
var
dictLoad
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
sectionProperty
=
_sectionPropertyRepository
.
GetList
(
f
=>
f
.
propertytype
==
1
);
if
(!
dictLoad
.
Any
())
var
sections
=
sectionProperty
.
Select
(
s
=>
s
.
sectionid
).
ToList
();
var
levelSection
=
_sigerProjectLevelSection
.
GetList
(
f
=>
f
.
parentid
==
line
&&
sections
.
Contains
(
f
.
id
));
if
(!
levelSection
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置上下料工站字典"
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
}
loadStation
=
dictLoad
.
Select
(
s
=>
s
.
dval
).
ToList
();
var
result
=
new
List
<
ResponseLoadStation
>
();
}
else
foreach
(
var
lv
in
levelSection
)
{
{
var
dictLoad
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
CleanStation
);
result
.
Add
(
new
ResponseLoadStation
if
(!
dictLoad
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置清洗工站字典"
);
section
=
lv
.
id
,
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
status
=
1
,
title
=
lv
.
title
,
});
}
}
loadStation
=
dictLoad
.
Select
(
s
=>
s
.
dval
).
ToList
();
return
new
ObjectResult
(
result
);
//检验
}
}
else
var
data
=
new
List
<
ResponseLoadStation
>();
foreach
(
var
station
in
loadStation
)
{
{
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
station
.
ToInt
()
&&
f
.
parentid
==
line
&&
f
.
status
==
(
int
)
RowState
.
Valid
);
var
sectionProperty
=
_sectionPropertyRepository
.
GetList
(
f
=>
f
.
propertytype
==
3
);
if
(
section
==
null
)
var
sections
=
sectionProperty
.
Select
(
s
=>
s
.
sectionid
).
ToList
();
continue
;
var
levelSection
=
_sigerProjectLevelSection
.
GetList
(
f
=>
f
.
parentid
==
line
&&
sections
.
Contains
(
f
.
id
));
var
machintAttr
=
_sigerProjectMachineAttribution
.
Get
(
f
=>
f
.
station
==
section
.
id
);
if
(!
levelSection
.
Any
())
if
(
machintAttr
==
null
)
{
{
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置工站字典"
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
continue
;
}
}
var
loadStatus
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
var
result
=
new
List
<
ResponseLoadStation
>();
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
section
.
id
);
foreach
(
var
lv
in
levelSection
)
if
(
machineStatus
==
null
)
{
_automationMachineStatus
.
Insert
(
new
siger_automation_machine_status
{
{
projectId
=
ProjectId
,
result
.
Add
(
new
ResponseLoadStation
enable
=
1
,
machineid
=
machintAttr
.
machine
,
section
=
section
.
id
,
updatetime
=
DateTime
.
Now
});
}
else
{
{
section
=
lv
.
id
,
status
=
1
,
title
=
lv
.
title
,
loadStatus
=
machineStatus
.
status
;
}
data
.
Add
(
new
ResponseLoadStation
{
section
=
section
.
id
,
title
=
section
.
title
,
status
=
loadStatus
});
});
}
}
_unitOfWork
.
Commit
();
return
new
ObjectResult
(
result
);
}
return
new
ObjectResult
(
data
);
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_machine_property.cs
View file @
0b279d64
...
@@ -15,7 +15,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
...
@@ -15,7 +15,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
/// </summary>
public
int
sectionid
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 1:上下料工位2:加工工位3:检验工位4:
装配工位
5:存储工位
/// 1:上下料工位2:加工工位3:检验工位4:
清洗
5:存储工位
/// </summary>
/// </summary>
public
int
propertytype
{
get
;
set
;
}
public
int
propertytype
{
get
;
set
;
}
/// <summary>
/// <summary>
...
...
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