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
b2984210
Commit
b2984210
authored
Feb 06, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupdate
parent
2da17f65
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
243 deletions
+101
-243
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+77
-144
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+6
-93
AutomationStateController.cs
...pis/Siger.ApiACC/Controllers/AutomationStateController.cs
+2
-0
QmsCheckController.cs
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
+9
-2
ApiAccDbContext.cs
...tories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
+2
-0
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+4
-4
ResponseAutomationMachineStatus.cs
...AccRepository/Response/ResponseAutomationMachineStatus.cs
+1
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
b2984210
...
@@ -102,18 +102,17 @@ namespace Siger.ApiACC.Controllers
...
@@ -102,18 +102,17 @@ namespace Siger.ApiACC.Controllers
// 设备空闲,或者完成时触发 自动任务
// 设备空闲,或者完成时触发 自动任务
if
(
request
.
enable
==
1
)
if
(
request
.
enable
==
1
)
{
{
if
(
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
||
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
{
{
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
{
{
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
Logger
.
WriteLineInfo
(
$"MachineStatus 设备
{
section
.
title
}
状态 触发自动任务检查"
);
if
(
section
!=
null
)
AutoProcess
(
section
.
parentid
);
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备
{
section
.
title
}
状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
);
}
}
}
}
}
}
}
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
}
...
@@ -208,10 +207,10 @@ namespace Siger.ApiACC.Controllers
...
@@ -208,10 +207,10 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
}
if
(
taskObj
.
status
==(
int
)
TaskResultStatus
.
Complated
)
//
if (taskObj.status==(int)TaskResultStatus.Complated)
{
//
{
throw
new
BadRequestException
(
AccEnum
.
AutoTaskDone
);
//
throw new BadRequestException(AccEnum.AutoTaskDone);
}
//
}
//更新Tasklist
//更新Tasklist
PlCfeeback
(
taskObj
,
request
.
status
);
PlCfeeback
(
taskObj
,
request
.
status
);
...
@@ -260,11 +259,9 @@ namespace Siger.ApiACC.Controllers
...
@@ -260,11 +259,9 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"PlCfeeback 未找到该工装储位信息"
);
Logger
.
WriteLineInfo
(
$"PlCfeeback 未找到该工装储位信息"
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if
(
sectionProperty
.
propertytype
==
1
)
if
(
sectionProperty
.
propertytype
==
1
)
{
{
//绑定SN 工件到立库储位
//绑定SN 工件到立库储位
if
(
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
if
(
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
{
{
...
@@ -279,9 +276,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -279,9 +276,13 @@ namespace Siger.ApiACC.Controllers
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
//从立库储位拿SN 工件到上料位
//从立库储位拿SN 工件到上料位
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_SXLW
)
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_SXLW
)
{
{
//location.sn = "";
location
.
sn
=
taskObj
.
sn
;
location
.
productcode
=
taskObj
.
productcode
;
location
.
productid
=
taskObj
.
productid
;
location
.
productname
=
taskObj
.
productname
;
location
.
route
=
taskObj
.
route
.
ToString
();
location
.
status
=
(
int
)
LocationStatus
.
Out
;
location
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
...
@@ -289,8 +290,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -289,8 +290,14 @@ namespace Siger.ApiACC.Controllers
// CNC 设备
// CNC 设备
if
(
sectionProperty
.
propertytype
==
2
)
if
(
sectionProperty
.
propertytype
==
2
)
{
{
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_JGZX
)
if
(
taskObj
.
action
==
TaskAction
.
Step_LK_JGZX
)
{
{
var
route
=
_productRoute
.
GetList
(
f
=>
f
.
productId
==
taskObj
.
productid
&&
f
.
id
!=
taskObj
.
route
&&
f
.
status
==
(
int
)
RowState
.
Valid
,
"serialNumber"
,
false
).
FirstOrDefault
();
if
(
route
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
ProductRouteMissing
);
}
location
.
route
=
route
.
id
.
ToString
();
location
.
status
=
(
int
)
LocationStatus
.
Out
;
location
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
...
@@ -302,14 +309,12 @@ namespace Siger.ApiACC.Controllers
...
@@ -302,14 +309,12 @@ namespace Siger.ApiACC.Controllers
{
{
location
.
status
=
(
int
)
LocationStatus
.
Out
;
location
.
status
=
(
int
)
LocationStatus
.
Out
;
_automationLocation
.
Update
(
location
);
_automationLocation
.
Update
(
location
);
}
}
}
}
//清洗机
//清洗机
if
(
sectionProperty
.
propertytype
==
4
)
if
(
sectionProperty
.
propertytype
==
4
)
{
{
if
(
taskObj
.
action
==
TaskAction
.
Step_QXJ_LK
)
if
(
taskObj
.
action
==
TaskAction
.
Step_QXJ_LK
)
{
{
//上料 指定的第一道工序
//上料 指定的第一道工序
var
route
=
_productRoute
.
GetList
(
f
=>
f
.
productId
==
taskObj
.
productid
&&
f
.
status
==
(
int
)
RowState
.
Valid
,
"serialNumber"
,
true
).
FirstOrDefault
();
var
route
=
_productRoute
.
GetList
(
f
=>
f
.
productId
==
taskObj
.
productid
&&
f
.
status
==
(
int
)
RowState
.
Valid
,
"serialNumber"
,
true
).
FirstOrDefault
();
...
@@ -331,16 +336,45 @@ namespace Siger.ApiACC.Controllers
...
@@ -331,16 +336,45 @@ namespace Siger.ApiACC.Controllers
}
}
}
}
}
}
if
(
monitor
==
null
)
}
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
if
(
monitor
!=
null
)
{
{
section
=
taskObj
.
sectionid
,
monitor
.
status
=
status
;
ordernumber
=
taskObj
.
ordercode
,
monitor
.
route
=
taskObj
.
route
;
fixtureguid
=
taskObj
.
fixtureguid
,
monitor
.
fixtureguid
=
taskObj
.
fixtureguid
;
fixturename
=
taskObj
.
fixturename
,
monitor
.
fixturename
=
taskObj
.
fixturename
;
createtime
=
DateTime
.
Now
,
_automationFixtureMonitor
.
Update
(
monitor
);
locationId
=
taskObj
.
locationid
,
productCode
=
taskObj
.
productcode
,
productId
=
taskObj
.
productid
,
productName
=
taskObj
.
productname
,
projectId
=
taskObj
.
projectId
,
route
=
taskObj
.
route
,
sn
=
taskObj
.
sn
,
status
=
status
,
taskno
=
taskObj
.
no
,
updatetime
=
DateTime
.
Now
,
});
}
else
{
monitor
.
ordernumber
=
taskObj
.
ordercode
;
monitor
.
fixtureguid
=
taskObj
.
fixtureguid
;
monitor
.
fixturename
=
taskObj
.
fixturename
;
monitor
.
createtime
=
DateTime
.
Now
;
monitor
.
locationId
=
taskObj
.
locationid
;
monitor
.
productCode
=
taskObj
.
productcode
;
monitor
.
productId
=
taskObj
.
productid
;
monitor
.
productName
=
taskObj
.
productname
;
monitor
.
projectId
=
taskObj
.
projectId
;
monitor
.
route
=
taskObj
.
route
;
monitor
.
sn
=
taskObj
.
sn
;
monitor
.
status
=
status
;
monitor
.
taskno
=
taskObj
.
no
;
monitor
.
updatetime
=
DateTime
.
Now
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
}
}
}
...
@@ -348,8 +382,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -348,8 +382,6 @@ namespace Siger.ApiACC.Controllers
/// 创建自动 Task任务
/// 创建自动 Task任务
/// </summary>
/// </summary>
/// <param name="line"></param>
/// <param name="line"></param>
/// <param name="fixture"></param>
/// <param name="stationDicts"></param>
/// <param name="tasklist"></param>
/// <param name="tasklist"></param>
void
AutoProcess
(
int
line
,
siger_automation_task_list
tasklist
=
null
)
void
AutoProcess
(
int
line
,
siger_automation_task_list
tasklist
=
null
)
{
{
...
@@ -372,9 +404,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -372,9 +404,7 @@ namespace Siger.ApiACC.Controllers
//3.其他设备下料
//3.其他设备下料
*/
*/
/* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
///* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
var
sectionPropertys
=
_automationSectionProperty
.
GetList
(
f
=>
f
.
projectId
==
PID
).
ToList
();
var
sectionPropertys
=
_automationSectionProperty
.
GetList
(
f
=>
f
.
projectId
==
PID
).
ToList
();
if
(!
sectionPropertys
.
Any
())
if
(!
sectionPropertys
.
Any
())
{
{
...
@@ -390,7 +420,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -390,7 +420,6 @@ namespace Siger.ApiACC.Controllers
return
;
return
;
}
}
//优先级1 :清洗机完成 。待下料
//优先级1 :清洗机完成 。待下料
var
cleanProperty
=
sectionPropertys
.
FirstOrDefault
(
f
=>
f
.
propertytype
==
4
);
var
cleanProperty
=
sectionPropertys
.
FirstOrDefault
(
f
=>
f
.
propertytype
==
4
);
if
(
cleanProperty
==
null
)
if
(
cleanProperty
==
null
)
{
{
...
@@ -398,48 +427,21 @@ namespace Siger.ApiACC.Controllers
...
@@ -398,48 +427,21 @@ namespace Siger.ApiACC.Controllers
return
;
return
;
}
}
var
cleanMachine
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
cleanProperty
.
sectionid
);
var
cleanMachine
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
cleanProperty
.
sectionid
);
if
(
cleanMachine
!=
null
)
if
(
cleanMachine
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 清洗机没找到"
);
}
else
{
{
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
}
完成,创建清洗机Task"
);
Logger
.
WriteLineError
(
$"AutoProcess 有清洗机
{
cleanMachine
.
section
}
完成,创建清洗机Task"
);
if
(
tasklist
=
=
null
)
if
(
tasklist
!
=
null
)
{
{
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空"
);
Logger
.
WriteLineError
(
$"AutoProcess Tasklist 为空,查找设备Monitor
{
cleanMachine
.
section
}
状态"
);
var
machineMonitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
machineMonitor
==
null
)
{
Logger
.
WriteLineError
(
$"AutoProcess 清洗机
{
cleanMachine
.
section
}
machineMonitor 为空"
);
return
;
}
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
machineMonitor
.
fixtureguid
,
machineMonitor
.
ordernumber
,
machineMonitor
.
sn
,
""
,
machineMonitor
.
productId
,
machineMonitor
.
productCode
,
machineMonitor
.
locationId
,
machineMonitor
.
route
);
}
else
{
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
);
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
tasklist
.
fixtureguid
,
tasklist
.
ordercode
,
tasklist
.
sn
,
"无程序"
,
tasklist
.
productid
,
tasklist
.
productcode
,
tasklist
.
locationid
,
tasklist
.
route
);
return
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
}
}
else
{
Logger
.
WriteLineInfo
(
$"AutoProcess 清洗机未完成"
);
}
}
else
{
Logger
.
WriteLineInfo
(
$"AutoProcess 清洗机没找到"
);
}
}
//优先级2 :其他设备待上料 (立库->加工中心)
//优先级2 :其他设备待上料 (立库->加工中心)
var
freeMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
var
freeMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
...
@@ -485,50 +487,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -485,50 +487,13 @@ namespace Siger.ApiACC.Controllers
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 "
);
//更新清洗机监控
//清洗机上料 为 任务触发 触发
var
monitor
=
_automationFixtureMonitor
.
Get
(
cleanMachine
.
section
);
if
(
tasklist
!=
null
)
if
(
monitor
==
null
)
{
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
//创建CNC 下料到清洗机
{
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
);
section
=
cleanMachine
.
section
,
return
;
//完成当前任务 退出
fixtureguid
=
tasklist
.
fixtureguid
,
fixturename
=
tasklist
.
fixturename
,
productCode
=
tasklist
.
productcode
,
productId
=
tasklist
.
productid
,
locationId
=
tasklist
.
locationid
,
ordernumber
=
tasklist
.
ordercode
,
productName
=
tasklist
.
productname
,
projectId
=
tasklist
.
projectId
,
taskno
=
tasklist
.
no
,
route
=
tasklist
.
route
,
sn
=
tasklist
.
sn
,
updatetime
=
DateTime
.
Now
,
status
=
1
,
createtime
=
DateTime
.
Now
,
});
}
else
{
monitor
.
fixtureguid
=
tasklist
.
fixtureguid
;
monitor
.
fixturename
=
tasklist
.
fixturename
;
monitor
.
productCode
=
tasklist
.
productcode
;
monitor
.
productId
=
tasklist
.
productid
;
monitor
.
locationId
=
tasklist
.
locationid
;
monitor
.
ordernumber
=
tasklist
.
ordercode
;
monitor
.
productName
=
tasklist
.
productname
;
monitor
.
projectId
=
tasklist
.
projectId
;
monitor
.
taskno
=
tasklist
.
no
;
monitor
.
route
=
tasklist
.
route
;
monitor
.
sn
=
tasklist
.
sn
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
status
=
tasklist
.
status
;
}
}
//创建CNC 下料到清洗机
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
;
//完成当前任务 退出
}
}
}
}
}
}
...
@@ -573,38 +538,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -573,38 +538,6 @@ namespace Siger.ApiACC.Controllers
remark
=
EnumHelper
.
GetEnumDesc
(
taskAction
),
remark
=
EnumHelper
.
GetEnumDesc
(
taskAction
),
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
)
Logger
.
WriteLineInfo
(
$"CreateTask sectionId:
{
section
}
工站
{
EnumHelper
.
GetEnumDesc
(
taskAction
)}
完成"
);
Logger
.
WriteLineInfo
(
$"CreateTask sectionId:
{
section
}
工站
{
EnumHelper
.
GetEnumDesc
(
taskAction
)}
完成"
);
else
else
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
b2984210
...
@@ -333,7 +333,10 @@ namespace Siger.ApiACC.Controllers
...
@@ -333,7 +333,10 @@ namespace Siger.ApiACC.Controllers
updatetime
=
DateTime
.
Now
updatetime
=
DateTime
.
Now
});
});
}
}
if
(
machineStatus
.
status
!=(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
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
)
{
{
...
@@ -401,47 +404,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -401,47 +404,6 @@ namespace Siger.ApiACC.Controllers
});
});
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
fixtureguid
=
fixtureToolsObj
.
FixtureGuid
,
fixturename
=
fixtureToolsObj
.
FixtureCode
,
projectId
=
ProjectId
,
section
=
loading
.
section
,
sn
=
sn
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
,
productId
=
plan
.
product_id
,
productCode
=
plan
.
product_code
,
productName
=
plan
.
product_name
,
ordernumber
=
plandts
.
OrderNumber
,
locationId
=
fixtureToolsObj
.
Location
,
unixtime
=
unixtime
,
route
=
route
.
id
,
taskno
=
taskNo
});
}
else
{
monitor
.
sn
=
sn
;
monitor
.
section
=
loading
.
section
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
;
monitor
.
productId
=
plan
.
product_id
;
monitor
.
productName
=
plan
.
product_name
;
monitor
.
productCode
=
plan
.
product_code
;
monitor
.
ordernumber
=
plandts
.
OrderNumber
;
monitor
.
locationId
=
fixtureToolsObj
.
Location
;
monitor
.
unixtime
=
unixtime
;
monitor
.
route
=
route
.
id
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
Logger
.
WriteLineError
(
$"准备上料任务:
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
Logger
.
WriteLineError
(
$"准备上料任务:
{
taskNo
}
创建成功-
{
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
...
@@ -471,11 +433,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -471,11 +433,6 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
if
(
machineStatus
.
auto
==
0
)
{
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
)
{
{
...
@@ -607,45 +564,9 @@ namespace Siger.ApiACC.Controllers
...
@@ -607,45 +564,9 @@ namespace Siger.ApiACC.Controllers
processid
=
0
,
processid
=
0
,
programnumber
=
""
,
programnumber
=
""
,
remark
=
lineMode
.
inspect
==
1
?
"准备下料-》抽检台"
:
"准备下料"
,
remark
=
lineMode
.
inspect
==
1
?
"准备下料-》抽检台"
:
"准备下料"
,
extend1
=
unixtime
.
ToStr
()
extend1
=
section
.
ToStr
()
});
});
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
fixtureguid
=
location
.
fixturetools
,
fixturename
=
location
.
fixturename
,
projectId
=
ProjectId
,
section
=
section
,
sn
=
location
.
sn
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
,
productId
=
location
.
productid
,
productCode
=
location
.
productcode
,
productName
=
location
.
productname
,
ordernumber
=
location
.
ordernumber
,
locationId
=
location
.
locationid
,
unixtime
=
unixtime
,
taskno
=
taskNo
});
}
else
{
monitor
.
sn
=
location
.
sn
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
;
monitor
.
productId
=
location
.
productid
;
monitor
.
productName
=
location
.
productname
;
monitor
.
productCode
=
location
.
productcode
;
monitor
.
ordernumber
=
location
.
ordernumber
;
monitor
.
locationId
=
location
.
locationid
;
monitor
.
unixtime
=
unixtime
;
monitor
.
taskno
=
taskNo
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
if
(
_unitOfWork
.
Commit
()
>
0
)
{
{
...
@@ -681,19 +602,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -681,19 +602,11 @@ namespace Siger.ApiACC.Controllers
{
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
}
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
id
==
monitor
.
locationId
);
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
location
id
==
monitor
.
locationId
);
if
(
location
==
null
)
if
(
location
==
null
)
{
{
throw
new
BadRequestException
(
AccEnum
.
LocationNoSn
);
throw
new
BadRequestException
(
AccEnum
.
LocationNoSn
);
}
}
if
(
string
.
IsNullOrEmpty
(
location
.
sn
))
{
throw
new
BadRequestException
(
AccEnum
.
LocationNoSn
);
}
if
(
location
.
status
==
(
int
)
LocationStatus
.
Out
)
{
throw
new
BadRequestException
(
AccEnum
.
LocationNoSn
);
}
if
(
location
!=
null
)
if
(
location
!=
null
)
{
{
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationStateController.cs
View file @
b2984210
...
@@ -126,6 +126,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -126,6 +126,7 @@ namespace Siger.ApiACC.Controllers
}
}
var
dataList
=
new
List
<
AutomationStateList
>();
var
dataList
=
new
List
<
AutomationStateList
>();
foreach
(
var
item
in
data
)
foreach
(
var
item
in
data
)
{
{
var
model
=
Mapper
<
ResponseAutomationTasklist
,
AutomationStateList
>.
Map
(
item
);
var
model
=
Mapper
<
ResponseAutomationTasklist
,
AutomationStateList
>.
Map
(
item
);
...
@@ -147,6 +148,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -147,6 +148,7 @@ namespace Siger.ApiACC.Controllers
model
.
status_value
=
""
;
model
.
status_value
=
""
;
break
;
break
;
}
}
dataList
.
Add
(
model
);
dataList
.
Add
(
model
);
}
}
if
(
dataList
.
Any
())
if
(
dataList
.
Any
())
...
...
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
View file @
b2984210
...
@@ -266,7 +266,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -266,7 +266,11 @@ namespace Siger.ApiACC.Controllers
{
{
try
try
{
{
//还有未完成任务 退出 等待任务下发
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
req
.
sectionid
))
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
CreateTaskList
(
req
.
sectionid
,
req
.
productid
,
product
.
code
,
req
.
sn
,
req
.
routeid
.
ToInt
());
CreateTaskList
(
req
.
sectionid
,
req
.
productid
,
product
.
code
,
req
.
sn
,
req
.
routeid
.
ToInt
());
AddSnList
(
req
.
materialid
.
ToInt
(),
inspection
,
product
.
code
,
section
.
parentid
);
//把二维码插入到 sn_list表
AddSnList
(
req
.
materialid
.
ToInt
(),
inspection
,
product
.
code
,
section
.
parentid
);
//把二维码插入到 sn_list表
}
}
...
@@ -325,6 +329,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -325,6 +329,7 @@ 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
)
{
{
var
monitor
=
_fixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
var
monitor
=
_fixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
if
(
monitor
==
null
)
if
(
monitor
==
null
)
{
{
...
@@ -356,7 +361,9 @@ namespace Siger.ApiACC.Controllers
...
@@ -356,7 +361,9 @@ namespace Siger.ApiACC.Controllers
projectId
=
ProjectId
,
projectId
=
ProjectId
,
productid
=
productid
,
productid
=
productid
,
sn
=
sn
,
sn
=
sn
,
ordercode
=
""
,
ordercode
=
monitor
.
ordernumber
,
fixturename
=
monitor
.
fixturename
,
productname
=
monitor
.
productName
,
fixtureguid
=
monitor
.
fixtureguid
,
fixtureguid
=
monitor
.
fixtureguid
,
locationid
=
monitor
.
locationId
,
locationid
=
monitor
.
locationId
,
productcode
=
productcode
,
productcode
=
productcode
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
View file @
b2984210
...
@@ -171,5 +171,7 @@ namespace Siger.Middlelayer.AccRepository
...
@@ -171,5 +171,7 @@ namespace Siger.Middlelayer.AccRepository
public
DbSet
<
siger_check_sn_trace_inspection
>
siger_check_sn_trace_inspection
{
get
;
set
;
}
public
DbSet
<
siger_check_sn_trace_inspection
>
siger_check_sn_trace_inspection
{
get
;
set
;
}
public
DbSet
<
siger_check_sn_trace_detail
>
siger_check_sn_trace_detail
{
get
;
set
;
}
public
DbSet
<
siger_check_sn_trace_detail
>
siger_check_sn_trace_detail
{
get
;
set
;
}
public
DbSet
<
siger_check_sn_list
>
siger_check_sn_list
{
get
;
set
;
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
b2984210
...
@@ -110,7 +110,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -110,7 +110,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
complatevalue
=
q
.
completetime
,
complatevalue
=
q
.
completetime
,
complatetime
=
q
.
completetime
==
DateTime
.
MinValue
?
""
:
q
.
completetime
.
ToString
(),
complatetime
=
q
.
completetime
==
DateTime
.
MinValue
?
""
:
q
.
completetime
.
ToString
(),
action
=
EnumHelper
.
GetEnumDesc
(
q
.
action
),
action
=
EnumHelper
.
GetEnumDesc
(
q
.
action
),
actionType
=
EnumHelper
.
GetEnumDesc
(
q
.
actiontype
),
actionType
=
EnumHelper
.
GetEnumDesc
(
q
.
actiontype
),
fixtureCode
=
t
.
code
,
fixtureCode
=
t
.
code
,
fixtureName
=
t
.
name
,
fixtureName
=
t
.
name
,
location
=
q
.
locationid
.
ToString
(),
location
=
q
.
locationid
.
ToString
(),
...
@@ -178,12 +178,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -178,12 +178,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if
(
toexcel
.
ToInt
()
==
1
)
if
(
toexcel
.
ToInt
()
==
1
)
{
{
var
entities
=
query
.
Where
(
expression
).
AsNoTracking
().
ToList
();
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
d
=>
d
.
id
).
AsNoTracking
();
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
entities
.
Count
);
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
entities
.
Count
()
);
}
}
else
else
{
{
var
entities
=
query
.
Where
(
expression
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
entities
=
query
.
Where
(
expression
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
OrderByDescending
(
d
=>
d
.
id
).
AsNoTracking
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
totalCount
);
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
totalCount
);
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationMachineStatus.cs
View file @
b2984210
...
@@ -6,6 +6,7 @@ namespace Siger.Middlelayer.AccRepository.Response
...
@@ -6,6 +6,7 @@ namespace Siger.Middlelayer.AccRepository.Response
{
{
public
class
ResponseAutomationMachineStatus
public
class
ResponseAutomationMachineStatus
{
{
public
int
id
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
// public string machine { get; set; }
// public string machine { get; set; }
...
...
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