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
e25383e7
Commit
e25383e7
authored
Feb 05, 2021
by
xin.yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
e546a966
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
4 deletions
+102
-4
storagemaintenance.vue
Html/src/view/wms/config/storagemaintenance.vue
+2
-3
UploadController.cs
Server/Apis/Siger.ApiWMS/Controllers/UploadController.cs
+11
-1
EPPlusWmsExcelHelper.cs
...Siger.Middlelayer.Utility/Helpers/EPPlusWmsExcelHelper.cs
+89
-0
No files found.
Html/src/view/wms/config/storagemaintenance.vue
View file @
e25383e7
...
@@ -396,13 +396,12 @@ export default {
...
@@ -396,13 +396,12 @@ export default {
handleSuccess
(
res
,
file
)
{
handleSuccess
(
res
,
file
)
{
if
(
res
.
ret
==
1
)
{
if
(
res
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
"950398"
));
this
.
$Message
.
success
(
this
.
$t
(
"950398"
));
this
.
getCategory
();
this
.
tosearch
();
this
.
search
(
1
,
10
);
}
else
{
}
else
{
if
((
res
.
msg
+
""
).
indexOf
(
","
)
!=
-
1
)
{
if
((
res
.
msg
+
""
).
indexOf
(
","
)
!=
-
1
)
{
inittip
(
res
.
msg
);
inittip
(
res
.
msg
);
}
else
{
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
));
this
.
$Message
.
error
(
this
.
$t
(
res
.
msg
));
}
}
}
}
},
},
...
...
Server/Apis/Siger.ApiWMS/Controllers/UploadController.cs
View file @
e25383e7
...
@@ -16,6 +16,7 @@ using Siger.Middlelayer.Utility.Helpers;
...
@@ -16,6 +16,7 @@ using Siger.Middlelayer.Utility.Helpers;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.WmsRepository.Entities
;
using
Siger.Middlelayer.WmsRepository.Entities
;
using
Siger.Middlelayer.WmsRepository.Repositories.Interface
;
using
Siger.Middlelayer.WmsRepository.Repositories.Interface
;
using
Siger.Middlelayer.Common.Extensions
;
namespace
Siger.ApiWMS.Controllers
namespace
Siger.ApiWMS.Controllers
{
{
...
@@ -116,10 +117,19 @@ namespace Siger.ApiWMS.Controllers
...
@@ -116,10 +117,19 @@ namespace Siger.ApiWMS.Controllers
var
locationTypes
=
_location_TypeRepository
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
locationTypes
=
_location_TypeRepository
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
if
(!
locationTypes
.
Any
())
if
(!
locationTypes
.
Any
())
{
{
throw
new
BadRequestException
(
RequestEnum
.
LocationTypeNotFound
);
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
(
int
)
RequestEnum
.
LocationTypeNotFound
)
);
}
}
var
sonLocationTypes
=
GetSonTypes
(
0
,
locationTypes
).
Select
(
q
=>
new
Tuple
<
int
,
string
>(
q
.
id
,
q
.
name
)).
ToList
();
var
sonLocationTypes
=
GetSonTypes
(
0
,
locationTypes
).
Select
(
q
=>
new
Tuple
<
int
,
string
>(
q
.
id
,
q
.
name
)).
ToList
();
var
checkResult
=
excelHelper
.
CheckExcel
(
sonLocationTypes
);
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
(
sonLocationTypes
);
var
data
=
excelHelper
.
ConvertSheetToList
(
sonLocationTypes
);
if
(!
data
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
(
int
)
CommonEnum
.
NoData
));
}
var
result
=
_locationRepository
.
ImportStorageLocations
(
data
,
ProjectId
,
UserId
);
var
result
=
_locationRepository
.
ImportStorageLocations
(
data
,
ProjectId
,
UserId
);
return
result
;
return
result
;
}
}
...
...
Server/Common/Siger.Middlelayer.Utility/Helpers/EPPlusWmsExcelHelper.cs
View file @
e25383e7
...
@@ -6,6 +6,7 @@ using System.Reflection;
...
@@ -6,6 +6,7 @@ using System.Reflection;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
OfficeOpenXml
;
using
OfficeOpenXml
;
using
OfficeOpenXml.Style
;
using
OfficeOpenXml.Style
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Utility.ExcelImport
;
using
Siger.Middlelayer.Utility.ExcelImport
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
ExcelColumn
=
Siger
.
Middlelayer
.
Utility
.
ExcelImport
.
ExcelColumn
;
using
ExcelColumn
=
Siger
.
Middlelayer
.
Utility
.
ExcelImport
.
ExcelColumn
;
...
@@ -117,6 +118,94 @@ namespace Siger.Middlelayer.Utility.Helpers
...
@@ -117,6 +118,94 @@ namespace Siger.Middlelayer.Utility.Helpers
return
collection
;
return
collection
;
}
}
public
List
<
string
>
CheckExcel
(
List
<
Tuple
<
int
,
string
>>
locationTypes
)
{
if
(
Sheet
==
null
)
{
throw
new
ArgumentNullException
(
nameof
(
Sheet
));
}
var
messages
=
new
List
<
string
>();
var
columns
=
new
List
<
string
>
{
"ID"
,
"仓库名称"
};
foreach
(
var
item
in
locationTypes
)
{
columns
.
Add
(
item
.
Item2
);
}
var
endRow
=
2
;
for
(
var
row
=
2
;
row
<=
Sheet
.
Dimension
.
Rows
;
row
++)
{
var
columnValues
=
new
List
<
string
>();
for
(
var
i
=
1
;
i
<=
columns
.
Count
;
i
++)
{
var
val
=
Sheet
.
Cells
[
row
,
i
];
if
(
val
!=
null
)
{
columnValues
.
Add
(
val
.
Text
);
}
}
if
(
columnValues
.
All
(
string
.
IsNullOrWhiteSpace
))
{
endRow
=
row
-
1
;
break
;
}
endRow
=
row
;
}
IList
<
int
>
rows
=
new
List
<
int
>();
for
(
var
i
=
2
;
i
<=
endRow
;
i
++)
{
rows
.
Add
(
i
);
}
foreach
(
var
row
in
rows
)
{
var
tnew
=
new
ImportStorageLocations
();
int
i
=
1
;
foreach
(
var
col
in
columns
)
{
var
cell
=
Sheet
.
Cells
[
row
,
i
];
var
val
=
cell
==
null
?
""
:
cell
.
Value
?.
ToString
()
??
""
;
if
(
i
==
1
)
{
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
$"
{
row
}
,
{(
int
)
RequestEnum
.
PleaseInputNotZeroIntID
}
"
);
return
messages
;
}
tnew
.
ID
=
val
;
}
if
(
i
==
2
)
{
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
$"
{
row
}
,
{(
int
)
RequestEnum
.
PleaseInputStorageName
}
"
);
return
messages
;
}
tnew
.
StorageName
=
val
;
}
if
(
i
>
2
)
{
var
typeId
=
locationTypes
.
FirstOrDefault
(
q
=>
q
.
Item2
==
col
);
if
(
string
.
IsNullOrEmpty
(
val
))
{
messages
.
Add
(
typeId
!=
null
?
$"
{
row
}
, 请填写
{
typeId
.
Item2
}
"
:
$"
{
row
}
,
{(
int
)
RequestEnum
.
LocationImportFormatError
}
"
);
return
messages
;
}
tnew
.
Locations
.
Add
(
new
LocationModels
{
LocationType
=
typeId
==
null
?
0
:
typeId
.
Item1
,
Location
=
val
});
}
i
++;
}
}
return
messages
;
}
public
void
Dispose
()
public
void
Dispose
()
{
{
Sheet
?.
Dispose
();
Sheet
?.
Dispose
();
...
...
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