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
bcf5fb79
Commit
bcf5fb79
authored
Jan 25, 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
cd2bd4b3
c4a53491
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
1420 additions
and
137 deletions
+1420
-137
en-US.js
Html/src/locale/lang/en-US.js
+1
-0
zh-CN.js
Html/src/locale/lang/zh-CN.js
+1
-0
assemblyInfo.vue
Html/src/view/fms/associate/assemblyInfo.vue
+39
-30
associateProduct.vue
Html/src/view/fms/associate/associateProduct.vue
+13
-13
accountInfo.vue
Html/src/view/fms/config/accountInfo.vue
+13
-13
typeMaintenance.vue
Html/src/view/fms/config/typeMaintenance.vue
+13
-13
storageInfoQuery.vue
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
+14
-14
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+84
-2
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+1
-0
AutomationStateController.cs
...pis/Siger.ApiACC/Controllers/AutomationStateController.cs
+101
-0
FixtureToolsAssemblyController.cs
...iger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
+87
-4
FixtureToolsController.cs
...r/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
+20
-13
FixtureToolsProductController.cs
...Siger.ApiACC/Controllers/FixtureToolsProductController.cs
+60
-2
UploadController.cs
Server/Apis/Siger.ApiACC/Controllers/UploadController.cs
+159
-1
DownloadController.cs
Server/Apis/Siger.ApiConfig/Controller/DownloadController.cs
+3
-0
CommonEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
+1
-0
Automation.cs
...mon/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
+7
-5
RequestEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
+3
-0
FixtureTools.cs
.../Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
+172
-13
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+122
-3
AutomationFixtureToolsCategoryRepository.cs
.../Repositories/AutomationFixtureToolsCategoryRepository.cs
+32
-6
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+89
-1
AutomationFixtureToolsRepository.cs
...pository/Repositories/AutomationFixtureToolsRepository.cs
+75
-0
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+80
-1
AutomationMachineStatusRepository.cs
...ository/Repositories/AutomationMachineStatusRepository.cs
+31
-0
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+87
-0
IAutomationFixtureToolsAssemblyRepository.cs
...es/Interface/IAutomationFixtureToolsAssemblyRepository.cs
+4
-1
IAutomationFixtureToolsCategoryRepository.cs
...es/Interface/IAutomationFixtureToolsCategoryRepository.cs
+4
-0
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+5
-1
IAutomationFixtureToolsRepository.cs
...positories/Interface/IAutomationFixtureToolsRepository.cs
+3
-0
IAutomationLocationRepository.cs
...y/Repositories/Interface/IAutomationLocationRepository.cs
+4
-1
IAutomationMachineStatus.cs
...sitory/Repositories/Interface/IAutomationMachineStatus.cs
+2
-0
IAutomationTaskListRepository.cs
...y/Repositories/Interface/IAutomationTaskListRepository.cs
+5
-0
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+4
-0
ResponseAutomationMachineStatus.cs
...AccRepository/Response/ResponseAutomationMachineStatus.cs
+35
-0
ResponseAutomationTasklist.cs
...ayer.AccRepository/Response/ResponseAutomationTasklist.cs
+46
-0
No files found.
Html/src/locale/lang/en-US.js
View file @
bcf5fb79
...
...
@@ -720,6 +720,7 @@ export default {
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9000498'
:
'该类型绑定了工装,不能删除'
,
'9100000'
:
'Departments cannot be empty'
,
'9100001'
:
'Position cannot be empty'
,
...
...
Html/src/locale/lang/zh-CN.js
View file @
bcf5fb79
...
...
@@ -747,6 +747,7 @@ export default {
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9000498'
:
'该类型绑定了工装,不能删除'
,
'9100000'
:
'部门不能为空'
,
...
...
Html/src/view/fms/associate/assemblyInfo.vue
View file @
bcf5fb79
...
...
@@ -41,7 +41,7 @@
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"
search(1, 10
)"
@
click=
"
tosearch(
)"
>
{{
$t
(
"1001"
)
}}
</Button
>
<Button
...
...
@@ -95,7 +95,7 @@
type=
"primary"
class=
"fourWord"
icon=
"ios-cloud-download"
@
click=
"
exportEecel(
)"
@
click=
"
search(1
)"
>
{{
$t
(
"1007"
)
}}
</Button
>
</div>
...
...
@@ -443,35 +443,46 @@ export default {
this
.
columns2
=
this
.
$time
.
initTableTitle
(
this
.
columns2
);
this
.
initFrockType
();
this
.
search
(
1
,
10
);
this
.
tosearch
(
);
},
methods
:
{
search
(
page
,
pagesize
)
{
tosearch
(){
this
.
page
=
1
;
this
.
pagesize
=
10
;
this
.
search
(
0
);
},
search
(
toexcel
)
{
let
data
=
{
category
:
this
.
categoryId
,
//工装类型id
code
:
this
.
number
,
name
:
this
.
name
,
//
state: this.state, //0停用 1可用
state
:
this
.
state
,
//0停用 1可用
page
:
this
.
page
,
pagesize
:
this
.
pagesize
,
// toexcel: 0,
//0查询 1导出
toexcel
:
toexcel
//0查询 1导出
};
this
.
request
(
"/acc/FixtureToolsAssembly/GetPageList"
,
data
,
"get"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
if
(
toexcel
===
1
){
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
}
else
{
this
.
total
=
0
;
this
.
data1
=
[];
let
data
=
res
.
data
.
data
;
if
(
res
.
data
.
ret
==
1
&&
Array
.
isArray
(
data
)
&&
data
.
length
)
{
this
.
total
=
res
.
data
.
total
;
// let arr = [];
// arr = res.data.data;
// arr.forEach(ele=>{
// ele.parentcate_guid = '';
// })
// this.data1 = arr;
console
.
log
(
this
.
data1
);
this
.
data1
=
res
.
data
.
data
;
}
}
});
},
add
()
{
...
...
@@ -519,7 +530,7 @@ export default {
this
.
modal
=
false
;
this
.
detailobj
=
{};
this
.
childObj
=
{};
this
.
search
(
this
.
page
,
this
.
pagesize
);
this
.
search
(
0
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
...
...
@@ -588,22 +599,20 @@ export default {
}
},
loadExcel
()
{
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
},
exportEecel
()
{
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsAssmeblyTemplate"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
exportEecel
()
{},
//工装类型
initFrockType
()
{
this
.
axios
...
...
Html/src/view/fms/associate/associateProduct.vue
View file @
bcf5fb79
...
...
@@ -150,7 +150,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/Submit?templateName=FixtureToolsProductTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -595,18 +595,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsProductTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/fms/config/accountInfo.vue
View file @
bcf5fb79
...
...
@@ -154,7 +154,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/Submit?templateName=FixtureToolsTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -546,18 +546,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/fms/config/typeMaintenance.vue
View file @
bcf5fb79
...
...
@@ -86,7 +86,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/Submit?templateName=FixtureToolsCategoryTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -313,18 +313,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsCategoryTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
View file @
bcf5fb79
...
...
@@ -176,7 +176,7 @@ export default {
},
{
title
:
'储位ID'
,
key
:
'loca
tion
id'
key
:
'locaid'
},
{
title
:
'工装类别'
,
...
...
@@ -275,7 +275,7 @@ export default {
addremark
:
''
,
//备注
filename
:
''
,
fileurl
:
''
,
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/Submit?templateName=AutomationLocationTemplate
"
,
UploadAction
:
this
.
axios
.
publicPath
+
"config/upload/UploadImage"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
...
...
@@ -665,18 +665,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=AutomationLocationTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
/*********文件上传 start******** */
//下载文件
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
bcf5fb79
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -39,9 +44,9 @@ namespace Siger.ApiACC.Controllers
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
wavehouseid
,
string
locationid
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
wavehouseid
,
string
locationid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
data
=
_autoLocationRepository
.
GetPagedList
(
wavehouseid
.
ToInt
(),
locationid
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
var
data
=
_autoLocationRepository
.
GetPagedList
(
wavehouseid
.
ToInt
(),
locationid
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
list
=
new
List
<
ResponseAutomationLocation
>();
var
locations
=
_autoLocationRepository
.
GetLocationList
(
ProjectId
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
...
...
@@ -81,8 +86,85 @@ namespace Siger.ApiACC.Controllers
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
data
.
Data
);
}
else
{
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAutomationLocation
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
AutomationLocationList
>();
foreach
(
var
item
in
data
)
{
var
state
=
""
;
switch
(
item
.
materialstate
)
{
case
1
:
state
=
"有工装无工件"
;
break
;
case
2
:
state
=
"有工装有工件"
;
break
;
case
3
:
state
=
"无工装无工件"
;
break
;
case
4
:
state
=
"无工装有工件"
;
break
;
}
dataList
.
Add
(
new
AutomationLocationList
{
Warehouse
=
item
.
wavehouse
,
Location
=
item
.
location
,
LocationId
=
item
.
locaid
.
ToString
(),
Catgeory
=
item
.
category
,
Code
=
item
.
code
,
Name
=
item
.
fixturetool
,
Specfication
=
item
.
specfication
,
SN
=
item
.
sn
,
RouteNumber
=
item
.
routenumber
,
RouteName
=
item
.
route
,
State
=
state
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
AutomationLocationList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
AutomationLocationList
>();
var
temporaryFileName
=
$"储位信息查询_FixtureToolsLocationData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Location Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
{
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
bcf5fb79
...
...
@@ -387,6 +387,7 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
/// <summary>
/// 准备下料
/// </summary>
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationStateController.cs
0 → 100644
View file @
bcf5fb79
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.ApiCommon.Filters
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace
Siger.ApiACC.Controllers
{
public
class
AutomationStateController
:
BaseController
{
private
readonly
ISigerProjectLevelSectionRepository
_sigerProjectLevelSection
;
private
readonly
IAutomationMachineStatus
_automationMachineStatus
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
public
AutomationStateController
(
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationMachineStatus
automationMachineStatus
,
IAutomationTaskListRepository
automationTaskList
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
{
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_automationMachineStatus
=
automationMachineStatus
;
_automationTaskList
=
automationTaskList
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
}
/// <summary>
/// 产线监控管理
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
[
HttpGet
]
public
IActionResult
GetStationMonitor
(
int
section
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
data
=
_automationMachineStatus
.
GetSectionStatus
(
ProjectId
,
section
,
ids
);
var
result
=
new
List
<
ResponseAutomationMachineStatus
>();
foreach
(
var
d
in
data
)
{
var
item
=
new
ResponseAutomationMachineStatus
{
sectionid
=
d
.
sectionid
,
section
=
d
.
section
,
enable
=
d
.
enable
,
product
=
""
,
location
=
0
,
sn
=
""
,
fixtureCode
=
""
,
fixtureName
=
""
,
lastupdate
=
""
,
status
=
0
,
};
var
fixture
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
d
.
sectionid
);
if
(
fixture
!=
null
)
{
item
.
product
=
fixture
.
productName
;
item
.
location
=
fixture
.
locationId
;
item
.
sn
=
fixture
.
sn
;
item
.
fixtureCode
=
fixture
.
fixtureguid
;
item
.
fixtureName
=
fixture
.
fixturename
;
}
result
.
Add
(
item
);
}
var
output
=
new
ResponseMachineMonitor
{
sum
=
new
ResponseAutomationMachineStatusTotal
{
waittingTotal
=
result
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
).
Count
(),
produceTotal
=
result
.
Where
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Produce
).
Count
(),
complateTotal
=
result
.
Where
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
).
Count
(),
disableTotal
=
result
.
Where
(
f
=>
f
.
enable
==
0
).
Count
(),
},
dts
=
result
};
return
new
ObjectResult
(
result
);
}
[
HttpGet
]
public
IActionResult
GetTasklist
(
int
section
,
int
tasktype
,
string
productCode
,
string
taskno
,
string
sn
,
int
status
,
int
actionType
,
string
triggertime
,
string
complatetime
,
int
page
,
int
pageSize
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
resulst
=
_automationTaskList
.
GetTasklistPagedList
(
ids
,
tasktype
,
productCode
,
taskno
,
sn
,
status
,
actionType
,
triggertime
,
complatetime
,
ProjectId
,
page
,
pageSize
);
return
new
PagedObjectResult
(
resulst
,
resulst
.
Total
,
page
,
pageSize
);
}
}
}
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
View file @
bcf5fb79
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -34,9 +39,9 @@ namespace Siger.ApiACC.Controllers
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
ProjectId
,
page
,
pagesize
);
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
foreach
(
var
item
in
data
.
Data
)
...
...
@@ -70,9 +75,87 @@ namespace Siger.ApiACC.Controllers
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
data
.
Data
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsAssmeblyList
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureToolsAssmeblyList
{
ParentCategory
=
item
.
category
,
ParentPartNumber
=
item
.
partnumber
,
ParentFixtureTool
=
item
.
name
,
ParentSpecfication
=
item
.
specfication
,
Category
=
""
,
FixtureTool
=
""
,
PartNumber
=
""
,
Specfication
=
""
,
Status
=
item
.
status
==
(
int
)
RowState
.
Valid
?
"可用"
:
"停用"
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
if
(
item
.
childrens
.
Any
())
{
foreach
(
var
son
in
item
.
childrens
)
{
dataList
.
Add
(
new
FixtureToolsAssmeblyList
{
ParentCategory
=
son
.
parentcategory
,
ParentPartNumber
=
son
.
parentpartnumber
,
ParentFixtureTool
=
son
.
parentname
,
ParentSpecfication
=
son
.
parentspecfication
,
Category
=
son
.
category
,
FixtureTool
=
son
.
name
,
PartNumber
=
son
.
partnumber
,
Specfication
=
son
.
specfication
,
Status
=
son
.
status
==
(
int
)
RowState
.
Valid
?
"可用"
:
"停用"
,
Remark
=
son
.
remark
,
Updator
=
son
.
updator
,
UpdateTime
=
son
.
updatetime
});
}
}
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsAssmeblyList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsAssmeblyList
>();
var
temporaryFileName
=
$"工装装配_FixtureToolsAssemblyData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Assembly Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
{
var
query
=
from
c
in
sections
where
c
.
guid
==
parentId
select
c
;
...
...
@@ -144,7 +227,7 @@ namespace Siger.ApiACC.Controllers
var
entity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
parent
?.
guid
??
""
,
parent
=
parent
Guid
,
son
=
son
.
guid
,
creator
=
UserId
,
createtime
=
DateTime
.
Now
,
...
...
@@ -226,7 +309,7 @@ namespace Siger.ApiACC.Controllers
_toolsAssemblyRepository
.
Insert
(
parentEntity
);
}
entity
.
parent
=
parent
?.
guid
??
""
;
entity
.
parent
=
parent
Guid
;
entity
.
son
=
son
.
guid
;
entity
.
attachment
=
req
.
fileurl
;
entity
.
filename
=
req
.
filename
;
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
View file @
bcf5fb79
...
...
@@ -66,11 +66,11 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureTools
Template
>();
var
dataList
=
new
List
<
FixtureTools
List
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureTools
Template
dataList
.
Add
(
new
FixtureTools
List
{
Catgeory
=
item
.
category
,
Name
=
item
.
name
,
...
...
@@ -80,15 +80,17 @@ namespace Siger.ApiACC.Controllers
Specfication
=
item
.
specification
,
Number
=
item
.
number
.
ToString
(),
Status
=
item
.
status
==
1
?
"可用"
:
"停用"
,
Remark
=
item
.
remark
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureTools
Template
>
helper
=
null
;
EpPlusExcelHelper
<
FixtureTools
List
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureTools
Template
>();
helper
=
new
EpPlusExcelHelper
<
FixtureTools
List
>();
var
temporaryFileName
=
$"工装台账_FixtureToolsData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
...
...
@@ -118,7 +120,7 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
)
string
.
IsNullOrEmpty
(
req
.
managetype
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
...
...
@@ -169,7 +171,7 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
req
.
id
<=
0
)
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
req
.
id
<=
0
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
...
...
@@ -399,18 +401,23 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
details
=
GetSonCategoryList
(
entity
.
guid
,
categorys
);
var
detailIds
=
details
.
Select
(
q
=>
q
.
id
).
Distinct
().
ToList
();
var
details
=
GetSonCategoryList
(
entity
.
guid
,
categorys
).
ToList
();
details
.
Add
(
entity
);
var
detailGuids
=
details
.
Select
(
q
=>
q
.
guid
).
Distinct
().
ToList
();
if
(
_toolsRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
detailGuids
.
Contains
(
q
.
category
)).
Any
())
{
throw
new
BadRequestException
(
RequestEnum
.
CategoryBindFixtureToolData
);
}
var
delDetails
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
detailIds
.
Contains
(
q
.
id
)).
ToList
();
detailGuids
.
Contains
(
q
.
guid
)).
ToList
();
foreach
(
var
detail
in
delDetails
)
{
detail
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
detail
);
}
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
...
...
@@ -425,7 +432,7 @@ namespace Siger.ApiACC.Controllers
{
var
query
=
from
c
in
sections
where
c
.
parent
==
parentId
select
c
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetSonCategoryList
(
t
.
parent
,
sections
)));
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetSonCategoryList
(
t
.
guid
,
sections
)));
}
[
HttpGet
]
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsProductController.cs
View file @
bcf5fb79
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -37,9 +42,9 @@ namespace Siger.ApiACC.Controllers
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsProduct
>();
foreach
(
var
item
in
data
.
Data
)
...
...
@@ -50,9 +55,62 @@ namespace Siger.ApiACC.Controllers
item
.
categoryids
=
cateIds
;
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
data
.
Data
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAumationFixtureToolsProduct
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsProductList
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureToolsProductList
{
Category
=
item
.
categoryname
,
PartNumber
=
item
.
partnumber
,
FixtureTool
=
item
.
fixturetool
,
Specfication
=
item
.
specfication
,
Product
=
item
.
productname
,
ProductCode
=
item
.
productcode
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsProductList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsProductList
>();
var
temporaryFileName
=
$"工装对应产品_FixtureToolsProductData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Product Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
{
var
query
=
from
c
in
sections
where
c
.
guid
==
parentId
select
c
;
...
...
Server/Apis/Siger.ApiACC/Controllers/UploadController.cs
View file @
bcf5fb79
...
...
@@ -41,12 +41,19 @@ namespace Siger.ApiACC.Controllers
private
readonly
IBasketSettingRepository
_basketSetting
;
private
readonly
ITrParameterConfigRepository
_parameterConfigRepository
;
private
readonly
ISeriNumCfg
_serinumCfgRepository
;
private
readonly
IAutomationFixtureToolsCategoryRepository
_fixtureToolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsRepository
_fixtureToolsRepository
;
private
readonly
IAutomationFixtureToolsProductRepository
_fixtureToolsProductRepository
;
private
readonly
IAutomationFixtureToolsAssemblyRepository
_fixtureToolsAssemblyRepository
;
private
readonly
IAutomationLocationRepository
_autoLocationRepository
;
public
UploadController
(
IUnitOfWork
unitOfWork
,
ISigerTrMaterialsRepository
materialsRepository
,
ISigerTrMaterialTypeRepository
materialTypeRepository
,
ISigerTrAssemblyMaintenanceRepository
assemblyMaintenanceRepository
,
ISigerTrProductStructureRepository
productStructureRepository
,
ISigerDict
sigerDict
,
ISigerEquipment
sigerEquipment
,
ISigerEquipmentPosition
sigerEquipmentPosition
,
ISigerRoutingEventNo
routingEvenNo
,
ISigerRoutingOutStation
sigerRoutingOutStation
,
ISigerRoutingInStation
sigerRoutingIn
,
ISigerPackingFullQty
sigerPackingFull
,
ISigerCheckItem
checkItem
,
ISigerWOBookingItem
sigerWOBooking
,
IBasketSettingRepository
basketSetting
,
ITrParameterConfigRepository
parameterConfigRepository
,
ISeriNumCfg
serinumCfgRepository
)
ISeriNumCfg
serinumCfgRepository
,
IAutomationFixtureToolsCategoryRepository
fixtureToolsCategoryRepository
,
IAutomationFixtureToolsRepository
fixtureToolsRepository
,
IAutomationFixtureToolsProductRepository
fixtureToolsProductRepository
,
IAutomationFixtureToolsAssemblyRepository
fixtureToolsAssemblyRepository
,
IAutomationLocationRepository
autoLocationRepository
)
{
_unitOfWork
=
unitOfWork
;
_materialsRepository
=
materialsRepository
;
...
...
@@ -65,6 +72,11 @@ namespace Siger.ApiACC.Controllers
_basketSetting
=
basketSetting
;
_parameterConfigRepository
=
parameterConfigRepository
;
_serinumCfgRepository
=
serinumCfgRepository
;
_fixtureToolsCategoryRepository
=
fixtureToolsCategoryRepository
;
_fixtureToolsRepository
=
fixtureToolsRepository
;
_fixtureToolsProductRepository
=
fixtureToolsProductRepository
;
_fixtureToolsAssemblyRepository
=
fixtureToolsAssemblyRepository
;
_autoLocationRepository
=
autoLocationRepository
;
}
[
HttpPost
]
...
...
@@ -208,6 +220,21 @@ namespace Siger.ApiACC.Controllers
case
TemplateNameEnums
.
SnRule
:
result
=
ImportSnRule
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsCategoryTemplate
:
result
=
ImportFixtureToolsCategory
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsTemplate
:
result
=
ImportFixtureTools
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsProductTemplate
:
result
=
ImportFixtureToolsProduct
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsAssmeblyTemplate
:
result
=
ImportFixtureToolsAssembly
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
AutomationLocationTemplate
:
result
=
ImportAutomationLocation
(
temporaryFilePath
);
break
;
default
:
throw
new
ArgumentOutOfRangeException
();
}
...
...
@@ -803,5 +830,136 @@ namespace Siger.ApiACC.Controllers
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsCategory
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsCategoryRepository
.
ImportData
(
data
,
ProjectId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsCategory failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureTools
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureTools failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsProduct
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsProductTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsProductTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsProductRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsProduct failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsAssembly
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsAssmeblyTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsAssmeblyTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsAssemblyRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsAssembly failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportAutomationLocation
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
AutomationLocationTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
AutomationLocationTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_autoLocationRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportAutomationLocation failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
}
}
Server/Apis/Siger.ApiConfig/Controller/DownloadController.cs
View file @
bcf5fb79
...
...
@@ -300,6 +300,9 @@ namespace Siger.ApiConfig.Controller
case
TemplateNameEnums
.
FixtureToolsAssmeblyTemplate
:
type
=
typeof
(
FixtureToolsAssmeblyTemplate
);
break
;
case
TemplateNameEnums
.
AutomationLocationTemplate
:
type
=
typeof
(
AutomationLocationTemplate
);
break
;
}
return
type
;
...
...
Server/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
View file @
bcf5fb79
...
...
@@ -236,6 +236,7 @@ namespace Siger.Middlelayer.Common
FixtureToolsTemplate
,
FixtureToolsProductTemplate
,
FixtureToolsAssmeblyTemplate
,
AutomationLocationTemplate
,
}
public
enum
LogLevel
...
...
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
View file @
bcf5fb79
...
...
@@ -45,21 +45,23 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
public
enum
TaskResultStatus
{
/// <summary>
/// 取消
/// </summary>
Cancel
=
0
,
/// <summary>
/// 待生产
/// </summary>
[
Description
(
"待执行"
)]
Waiting
=
1
,
/// <summary>
/// 生产中
/// </summary>
[
Description
(
"执行中"
)]
Produce
=
2
,
/// <summary>
/// 生产完成
/// </summary>
Complated
=
3
[
Description
(
"任务完成"
)]
Complated
=
3
,
[
Description
(
"取消"
)]
Cancel
=
4
,
}
/// <summary>
/// 设备状态 (自动任务)
...
...
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
View file @
bcf5fb79
...
...
@@ -1476,5 +1476,8 @@ namespace Siger.Middlelayer.Common
[
Description
(
"父级和子级不能相同"
)]
ParentSonSame
,
[
Description
(
"该类型绑定了工装,不能删除"
)]
CategoryBindFixtureToolData
,
}
}
Server/Common/Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
View file @
bcf5fb79
...
...
@@ -4,7 +4,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities
{
public
class
FixtureToolsCategoryTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装类型*
"
)]
[
ExcelColumn
(
"
*工装类型
"
)]
public
string
Fixture
{
get
;
set
;
}
[
ExcelColumn
(
"上级类型"
)]
...
...
@@ -13,28 +13,58 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public
class
FixtureToolsTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装类型*
"
)]
[
ExcelColumn
(
"
*工装类型
"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"
管理类型*
"
)]
[
ExcelColumn
(
"
*管理类型
"
)]
public
string
Manage
{
get
;
set
;
}
[
ExcelColumn
(
"
工装名称*
"
)]
[
ExcelColumn
(
"
*工装名称
"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"
工装料号*
"
)]
[
ExcelColumn
(
"
*工装料号
"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"
工装编号*
"
)]
[
ExcelColumn
(
"
*工装编号
"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"
规格型号*
"
)]
[
ExcelColumn
(
"
*规格型号
"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"
数量*
"
)]
[
ExcelColumn
(
"
*数量
"
)]
public
string
Number
{
get
;
set
;
}
[
ExcelColumn
(
"状态*"
)]
[
ExcelColumn
(
"*状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsList
:
ImportBase
{
[
ExcelColumn
(
"工装类型"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"管理类型"
)]
public
string
Manage
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工装编号"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"规格型号"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"数量"
)]
public
string
Number
{
get
;
set
;
}
[
ExcelColumn
(
"状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
...
...
@@ -49,25 +79,154 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public
class
FixtureToolsProductTemplate
:
ImportBase
{
[
ExcelColumn
(
"工装编号*"
)]
[
ExcelColumn
(
"*工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"*产品名称"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsProductList
:
ImportBase
{
[
ExcelColumn
(
"工装类型"
)]
public
string
Category
{
get
;
set
;
}
[
ExcelColumn
(
"工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"产品名称*"
)]
[
ExcelColumn
(
"规格型号"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"产品编号"
)]
public
string
ProductCode
{
get
;
set
;
}
[
ExcelColumn
(
"产品名称"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
public
class
FixtureToolsAssmeblyTemplate
:
ImportBase
{
[
ExcelColumn
(
"
父工装编号*
"
)]
[
ExcelColumn
(
"
*父工装名称
"
)]
public
string
ParentFixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"
子工装编号*
"
)]
[
ExcelColumn
(
"
*子工装名称
"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"*状态"
)]
public
string
Status
{
get
;
set
;
}
}
public
class
FixtureToolsAssmeblyList
:
ImportBase
{
[
ExcelColumn
(
"父工装类型"
)]
public
string
ParentCategory
{
get
;
set
;
}
[
ExcelColumn
(
"父工装料号"
)]
public
string
ParentPartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"父工装名称"
)]
public
string
ParentFixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"父工装规格"
)]
public
string
ParentSpecfication
{
get
;
set
;
}
[
ExcelColumn
(
"子工装类型"
)]
public
string
Category
{
get
;
set
;
}
[
ExcelColumn
(
"子工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"子工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"子工装规格"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
public
class
AutomationLocationTemplate
:
ImportBase
{
[
ExcelColumn
(
"*储位ID"
)]
public
string
LocationId
{
get
;
set
;
}
[
ExcelColumn
(
"*工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
AutomationLocationList
:
ImportBase
{
[
ExcelColumn
(
"仓库名称"
)]
public
string
Warehouse
{
get
;
set
;
}
[
ExcelColumn
(
"储位信息"
)]
public
string
Location
{
get
;
set
;
}
[
ExcelColumn
(
"储位ID"
)]
public
string
LocationId
{
get
;
set
;
}
[
ExcelColumn
(
"工装类别"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"工装编号"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"工装规格"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"工件编号"
)]
public
string
SN
{
get
;
set
;
}
[
ExcelColumn
(
"工序顺序"
)]
public
string
RouteNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工序名称"
)]
public
string
RouteName
{
get
;
set
;
}
[
ExcelColumn
(
"物料状态"
)]
public
string
State
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
bcf5fb79
...
...
@@ -7,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -21,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
...
...
@@ -55,7 +58,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories
parentguid
=
q
.
parent
,
fixtureguid
=
q
.
son
,
remark
=
q
.
remark
,
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
,
parentcategory
=
c1
.
name
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentspecfication
=
t1
.
specification
??
""
};
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
...
...
@@ -73,10 +79,18 @@ namespace Siger.Middlelayer.AccRepository.Repositories
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
totalCount
);
}
}
public
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
)
{
...
...
@@ -111,10 +125,115 @@ namespace Siger.Middlelayer.AccRepository.Repositories
parentguid
=
q
.
parent
,
fixtureguid
=
q
.
son
,
remark
=
q
.
remark
,
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
,
parentcategory
=
c1
.
name
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentspecfication
=
t1
.
specification
??
""
};
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
entities
;
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
var
entities
=
new
List
<
siger_automation_fixture_tools_assembly
>();
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
)
||
string
.
IsNullOrEmpty
(
item
.
ParentFixtureTool
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
if
(
item
.
ParentFixtureTool
==
item
.
FixtureTool
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentSonSame
}
"
);
}
var
parent
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
ParentFixtureTool
&&
q
.
projectId
==
projectid
);
if
(
parent
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
son
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
if
(
son
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
parentGuid
=
parent
.
guid
;
var
exsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
son
.
guid
&&
q
.
parent
==
parentGuid
);
if
(
exsit
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
&&
q
.
ParentFixtureTool
==
item
.
ParentFixtureTool
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
parentExsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LevelCountError
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
if
(
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
)
==
null
)
{
var
parentEntity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
""
,
son
=
parent
.
guid
,
creator
=
userid
,
createtime
=
DateTime
.
Now
,
attachment
=
""
,
filename
=
""
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
remark
=
item
.
Remark
};
_context
.
siger_automation_fixture_tools_assembly
.
Add
(
parentEntity
);
}
var
entity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
parentGuid
,
son
=
son
.
guid
,
creator
=
userid
,
createtime
=
DateTime
.
Now
,
attachment
=
""
,
filename
=
""
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
remark
=
item
.
Remark
};
entities
.
Add
(
entity
);
try
{
_context
.
siger_automation_fixture_tools_assembly
.
AddRange
(
entities
);
_context
.
SaveChanges
();
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
return
new
CommonImportResult
(
1
,
"1"
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsCategoryRepository.cs
View file @
bcf5fb79
...
...
@@ -60,16 +60,34 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsCategoryTemplate
>
list
,
int
projectid
)
{
var
entities
=
new
List
<
siger_automation_fixture_tools_category
>();
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
//errors.Add($"{rowIndex},{(int)RequestEnum.ManageCatOnlyBySuperAdministrator}");
if
(
string
.
IsNullOrEmpty
(
item
.
Fixture
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
data
=
_context
.
siger_automation_fixture_tools_category
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
item
.
Fixture
);
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
parent
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
Parent
))
{
var
exsit
=
_context
.
siger_automation_fixture_tools_category
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
item
.
Parent
);
if
(
exsit
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentTypeError
}
"
);
}
else
{
parent
=
exsit
.
guid
;
}
}
if
(
errors
.
Any
())
...
...
@@ -79,15 +97,23 @@ namespace Siger.Middlelayer.AccRepository.Repositories
try
{
_context
.
siger_automation_fixture_tools_category
.
AddRange
(
entities
);
var
entity
=
new
siger_automation_fixture_tools_category
{
guid
=
Guid
.
NewGuid
().
ToString
(),
name
=
item
.
Fixture
,
parent
=
parent
,
createtime
=
DateTime
.
Now
,
};
_context
.
siger_automation_fixture_tools_category
.
Add
(
entity
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
return
new
CommonImportResult
(
1
,
"1"
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
bcf5fb79
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -6,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -36,7 +40,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return
query
.
FirstOrDefault
();
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_product
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
...
...
@@ -80,10 +84,18 @@ namespace Siger.Middlelayer.AccRepository.Repositories
productExpression
=
q
=>
q
.
productid
==
product
;
}
var
expression
=
categoryExpression
.
And
(
toolExpression
).
And
(
productExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
totalCount
);
}
}
public
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
)
{
...
...
@@ -106,5 +118,81 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return
query
.
FirstOrDefault
();
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
entities
=
new
List
<
siger_automation_fixture_tools_product
>();
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
)
||
string
.
IsNullOrEmpty
(
item
.
Product
)
||
string
.
IsNullOrEmpty
(
item
.
Product
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
fixtureTool
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
name
==
item
.
FixtureTool
);
if
(
fixtureTool
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
product
=
_context
.
siger_project_product
.
FirstOrDefault
(
q
=>
q
.
projectid
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
code
==
item
.
Product
);
if
(
product
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ProductNotFound
}
"
);
}
if
(
fixtureTool
!=
null
&&
product
!=
null
)
{
var
data
=
_context
.
siger_automation_fixture_tools_product
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixtureTool
.
guid
||
q
.
productid
==
product
.
id
));
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
||
q
.
Product
==
item
.
Product
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_fixture_tools_product
{
guid
=
Guid
.
NewGuid
().
ToString
(),
fixturetools
=
fixtureTool
.
guid
,
remark
=
item
.
Remark
,
productid
=
product
.
id
,
productcode
=
product
.
code
,
projectId
=
projectid
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
userid
,
updator
=
userid
,
attachment
=
""
,
filename
=
""
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_fixture_tools_product
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsRepository.cs
View file @
bcf5fb79
...
...
@@ -8,9 +8,11 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -128,5 +130,78 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return
query
.
FirstOrDefault
();
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
entities
=
new
List
<
siger_automation_fixture_tools
>();
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
PartNumber
)
||
string
.
IsNullOrEmpty
(
item
.
Code
)
||
string
.
IsNullOrEmpty
(
item
.
Name
)
||
string
.
IsNullOrEmpty
(
item
.
Catgeory
)
||
string
.
IsNullOrEmpty
(
item
.
Manage
)
||
string
.
IsNullOrEmpty
(
item
.
Number
)
||
string
.
IsNullOrEmpty
(
item
.
Status
)
||
string
.
IsNullOrEmpty
(
item
.
Specfication
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
data
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
(
q
.
name
==
item
.
Name
||
q
.
code
==
item
.
Code
||
q
.
partnumber
==
item
.
PartNumber
));
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
Name
==
item
.
Name
||
q
.
Code
==
item
.
Code
||
q
.
PartNumber
==
item
.
PartNumber
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
category
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
Catgeory
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
category
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolCatgeoryNotFound
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_fixture_tools
{
guid
=
Guid
.
NewGuid
().
ToString
(),
category
=
category
.
guid
,
managetype
=
item
.
Manage
==
"单件"
?
1
:
2
,
partnumber
=
item
.
PartNumber
,
name
=
item
.
Name
,
specification
=
item
.
Specfication
,
number
=
item
.
Number
.
ToInt
(),
remark
=
item
.
Remark
,
attachment
=
""
,
filename
=
""
,
code
=
item
.
Code
,
projectId
=
projectid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
userid
,
updator
=
userid
,
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_fixture_tools
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
bcf5fb79
...
...
@@ -7,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -21,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
query
=
from
q
in
_context
.
siger_automation_location
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
...
...
@@ -71,10 +74,18 @@ namespace Siger.Middlelayer.AccRepository.Repositories
locationidExpression
=
q
=>
q
.
locationid
==
locationid
;
}
var
expression
=
wavehouseidExpression
.
And
(
locationidExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAutomationLocation
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationLocation
>(
entities
,
totalCount
);
}
}
public
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
)
{
...
...
@@ -115,5 +126,73 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var
entities
=
query
.
AsNoTracking
().
ToList
();
return
entities
;
}
public
CommonImportResult
ImportData
(
IEnumerable
<
AutomationLocationTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
var
entities
=
new
List
<
siger_automation_location
>();
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
LocationId
)
||
string
.
IsNullOrEmpty
(
item
.
FixtureTool
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
fixturetool
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
if
(
fixturetool
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
location
=
_context
.
siger_wms_storage_location
.
FirstOrDefault
(
q
=>
q
.
locationid
==
item
.
LocationId
.
ToInt
()
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
location
==
null
||
item
.
LocationId
.
ToInt
()
<=
0
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LocationNull
}
"
);
}
var
exsit
=
_context
.
siger_automation_location
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixturetool
.
guid
||
q
.
locationid
==
item
.
LocationId
.
ToInt
()));
if
(
exsit
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
||
q
.
LocationId
==
item
.
LocationId
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_location
{
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
item
.
LocationId
.
ToInt
(),
fixturetools
=
fixturetool
.
guid
,
attachment
=
""
,
filename
=
""
,
remark
=
item
.
Remark
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_location
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationMachineStatusRepository.cs
View file @
bcf5fb79
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq.Expressions
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
AutomationMachineStatusRepository
:
AccRepositoryBase
<
siger_automation_machine_status
>,
IAutomationMachineStatus
{
private
ApiAccDbContext
_context
;
public
AutomationMachineStatusRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
public
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
)
{
var
data
=
from
atr
in
_context
.
siger_project_machine_attribution
join
lv
in
_context
.
siger_project_level_section
on
atr
.
station
equals
lv
.
id
join
ms
in
_context
.
siger_automation_machine_status
on
lv
.
id
equals
ms
.
section
into
mstemp
join
plv
in
_context
.
siger_project_level_section
on
lv
.
parentid
equals
plv
.
id
from
ms
in
mstemp
.
DefaultIfEmpty
()
select
new
ResponseAutomationMachineStatus
{
sectionid
=
lv
.
id
,
section
=
$"
{
plv
.
title
}
-
{
lv
.
title
}
"
,
lastupdate
=
ms
!=
null
?
ms
.
updatetime
.
ToString
():
""
,
enable
=
ms
!=
null
?
ms
.
enable
:
1
,
status
=
ms
!=
null
?
ms
.
status
:
1
,
};
Expression
<
Func
<
ResponseAutomationMachineStatus
,
bool
>>
sectionsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectionsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
return
data
.
Where
(
sectionsExpression
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
bcf5fb79
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
...
...
@@ -55,5 +59,88 @@ namespace Siger.Middlelayer.AccRepository.Repositories
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
)
{
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
s
in
_context
.
siger_project_level_section
on
q
.
sectionid
equals
s
.
id
join
lv
in
_context
.
siger_project_level_section
on
s
.
parentid
equals
lv
.
id
where
q
.
projectId
==
projectid
select
new
ResponseAutomationTasklist
{
taskno
=
q
.
no
,
sectionid
=
q
.
sectionid
,
section
=
$"
{
lv
.
title
}
-
{
s
.
title
}
"
,
trigger
=
EnumHelper
.
GetEnumDesc
(
q
.
trigger
),
triggervalue
=
q
.
triggertime
,
triggerTime
=
q
.
triggertime
==
DateTime
.
MinValue
?
""
:
q
.
triggertime
.
ToString
(),
complatevalue
=
q
.
completetime
,
complatetime
=
q
.
completetime
==
DateTime
.
MinValue
?
""
:
q
.
completetime
.
ToString
(),
action
=
EnumHelper
.
GetEnumDesc
(
q
.
action
),
actionType
=
EnumHelper
.
GetEnumDesc
(
q
.
actiontype
),
fixtureCode
=
t
.
code
,
fixtureName
=
t
.
name
,
location
=
q
.
locationid
.
ToString
(),
sn
=
q
.
sn
,
ordernumber
=
q
.
ordercode
,
productCode
=
q
.
productcode
,
program
=
q
.
programnumber
,
route
=
q
.
remark
,
tasktype
=
EnumHelper
.
GetEnumDesc
(
q
.
tasktype
),
status
=
q
.
status
,
};
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
sectonsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectonsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
taskTypeExpression
=
f
=>
true
;
if
(
taskType
!=
0
)
{
taskTypeExpression
=
q
=>
q
.
tasktypeid
==
taskType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
productCodeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
productCode
))
{
productCodeExpression
=
q
=>
q
.
productCode
.
Contains
(
productCode
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
tasknoExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
TaskNo
))
{
tasknoExpression
=
q
=>
q
.
taskno
.
Contains
(
TaskNo
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
snExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
sn
))
{
snExpression
=
q
=>
q
.
sn
.
Contains
(
sn
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
actionTypeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
actionTypeExpression
=
q
=>
q
.
actionTypeid
==
actionType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
triggerTimeTypeExpression
=
f
=>
true
;
if
(
string
.
IsNullOrEmpty
(
tiggertime
))
{
triggerTimeTypeExpression
=
q
=>
q
.
triggervalue
==
tiggertime
.
ToDateTime
();
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
comptimeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
comptimeExpression
=
q
=>
q
.
complatevalue
==
comptime
.
ToDateTime
();
}
var
expression
=
sectonsExpression
.
And
(
taskTypeExpression
).
And
(
productCodeExpression
).
And
(
tasknoExpression
).
And
(
snExpression
)
.
And
(
actionTypeExpression
).
And
(
triggerTimeTypeExpression
).
And
(
comptimeExpression
);
var
entities
=
query
.
Where
(
expression
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsAssemblyRepository.cs
View file @
bcf5fb79
...
...
@@ -2,14 +2,17 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsAssemblyRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_assembly
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsCategoryRepository.cs
View file @
bcf5fb79
...
...
@@ -2,11 +2,15 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsCategoryRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_category
>
{
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsCategoryTemplate
>
list
,
int
projectid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
bcf5fb79
...
...
@@ -2,12 +2,14 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsProductRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_product
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
);
ResponseProductFixtureInfo
GetFixtureInfoByProductCode
(
int
projectId
,
string
productCode
);
...
...
@@ -19,5 +21,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns>
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsRepository.cs
View file @
bcf5fb79
...
...
@@ -2,6 +2,7 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
...
...
@@ -14,5 +15,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
int
categoryid
,
int
projectid
);
ResponseProductFixtureInfo
GetProductFixtureLocation
(
int
projectId
,
string
guid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationLocationRepository.cs
View file @
bcf5fb79
...
...
@@ -2,13 +2,14 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationLocationRepository
:
IAccRepositoryBase
<
siger_automation_location
>
{
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
);
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
);
...
...
@@ -16,5 +17,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IEnumerable
<
ResponseAutomationLocationList
>
GetDataList
(
int
projectid
);
IEnumerable
<
siger_wms_storage_location
>
GetLocationList
(
int
projectid
);
CommonImportResult
ImportData
(
IEnumerable
<
AutomationLocationTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationMachineStatus.cs
View file @
bcf5fb79
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationMachineStatus
:
IAccRepositoryBase
<
siger_automation_machine_status
>
{
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationTaskListRepository.cs
View file @
bcf5fb79
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
System.Collections.Generic
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
...
...
@@ -22,5 +24,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// </summary>
/// <returns></returns>
string
CreateRandonSn
(
string
productCode
);
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/Response/FixtureToolsCategory.cs
View file @
bcf5fb79
...
...
@@ -148,5 +148,9 @@ namespace Siger.Middlelayer.AccRepository.Response
public
List
<
ResponseAumationFixtureToolsAssembly
>
childrens
{
get
;
set
;
}
public
string
remark
{
get
;
set
;
}
public
string
parentcategory
{
get
;
set
;
}
public
string
parentpartnumber
{
get
;
set
;
}
public
string
parentspecfication
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationMachineStatus.cs
0 → 100644
View file @
bcf5fb79
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationMachineStatus
{
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
// public string machine { get; set; }
public
string
product
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
int
location
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
int
enable
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
string
lastupdate
{
get
;
set
;
}
}
public
class
ResponseAutomationMachineStatusTotal
{
public
int
waittingTotal
{
get
;
set
;
}
public
int
produceTotal
{
get
;
set
;
}
public
int
complateTotal
{
get
;
set
;
}
public
int
disableTotal
{
get
;
set
;
}
}
public
class
ResponseMachineMonitor
{
public
ResponseAutomationMachineStatusTotal
sum
{
get
;
set
;
}
public
List
<
ResponseAutomationMachineStatus
>
dts
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationTasklist.cs
0 → 100644
View file @
bcf5fb79
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationTasklist
{
public
string
taskno
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
/// <summary>
/// 触发方式
/// </summary>
public
string
trigger
{
get
;
set
;
}
public
int
tasktypeid
{
get
;
set
;
}
/// <summary>
/// 任务类型
/// </summary>
public
string
tasktype
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
routeNo
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
string
program
{
get
;
set
;
}
/// <summary>
/// 储位ID
/// </summary>
public
string
location
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
string
action
{
get
;
set
;
}
public
int
actionTypeid
{
get
;
set
;
}
/// <summary>
/// 执行类型
/// </summary>
public
string
actionType
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
DateTime
triggervalue
{
get
;
set
;
}
public
string
triggerTime
{
get
;
set
;
}
public
DateTime
?
complatevalue
{
get
;
set
;
}
public
string
complatetime
{
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