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
3b969146
Commit
3b969146
authored
Jan 25, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some update
parent
46b709eb
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
288 additions
and
34 deletions
+288
-34
storageInfoQuery.vue
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
+1
-1
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+84
-2
UploadController.cs
Server/Apis/Siger.ApiACC/Controllers/UploadController.cs
+33
-1
CommonEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
+1
-0
FixtureTools.cs
.../Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
+78
-21
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+7
-7
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+80
-1
IAutomationLocationRepository.cs
...y/Repositories/Interface/IAutomationLocationRepository.cs
+4
-1
No files found.
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
View file @
3b969146
...
...
@@ -176,7 +176,7 @@ export default {
},
{
title
:
'储位ID'
,
key
:
'loca
tion
id'
key
:
'locaid'
},
{
title
:
'工装类别'
,
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
3b969146
...
...
@@ -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/UploadController.cs
View file @
3b969146
...
...
@@ -45,13 +45,15 @@ namespace Siger.ApiACC.Controllers
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
,
IAutomationFixtureToolsCategoryRepository
fixtureToolsCategoryRepository
,
IAutomationFixtureToolsRepository
fixtureToolsRepository
,
IAutomationFixtureToolsProductRepository
fixtureToolsProductRepository
,
IAutomationFixtureToolsAssemblyRepository
fixtureToolsAssemblyRepository
)
IAutomationFixtureToolsProductRepository
fixtureToolsProductRepository
,
IAutomationFixtureToolsAssemblyRepository
fixtureToolsAssemblyRepository
,
IAutomationLocationRepository
autoLocationRepository
)
{
_unitOfWork
=
unitOfWork
;
_materialsRepository
=
materialsRepository
;
...
...
@@ -74,6 +76,7 @@ namespace Siger.ApiACC.Controllers
_fixtureToolsRepository
=
fixtureToolsRepository
;
_fixtureToolsProductRepository
=
fixtureToolsProductRepository
;
_fixtureToolsAssemblyRepository
=
fixtureToolsAssemblyRepository
;
_autoLocationRepository
=
autoLocationRepository
;
}
[
HttpPost
]
...
...
@@ -229,6 +232,9 @@ namespace Siger.ApiACC.Controllers
case
TemplateNameEnums
.
FixtureToolsAssmeblyTemplate
:
result
=
ImportFixtureToolsAssembly
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
AutomationLocationTemplate
:
result
=
ImportAutomationLocation
(
temporaryFilePath
);
break
;
default
:
throw
new
ArgumentOutOfRangeException
();
}
...
...
@@ -929,5 +935,31 @@ namespace Siger.ApiACC.Controllers
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/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
View file @
3b969146
...
...
@@ -236,6 +236,7 @@ namespace Siger.Middlelayer.Common
FixtureToolsTemplate
,
FixtureToolsProductTemplate
,
FixtureToolsAssmeblyTemplate
,
AutomationLocationTemplate
,
}
public
enum
LogLevel
...
...
Server/Common/Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
View file @
3b969146
...
...
@@ -4,7 +4,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities
{
public
class
FixtureToolsCategoryTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装类型*
"
)]
[
ExcelColumn
(
"
*工装类型
"
)]
public
string
Fixture
{
get
;
set
;
}
[
ExcelColumn
(
"上级类型"
)]
...
...
@@ -13,28 +13,28 @@ 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
(
"备注"
)]
...
...
@@ -46,25 +46,25 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[
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
(
"备注"
)]
...
...
@@ -79,10 +79,10 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public
class
FixtureToolsProductTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装名称*
"
)]
[
ExcelColumn
(
"
*工装名称
"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"
产品名称*
"
)]
[
ExcelColumn
(
"
*产品名称
"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
...
...
@@ -121,16 +121,16 @@ namespace Siger.Middlelayer.Utility.ImportEntities
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
(
"
状态*
"
)]
[
ExcelColumn
(
"
*状态
"
)]
public
string
Status
{
get
;
set
;
}
}
...
...
@@ -172,4 +172,61 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[
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 @
3b969146
...
...
@@ -147,36 +147,36 @@ namespace Siger.Middlelayer.AccRepository.Repositories
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
)
||
string
.
IsNullOrEmpty
(
item
.
ParentFixtureTool
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
if
(
item
.
ParentFixtureTool
==
item
.
FixtureTool
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParentSonSame
);
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
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
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
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
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
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
&&
q
.
ParentFixtureTool
==
item
.
ParentFixtureTool
)
>
1
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
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
))
{
throw
new
BadRequestException
(
RequestEnum
.
LevelCountError
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LevelCountError
}
"
);
}
if
(
errors
.
Any
())
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
3b969146
...
...
@@ -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/Interface/IAutomationLocationRepository.cs
View file @
3b969146
...
...
@@ -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
);
}
}
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