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
3817cbfb
Commit
3817cbfb
authored
Jan 26, 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
516f46c9
22cc76a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
31 deletions
+59
-31
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+41
-31
siger_automation_location.cs
...layer.AccRepository/Entities/siger_automation_location.cs
+5
-0
ResponseAutomationInfo.cs
...dlelayer.AccRepository/Response/ResponseAutomationInfo.cs
+12
-0
DB.script
Server/Infrastructure/Script/DB.script
+1
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
3817cbfb
...
...
@@ -19,6 +19,7 @@ using Siger.Middlelayer.Share.Enum.ModuleEnum;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
using
Siger.Middlelayer.Repository.Entities
;
using
NPOI.SS.Formula.Functions
;
using
Siger.Middlelayer.AccRepository.Response
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -82,6 +83,7 @@ namespace Siger.ApiACC.Controllers
exitsObj
.
enable
=
request
.
enable
;
exitsObj
.
status
=
request
.
status
;
exitsObj
.
updatetime
=
DateTime
.
Now
;
_automationMachineStatus
.
Update
(
exitsObj
);
}
...
...
@@ -316,6 +318,7 @@ namespace Siger.ApiACC.Controllers
location
.
productcode
=
taskObj
.
productcode
;
location
.
productid
=
taskObj
.
productid
;
location
.
sn
=
taskObj
.
sn
;
_automationLocation
.
Update
(
location
);
}
}
else
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_CJT
||
taskObj
.
action
==
TaskAction
.
Step_LK_JGZX
||
taskObj
.
action
==
TaskAction
.
Step_LK_SXLW
)
...
...
@@ -395,7 +398,7 @@ namespace Siger.ApiACC.Controllers
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
).
ToList
();
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()
).
ToList
();
/* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
...
...
@@ -407,8 +410,8 @@ namespace Siger.ApiACC.Controllers
return
;
}
// 获取可用 设备状态列表
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
enable
==
1
);
// 获取可用 设备状态列表
排除上料工位
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
!
uploadStations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
if
(!
machineStatusList
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
...
...
@@ -421,19 +424,15 @@ namespace Siger.ApiACC.Controllers
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 有清洗机完成,创建清洗机Task"
);
var
uploadPostion
=
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
cleanMachine
.
section
.
ToString
()));
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
return
;
}
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
monitor
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到CNC监控信息"
);
return
;
}
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
monitor
.
productCode
,
monitor
.
locationId
);
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
}
}
...
...
@@ -444,19 +443,15 @@ namespace Siger.ApiACC.Controllers
if
(
freeMachine
!=
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备上料Task"
);
var
uploadPostion
=
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
freeMachine
.
section
.
ToString
()));
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
return
;
}
var
location
=
SelectLocation
(
freeMachine
.
machineid
);
if
(
location
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到储位信息"
);
return
;
}
CreateTask
(
freeMachine
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
guid
,
location
.
ordernumber
,
location
.
sn
,
location
.
productcode
,
location
.
locationid
);
CreateTask
(
freeMachine
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
fixture
,
location
.
ordernumber
,
location
.
sn
,
location
.
pn
,
location
.
productCode
,
location
.
location
);
return
;
//完成当前任务 退出
}
//优先级3:其他设备下料 (加工中心 ->立库)
...
...
@@ -466,19 +461,15 @@ namespace Siger.ApiACC.Controllers
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备下料Task "
);
var
uploadPostion
=
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
cleanMachine
.
section
.
ToString
()));
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
return
;
}
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
monitor
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到CNC监控信息"
);
return
;
}
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
monitor
.
productCode
,
monitor
.
locationId
);
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
}
...
...
@@ -498,7 +489,7 @@ namespace Siger.ApiACC.Controllers
/// <param name="sn">工件</param>
/// <param name="productCode">产品CODE</param>
/// <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
)
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
,
string
guid
,
string
orderno
,
string
sn
,
string
pro
gram
,
string
pro
ductCode
,
int
locationid
)
{
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
...
...
@@ -518,6 +509,7 @@ namespace Siger.ApiACC.Controllers
status
=
1
,
fixtureguid
=
guid
,
productcode
=
productCode
,
programnumber
=
program
,
locationid
=
locationid
,
ordercode
=
orderno
,
sn
=
sn
,
...
...
@@ -534,7 +526,7 @@ namespace Siger.ApiACC.Controllers
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// </summary>
siger_automation_location
SelectLocation
(
int
machine
)
ResponseAutomationLocationRouteInfo
SelectLocation
(
int
machine
)
{
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
f
.
machineID
==
machine
);
...
...
@@ -550,8 +542,8 @@ namespace Siger.ApiACC.Controllers
var
order
=
planOrder
.
FirstOrDefault
();
//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));
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}的储位信息");
...
...
@@ -560,12 +552,30 @@ namespace Siger.ApiACC.Controllers
//}
//储位有SN 工件
var
location
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
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
;
return
null
;
var
result
=
location
.
FirstOrDefault
();
return
location
.
FirstOrDefault
();
var
valiateBeat
=
beatset
.
FirstOrDefault
(
f
=>
f
.
route_number
.
ToInt
()>
result
.
routenum
);
if
(
valiateBeat
==
null
)
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到产品的工艺顺序"
);
return
null
;
}
return
new
ResponseAutomationLocationRouteInfo
{
fixture
=
result
.
fixturetools
,
ordernumber
=
result
.
ordernumber
,
location
=
result
.
locationid
,
productCode
=
result
.
productcode
,
sn
=
result
.
sn
,
pn
=
valiateBeat
.
process_number
,
route
=
valiateBeat
.
route_name
};
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_location.cs
View file @
3817cbfb
...
...
@@ -38,6 +38,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public
string
route
{
get
;
set
;
}
/// <summary>
/// 工序顺序
/// </summary>
public
int
routenum
{
get
;
set
;
}
/// <summary>
/// 附件
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationInfo.cs
View file @
3817cbfb
...
...
@@ -28,4 +28,16 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary>
public
string
fixture
{
get
;
set
;
}
}
public
class
ResponseAutomationLocationRouteInfo
{
public
string
fixture
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
int
location
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
string
pn
{
get
;
set
;
}
}
}
Server/Infrastructure/Script/DB.script
View file @
3817cbfb
...
...
@@ -276,6 +276,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件',
`routeid` int(11) NULL DEFAULT 0,
`route` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工序',
`routenum` int(11) NULL DEFAULT 0 COMMENT '工序顺序',
`attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
`filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
...
...
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