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
f9c1da95
Commit
f9c1da95
authored
Feb 06, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixedbug
parent
3a6bfe74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
29 deletions
+20
-29
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+20
-29
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
f9c1da95
...
...
@@ -297,7 +297,7 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
AccEnum
.
ProductRouteMissing
);
}
location
.
route
=
route
.
id
.
ToString
()
;
location
.
route
id
=
route
.
id
;
location
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
location
);
...
...
@@ -429,7 +429,7 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
return
;
}
//优先级1 :清洗机完成 。待下料
var
cleanProperty
=
sectionPropertys
.
FirstOrDefault
(
f
=>
f
.
propertytype
==
4
);
if
(
cleanProperty
==
null
)
{
...
...
@@ -443,11 +443,12 @@ namespace Siger.ApiACC.Controllers
}
else
{
//优先级1 :清洗机完成 。待下料
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
}
完成,创建清洗机Task"
);
//取最近完成的 Task
var
lastTask
=
_automationTaskList
.
GetList
(
f
=>
f
.
extend1
==
cleanMachine
.
section
.
ToString
()
,
"id"
,
true
).
FirstOrDefault
();
var
lastTask
=
_automationTaskList
.
GetList
(
f
=>
f
.
extend1
==
cleanMachine
.
section
.
ToString
()
&&
f
.
status
==
(
int
)
Automation
.
TaskResultStatus
.
Complated
,
"id"
,
true
).
FirstOrDefault
();
if
(
lastTask
!=
null
)
{
lastTask
.
extend1
=
string
.
Empty
;
...
...
@@ -465,33 +466,9 @@ namespace Siger.ApiACC.Controllers
var
location
=
SelectLocation
(
freeMachine
.
Select
(
s
=>
s
.
machineid
).
ToList
());
if
(
location
!=
null
)
{
// * 更新下一个工序到储位
//var locationObj = _automationLocation.Get(f => f.id == location.lid);
//if (locationObj != null)
//{
//var doneRoute = _productRoute.Get(f => f.id == location.route);
//if (doneRoute == null)
// return;
//var productRoutes = _productRoute.GetList(f => f.projectId == PID && f.productId == location.productId && f.status == (int)RowState.Valid && f.serialNumber > doneRoute.serialNumber);
//if (!productRoutes.Any())
//{
// locationObj.route = string.Empty;
//}
//else
//{
// var nextRoute = productRoutes.OrderBy(d => d.serialNumber).FirstOrDefault();
CreateTask
(
location
.
section
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
fixture
,
location
.
ordernumber
,
location
.
sn
,
location
.
pn
,
location
.
productId
,
location
.
productCode
,
location
.
location
,
location
.
route
);
// locationObj.routeid = nextRoute != null ? nextRoute.id : 0;
// locationObj.route = nextRoute != null ? nextRoute.name : "";
//}
////工件已出立库
//locationObj.status = (int)LocationStatus.Out;
//_automationLocation.Update(locationObj);
CreateTask
(
location
.
section
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
fixture
,
location
.
ordernumber
,
location
.
sn
,
location
.
pn
,
location
.
productId
,
location
.
productCode
,
location
.
location
,
location
.
route
);
return
;
//完成当前任务 退出
//}
}
}
//优先级3:其他设备下料 (加工中心 ->清洗机)
...
...
@@ -504,9 +481,18 @@ namespace Siger.ApiACC.Controllers
//清洗机上料 为 任务触发 触发
if
(
tasklist
!=
null
)
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,TaskResult触发 "
);
//创建CNC 下料到清洗机
CreateTask
(
fullMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
tasklist
.
fixtureguid
,
tasklist
.
ordercode
,
tasklist
.
sn
,
tasklist
.
programnumber
,
tasklist
.
productid
,
tasklist
.
productcode
,
tasklist
.
locationid
,
tasklist
.
route
);
return
;
//完成当前任务 退出
}
else
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,MachineStatus触发 "
);
var
lastTask
=
_automationTaskList
.
GetList
(
f
=>
f
.
sectionid
==
fullMachine
.
section
&&
f
.
status
==(
int
)
Automation
.
TaskResultStatus
.
Complated
,
"id"
,
true
).
FirstOrDefault
();
if
(
lastTask
!=
null
)
{
CreateTask
(
fullMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
lastTask
.
fixtureguid
,
lastTask
.
ordercode
,
lastTask
.
sn
,
lastTask
.
programnumber
,
lastTask
.
productid
,
lastTask
.
productcode
,
lastTask
.
locationid
,
lastTask
.
route
);
}
}
}
}
...
...
@@ -526,6 +512,11 @@ namespace Siger.ApiACC.Controllers
/// <param name="locationid">储位ID</param>
void
CreateTask
(
int
section
,
TaskActionType
actionType
,
TaskAction
taskAction
,
string
guid
,
string
orderno
,
string
sn
,
string
program
,
int
productId
,
string
productCode
,
int
locationid
,
int
route
)
{
if
(
_automationTaskList
.
CanTask
(
PID
,
section
))
{
Logger
.
WriteLineInfo
(
$"CreateTask sectionId:
{
section
}
工站
{
EnumHelper
.
GetEnumDesc
(
taskAction
)}
触发条件不满足"
);
return
;
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
...
...
@@ -568,7 +559,7 @@ namespace Siger.ApiACC.Controllers
foreach
(
var
b
in
beats
)
{
Logger
.
WriteLineError
(
$"SelectLocation 设备
{
b
.
machineID
}
标准节拍
{
b
.
route_number
}{
b
.
route_name
}
"
);
var
autoLocationIds
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
b
.
projectID
&&
f
.
routeid
==
b
.
route_number
.
ToInt
()
&&
f
.
productid
==
b
.
product_name
.
ToInt
());
var
autoLocationIds
=
_automationLocation
.
GetList
(
f
=>
f
.
status
==(
int
)
RowState
.
Valid
&&
f
.
projectId
==
b
.
projectID
&&
f
.
routeid
==
b
.
route_number
.
ToInt
()
&&
f
.
productid
==
b
.
product_name
.
ToInt
());
if
(!
autoLocationIds
.
Any
())
{
Logger
.
WriteLineError
(
$"SelectLocation 设备
{
b
.
machineID
}
routeid:
{
b
.
route_number
}
-
{
b
.
route_name
}
productId:
{
b
.
product_name
}
没有匹配到当前储位"
);
...
...
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