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
a3972ccc
Commit
a3972ccc
authored
Feb 20, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupdate 新增监控SN状态 防错上下料
parent
00a1630e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
30 deletions
+56
-30
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+55
-30
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+1
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
a3972ccc
...
...
@@ -22,6 +22,7 @@ using NPOI.SS.Formula.Functions;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Helpers
;
using
NPOI.SS.Formula
;
using
NPOI.OpenXml4Net.OPC.Internal
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -551,31 +552,41 @@ 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
.
sectionid
==
cleanMachine
.
section
,
"id"
,
true
).
FirstOrDefault
(
);
if
(
lastTask
!=
null
)
var
monitorClean
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
monitorClean
!=
null
)
{
if
(
lastTask
.
action
==
TaskAction
.
Step_QXJ_LK
)
if
(
string
.
IsNullOrEmpty
(
monitorClean
.
sn
)
)
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机完成,上一个任务与本次任务指令重复"
);
return
;
//任务重复
}
if
(
lastTask
.
status
==
(
int
)
TaskResultStatus
.
Complated
)
Logger
.
WriteLineError
(
$"AutoProcess 清洗机完成,清洗监控无工件"
);
}
else
{
Logger
.
WriteLineInfo
(
$"自动化业务流转--AutoProcess section
{
cleanMachine
.
section
}
task:
{
TaskAction
.
Step_QXJ_LK
.
ToStr
()}
sn
{
lastTask
.
sn
}
"
);
//if (TargetFree(invenSection.sectionid, cleanMachine.section, TaskAction.Step_QXJ_LK))
//{
CreateTask
(
invenSection
.
sectionid
,
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
lastTask
.
fixtureguid
,
lastTask
.
fixturename
,
lastTask
.
ordercode
,
lastTask
.
sn
,
"无程序"
,
lastTask
.
productid
,
lastTask
.
productcode
,
lastTask
.
productname
,
lastTask
.
locationid
,
lastTask
.
route
);
return
;
//完成当前任务 退出
//}
//取最近完成的 Task
var
lastTask
=
_automationTaskList
.
GetList
(
f
=>
f
.
sectionid
==
cleanMachine
.
section
,
"id"
,
true
).
FirstOrDefault
();
if
(
lastTask
!=
null
)
{
if
(
lastTask
.
action
==
TaskAction
.
Step_QXJ_LK
)
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机完成,上一个任务与本次任务指令重复"
);
return
;
//任务重复
}
if
(
lastTask
.
status
==
(
int
)
TaskResultStatus
.
Complated
)
{
Logger
.
WriteLineInfo
(
$"自动化业务流转--AutoProcess section
{
cleanMachine
.
section
}
task:
{
TaskAction
.
Step_QXJ_LK
.
ToStr
()}
sn
{
lastTask
.
sn
}
"
);
//if (TargetFree(invenSection.sectionid, cleanMachine.section, TaskAction.Step_QXJ_LK))
//{
CreateTask
(
invenSection
.
sectionid
,
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
lastTask
.
fixtureguid
,
lastTask
.
fixturename
,
lastTask
.
ordercode
,
lastTask
.
sn
,
"无程序"
,
lastTask
.
productid
,
lastTask
.
productcode
,
lastTask
.
productname
,
lastTask
.
locationid
,
lastTask
.
route
);
return
;
//完成当前任务 退出
//}
}
}
}
}
}
}
//优先级2 :其他设备待上料 (立库->加工中心)
...
...
@@ -602,7 +613,7 @@ namespace Siger.ApiACC.Controllers
//优先级3:其他设备下料 (加工中心 ->清洗机)
if
(
cleanMachine
!=
null
)
{
siger_automation_machine_status
fullMachine
=
null
;
//
siger_automation_machine_status fullMachine = null;
var
fullAllMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
);
if
(
fullAllMachine
.
Any
()
&&
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
)
...
...
@@ -611,7 +622,7 @@ namespace Siger.ApiACC.Controllers
//清洗机上料 为 任务触发 触发
if
(
tasklist
!=
null
&&
fullAllMachine
.
Where
(
p
=>
p
.
section
==
tasklist
.
sectionid
).
Any
())
{
fullMachine
=
fullAllMachine
.
Where
(
p
=>
p
.
section
==
tasklist
.
sectionid
).
FirstOrDefault
();
var
fullMachine
=
fullAllMachine
.
Where
(
p
=>
p
.
section
==
tasklist
.
sectionid
).
FirstOrDefault
();
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,TaskResult触发 "
);
Logger
.
WriteLineInfo
(
$"自动化业务流转--AutoProcess section
{
fullMachine
.
section
}
task:
{
TaskAction
.
Step_JGZX_QXJ
.
ToStr
()}
sn
{
tasklist
.
sn
}
"
);
...
...
@@ -631,24 +642,26 @@ namespace Siger.ApiACC.Controllers
}
else
{
fullMachine
=
fullAllMachine
.
First
();
if
(
_automationTaskList
.
CanTask
(
PID
,
fullMachine
.
section
))
var
fullmids
=
fullAllMachine
.
Select
(
s
=>
s
.
section
).
ToList
();
var
lastMonitorItem
=
_automationFixtureMonitor
.
GetList
(
p
=>
fullmids
.
Contains
(
p
.
section
)
&&
!
string
.
IsNullOrEmpty
(
p
.
sn
)).
OrderByDescending
(
p
=>
p
.
id
).
FirstOrDefault
();
if
(
lastMonitorItem
==
null
)
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,设备监控无可下料的设备 "
);
return
;
}
if
(
_automationTaskList
.
CanTask
(
PID
,
lastMonitorItem
.
section
))
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,MachineStatus触发 "
);
var
last
MonitorItem
=
_automationFixtureMonitor
.
GetList
(
p
=>
p
.
section
==
fullMachine
.
section
).
OrderByDescending
(
p
=>
p
.
id
).
FirstOrDefault
();
if
(
last
MonitorItem
!=
null
)
var
last
Task
=
_automationTaskList
.
GetList
(
f
=>
f
.
sectionid
==
lastMonitorItem
.
section
&&
f
.
sn
==
lastMonitorItem
.
sn
&&
f
.
status
==
(
int
)
Automation
.
TaskResultStatus
.
Complated
,
"id"
,
true
).
FirstOrDefault
();
if
(
last
Task
!=
null
)
{
var
lastTask
=
_automationTaskList
.
GetList
(
f
=>
f
.
sectionid
==
fullMachine
.
section
&&
f
.
sn
==
lastMonitorItem
.
sn
&&
f
.
status
==
(
int
)
Automation
.
TaskResultStatus
.
Complated
,
"id"
,
true
).
FirstOrDefault
(
);
if
(
lastTask
!=
null
)
Logger
.
WriteLineInfo
(
$"自动化业务流转--AutoProcess section
{
lastMonitorItem
.
section
}
task:
{
TaskAction
.
Step_JGZX_QXJ
.
ToStr
()}
sn
{
lastTask
.
sn
}
"
);
if
(
TargetFree
(
cleanMachine
.
section
,
lastMonitorItem
.
section
,
TaskAction
.
Step_JGZX_QXJ
)
)
{
Logger
.
WriteLineInfo
(
$"自动化业务流转--AutoProcess section
{
fullMachine
.
section
}
task:
{
TaskAction
.
Step_JGZX_QXJ
.
ToStr
()}
sn
{
lastTask
.
sn
}
"
);
if
(
TargetFree
(
cleanMachine
.
section
,
fullMachine
.
section
,
TaskAction
.
Step_JGZX_QXJ
))
{
CreateTask
(
cleanMachine
.
section
,
fullMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
lastTask
.
fixtureguid
,
lastTask
.
fixturename
,
lastTask
.
ordercode
,
lastTask
.
sn
,
lastTask
.
programnumber
,
lastTask
.
productid
,
lastTask
.
productcode
,
lastTask
.
productname
,
lastTask
.
locationid
,
lastTask
.
route
);
}
CreateTask
(
cleanMachine
.
section
,
lastMonitorItem
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
lastTask
.
fixtureguid
,
lastTask
.
fixturename
,
lastTask
.
ordercode
,
lastTask
.
sn
,
lastTask
.
programnumber
,
lastTask
.
productid
,
lastTask
.
productcode
,
lastTask
.
productname
,
lastTask
.
locationid
,
lastTask
.
route
);
}
}
}
}
}
...
...
@@ -716,9 +729,21 @@ namespace Siger.ApiACC.Controllers
{
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
machines
.
Contains
(
f
.
machineID
)
&&
f
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
TempList
=
new
List
<
ResponseAutoRouteInfo
>();
foreach
(
var
b
in
beats
)
{
var
moniter
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
b
.
section_id
);
if
(
moniter
!=
null
)
{
//防错 监控设备中无SN 加工的工站
if
(!
string
.
IsNullOrEmpty
(
moniter
.
sn
))
{
Logger
.
WriteLineInfo
(
$"CreateTask machineId:
{
b
.
machineID
}
设备上有SN在加工"
);
continue
;
}
}
Logger
.
WriteLineError
(
$"SelectLocation 设备
{
b
.
machineID
}
标准节拍
{
b
.
route_number
}{
b
.
route_name
}
"
);
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
())
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
a3972ccc
...
...
@@ -130,6 +130,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join
pd
in
_context
.
siger_project_product
on
p
.
product_id
equals
pd
.
id
where
q
.
projectId
==
projectId
&&
d
.
OrderNumber
==
ordernumber
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
l
.
status
==(
int
)
RowState
.
Valid
&&
string
.
IsNullOrEmpty
(
l
.
sn
)
select
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
ordernumber
,
...
...
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