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
26bc8367
Commit
26bc8367
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
d4ba33b9
f997f0e1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
306 additions
and
66 deletions
+306
-66
feedingBlanking.vue
Html/src/view/fml/operation_manage/feedingBlanking.vue
+4
-3
lineMonitor.vue
Html/src/view/fml/statistical_analysis/lineMonitor.vue
+2
-2
taskList.vue
Html/src/view/fml/statistical_analysis/taskList.vue
+6
-4
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+202
-52
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+11
-1
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+6
-3
DictKeyValConst.cs
...ommon/Siger.Middlelayer.Share/Constant/DictKeyValConst.cs
+5
-0
AccEnum.cs
...Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
+3
-1
siger_automation_location.cs
...layer.AccRepository/Entities/siger_automation_location.cs
+20
-0
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+22
-0
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+8
-0
ResponseProductFixtureInfo.cs
...ayer.AccRepository/Response/ResponseProductFixtureInfo.cs
+11
-0
DB.script
Server/Infrastructure/Script/DB.script
+6
-0
No files found.
Html/src/view/fml/operation_manage/feedingBlanking.vue
View file @
26bc8367
...
...
@@ -370,11 +370,12 @@ export default {
this
.
b
=
index
;
let
status
=
this
.
stationList
[
index
].
status
;
this
.
sectionid
=
this
.
stationList
[
index
].
section
;
//
if (status == 3) {
if
(
status
==
3
)
{
// this.attr1 = true;
// this.tabindex = "2";
// this.getRunningDetail(index);
// } else {
this
.
getRunningDetail
(
index
);
}
// else {
// this.attr2 = true;
// }
if
(
status
==
2
)
{
...
...
Html/src/view/fml/statistical_analysis/lineMonitor.vue
View file @
26bc8367
...
...
@@ -352,10 +352,10 @@ export default {
bgc
=
"#ff9900"
;
}
if
(
ele
.
status
==
2
)
{
bgc
=
"#
2db7f5
"
;
bgc
=
"#
19be6b
"
;
}
if
(
ele
.
status
==
3
)
{
bgc
=
"#
19be6b
"
;
bgc
=
"#
2db7f5
"
;
}
ele
.
bgc
=
bgc
;
});
...
...
Html/src/view/fml/statistical_analysis/taskList.vue
View file @
26bc8367
...
...
@@ -124,20 +124,22 @@
>
{{
$t
(
"1001"
)
}}
</Button
>
<!-- -->
<Button
<
!--
<
Button
type=
"warning"
class=
"twoWord"
icon=
"ios-search"
@
click=
"cancel()"
>
取消
</Button
>
<!--只有状态是待执行的可以改成取消-->
<Button
>
-->
<!--只有状态是待执行的可以改成取消-->
<!--
<Button
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"manual()"
>
手动
</Button
>
<!--当生产线的模式是手动是才可以进行手动任务执行-->
>
-->
<!--当生产线的模式是手动是才可以进行手动任务执行-->
<Button
type=
"primary"
class=
"twoWord"
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
26bc8367
...
...
@@ -17,6 +17,8 @@ using Siger.Middlelayer.Repository.Repositories.Interface;
using
Siger.Middlelayer.Share.Constant
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
using
Siger.Middlelayer.Repository.Entities
;
using
NPOI.SS.Formula.Functions
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -31,9 +33,12 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
ISigerProjectMachineAttributionRepository
_sigerProjectMachineAttribution
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationLocationRepository
_automationLocation
;
private
readonly
IProductionBeatSetRepository
_productionBeatSet
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
public
AutomationController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationLineMode
automationLineMode
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerDict
sigerDict
,
IAutomationTaskListRepository
automationTaskList
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationLocationRepository
automationLocation
,
IProductionBeatSetRepository
productionBeatSet
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -43,8 +48,11 @@ namespace Siger.ApiACC.Controllers
_automationTaskList
=
automationTaskList
;
_sigerProjectMachineAttribution
=
sigerProjectMachineAttribution
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
_automationLocation
=
automationLocation
;
_productionBeatSet
=
productionBeatSet
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
}
/// <summary>
/// 设备状态接口 用于 保存 设备当前可用状态
/// </summary>
...
...
@@ -76,6 +84,7 @@ namespace Siger.ApiACC.Controllers
exitsObj
.
updatetime
=
DateTime
.
Now
;
}
if
(
_unitOfWork
.
Commit
()
>
0
)
{
// 设备空闲,或者完成时触发 自动任务
...
...
@@ -86,11 +95,17 @@ namespace Siger.ApiACC.Controllers
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
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
);
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
}
}
...
...
@@ -138,11 +153,19 @@ namespace Siger.ApiACC.Controllers
//TODO
//手动-》自动 时
//task 无任务时候 ,根据设备状态创建任务
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"LineMode Mode=1 触发自动任务检查"
);
AutoProcess
(
line
);
AutoProcess
(
line
,
stationDicts
);
}
}
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
...
...
@@ -193,18 +216,14 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
AccEnum
.
AutoTaskDone
);
}
//2.更新状态
taskObj
.
status
=
request
.
status
;
_automationTaskList
.
Update
(
taskObj
);
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
if
(
machineStatus
==
null
)
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
machineStatus
.
status
=
request
.
status
;
_automationMachineStatus
.
Update
(
machineStatus
);
//更新Tasklist
PlCfeeback
(
taskObj
,
request
.
status
,
stationDicts
);
if
(
_unitOfWork
.
Commit
()
<=
0
)
{
...
...
@@ -229,7 +248,7 @@ namespace Siger.ApiACC.Controllers
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
taskObj
.
sectionid
);
if
(
section
!=
null
)
{
AutoProcess
(
section
.
parentid
);
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
break
;
}
...
...
@@ -243,11 +262,93 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
void
PlCfeeback
(
siger_automation_task_list
taskObj
,
int
status
,
IEnumerable
<
SigerTrDict
>
stationDicts
)
{
//2.更新状态
taskObj
.
status
=
status
;
_automationTaskList
.
Update
(
taskObj
);
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
if
(
machineStatus
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
machineStatus
.
status
=
status
;
_automationMachineStatus
.
Update
(
machineStatus
);
//PLC 反馈结束. 工装监控 解除设备绑定
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
(
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
taskObj
.
sectionid
.
ToString
())))
{
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
if
(
location
==
null
)
{
location
.
ordernumber
=
taskObj
.
ordercode
;
location
.
sn
=
taskObj
.
sn
;
}
}
}
else
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_CJT
||
taskObj
.
action
==
TaskAction
.
Step_LK_JGZX
||
taskObj
.
action
==
TaskAction
.
Step_LK_SXLW
)
{
//出库
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
if
(
location
==
null
)
{
location
.
ordernumber
=
""
;
location
.
sn
=
""
;
}
//更新 CNC 状态
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
ordernumber
=
taskObj
.
ordercode
,
productCode
=
taskObj
.
productcode
,
//productNam
section
=
taskObj
.
sectionid
,
status
=
status
,
sn
=
taskObj
.
sn
,
fixtureguid
=
taskObj
.
fixtureguid
,
//fixturename=,
locationId
=
taskObj
.
locationid
,
createtime
=
DateTime
.
Now
,
projectId
=
PID
,
route
=
0
,
updatetime
=
DateTime
.
Now
,
});
}
else
{
monitor
.
ordernumber
=
taskObj
.
ordercode
;
monitor
.
productCode
=
taskObj
.
productcode
;
monitor
.
status
=
taskObj
.
status
;
monitor
.
sn
=
taskObj
.
sn
;
monitor
.
locationId
=
taskObj
.
locationid
;
monitor
.
updatetime
=
DateTime
.
Now
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
}
}
/// <summary>
/// 创建自动 Task任务
/// </summary>
/// <param name="line"></param>
void
AutoProcess
(
int
line
)
/// <param name="stationDicts"></param>
void
AutoProcess
(
int
line
,
IEnumerable
<
SigerTrDict
>
stationDicts
)
{
var
lineMode
=
_automationLineMode
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
section
==
line
);
if
(
lineMode
==
null
)
...
...
@@ -268,12 +369,7 @@ namespace Siger.ApiACC.Controllers
//2.其他设备上料
//3.其他设备下料
*/
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
return
;
}
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
).
ToList
();
...
...
@@ -301,8 +397,20 @@ namespace Siger.ApiACC.Controllers
{
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 有清洗机完成,创建清洗剂Task"
);
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
uploadStations
);
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
);
return
;
//完成当前任务 退出
}
}
...
...
@@ -313,7 +421,19 @@ namespace Siger.ApiACC.Controllers
if
(
freeMachine
!=
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备上料Task"
);
CreateTask
(
freeMachine
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
uploadStations
);
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
);
return
;
//完成当前任务 退出
}
//优先级3:其他设备下料 (加工中心 ->立库)
...
...
@@ -323,7 +443,19 @@ namespace Siger.ApiACC.Controllers
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备下料Task "
);
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
uploadStations
);
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
);
return
;
//完成当前任务 退出
}
...
...
@@ -338,28 +470,14 @@ namespace Siger.ApiACC.Controllers
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
/// <param name="uploadStations"></param>
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
,
List
<
string
>
uploadStations
)
/// <param name="guid">工装GUID</param>
/// <param name="orderno">订单</param>
/// <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
)
{
var
uploadPostion
=
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
machineStatus
.
section
.
ToString
()));
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"CreateTask 上料料工站 无需自动创建任务 "
);
return
;
}
//j检查工装监控状态
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
machineStatus
.
section
);
if
(
monitor
==
null
)
{
Logger
.
WriteLineInfo
(
$"CreateTask 工装监控状态无数据,请确认业务链正确 "
);
return
;
}
if
(
monitor
.
section
==
0
)
{
Logger
.
WriteLineInfo
(
$"CreateTask 工装监控状态无当前工站信息,请确认业务链正确 "
);
return
;
}
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
projectId
=
PID
,
...
...
@@ -374,11 +492,11 @@ namespace Siger.ApiACC.Controllers
send
=
0
,
operater
=
0
,
status
=
1
,
fixtureguid
=
monitor
.
fixture
guid
,
productcode
=
monitor
.
productCode
,
locationid
=
monitor
.
locationI
d
,
ordercode
=
monitor
.
ordernumber
,
sn
=
monitor
.
sn
,
fixtureguid
=
guid
,
productcode
=
productCode
,
locationid
=
locationi
d
,
ordercode
=
orderno
,
sn
=
sn
,
remark
=
"自动任务"
});
...
...
@@ -389,6 +507,38 @@ namespace Siger.ApiACC.Controllers
else
Logger
.
WriteLineInfo
(
$"CreateTask 工站 失败"
);
}
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// </summary>
siger_automation_location
SelectLocation
(
int
machine
)
{
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
f
.
machineID
==
machine
);
var
productIds
=
beats
.
Select
(
f
=>
f
.
product_name
.
ToInt
()).
ToList
();
// 取产品交期最近的订单
var
planOrder
=
_automationFixtureToolsProduct
.
GetDeliveryOrder
(
productIds
,
PID
);
if
(!
planOrder
.
Any
())
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到最近订单号信息"
);
return
null
;
}
var
order
=
planOrder
.
FirstOrDefault
();
var
beatset
=
beats
.
Where
(
f
=>
f
.
product_name
==
order
.
productId
.
ToString
());
//var routeIds = beatset.Select(s => s.id).ToList();
var
location
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
ordernumber
==
order
.
ordernumber
&&
productIds
.
Contains
(
f
.
productid
));
if
(
location
==
null
)
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到最近交期订单号
{
order
.
ordernumber
}
对应产品
{
order
.
productName
}
的储位信息"
);
return
null
;
}
return
location
.
FirstOrDefault
();
}
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
26bc8367
...
...
@@ -30,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationLocationRepository
_autoLocationRepository
;
private
readonly
IAutomationFixtureMonitor
_fixtureMonitor
;
private
readonly
IProductRouteRepository
_routeRepository
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
public
AutomationLocationController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationLocationRepository
autoLocationRepository
,
IAutomationFixtureMonitor
fixtureMonitor
,
IProductRouteRepository
routeRepository
)
IAutomationFixtureMonitor
fixtureMonitor
,
IProductRouteRepository
routeRepository
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
...
...
@@ -41,6 +42,7 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository
=
autoLocationRepository
;
_fixtureMonitor
=
fixtureMonitor
;
_routeRepository
=
routeRepository
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
}
[
HttpGet
]
...
...
@@ -192,6 +194,8 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
fixturetoolProduct
=
_automationFixtureToolsProduct
.
Get
(
f
=>
f
.
fixturetools
==
fixturetool
.
guid
);
var
location
=
_autoLocationRepository
.
GetLocation
(
req
.
locationid
.
ToInt
(),
ProjectId
);
if
(
location
==
null
)
{
...
...
@@ -209,6 +213,8 @@ namespace Siger.ApiACC.Controllers
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
location
.
locationid
,
fixturetools
=
fixturetool
.
guid
,
productid
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productid
:
0
,
productcode
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productcode
:
""
,
attachment
=
req
.
fileurl
,
filename
=
req
.
filename
,
remark
=
req
.
remark
,
...
...
@@ -244,6 +250,7 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
fixturetoolProduct
=
_automationFixtureToolsProduct
.
Get
(
f
=>
f
.
fixturetools
==
fixturetool
.
guid
);
var
location
=
_autoLocationRepository
.
GetLocation
(
req
.
locationid
.
ToInt
(),
ProjectId
);
if
(
location
==
null
)
{
...
...
@@ -263,6 +270,9 @@ namespace Siger.ApiACC.Controllers
entity
.
remark
=
req
.
remark
;
entity
.
updatetime
=
DateTime
.
Now
;
entity
.
updator
=
UserId
;
entity
.
productid
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productid
:
0
;
entity
.
productcode
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productcode
:
""
;
_autoLocationRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
26bc8367
...
...
@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
private
readonly
IAutomationLocationRepository
_automationLocation
;
public
AutomationOperateController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
ISigerDict
sigerDict
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationTaskListRepository
automationTaskList
,
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
)
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
,
IAutomationLocationRepository
automationLocation
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor
=
automationFixtureMonitor
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureTools
=
automationFixtureTools
;
_automationLocation
=
automationLocation
;
}
/// <summary>
...
...
@@ -173,7 +175,7 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
result
);
}
/// <summary>
/// 准备上料 -生成指令 load
/// 准备上料 -生成指令 load
(立库->上料位)
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
...
...
@@ -348,6 +350,8 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
...
...
@@ -376,7 +380,6 @@ namespace Siger.ApiACC.Controllers
});
if
(
_unitOfWork
.
Commit
()
>
0
)
{
Logger
.
WriteLineError
(
$"手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
...
...
Server/Common/Siger.Middlelayer.Share/Constant/DictKeyValConst.cs
View file @
26bc8367
...
...
@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary>
public
const
string
UploadloadStation
=
"LoadStation"
;
/// <summary>
/// 立库
/// </summary>
public
const
string
WarehouseStation
=
"WarehouseStation"
;
}
}
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
View file @
26bc8367
...
...
@@ -334,7 +334,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[
Description
(
"设备已经生产完成"
)]
MachineProCompalate
,
[
Description
(
"该设备当前无工装状态"
)]
MonitorNotfound
MonitorNotfound
,
[
Description
(
"未配置字典信息"
)]
AutomationDictNotfound
}
public
enum
SeriNumCfg
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_location.cs
View file @
26bc8367
...
...
@@ -18,6 +18,26 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID
/// </summary>
public
string
fixturetools
{
get
;
set
;
}
public
int
productid
{
get
;
set
;
}
public
string
productcode
{
get
;
set
;
}
/// <summary>
/// 工件对应的工单号
/// </summary>
public
string
ordernumber
{
get
;
set
;
}
/// <summary>
/// 工装工件
/// </summary>
public
string
sn
{
get
;
set
;
}
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public
int
routeid
{
get
;
set
;
}
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public
string
route
{
get
;
set
;
}
/// <summary>
/// 附件
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
26bc8367
...
...
@@ -97,6 +97,28 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
}
/// <summary>
/// 获取 交期最早的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productIds
,
int
projectId
)
{
var
query
=
from
d
in
_context
.
siger_project_product_plan_detail
join
p
in
_context
.
siger_project_product_plan
on
d
.
PlanId
equals
p
.
id
where
d
.
projectId
==
projectId
&&
productIds
.
Contains
(
p
.
product_id
)
&&
d
.
status
!=
(
int
)
RowState
.
Invalid
&&
p
.
status
!=
(
int
)
RowState
.
Invalid
select
new
ResponseAutomationPlanOrder
{
productId
=
p
.
product_id
,
ordernumber
=
d
.
OrderNumber
,
productCode
=
p
.
product_code
,
productName
=
p
.
product_name
,
delvery
=
p
.
delivery_time
,
};
return
query
.
OrderBy
(
f
=>
f
.
delvery
);
}
public
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
)
{
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
26bc8367
...
...
@@ -23,5 +23,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
);
/// <summary>
/// 获取交期最近的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productIds
,
int
projectId
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseProductFixtureInfo.cs
View file @
26bc8367
...
...
@@ -40,4 +40,15 @@ namespace Siger.Middlelayer.AccRepository.Response
public
int
Location
{
get
;
set
;
}
public
string
Sn
{
get
;
set
;
}
}
public
class
ResponseAutomationPlanOrder
{
public
string
ordernumber
{
get
;
set
;
}
public
int
productId
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
int
delvery
{
get
;
set
;
}
}
}
Server/Infrastructure/Script/DB.script
View file @
26bc8367
...
...
@@ -269,6 +269,12 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件对应工单号',
`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 '工序',
`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