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
f5a860da
Commit
f5a860da
authored
Jan 27, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupdate
parent
eee35f58
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
15 deletions
+82
-15
.gitignore
.gitignore
+5
-0
zh-CN.js
Html/src/locale/lang/zh-CN.js
+2
-0
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+66
-2
AutoMES.cs
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
+1
-1
DBhelper.cs
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
+8
-12
No files found.
.gitignore
View file @
f5a860da
...
...
@@ -43,3 +43,8 @@ Server/.vs/SigerData/v15/Server/sqlite3/storage.ide
*.targets
/Server/Schedule/Siger.Schedule.ToolsModule/obj/Debug/netstandard2.0/Siger.Schedule.ToolsModule.AssemblyInfo.cs
*.props
*.png
*.xml
*.svg
*.so
*.zip
Html/src/locale/lang/zh-CN.js
View file @
f5a860da
...
...
@@ -2077,6 +2077,8 @@ export default {
'3000164'
:
'设备已经生产完成'
,
'3000165'
:
'该设备当前无工装状态'
,
'3000166'
:
'未配置字典信息'
,
'3000167'
:
'产线当前为自动模式'
,
'3000168'
:
'该任务已经下发'
,
'400000'
:
'设备状态'
,
'400002'
:
'更改状态'
,
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
f5a860da
...
...
@@ -18,6 +18,9 @@ using Siger.Middlelayer.Repository.Repositories.Interface;
using
Siger.Middlelayer.Repository.Response
;
using
Siger.Middlelayer.Share.Constant
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
Siger.Middlelayer.Common.Configuration
;
using
Siger.Middlelayer.Common.Helpers
;
using
Newtonsoft.Json
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -190,8 +193,69 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
AccEnum
.
LineIsAutoMode
);
}
//TODO
return
new
ObjectResult
(
1
);
var
host
=
GetHost
();
if
(
string
.
IsNullOrEmpty
(
host
))
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
var
sendToPLC
=
new
RequestPLC
{
RStation
=
taskobj
.
sectionid
,
Fixture
=
taskobj
.
fixtureguid
,
RequestForm
=
taskobj
.
no
,
RobotStep
=
(
int
)
taskobj
.
action
,
StorageNo
=
taskobj
.
locationid
,
SN
=
taskobj
.
sn
,
Program
=
taskobj
.
programnumber
};
var
result
=
PushTask
(
host
,
sendToPLC
,
out
string
message
);
if
(!
result
)
{
Logger
.
WriteLineError
(
$"TASK 下发失败 :
{
message
}
"
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
taskobj
.
send
=
1
;
_automationTaskList
.
Update
(
taskobj
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
private
bool
PushTask
(
string
ip
,
RequestPLC
request
,
out
string
msg
)
{
msg
=
string
.
Empty
;
try
{
var
param
=
JsonHelper
.
SerializerToJsonString
(
request
);
var
retstring
=
HttpHelper
.
HttpPost
(
$"
{
ip
}{
CommonConst
.
SenTaskToMES
}
"
,
"application/json"
,
param
);
var
result
=
JsonConvert
.
DeserializeObject
<
ResponsePlC
>(
retstring
);
if
(
result
.
return_code
!=
0
)
{
msg
=
$"PushTask failed,URL
{
ip
}
input:
{
param
}
result :
{
result
.
return_desc
}
"
;
return
false
;
}
return
true
;
}
catch
(
Exception
ex
)
{
msg
=
ex
.
ToString
();
}
return
false
;
}
private
string
GetHost
()
{
var
host
=
ConfigManager
.
GetValue
(
"ProjectSetting"
,
"Host"
,
string
.
Empty
);
if
(
string
.
IsNullOrEmpty
(
host
))
{
Logger
.
WriteLineError
(
"DbSetting about [ProjectSetting] Host not found."
);
return
null
;
}
return
host
;
}
/// <summary>
/// 扫描
...
...
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
View file @
f5a860da
...
...
@@ -29,10 +29,10 @@ namespace Siger.ApiACC.Tasks
}
using
(
DBhelper
dbhelper
=
new
DBhelper
())
{
var
linemode
=
var
tasklist
=
dbhelper
.
GetTaskList
(
projectId
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"无任务下发"
);
return
;
}
...
...
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
View file @
f5a860da
...
...
@@ -25,16 +25,9 @@ namespace Siger.ApiACC.Tasks
ConfigDbContext
=
new
ApiConfigDbContext
();
}
internal
bool
CanTask
(
int
projectId
,
int
section
)
public
siger_automation_line_mode
GetLineMode
(
int
projectId
)
{
var
taskObj
=
AccDbContext
.
siger_automation_task_list
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectId
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(
taskObj
==
null
)
return
true
;
else
return
false
;
return
AccDbContext
.
siger_automation_line_mode
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectId
);
}
/// <summary>
/// 获取未推送tasklist
...
...
@@ -43,9 +36,12 @@ namespace Siger.ApiACC.Tasks
/// <returns></returns>
public
IEnumerable
<
siger_automation_task_list
>
GetTaskList
(
int
projectId
)
{
var
taskObjs
=
AccDbContext
.
siger_automation_task_list
.
Where
(
f
=>
f
.
projectId
==
projectId
&&
f
.
send
==
0
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
return
taskObjs
;
var
query
=
from
q
in
AccDbContext
.
siger_automation_task_list
join
l
in
AccDbContext
.
siger_project_level_section
on
q
.
sectionid
equals
l
.
id
join
lm
in
AccDbContext
.
siger_automation_line_mode
on
l
.
parentid
equals
lm
.
section
where
q
.
projectId
==
projectId
&&
lm
.
mode
==
1
&&
q
.
send
==
0
select
q
;
return
query
;
}
public
siger_automation_fixture_tools_monitor
GetMonitor
(
int
section
)
{
...
...
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