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
99679107
Commit
99679107
authored
Feb 05, 2021
by
yiyu.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://test.siger-data.com:9000/jiawei.su/Laisi_AutoMES2
parents
4dde11b9
7de3387d
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
314 additions
and
152 deletions
+314
-152
beat.vue
Html/src/view/cnc/set/beat.vue
+1
-1
productPlanMange.vue
Html/src/view/pms/planMange/productPlanMange.vue
+0
-1
storagemaintenance.vue
Html/src/view/wms/config/storagemaintenance.vue
+2
-3
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+76
-82
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+48
-40
AutomationStateController.cs
...pis/Siger.ApiACC/Controllers/AutomationStateController.cs
+24
-1
QmsCheckController.cs
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
+4
-8
SectionPropertyController.cs
...pis/Siger.ApiACC/Controllers/SectionPropertyController.cs
+1
-2
AutoMES.cs
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
+8
-1
DBhelper.cs
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
+4
-0
UploadController.cs
Server/Apis/Siger.ApiWMS/Controllers/UploadController.cs
+11
-1
Automation.cs
...mon/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
+8
-0
EPPlusWmsExcelHelper.cs
...Siger.Middlelayer.Utility/Helpers/EPPlusWmsExcelHelper.cs
+89
-0
ApiAccDbContext.cs
...tories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
+2
-0
siger_automation_fixture_tools_monitor.cs
...sitory/Entities/siger_automation_fixture_tools_monitor.cs
+5
-1
siger_automation_machine_status.cs
...AccRepository/Entities/siger_automation_machine_status.cs
+5
-0
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+9
-0
AutomationFixtureToolsRepository.cs
...pository/Repositories/AutomationFixtureToolsRepository.cs
+2
-1
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+2
-1
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+6
-7
IAutomationTaskListRepository.cs
...y/Repositories/Interface/IAutomationTaskListRepository.cs
+1
-1
RequestAutomationTaskResult.cs
...ayer.AccRepository/Request/RequestAutomationTaskResult.cs
+1
-1
RequestPLC.cs
...ies/Siger.Middlelayer.AccRepository/Request/RequestPLC.cs
+1
-0
ResponseAutomationTasklist.cs
...ayer.AccRepository/Response/ResponseAutomationTasklist.cs
+1
-0
DB.script
Server/Infrastructure/Script/DB.script
+3
-0
No files found.
Html/src/view/cnc/set/beat.vue
View file @
99679107
...
@@ -620,7 +620,7 @@ export default {
...
@@ -620,7 +620,7 @@ export default {
getRoutesByProduct
(
val
)
{
getRoutesByProduct
(
val
)
{
// 选择产品查询工艺路径
// 选择产品查询工艺路径
let
id
=
0
;
let
id
=
0
;
id
=
val
.
value
?
val
.
value
:
0
;
id
=
val
&&
val
.
value
?
val
.
value
:
0
;
var
params
=
{
var
params
=
{
productId
:
id
,
productId
:
id
,
page
:
1
,
page
:
1
,
...
...
Html/src/view/pms/planMange/productPlanMange.vue
View file @
99679107
...
@@ -256,7 +256,6 @@
...
@@ -256,7 +256,6 @@
</label>
</label>
<DatePicker
<DatePicker
class=
"searchInput"
class=
"searchInput"
:disabled=
"type == 2 ? true : false"
v-model=
"addobj.deliverydate"
v-model=
"addobj.deliverydate"
type=
"date"
type=
"date"
></DatePicker>
></DatePicker>
...
...
Html/src/view/wms/config/storagemaintenance.vue
View file @
99679107
...
@@ -396,13 +396,12 @@ export default {
...
@@ -396,13 +396,12 @@ export default {
handleSuccess
(
res
,
file
)
{
handleSuccess
(
res
,
file
)
{
if
(
res
.
ret
==
1
)
{
if
(
res
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
"950398"
));
this
.
$Message
.
success
(
this
.
$t
(
"950398"
));
this
.
getCategory
();
this
.
tosearch
();
this
.
search
(
1
,
10
);
}
else
{
}
else
{
if
((
res
.
msg
+
""
).
indexOf
(
","
)
!=
-
1
)
{
if
((
res
.
msg
+
""
).
indexOf
(
","
)
!=
-
1
)
{
inittip
(
res
.
msg
);
inittip
(
res
.
msg
);
}
else
{
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
));
this
.
$Message
.
error
(
this
.
$t
(
res
.
msg
));
}
}
}
}
},
},
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
99679107
...
@@ -82,7 +82,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -82,7 +82,7 @@ namespace Siger.ApiACC.Controllers
machineid
=
request
.
machineid
,
machineid
=
request
.
machineid
,
projectId
=
PID
,
projectId
=
PID
,
updatetime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
enable
=
request
.
enable
,
enable
=
request
.
enable
==
1
?
1
:
0
,
status
=
request
.
status
status
=
request
.
status
});
});
}
else
}
else
...
@@ -101,14 +101,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -101,14 +101,13 @@ namespace Siger.ApiACC.Controllers
{
{
if
(
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
||
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
if
(
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
||
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
{
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
if
(!
stationDicts
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
}
Logger
.
WriteLineInfo
(
$"设备状态更变
{
request
.
status
}
触发"
);
//
Logger.WriteLineInfo($"设备状态更变{request.status}触发");
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
{
{
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
...
@@ -258,34 +257,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -258,34 +257,13 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
//3.Tasklist 任务全部完成 ,创建自动任务
//3.Tasklist 任务全部完成 ,创建自动任务
switch
(
request
.
status
)
{
case
(
int
)
TaskResultStatus
.
Cancel
:
case
(
int
)
TaskResultStatus
.
Complated
:
{
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
taskObj
.
sectionid
);
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
taskObj
.
sectionid
);
if
(
section
!=
null
)
if
(
section
!=
null
)
{
{
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
Logger
.
WriteLineInfo
(
$" 设备
{
section
.
title
}
任务编号:
{
taskObj
.
no
}
状态:
{
request
.
status
}
"
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
AutoProcess
(
section
.
parentid
,
stationDicts
,
taskObj
);
var
uploadPostion
=
uploadStations
.
Contains
(
taskObj
.
sectionid
);
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
break
;
}
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
break
;
}
case
(
int
)
TaskResultStatus
.
Waiting
:
case
(
int
)
TaskResultStatus
.
Produce
:
default
:
{
break
;
}
}
}
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
...
@@ -321,15 +299,22 @@ namespace Siger.ApiACC.Controllers
...
@@ -321,15 +299,22 @@ namespace Siger.ApiACC.Controllers
location
.
productid
=
taskObj
.
productid
;
location
.
productid
=
taskObj
.
productid
;
location
.
routeid
=
taskObj
.
route
;
location
.
routeid
=
taskObj
.
route
;
location
.
sn
=
taskObj
.
sn
;
location
.
sn
=
taskObj
.
sn
;
location
.
status
=
(
int
)
LocationStatus
.
In
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
}
}
if
(
monitor
!=
null
)
if
(
monitor
!=
null
&&
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
{
{
monitor
.
section
=
0
;
monitor
.
section
=
0
;
}
//上料上下料设备状态为后台控制,CNC是PLC控制
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
&&
f
.
auto
==
0
);
if
(
machineStatus
!=
null
)
{
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
_automationMachineStatus
.
Update
(
machineStatus
);
}
}
}
}
...
@@ -341,7 +326,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -341,7 +326,6 @@ namespace Siger.ApiACC.Controllers
monitor
.
fixturename
=
taskObj
.
fixturename
;
monitor
.
fixturename
=
taskObj
.
fixturename
;
_automationFixtureMonitor
.
Update
(
monitor
);
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
}
}
/// <summary>
/// <summary>
...
@@ -350,7 +334,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -350,7 +334,8 @@ namespace Siger.ApiACC.Controllers
/// <param name="line"></param>
/// <param name="line"></param>
/// <param name="fixture"></param>
/// <param name="fixture"></param>
/// <param name="stationDicts"></param>
/// <param name="stationDicts"></param>
void
AutoProcess
(
int
line
,
IEnumerable
<
SigerTrDict
>
stationDicts
)
/// <param name="tasklist"></param>
void
AutoProcess
(
int
line
,
IEnumerable
<
SigerTrDict
>
stationDicts
,
siger_automation_task_list
tasklist
=
null
)
{
{
var
lineMode
=
_automationLineMode
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
section
==
line
);
var
lineMode
=
_automationLineMode
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
section
==
line
);
if
(
lineMode
==
null
)
if
(
lineMode
==
null
)
...
@@ -360,11 +345,10 @@ namespace Siger.ApiACC.Controllers
...
@@ -360,11 +345,10 @@ namespace Siger.ApiACC.Controllers
}
}
if
(
lineMode
.
mode
==
0
)
if
(
lineMode
.
mode
==
0
)
{
{
Logger
.
WriteLineInfo
(
$"AutoProcess 手动模式"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 手动模式
不能创建自动任务
"
);
//手动模式时 退出
//手动模式时 退出
return
;
return
;
}
}
/*
/*
//自动Task任务 顺序
//自动Task任务 顺序
//1.清洗机下料
//1.清洗机下料
...
@@ -381,7 +365,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -381,7 +365,7 @@ namespace Siger.ApiACC.Controllers
return
;
return
;
}
}
// 获取可用 设备状态列表 排除上料工位
// 获取可用 设备状态列表 排除上料工位
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
!
uploadStations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
auto
==
1
&&
!
uploadStations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
if
(!
machineStatusList
.
Any
())
if
(!
machineStatusList
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
...
@@ -393,17 +377,26 @@ namespace Siger.ApiACC.Controllers
...
@@ -393,17 +377,26 @@ namespace Siger.ApiACC.Controllers
{
{
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机完成,创建清洗机Task"
);
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
}
完成,创建清洗机Task"
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
tasklist
==
null
)
if
(
monitor
!=
null
)
{
{
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
,
monitor
.
route
);
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空"
);
return
;
//完成当前任务 退出
return
;
}
}
}
var
locationObj
=
_automationLocation
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
locationid
==
tasklist
.
locationid
);
if
(
locationObj
==
null
)
{
Logger
.
WriteLineError
(
$"AutoProcess 立库 为空"
);
return
;
}
}
//工件回到立库
locationObj
.
status
=
(
int
)
LocationStatus
.
In
;
_automationLocation
.
Update
(
locationObj
);
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
tasklist
.
fixtureguid
,
tasklist
.
ordercode
,
tasklist
.
sn
,
"无程序"
,
tasklist
.
productid
,
tasklist
.
productcode
,
tasklist
.
locationid
,
tasklist
.
route
);
return
;
//完成当前任务 退出
}
}
//优先级2 :其他设备待上料 (立库->加工中心)
//优先级2 :其他设备待上料 (立库->加工中心)
var
freeMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
var
freeMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
if
(
freeMachine
!=
null
)
if
(
freeMachine
!=
null
)
...
@@ -412,41 +405,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -412,41 +405,6 @@ namespace Siger.ApiACC.Controllers
var
location
=
SelectLocation
(
freeMachine
.
Select
(
s
=>
s
.
machineid
).
ToList
());
var
location
=
SelectLocation
(
freeMachine
.
Select
(
s
=>
s
.
machineid
).
ToList
());
if
(
location
!=
null
)
if
(
location
!=
null
)
{
{
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
location
.
section
);
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
projectId
=
PID
,
productId
=
location
.
productId
,
productCode
=
location
.
productCode
,
productName
=
location
.
productName
,
fixtureguid
=
location
.
fixture
,
fixturename
=
location
.
fixturename
,
ordernumber
=
location
.
ordernumber
,
locationId
=
location
.
location
,
section
=
location
.
section
,
sn
=
location
.
sn
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
route
=
location
.
route
,
});
}
else
{
monitor
.
productId
=
location
.
productId
;
monitor
.
productCode
=
location
.
productCode
;
monitor
.
productName
=
location
.
productName
;
monitor
.
fixtureguid
=
location
.
fixture
;
monitor
.
fixturename
=
location
.
fixturename
;
monitor
.
ordernumber
=
location
.
ordernumber
;
monitor
.
locationId
=
location
.
location
;
monitor
.
sn
=
location
.
sn
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
route
=
location
.
route
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
// * 更新下一个工序到储位
// * 更新下一个工序到储位
var
locationObj
=
_automationLocation
.
Get
(
f
=>
f
.
id
==
location
.
lid
);
var
locationObj
=
_automationLocation
.
Get
(
f
=>
f
.
id
==
location
.
lid
);
if
(
locationObj
!=
null
)
if
(
locationObj
!=
null
)
...
@@ -467,6 +425,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -467,6 +425,8 @@ namespace Siger.ApiACC.Controllers
locationObj
.
routeid
=
nextRoute
!=
null
?
nextRoute
.
id
:
0
;
locationObj
.
routeid
=
nextRoute
!=
null
?
nextRoute
.
id
:
0
;
locationObj
.
route
=
nextRoute
!=
null
?
nextRoute
.
name
:
""
;
locationObj
.
route
=
nextRoute
!=
null
?
nextRoute
.
name
:
""
;
}
}
//工件已出立库
locationObj
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
locationObj
);
_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
);
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
);
...
@@ -480,15 +440,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -480,15 +440,13 @@ namespace Siger.ApiACC.Controllers
var
fullMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
);
var
fullMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
);
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
)
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 普通空闲,创建普通设备下料Task "
);
Logger
.
WriteLineError
(
$"AutoProcess 清洗机空闲,创建普通设备下料到清洗机Task "
);
if
(
tasklist
==
null
)
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
fullMachine
.
section
);
if
(
monitor
==
null
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess
找不到CNC监控信息
"
);
Logger
.
WriteLineError
(
$"AutoProcess
Tasklist 为空
"
);
return
;
return
;
}
}
CreateTask
(
fullMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
,
monitor
.
route
);
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
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
...
@@ -536,6 +494,36 @@ namespace Siger.ApiACC.Controllers
...
@@ -536,6 +494,36 @@ namespace Siger.ApiACC.Controllers
route
=
route
route
=
route
});
});
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
projectId
=
PID
,
section
=
section
,
fixtureguid
=
guid
,
productId
=
productId
,
productCode
=
productCode
,
locationId
=
locationid
,
createtime
=
DateTime
.
Now
,
ordernumber
=
orderno
,
route
=
route
,
status
=
1
,
sn
=
sn
,
taskno
=
taskNo
,
});
}
else
{
monitor
.
sn
=
sn
;
monitor
.
route
=
route
;
monitor
.
locationId
=
locationid
;
monitor
.
productCode
=
productCode
;
monitor
.
productId
=
productId
;
monitor
.
fixtureguid
=
guid
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
...
@@ -556,6 +544,12 @@ namespace Siger.ApiACC.Controllers
...
@@ -556,6 +544,12 @@ namespace Siger.ApiACC.Controllers
var
autoLocation
=
_automationLocation
.
Get
(
f
=>
f
.
projectId
==
b
.
projectID
&&
!
string
.
IsNullOrEmpty
(
f
.
sn
)
&&
f
.
routeid
==
b
.
route_number
.
ToInt
()
&&
f
.
productid
==
b
.
product_name
.
ToInt
());
var
autoLocation
=
_automationLocation
.
Get
(
f
=>
f
.
projectId
==
b
.
projectID
&&
!
string
.
IsNullOrEmpty
(
f
.
sn
)
&&
f
.
routeid
==
b
.
route_number
.
ToInt
()
&&
f
.
productid
==
b
.
product_name
.
ToInt
());
if
(
autoLocation
==
null
)
if
(
autoLocation
==
null
)
continue
;
continue
;
if
(
autoLocation
.
status
==
2
)
{
//SN不在立库内
Logger
.
WriteLineError
(
$"SelectLocation 当前储位工件不在储位上"
);
continue
;
}
TempList
.
Add
(
new
ResponseAutoRouteInfo
TempList
.
Add
(
new
ResponseAutoRouteInfo
{
{
FixtureGuid
=
autoLocation
.
fixturetools
,
FixtureGuid
=
autoLocation
.
fixturetools
,
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
99679107
...
@@ -22,6 +22,7 @@ using Siger.Middlelayer.Common.Configuration;
...
@@ -22,6 +22,7 @@ using Siger.Middlelayer.Common.Configuration;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Common.Helpers
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
NPOI.SS.Formula
;
using
NPOI.SS.Formula
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
namespace
Siger.ApiACC.Controllers
namespace
Siger.ApiACC.Controllers
{
{
...
@@ -157,7 +158,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -157,7 +158,7 @@ namespace Siger.ApiACC.Controllers
var
state
=
(
int
)
Automation
.
TaskResultStatus
.
Waiting
;
var
state
=
(
int
)
Automation
.
TaskResultStatus
.
Waiting
;
if
(
monitor
!=
null
)
if
(
monitor
!=
null
)
{
{
var
taskobj
=
_automationTaskList
.
Get
(
f
=>
f
.
extend1
==
monitor
.
unixtime
.
ToStr
()
);
var
taskobj
=
_automationTaskList
.
Get
(
f
=>
f
.
no
==
monitor
.
taskno
);
state
=
taskobj
!=
null
?
taskobj
.
status
:
(
int
)
Automation
.
TaskResultStatus
.
Waiting
;
state
=
taskobj
!=
null
?
taskobj
.
status
:
(
int
)
Automation
.
TaskResultStatus
.
Waiting
;
}
}
var
result
=
new
ResponsePlanlFixtureInfo
var
result
=
new
ResponsePlanlFixtureInfo
...
@@ -210,11 +211,17 @@ namespace Siger.ApiACC.Controllers
...
@@ -210,11 +211,17 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
var
fixture
=
_automationFixtureTools
.
Get
(
f
=>
f
.
guid
==
taskobj
.
fixtureguid
);
if
(
fixture
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
FixtureToolsIsNone
);
}
var
sendToPLC
=
new
RequestPLC
var
sendToPLC
=
new
RequestPLC
{
{
ProductCode
=
taskobj
.
productcode
,
LineID
=
levelsection
.
parentid
,
LineID
=
levelsection
.
parentid
,
RStation
=
attr
.
machine
,
RStation
=
attr
.
machine
,
Fixture
=
taskobj
.
fixtureguid
,
Fixture
=
fixture
.
code
,
RequestForm
=
taskobj
.
no
,
RequestForm
=
taskobj
.
no
,
RobotStep
=
(
int
)
taskobj
.
action
,
RobotStep
=
(
int
)
taskobj
.
action
,
StorageNo
=
taskobj
.
locationid
,
StorageNo
=
taskobj
.
locationid
,
...
@@ -320,7 +327,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -320,7 +327,6 @@ namespace Siger.ApiACC.Controllers
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
machineid
==
machineAttr
.
machine
);
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
machineid
==
machineAttr
.
machine
);
if
(
machineStatus
==
null
)
if
(
machineStatus
==
null
)
{
{
// throw new BadRequestException(CommonEnum.RecordNotFound);
//上料设备状态与PLC 无关,
//上料设备状态与PLC 无关,
//需要手动插入
//需要手动插入
_automationMachineStatus
.
Insert
(
new
siger_automation_machine_status
_automationMachineStatus
.
Insert
(
new
siger_automation_machine_status
...
@@ -328,26 +334,16 @@ namespace Siger.ApiACC.Controllers
...
@@ -328,26 +334,16 @@ namespace Siger.ApiACC.Controllers
enable
=
1
,
enable
=
1
,
section
=
loading
.
section
,
section
=
loading
.
section
,
machineid
=
machineAttr
.
machine
,
machineid
=
machineAttr
.
machine
,
auto
=
0
,
projectId
=
ProjectId
,
projectId
=
ProjectId
,
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
,
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
,
updatetime
=
DateTime
.
Now
updatetime
=
DateTime
.
Now
});
});
}
}
else
if
(
machineStatus
.
auto
==
1
)
{
if
(
machineStatus
.
enable
==
0
)
{
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
if
(
machineStatus
.
status
!=
(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineBusy
);
}
}
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
loading
.
section
))
{
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
);
}
var
plandts
=
_planDetails
.
Get
(
f
=>
f
.
projectId
==
ProjectId
&&
f
.
OrderNumber
==
loading
.
code
);
var
plandts
=
_planDetails
.
Get
(
f
=>
f
.
projectId
==
ProjectId
&&
f
.
OrderNumber
==
loading
.
code
);
if
(
plandts
==
null
)
if
(
plandts
==
null
)
...
@@ -366,6 +362,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -366,6 +362,11 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
AccEnum
.
FixtureToolsIsNone
);
throw
new
BadRequestException
(
AccEnum
.
FixtureToolsIsNone
);
}
}
var
exitsUpload
=
_automationTaskList
.
Get
(
f
=>
f
.
send
==
0
&&
f
.
locationid
==
loading
.
locationid
);
if
(
exitsUpload
!=
null
)
{
throw
new
BadRequestException
(
AccEnum
.
FixtureOrderNulll
);
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
sn
=
_automationTaskList
.
CreateRandonSn
(
plan
.
product_code
);
var
sn
=
_automationTaskList
.
CreateRandonSn
(
plan
.
product_code
);
...
@@ -413,7 +414,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -413,7 +414,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
{
fixtureguid
=
fixtureToolsObj
.
FixtureGuid
,
fixtureguid
=
fixtureToolsObj
.
FixtureGuid
,
fixturename
=
fixtureToolsObj
.
Fixture
Nam
e
,
fixturename
=
fixtureToolsObj
.
Fixture
Cod
e
,
projectId
=
ProjectId
,
projectId
=
ProjectId
,
section
=
loading
.
section
,
section
=
loading
.
section
,
sn
=
sn
,
sn
=
sn
,
...
@@ -426,7 +427,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -426,7 +427,8 @@ namespace Siger.ApiACC.Controllers
ordernumber
=
plandts
.
OrderNumber
,
ordernumber
=
plandts
.
OrderNumber
,
locationId
=
fixtureToolsObj
.
Location
,
locationId
=
fixtureToolsObj
.
Location
,
unixtime
=
unixtime
,
unixtime
=
unixtime
,
route
=
route
.
id
route
=
route
.
id
,
taskno
=
taskNo
});
});
}
}
else
else
...
@@ -442,13 +444,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -442,13 +444,14 @@ namespace Siger.ApiACC.Controllers
monitor
.
locationId
=
fixtureToolsObj
.
Location
;
monitor
.
locationId
=
fixtureToolsObj
.
Location
;
monitor
.
unixtime
=
unixtime
;
monitor
.
unixtime
=
unixtime
;
monitor
.
route
=
route
.
id
;
monitor
.
route
=
route
.
id
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
Logger
.
WriteLineError
(
$"
手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
Logger
.
WriteLineError
(
$"
准备上料任务:
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
else
else
...
@@ -474,26 +477,20 @@ namespace Siger.ApiACC.Controllers
...
@@ -474,26 +477,20 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
//if (machineStatus.status == (int)Automation.MachineStatus.Waiting)
//{
// throw new BadRequestException(AccEnum.MachineOnFree);
//}
//if (machineStatus.status == (int)Automation.MachineStatus.Complated)
//{
// throw new BadRequestException(AccEnum.MachineProCompalate);
//}
if
(
!
_automationTaskList
.
CanTask
(
ProjectId
,
assemble
.
section
)
)
if
(
machineStatus
.
auto
==
0
)
{
{
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
)
;
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
}
}
//创建 安装完成动作
//创建 安装完成动作
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
projectId
==
ProjectId
&&
f
.
section
==
assemble
.
section
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
projectId
==
ProjectId
&&
f
.
section
==
assemble
.
section
);
if
(
monitor
==
null
)
if
(
monitor
==
null
)
{
{
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
}
}
//移出 上料位
//检测工序是否配置正确
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
_automationTaskList
.
Insert
(
new
siger_automation_task_list
...
@@ -520,12 +517,15 @@ namespace Siger.ApiACC.Controllers
...
@@ -520,12 +517,15 @@ namespace Siger.ApiACC.Controllers
processid
=
0
,
processid
=
0
,
programnumber
=
""
,
programnumber
=
""
,
remark
=
"手动任务-安装完成"
,
remark
=
"手动任务-安装完成"
,
route
=
monitor
.
route
});
});
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
Logger
.
WriteLineError
(
$"
手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
Logger
.
WriteLineError
(
$"
安装完成任务
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
else
else
...
@@ -570,10 +570,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -570,10 +570,11 @@ namespace Siger.ApiACC.Controllers
//2. 无检验状态 (立库-》上下料工位)
//2. 无检验状态 (立库-》上下料工位)
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
action
=
lineMode
.
inspect
==
1
?
Automation
.
TaskAction
.
Step_LK_CJT
:
Automation
.
TaskAction
.
Step_LK_SXLW
;
_automationTaskList
.
Insert
(
new
siger_automation_task_list
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
{
no
=
taskNo
,
no
=
taskNo
,
action
=
lineMode
.
inspect
==
1
?
Automation
.
TaskAction
.
Step_LK_CJT
:
Automation
.
TaskAction
.
Step_LK_SXLW
,
action
=
action
,
actiontype
=
Automation
.
ExcueType
.
None
,
actiontype
=
Automation
.
ExcueType
.
None
,
triggertime
=
DateTime
.
Now
,
triggertime
=
DateTime
.
Now
,
tasktype
=
Automation
.
TaskActionType
.
Load
,
tasktype
=
Automation
.
TaskActionType
.
Load
,
...
@@ -593,7 +594,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -593,7 +594,7 @@ namespace Siger.ApiACC.Controllers
productcode
=
location
.
productcode
,
productcode
=
location
.
productcode
,
processid
=
0
,
processid
=
0
,
programnumber
=
""
,
programnumber
=
""
,
remark
=
"手动任务-准备
上
料"
,
remark
=
"手动任务-准备
下
料"
,
extend1
=
unixtime
.
ToStr
()
extend1
=
unixtime
.
ToStr
()
});
});
...
@@ -615,13 +616,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -615,13 +616,13 @@ namespace Siger.ApiACC.Controllers
productName
=
location
.
productname
,
productName
=
location
.
productname
,
ordernumber
=
location
.
ordernumber
,
ordernumber
=
location
.
ordernumber
,
locationId
=
location
.
locationid
,
locationId
=
location
.
locationid
,
unixtime
=
unixtime
unixtime
=
unixtime
,
taskno
=
taskNo
});
});
}
}
else
else
{
{
monitor
.
sn
=
location
.
sn
;
monitor
.
sn
=
location
.
sn
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
;
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
;
monitor
.
productId
=
location
.
productid
;
monitor
.
productId
=
location
.
productid
;
...
@@ -630,11 +631,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -630,11 +631,13 @@ namespace Siger.ApiACC.Controllers
monitor
.
ordernumber
=
location
.
ordernumber
;
monitor
.
ordernumber
=
location
.
ordernumber
;
monitor
.
locationId
=
location
.
locationid
;
monitor
.
locationId
=
location
.
locationid
;
monitor
.
unixtime
=
unixtime
;
monitor
.
unixtime
=
unixtime
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
Logger
.
WriteLineError
(
$"准备下料任务
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
action
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
else
else
...
@@ -661,7 +664,10 @@ namespace Siger.ApiACC.Controllers
...
@@ -661,7 +664,10 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
if
(
machineStatus
.
auto
==
0
)
{
machineStatus
.
status
=
1
;
}
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
disassemble
.
section
))
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
disassemble
.
section
))
{
{
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
);
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
);
...
@@ -672,16 +678,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -672,16 +678,13 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
}
}
//移出 上料位
monitor
.
section
=
0
;
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
id
==
monitor
.
locationId
);
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
id
==
monitor
.
locationId
);
if
(
location
!=
null
)
if
(
location
!=
null
)
{
{
location
.
sn
=
""
;
location
.
sn
=
""
;
location
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
{
...
@@ -709,9 +712,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -709,9 +712,14 @@ namespace Siger.ApiACC.Controllers
remark
=
"手动任务-拆卸完成"
,
remark
=
"手动任务-拆卸完成"
,
});
});
//移出 上料位
monitor
.
section
=
0
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
Logger
.
WriteLineError
(
$"
手动任务-拆卸完成-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
Logger
.
WriteLineError
(
$"
拆卸完成任务
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
else
else
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationStateController.cs
View file @
99679107
...
@@ -10,19 +10,23 @@ using Siger.Middlelayer.AccRepository.Response;
...
@@ -10,19 +10,23 @@ using Siger.Middlelayer.AccRepository.Response;
using
Siger.ApiCommon.Result
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
Siger.Middlelayer.Repository
;
using
Siger.Middlelayer.Log
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace
Siger.ApiACC.Controllers
namespace
Siger.ApiACC.Controllers
{
{
public
class
AutomationStateController
:
BaseController
public
class
AutomationStateController
:
BaseController
{
{
private
readonly
IUnitOfWork
_unitOfWork
;
private
readonly
ISigerProjectLevelSectionRepository
_sigerProjectLevelSection
;
private
readonly
ISigerProjectLevelSectionRepository
_sigerProjectLevelSection
;
private
readonly
IAutomationMachineStatus
_automationMachineStatus
;
private
readonly
IAutomationMachineStatus
_automationMachineStatus
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
public
AutomationStateController
(
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationMachineStatus
automationMachineStatus
,
IAutomationTaskListRepository
automationTaskList
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
public
AutomationStateController
(
I
UnitOfWork
unitOfWork
,
I
SigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationMachineStatus
automationMachineStatus
,
IAutomationTaskListRepository
automationTaskList
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
{
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_automationMachineStatus
=
automationMachineStatus
;
_automationMachineStatus
=
automationMachineStatus
;
_automationTaskList
=
automationTaskList
;
_automationTaskList
=
automationTaskList
;
...
@@ -102,5 +106,24 @@ namespace Siger.ApiACC.Controllers
...
@@ -102,5 +106,24 @@ namespace Siger.ApiACC.Controllers
return
new
PagedObjectResult
(
resulst
,
resulst
.
Total
,
page
,
pageSize
);
return
new
PagedObjectResult
(
resulst
,
resulst
.
Total
,
page
,
pageSize
);
}
}
public
IActionResult
DeleteTask
(
int
id
)
{
var
record
=
_automationTaskList
.
Get
(
f
=>
f
.
id
==
id
);
if
(
record
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
_automationTaskList
.
Delete
(
record
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
Logger
.
WriteLineError
(
$"手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
}
}
}
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
View file @
99679107
...
@@ -320,16 +320,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -320,16 +320,11 @@ namespace Siger.ApiACC.Controllers
private
void
CreateTaskList
(
int
section
,
int
productid
,
string
productcode
,
string
sn
,
int
routeid
)
private
void
CreateTaskList
(
int
section
,
int
productid
,
string
productcode
,
string
sn
,
int
routeid
)
{
{
if
(
section
<=
0
||
string
.
IsNullOrEmpty
(
sn
)
||
string
.
IsNullOrEmpty
(
productcode
)
||
productid
<=
0
)
var
monitor
=
_fixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
if
(
monitor
==
null
)
{
{
return
;
Logger
.
WriteLineInfo
(
$"检验工站
{
section
}
monitor 为空"
)
;
}
}
var
monitor
=
_fixtureMonitor
.
GetList
(
q
=>
q
.
section
==
section
&&
q
.
sn
==
sn
).
OrderByDescending
(
q
=>
q
.
updatetime
).
FirstOrDefault
();
if
(
monitor
==
null
)
{
return
;
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
_automationTaskList
.
Insert
(
new
siger_automation_task_list
...
@@ -357,6 +352,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -357,6 +352,7 @@ namespace Siger.ApiACC.Controllers
programnumber
=
""
,
programnumber
=
""
,
remark
=
"质量检验"
,
remark
=
"质量检验"
,
});
});
monitor
.
taskno
=
taskNo
;
_unitOfWork
.
Commit
();
_unitOfWork
.
Commit
();
}
}
...
...
Server/Apis/Siger.ApiACC/Controllers/SectionPropertyController.cs
View file @
99679107
...
@@ -64,8 +64,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -64,8 +64,7 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
[
HttpGet
]
public
IActionResult
GetSn
(
int
sectionid
)
public
IActionResult
GetSn
(
int
sectionid
)
{
{
var
monitor
=
_fixtureMonitor
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
section
==
sectionid
).
OrderByDescending
(
q
=>
q
.
updatetime
).
var
monitor
=
_fixtureMonitor
.
Get
(
sectionid
);
FirstOrDefault
();
return
new
ObjectResult
(
monitor
?.
sn
??
""
);
return
new
ObjectResult
(
monitor
?.
sn
??
""
);
}
}
}
}
...
...
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
View file @
99679107
...
@@ -50,11 +50,18 @@ namespace Siger.ApiACC.Tasks
...
@@ -50,11 +50,18 @@ namespace Siger.ApiACC.Tasks
if
(
attr
==
null
)
if
(
attr
==
null
)
return
;
return
;
var
fixtrue
=
dbhelper
.
GetFixture
(
task
.
fixtureguid
);
if
(
fixtrue
==
null
)
{
Logger
.
WriteLineError
(
$"自动工装未找到"
);
return
;
}
var
sendToPLC
=
new
RequestPLC
var
sendToPLC
=
new
RequestPLC
{
{
ProductCode
=
task
.
productcode
,
LineID
=
levelsction
.
parentid
,
LineID
=
levelsction
.
parentid
,
RStation
=
attr
.
machine
,
RStation
=
attr
.
machine
,
Fixture
=
task
.
fixtureguid
,
Fixture
=
fixtrue
.
code
,
RequestForm
=
task
.
no
,
RequestForm
=
task
.
no
,
RobotStep
=
(
int
)
task
.
action
,
RobotStep
=
(
int
)
task
.
action
,
StorageNo
=
task
.
locationid
,
StorageNo
=
task
.
locationid
,
...
...
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
View file @
99679107
...
@@ -70,6 +70,10 @@ namespace Siger.ApiACC.Tasks
...
@@ -70,6 +70,10 @@ namespace Siger.ApiACC.Tasks
{
{
return
AccDbContext
.
siger_project_machine_attribution
.
FirstOrDefault
(
f
=>
f
.
station
==
section
&&
f
.
status
==
1
);
return
AccDbContext
.
siger_project_machine_attribution
.
FirstOrDefault
(
f
=>
f
.
station
==
section
&&
f
.
status
==
1
);
}
}
public
siger_automation_fixture_tools
GetFixture
(
string
guid
)
{
return
AccDbContext
.
siger_automation_fixture_tools
.
FirstOrDefault
(
f
=>
f
.
guid
==
guid
&&
f
.
status
==
1
);
}
public
void
Dispose
()
public
void
Dispose
()
{
{
CncDbContext
?.
Dispose
();
CncDbContext
?.
Dispose
();
...
...
Server/Apis/Siger.ApiWMS/Controllers/UploadController.cs
View file @
99679107
...
@@ -16,6 +16,7 @@ using Siger.Middlelayer.Utility.Helpers;
...
@@ -16,6 +16,7 @@ using Siger.Middlelayer.Utility.Helpers;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.WmsRepository.Entities
;
using
Siger.Middlelayer.WmsRepository.Entities
;
using
Siger.Middlelayer.WmsRepository.Repositories.Interface
;
using
Siger.Middlelayer.WmsRepository.Repositories.Interface
;
using
Siger.Middlelayer.Common.Extensions
;
namespace
Siger.ApiWMS.Controllers
namespace
Siger.ApiWMS.Controllers
{
{
...
@@ -116,10 +117,19 @@ namespace Siger.ApiWMS.Controllers
...
@@ -116,10 +117,19 @@ namespace Siger.ApiWMS.Controllers
var
locationTypes
=
_location_TypeRepository
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
locationTypes
=
_location_TypeRepository
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
if
(!
locationTypes
.
Any
())
if
(!
locationTypes
.
Any
())
{
{
throw
new
BadRequestException
(
RequestEnum
.
LocationTypeNotFound
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
(
int
)
RequestEnum
.
LocationTypeNotFound
)
);
}
}
var
sonLocationTypes
=
GetSonTypes
(
0
,
locationTypes
).
Select
(
q
=>
new
Tuple
<
int
,
string
>(
q
.
id
,
q
.
name
)).
ToList
();
var
sonLocationTypes
=
GetSonTypes
(
0
,
locationTypes
).
Select
(
q
=>
new
Tuple
<
int
,
string
>(
q
.
id
,
q
.
name
)).
ToList
();
var
checkResult
=
excelHelper
.
CheckExcel
(
sonLocationTypes
);
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
(
sonLocationTypes
);
var
data
=
excelHelper
.
ConvertSheetToList
(
sonLocationTypes
);
if
(!
data
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
(
int
)
CommonEnum
.
NoData
));
}
var
result
=
_locationRepository
.
ImportStorageLocations
(
data
,
ProjectId
,
UserId
);
var
result
=
_locationRepository
.
ImportStorageLocations
(
data
,
ProjectId
,
UserId
);
return
result
;
return
result
;
}
}
...
...
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
View file @
99679107
...
@@ -148,5 +148,13 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
...
@@ -148,5 +148,13 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
[
Description
(
"清洗机->加工中心"
)]
[
Description
(
"清洗机->加工中心"
)]
Step_QXJ_JGZX
=
10
,
Step_QXJ_JGZX
=
10
,
}
}
public
enum
LocationStatus
{
[
Description
(
"在库内"
)]
In
=
1
,
[
Description
(
"不在库内"
)]
Out
=
2
}
}
}
}
}
Server/Common/Siger.Middlelayer.Utility/Helpers/EPPlusWmsExcelHelper.cs
View file @
99679107
...
@@ -6,6 +6,7 @@ using System.Reflection;
...
@@ -6,6 +6,7 @@ using System.Reflection;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
OfficeOpenXml
;
using
OfficeOpenXml
;
using
OfficeOpenXml.Style
;
using
OfficeOpenXml.Style
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Utility.ExcelImport
;
using
Siger.Middlelayer.Utility.ExcelImport
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
ExcelColumn
=
Siger
.
Middlelayer
.
Utility
.
ExcelImport
.
ExcelColumn
;
using
ExcelColumn
=
Siger
.
Middlelayer
.
Utility
.
ExcelImport
.
ExcelColumn
;
...
@@ -117,6 +118,94 @@ namespace Siger.Middlelayer.Utility.Helpers
...
@@ -117,6 +118,94 @@ namespace Siger.Middlelayer.Utility.Helpers
return
collection
;
return
collection
;
}
}
public
List
<
string
>
CheckExcel
(
List
<
Tuple
<
int
,
string
>>
locationTypes
)
{
if
(
Sheet
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
Sheet
));
}
var
messages
=
new
List
<
string
>();
var
columns
=
new
List
<
string
>
{
"ID"
,
"仓库名称"
};
foreach
(
var
item
in
locationTypes
)
{
columns
.
Add
(
item
.
Item2
);
}
var
endRow
=
2
;
for
(
var
row
=
2
;
row
<=
Sheet
.
Dimension
.
Rows
;
row
++)
{
var
columnValues
=
new
List
<
string
>();
for
(
var
i
=
1
;
i
<=
columns
.
Count
;
i
++)
{
var
val
=
Sheet
.
Cells
[
row
,
i
];
if
(
val
!=
null
)
{
columnValues
.
Add
(
val
.
Text
);
}
}
if
(
columnValues
.
All
(
string
.
IsNullOrWhiteSpace
))
{
endRow
=
row
-
1
;
break
;
}
endRow
=
row
;
}
IList
<
int
>
rows
=
new
List
<
int
>();
for
(
var
i
=
2
;
i
<=
endRow
;
i
++)
{
rows
.
Add
(
i
);
}
foreach
(
var
row
in
rows
)
{
var
tnew
=
new
ImportStorageLocations
();
int
i
=
1
;
foreach
(
var
col
in
columns
)
{
var
cell
=
Sheet
.
Cells
[
row
,
i
];
var
val
=
cell
==
null
?
""
:
cell
.
Value
?.
ToString
()
??
""
;
if
(
i
==
1
)
{
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
$"
{
row
}
,
{(
int
)
RequestEnum
.
PleaseInputNotZeroIntID
}
"
);
return
messages
;
}
tnew
.
ID
=
val
;
}
if
(
i
==
2
)
{
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
$"
{
row
}
,
{(
int
)
RequestEnum
.
PleaseInputStorageName
}
"
);
return
messages
;
}
tnew
.
StorageName
=
val
;
}
if
(
i
>
2
)
{
var
typeId
=
locationTypes
.
FirstOrDefault
(
q
=>
q
.
Item2
==
col
);
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
typeId
!=
null
?
$"
{
row
}
, 请填写
{
typeId
.
Item2
}
"
:
$"
{
row
}
,
{(
int
)
RequestEnum
.
LocationImportFormatError
}
"
);
return
messages
;
}
tnew
.
Locations
.
Add
(
new
LocationModels
{
LocationType
=
typeId
==
null
?
0
:
typeId
.
Item1
,
Location
=
val
});
}
i
++;
}
}
return
messages
;
}
public
void
Dispose
()
public
void
Dispose
()
{
{
Sheet
?.
Dispose
();
Sheet
?.
Dispose
();
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
View file @
99679107
...
@@ -167,5 +167,7 @@ namespace Siger.Middlelayer.AccRepository
...
@@ -167,5 +167,7 @@ namespace Siger.Middlelayer.AccRepository
public
DbSet
<
siger_automation_produce_history
>
siger_automation_produce_history
{
get
;
set
;
}
public
DbSet
<
siger_automation_produce_history
>
siger_automation_produce_history
{
get
;
set
;
}
public
DbSet
<
siger_automation_fixture_tools_monitor
>
siger_automation_fixture_tools_moniter
{
get
;
set
;
}
public
DbSet
<
siger_automation_fixture_tools_monitor
>
siger_automation_fixture_tools_moniter
{
get
;
set
;
}
public
DbSet
<
siger_check_sn_trace_inspection
>
siger_check_sn_trace_inspection
{
get
;
set
;
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_monitor.cs
View file @
99679107
...
@@ -11,7 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
...
@@ -11,7 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
/// </summary>
public
string
fixtureguid
{
get
;
set
;
}
public
string
fixtureguid
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 工装
名称
/// 工装
编号
/// </summary>
/// </summary>
public
string
fixturename
{
get
;
set
;
}
public
string
fixturename
{
get
;
set
;
}
/// <summary>
/// <summary>
...
@@ -50,5 +50,9 @@ namespace Siger.Middlelayer.AccRepository.Entities
...
@@ -50,5 +50,9 @@ namespace Siger.Middlelayer.AccRepository.Entities
public
string
productName
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
int
locationId
{
get
;
set
;
}
public
int
locationId
{
get
;
set
;
}
public
int
unixtime
{
get
;
set
;
}
public
int
unixtime
{
get
;
set
;
}
/// <summary>
/// 当前任务
/// </summary>
public
string
taskno
{
get
;
set
;
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_machine_status.cs
View file @
99679107
...
@@ -30,5 +30,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
...
@@ -30,5 +30,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
/// </summary>
public
string
program
{
get
;
set
;
}
public
string
program
{
get
;
set
;
}
/// <summary>
/// 1: 自动设备 0:上下料设备
/// </summary>
public
int
auto
{
get
;
set
;
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
99679107
...
@@ -186,28 +186,34 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -186,28 +186,34 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if
(
string
.
IsNullOrEmpty
(
item
.
ParentFixtureTool
))
if
(
string
.
IsNullOrEmpty
(
item
.
ParentFixtureTool
))
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputParentFixtureCode
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputParentFixtureCode
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
))
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
))
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputSonFixtureCode
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputSonFixtureCode
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
if
(
string
.
IsNullOrEmpty
(
item
.
Status
))
if
(
string
.
IsNullOrEmpty
(
item
.
Status
))
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputStatus
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
PleaseInputStatus
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
if
(
item
.
ParentFixtureTool
==
item
.
FixtureTool
)
if
(
item
.
ParentFixtureTool
==
item
.
FixtureTool
)
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentSonSame
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentSonSame
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
var
parent
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
code
==
item
.
ParentFixtureTool
&&
q
.
projectId
==
projectid
);
var
parent
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
code
==
item
.
ParentFixtureTool
&&
q
.
projectId
==
projectid
);
if
(
parent
==
null
)
if
(
parent
==
null
)
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
var
son
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
code
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
var
son
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
code
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
if
(
son
==
null
)
if
(
son
==
null
)
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
var
parentGuid
=
parent
.
guid
;
var
parentGuid
=
parent
.
guid
;
if
(
son
!=
null
&&
parent
!=
null
)
if
(
son
!=
null
&&
parent
!=
null
)
...
@@ -216,16 +222,19 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -216,16 +222,19 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if
(
exsit
!=
null
)
if
(
exsit
!=
null
)
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
}
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
&&
q
.
ParentFixtureTool
==
item
.
ParentFixtureTool
)
>
1
)
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
&&
q
.
ParentFixtureTool
==
item
.
ParentFixtureTool
)
>
1
)
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
var
parentExsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
);
var
parentExsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
))
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
))
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LevelCountError
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LevelCountError
}
"
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
if
(
errors
.
Any
())
if
(
errors
.
Any
())
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsRepository.cs
View file @
99679107
...
@@ -121,7 +121,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -121,7 +121,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
join
l
in
_context
.
siger_automation_location
on
q
.
guid
equals
l
.
fixturetools
join
l
in
_context
.
siger_automation_location
on
q
.
guid
equals
l
.
fixturetools
where
q
.
projectId
==
projectId
&&
q
.
guid
==
guid
&&
l
.
locationid
==
loactionId
where
q
.
projectId
==
projectId
&&
q
.
guid
==
guid
&&
l
.
locationid
==
loactionId
&&
l
.
status
==
1
select
new
ResponseProductFixtureInfo
select
new
ResponseProductFixtureInfo
{
{
FixtureGuid
=
q
.
guid
,
FixtureGuid
=
q
.
guid
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
99679107
...
@@ -212,7 +212,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -212,7 +212,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var
entity
=
new
siger_automation_location
var
entity
=
new
siger_automation_location
{
{
guid
=
Guid
.
NewGuid
().
ToString
(),
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
location
.
id
,
location_cid
=
location
.
id
,
locationid
=
location
.
locationid
,
fixturetools
=
fixturetool
.
guid
,
fixturetools
=
fixturetool
.
guid
,
attachment
=
""
,
attachment
=
""
,
filename
=
""
,
filename
=
""
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
99679107
...
@@ -29,7 +29,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -29,7 +29,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
{
//已经下发,并且任务完成
//已经下发,并且任务完成
var
taskObjs
=
_context
.
siger_automation_task_list
.
Where
(
f
=>
f
.
projectId
==
projectId
&&
f
.
send
==
0
);
var
taskObjs
=
_context
.
siger_automation_task_list
.
Where
(
f
=>
f
.
projectId
==
projectId
&&
f
.
send
==
0
);
if
(
taskObjs
.
Any
())
if
(
taskObjs
.
Any
())
{
{
return
false
;
return
false
;
...
@@ -90,7 +89,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -90,7 +89,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
}
public
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
ti
ggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
ti
rbeigin
,
string
triend
,
string
compbegin
,
string
compend
,
int
projectid
,
int
page
,
int
pagesize
)
{
{
var
query
=
from
q
in
_context
.
siger_automation_task_list
var
query
=
from
q
in
_context
.
siger_automation_task_list
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixtureguid
equals
t
.
guid
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixtureguid
equals
t
.
guid
...
@@ -120,7 +119,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -120,7 +119,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
productCode
=
q
.
productcode
,
productCode
=
q
.
productcode
,
program
=
q
.
programnumber
,
program
=
q
.
programnumber
,
route
=
r
!=
null
?
$"
{
r
.
serialNumber
}
-
{
r
.
name
}
"
:
""
,
route
=
r
!=
null
?
$"
{
r
.
serialNumber
}
-
{
r
.
name
}
"
:
""
,
send
=
q
.
send
,
tasktype
=
EnumHelper
.
GetEnumDesc
(
q
.
tasktype
),
tasktype
=
EnumHelper
.
GetEnumDesc
(
q
.
tasktype
),
status
=
q
.
status
,
status
=
q
.
status
,
...
@@ -156,15 +155,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -156,15 +155,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories
actionTypeExpression
=
q
=>
q
.
actionTypeid
==
actionType
;
actionTypeExpression
=
q
=>
q
.
actionTypeid
==
actionType
;
}
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
triggerTimeTypeExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
triggerTimeTypeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
t
iggertime
))
if
(!
string
.
IsNullOrEmpty
(
t
riend
)
&&
!
string
.
IsNullOrEmpty
(
tirbeigin
))
{
{
triggerTimeTypeExpression
=
q
=>
q
.
triggervalue
==
tiggertime
.
ToDateTime
();
triggerTimeTypeExpression
=
q
=>
q
.
triggervalue
>=
tirbeigin
.
ToDateTime
()
&&
q
.
triggervalue
<=
triend
.
ToDateTime
();
}
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
comptimeExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
comptimeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
comp
time
))
if
(!
string
.
IsNullOrEmpty
(
comp
begin
)
&&
!
string
.
IsNullOrEmpty
(
compend
))
{
{
comptimeExpression
=
q
=>
q
.
complatevalue
==
comptime
.
ToDateTime
();
comptimeExpression
=
q
=>
q
.
complatevalue
>=
compbegin
.
ToDateTime
()
&&
q
.
complatevalue
<=
compend
.
ToDateTime
();
}
}
var
expression
=
sectonsExpression
.
And
(
taskTypeExpression
).
And
(
productCodeExpression
).
And
(
tasknoExpression
).
And
(
snExpression
)
var
expression
=
sectonsExpression
.
And
(
taskTypeExpression
).
And
(
productCodeExpression
).
And
(
tasknoExpression
).
And
(
snExpression
)
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationTaskListRepository.cs
View file @
99679107
...
@@ -26,6 +26,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -26,6 +26,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
string
CreateRandonSn
(
string
productCode
);
string
CreateRandonSn
(
string
productCode
);
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
ti
ggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
ti
rbeigin
,
string
triend
,
string
compbegin
,
string
compend
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestAutomationTaskResult.cs
View file @
99679107
...
@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Request
...
@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Request
{
{
[
Required
(
ErrorMessage
=
"guidNotNull"
)]
[
Required
(
ErrorMessage
=
"guidNotNull"
)]
/// <summary>
/// <summary>
/// 任务列表
GUID
/// 任务列表
taskNo
/// </summary>
/// </summary>
public
string
guid
{
get
;
set
;
}
public
string
guid
{
get
;
set
;
}
[
Required
(
ErrorMessage
=
"status"
)]
[
Required
(
ErrorMessage
=
"status"
)]
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestPLC.cs
View file @
99679107
...
@@ -6,6 +6,7 @@ namespace Siger.Middlelayer.AccRepository.Request
...
@@ -6,6 +6,7 @@ namespace Siger.Middlelayer.AccRepository.Request
{
{
public
class
RequestPLC
public
class
RequestPLC
{
{
public
string
ProductCode
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 工件唯一识别SN
/// 工件唯一识别SN
/// </summary>
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationTasklist.cs
View file @
99679107
...
@@ -46,5 +46,6 @@ namespace Siger.Middlelayer.AccRepository.Response
...
@@ -46,5 +46,6 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
triggerTime
{
get
;
set
;
}
public
string
triggerTime
{
get
;
set
;
}
public
DateTime
?
complatevalue
{
get
;
set
;
}
public
DateTime
?
complatevalue
{
get
;
set
;
}
public
string
complatetime
{
get
;
set
;
}
public
string
complatetime
{
get
;
set
;
}
public
int
send
{
get
;
set
;
}
}
}
}
}
Server/Infrastructure/Script/DB.script
View file @
99679107
...
@@ -375,6 +375,7 @@ CREATE TABLE `siger_automation_machine_status` (
...
@@ -375,6 +375,7 @@ CREATE TABLE `siger_automation_machine_status` (
`machineid` int NOT NULL DEFAULT '0' COMMENT '工位对应设备ID',
`machineid` int NOT NULL DEFAULT '0' COMMENT '工位对应设备ID',
`projectid` int NOT NULL DEFAULT '0',
`projectid` int NOT NULL DEFAULT '0',
`enable` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:不可用 1:可用',
`enable` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:不可用 1:可用',
`auto` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:上下料设备 1:自动设备',
`status` int NOT NULL DEFAULT '1' COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`status` int NOT NULL DEFAULT '1' COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`updatetime` datetime DEFAULT NULL COMMENT '操作时间',
`updatetime` datetime DEFAULT NULL COMMENT '操作时间',
`program` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '程序号',
`program` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '程序号',
...
@@ -445,6 +446,8 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
...
@@ -445,6 +446,8 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` int(11) NOT NULL DEFAULT 0,
`locationId` int(11) NOT NULL DEFAULT 0,
`unixtime` int(1) NOT NULL DEFAULT 1 COMMENT 'task时间',
`taskno` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前任务单',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
...
...
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