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
bf400bbc
Commit
bf400bbc
authored
Jan 26, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupate
parent
1bf8eb3f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
35 deletions
+63
-35
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+53
-25
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+10
-10
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
bf400bbc
...
...
@@ -92,20 +92,29 @@ namespace Siger.ApiACC.Controllers
{
if
(
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
||
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
uploadStation
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
if
(!
uploadStations
.
Contains
(
machineAttr
.
station
))
{
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
,
stationDicts
);
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
}
}
}
...
...
@@ -248,6 +257,14 @@ namespace Siger.ApiACC.Controllers
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
taskObj
.
sectionid
);
if
(
section
!=
null
)
{
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
var
uploadPostion
=
uploadStations
.
Contains
(
taskObj
.
sectionid
);
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
break
;
}
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
break
;
...
...
@@ -292,9 +309,13 @@ namespace Siger.ApiACC.Controllers
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
if
(
location
==
null
)
{
location
.
ordernumber
=
taskObj
.
ordercode
;
location
.
sn
=
taskObj
.
sn
;
Logger
.
WriteLineInfo
(
$"PlCfeeback 未找到该工装储位信息"
)
;
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
)
;
}
location
.
ordernumber
=
taskObj
.
ordercode
;
location
.
productcode
=
taskObj
.
productcode
;
location
.
productid
=
taskObj
.
productid
;
location
.
sn
=
taskObj
.
sn
;
}
}
else
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_CJT
||
taskObj
.
action
==
TaskAction
.
Step_LK_JGZX
||
taskObj
.
action
==
TaskAction
.
Step_LK_SXLW
)
...
...
@@ -304,6 +325,8 @@ namespace Siger.ApiACC.Controllers
if
(
location
==
null
)
{
location
.
ordernumber
=
""
;
location
.
productcode
=
""
;
location
.
productid
=
0
;
location
.
sn
=
""
;
}
...
...
@@ -477,9 +500,10 @@ namespace Siger.ApiACC.Controllers
/// <param name="locationid">储位ID</param>
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
,
string
guid
,
string
orderno
,
string
sn
,
string
productCode
,
int
locationid
)
{
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
no
=
taskNo
,
projectId
=
PID
,
sectionid
=
machineStatus
.
section
,
trigger
=
TaskTrigerType
.
Auto
,
...
...
@@ -514,7 +538,7 @@ namespace Siger.ApiACC.Controllers
{
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
f
.
machineID
==
machine
);
var
productIds
=
beats
.
Select
(
f
=>
f
.
product_name
.
ToInt
()).
ToList
();
var
productIds
=
beats
.
Select
(
f
=>
f
.
product_name
.
ToInt
()).
Distinct
().
ToList
();
// 取产品交期最近的订单
var
planOrder
=
_automationFixtureToolsProduct
.
GetDeliveryOrder
(
productIds
,
PID
);
...
...
@@ -525,18 +549,22 @@ namespace Siger.ApiACC.Controllers
}
var
order
=
planOrder
.
FirstOrDefault
();
var
beatset
=
beats
.
Where
(
f
=>
f
.
product_name
==
order
.
productId
.
ToString
());
//TODO 20210126
//var beatset = beats.Where(f => f.product_name == order.productId.ToString());
//var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber== order.ordernumber && productIds.Contains(f.productid));
//if (!location.Any())
//{
// Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
// return null;
//var routeIds = beatset.Select(s => s.id).ToList();
//}
//储位有SN 工件
var
location
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
ordernumber
==
order
.
ordernumber
&&
productIds
.
Contains
(
f
.
productid
));
var
location
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
productIds
.
Contains
(
f
.
productid
));
var
hasSnloaction
=
location
.
Where
(
f
=>!
string
.
IsNullOrEmpty
(
f
.
sn
));
if
(!
hasSnloaction
.
Any
())
return
null
;
if
(
location
==
null
)
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到最近交期订单号
{
order
.
ordernumber
}
对应产品
{
order
.
productName
}
的储位信息"
);
return
null
;
}
return
location
.
FirstOrDefault
();
}
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
bf400bbc
...
...
@@ -149,14 +149,14 @@ namespace Siger.ApiACC.Controllers
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
var
result
=
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
monitor
.
ordernumber
,
FixtureGuid
=
monitor
.
fixtureguid
,
FixtureName
=
monitor
.
fixturename
,
ProductCode
=
monitor
.
productCode
,
ProductName
=
monitor
.
productName
,
Sn
=
monitor
.
sn
,
status
=
monitor
.
status
,
Location
=
monitor
.
locationId
,
OrderNumber
=
monitor
!=
null
?
monitor
.
ordernumber
:
""
,
FixtureGuid
=
monitor
!=
null
?
monitor
.
fixtureguid
:
""
,
FixtureName
=
monitor
!=
null
?
monitor
.
fixturename
:
""
,
ProductCode
=
monitor
!=
null
?
monitor
.
productCode
:
""
,
ProductName
=
monitor
!=
null
?
monitor
.
productName
:
""
,
Sn
=
monitor
!=
null
?
monitor
.
sn
:
""
,
status
=
monitor
!=
null
?
monitor
.
status
:(
int
)
Automation
.
MachineStatus
.
Waiting
,
Location
=
monitor
!=
null
?
monitor
.
locationId
:
0
,
};
return
new
ObjectResult
(
result
);
}
...
...
@@ -204,7 +204,7 @@ namespace Siger.ApiACC.Controllers
section
=
loading
.
section
,
machineid
=
machineAttr
.
machine
,
projectId
=
ProjectId
,
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
,
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
,
updatetime
=
DateTime
.
Now
});
}
...
...
@@ -376,7 +376,7 @@ namespace Siger.ApiACC.Controllers
completetime
=
DateTime
.
MinValue
,
trigger
=
Automation
.
TaskTrigerType
.
Manual
,
projectId
=
ProjectId
,
productid
=
monitor
.
pr
,
productid
=
monitor
.
pr
oductId
,
sn
=
monitor
.
sn
,
ordercode
=
monitor
.
ordernumber
,
fixtureguid
=
monitor
.
fixtureguid
,
...
...
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