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
e8eb7746
Commit
e8eb7746
authored
Jan 28, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupdate
parent
acbf1f72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
15 deletions
+86
-15
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+25
-7
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+25
-1
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+28
-7
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+8
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
e8eb7746
...
@@ -260,21 +260,37 @@ namespace Siger.ApiACC.Controllers
...
@@ -260,21 +260,37 @@ namespace Siger.ApiACC.Controllers
return
host
;
return
host
;
}
}
/// <summary>
/// <summary>
/// 扫描
/// 扫描
/// </summary>
/// </summary>
/// <param name="code"></param>
/// <param name="code"></param>
/// <param name="id"></param>
/// <returns></returns>
/// <returns></returns>
[
HttpGet
]
[
HttpGet
]
public
IActionResult
ScanCode
(
string
code
)
public
IActionResult
ScanCode
(
string
code
,
int
id
)
{
{
var
result
=
_automationFixtureToolsProduct
.
GetPlanFixtureInfo
(
ProjectId
,
code
);
if
(
string
.
IsNullOrEmpty
(
code
))
if
(
result
==
null
)
{
var
result
=
_automationFixtureToolsProduct
.
GetPlanFixtureInfo
(
ProjectId
,
code
);
if
(
result
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
FixtureOrderNulll
);
}
var
sn
=
_automationTaskList
.
CreateRandonSn
(
result
.
ProductCode
);
result
.
Sn
=
sn
;
return
new
ObjectResult
(
result
);
}
if
(
id
==
0
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
//下料
var
unload
=
_automationFixtureToolsProduct
.
GetPlanFixtureInfoByLocation
(
ProjectId
,
id
);
if
(
unload
==
null
)
{
{
throw
new
BadRequestException
(
AccEnum
.
FixtureOrderNulll
);
throw
new
BadRequestException
(
AccEnum
.
FixtureOrderNulll
);
}
}
var
sn
=
_automationTaskList
.
CreateRandonSn
(
result
.
ProductCode
);
return
new
ObjectResult
(
unload
);
result
.
Sn
=
sn
;
return
new
ObjectResult
(
result
);
}
}
/// <summary>
/// <summary>
/// 准备上料 -生成指令 load (立库->上料位)
/// 准备上料 -生成指令 load (立库->上料位)
...
@@ -676,5 +692,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -676,5 +692,7 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
e8eb7746
...
@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
ProductName
=
p
.
product_name
,
ProductName
=
p
.
product_name
,
Url
=
pd
.
image
,
Url
=
pd
.
image
,
FixtureName
=
t
.
name
,
FixtureName
=
t
.
name
,
FixtureGuid
=
t
.
guid
,
FixtureGuid
=
t
.
code
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
};
};
...
@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories
throw
;
throw
;
}
}
}
}
public
ResponsePlanlFixtureInfo
GetPlanFixtureInfoByLocation
(
int
projectId
,
int
id
)
{
var
query
=
from
d
in
_context
.
siger_project_product_plan_detail
join
p
in
_context
.
siger_project_product_plan
on
d
.
PlanId
equals
p
.
id
join
q
in
_context
.
siger_automation_fixture_tools_product
on
p
.
product_code
equals
q
.
productcode
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
join
l
in
_context
.
siger_automation_location
on
t
.
guid
equals
l
.
fixturetools
join
pd
in
_context
.
siger_project_product
on
p
.
product_id
equals
pd
.
id
where
q
.
projectId
==
projectId
&&
l
.
id
==
id
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
l
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
d
.
OrderNumber
,
ProductName
=
p
.
product_name
,
Url
=
pd
.
image
,
FixtureName
=
t
.
name
,
FixtureGuid
=
t
.
code
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
Sn
=
l
.
sn
};
return
query
.
FirstOrDefault
();
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
e8eb7746
...
@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
}
/// <summary>
/// 长度10 任务编号 PLC限制
/// </summary>
/// <param name="trigerType"></param>
/// <returns></returns>
public
string
CrateTaskNumber
(
TaskTrigerType
trigerType
)
public
string
CrateTaskNumber
(
TaskTrigerType
trigerType
)
{
{
var
date
=
DateTime
.
Now
;
var
date
=
DateTime
.
Now
;
var
lable
=
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)
+
date
.
Hour
+
date
.
Minute
+
date
.
Second
;
var
lable
=
date
.
Year
+
date
.
Day
+
date
.
Hour
+
date
.
Minute
+
date
.
Second
;
var
lableUnix
=
UnixTimeHelper
.
GetNow
();
var
lableUnix
=
UnixTimeHelper
.
GetNow
();
var
radon
=
new
Random
().
Next
(
1000
,
9999
);
if
(
trigerType
==
TaskTrigerType
.
Auto
)
if
(
trigerType
==
TaskTrigerType
.
Auto
)
{
{
return
$"
A
{
lableUnix
}
R
{
radon
}
T
{
lable
}
"
;
return
$"
{
date
.
Year
}{
date
.
DayOfYear
}
A
{
lable
}
"
;
}
else
}
else
{
{
return
$"
M
{
lableUnix
}
R
{
radon
}
T
{
lable
}
"
;
return
$"
{
date
.
Year
}{
date
.
DayOfYear
}
M
{
lable
}
"
;
}
}
}
}
/// <summary>
/// 工件长度10 PLC 限制
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
public
string
CreateRandonSn
(
string
productCode
)
public
string
CreateRandonSn
(
string
productCode
)
{
{
var
date
=
DateTime
.
Now
;
var
date
=
DateTime
.
Now
;
var
serinum
=
date
.
DayOfYear
+
date
.
Hour
+
date
.
Minute
+
date
.
Second
+
date
.
Millisecond
;
var
serinum
=
date
.
DayOfYear
+
date
.
Hour
+
date
.
Minute
+
date
.
Second
+
date
.
Millisecond
;
var
dayofyear
=
GetDayOfYear
(
date
);
var
lable
=
$"
{
date
.
Year
}{
dayofyear
}{
serinum
}
"
;
return
lable
;
}
private
string
GetDayOfYear
(
DateTime
dt
)
{
var
lable
=
dt
.
DayOfYear
.
ToString
();
var
result
=
string
.
Empty
;
for
(
int
i
=
0
;
i
<
3
-
lable
.
Length
;
i
++)
{
result
+=
"0"
;
}
return
$"
{
result
}{
lable
}
"
;
var
randon
=
new
Random
().
Next
(
1000
,
9999
);
return
$"
{
productCode
}{
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)}{
serinum
}{
randon
}
"
;
}
}
public
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
tiggertime
,
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
tiggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
)
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
e8eb7746
...
@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns>
/// <returns></returns>
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
);
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
);
/// <summary>
///
/// </summary>
/// <param name="projectId"></param>
/// <param name="ordernumber"></param>
/// <returns></returns>
ResponsePlanlFixtureInfo
GetPlanFixtureInfoByLocation
(
int
projectId
,
int
id
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
);
/// <summary>
/// <summary>
...
...
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