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
677e6875
Commit
677e6875
authored
Feb 03, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixedbug
parent
2dc55539
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
111 additions
and
65 deletions
+111
-65
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+60
-21
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+30
-31
QmsCheckController.cs
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
+1
-5
ApiAccDbContext.cs
...tories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
+2
-0
siger_automation_fixture_tools_monitor.cs
...sitory/Entities/siger_automation_fixture_tools_monitor.cs
+4
-0
siger_automation_machine_status.cs
...AccRepository/Entities/siger_automation_machine_status.cs
+5
-0
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+6
-6
IAutomationTaskListRepository.cs
...y/Repositories/Interface/IAutomationTaskListRepository.cs
+1
-1
RequestAutomationTaskResult.cs
...ayer.AccRepository/Request/RequestAutomationTaskResult.cs
+1
-1
ResponseAutomationTasklist.cs
...ayer.AccRepository/Response/ResponseAutomationTasklist.cs
+1
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
677e6875
...
@@ -108,7 +108,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -108,7 +108,7 @@ namespace Siger.ApiACC.Controllers
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
);
...
@@ -275,7 +275,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -275,7 +275,7 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
break
;
break
;
}
}
AutoProcess
(
section
.
parentid
,
stationDicts
);
AutoProcess
(
section
.
parentid
,
stationDicts
,
taskObj
);
}
}
break
;
break
;
}
}
...
@@ -329,8 +329,18 @@ namespace Siger.ApiACC.Controllers
...
@@ -329,8 +329,18 @@ namespace Siger.ApiACC.Controllers
{
{
monitor
.
section
=
0
;
monitor
.
section
=
0
;
}
}
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
if
(
machineStatus
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
if
(
machineStatus
!=
null
)
{
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
_automationMachineStatus
.
Update
(
machineStatus
);
}
}
}
if
(
monitor
!=
null
)
if
(
monitor
!=
null
)
{
{
monitor
.
status
=
status
;
monitor
.
status
=
status
;
...
@@ -340,6 +350,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -340,6 +350,8 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor
.
Update
(
monitor
);
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
}
}
/// <summary>
/// <summary>
...
@@ -348,7 +360,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -348,7 +360,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
)
...
@@ -358,11 +371,10 @@ namespace Siger.ApiACC.Controllers
...
@@ -358,11 +371,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.清洗机下料
...
@@ -379,7 +391,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -379,7 +391,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 无可用状态的设备"
);
...
@@ -391,17 +403,16 @@ namespace Siger.ApiACC.Controllers
...
@@ -391,17 +403,16 @@ 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
;
}
}
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
)
...
@@ -478,15 +489,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -478,15 +489,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
;
//完成当前任务 退出
}
}
...
@@ -534,7 +543,37 @@ namespace Siger.ApiACC.Controllers
...
@@ -534,7 +543,37 @@ 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
)
Logger
.
WriteLineInfo
(
$"CreateTask sectionId:
{
section
}
工站
{
EnumHelper
.
GetEnumDesc
(
taskAction
)}
完成"
);
Logger
.
WriteLineInfo
(
$"CreateTask sectionId:
{
section
}
工站
{
EnumHelper
.
GetEnumDesc
(
taskAction
)}
完成"
);
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
677e6875
...
@@ -320,7 +320,6 @@ namespace Siger.ApiACC.Controllers
...
@@ -320,7 +320,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 +327,16 @@ namespace Siger.ApiACC.Controllers
...
@@ -328,26 +327,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 +355,11 @@ namespace Siger.ApiACC.Controllers
...
@@ -366,6 +355,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
);
...
@@ -426,7 +420,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -426,7 +420,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 +437,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -442,13 +437,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
...
@@ -483,12 +479,8 @@ namespace Siger.ApiACC.Controllers
...
@@ -483,12 +479,8 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
AccEnum
.
MachineProCompalate
);
throw
new
BadRequestException
(
AccEnum
.
MachineProCompalate
);
}
}
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Complated
;
machineStatus
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
//if (!_automationTaskList.CanTask(ProjectId, assemble.section))
//{
// throw new BadRequestException(AccEnum.TaskProcessing);
//}
//创建 安装完成动作
//创建 安装完成动作
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
)
...
@@ -524,10 +516,12 @@ namespace Siger.ApiACC.Controllers
...
@@ -524,10 +516,12 @@ namespace Siger.ApiACC.Controllers
remark
=
"手动任务-安装完成"
,
remark
=
"手动任务-安装完成"
,
});
});
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
...
@@ -571,11 +565,12 @@ namespace Siger.ApiACC.Controllers
...
@@ -571,11 +565,12 @@ namespace Siger.ApiACC.Controllers
//1. 有检验状态 (立库-》检验工位)
//1. 有检验状态 (立库-》检验工位)
//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
,
...
@@ -595,7 +590,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -595,7 +590,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
()
});
});
...
@@ -617,13 +612,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -617,13 +612,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
;
...
@@ -632,11 +627,13 @@ namespace Siger.ApiACC.Controllers
...
@@ -632,11 +627,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
...
@@ -674,16 +671,12 @@ namespace Siger.ApiACC.Controllers
...
@@ -674,16 +671,12 @@ 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
=
""
;
_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
{
{
...
@@ -711,8 +704,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -711,8 +704,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
(
$"拆卸完成任务
{
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/QmsCheckController.cs
View file @
677e6875
...
@@ -324,11 +324,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -324,11 +324,7 @@ namespace Siger.ApiACC.Controllers
{
{
return
;
return
;
}
}
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
);
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/ApiAccDbContext.cs
View file @
677e6875
...
@@ -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 @
677e6875
...
@@ -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 @
677e6875
...
@@ -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/AutomationTaskListRepository.cs
View file @
677e6875
...
@@ -90,7 +90,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -90,7 +90,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 +120,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -120,7 +120,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 +156,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -156,15 +156,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 @
677e6875
...
@@ -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 @
677e6875
...
@@ -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/Response/ResponseAutomationTasklist.cs
View file @
677e6875
...
@@ -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
;
}
}
}
}
}
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