Commit 20ea8ec3 by xin.yang

some update

parent 4e5891a7
...@@ -416,7 +416,8 @@ namespace Siger.ApiWMS.Controllers ...@@ -416,7 +416,8 @@ namespace Siger.ApiWMS.Controllers
storageName = waveHouseDic[item.storageid], storageName = waveHouseDic[item.storageid],
serialNumber = item.serial_number, serialNumber = item.serial_number,
state = item.status, state = item.status,
field = new List<string>() field = new List<string>(),
storeID = item.locationid
}; };
int i = 1; int i = 1;
tmp.field.Insert(0, item.realname); tmp.field.Insert(0, item.realname);
...@@ -898,7 +899,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -898,7 +899,7 @@ namespace Siger.ApiWMS.Controllers
[HttpPost] [HttpPost]
public IActionResult AddLocation([FromBody]RequestAddLocationModel req) public IActionResult AddLocation([FromBody]RequestAddLocationModel req)
{ {
if (req.storeID.ToInt() <= 0 || req.locations == null || !req.locations.Any() || req.warehouseid <= 0) if (req.storeID.ToInt() <= 0 || req.storeArr == null || !req.storeArr.Any() || req.warehouseid <= 0)
{ {
throw new BadRequestException(RequestEnum.ParameterError); throw new BadRequestException(RequestEnum.ParameterError);
} }
...@@ -914,12 +915,12 @@ namespace Siger.ApiWMS.Controllers ...@@ -914,12 +915,12 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.WaveHouseIDNotExist); throw new BadRequestException(RequestEnum.WaveHouseIDNotExist);
} }
if (req.locations.Count != locationTypes.Count) if (req.storeArr.Count != locationTypes.Count)
{ {
throw new BadRequestException(RequestEnum.LocationCountError); throw new BadRequestException(RequestEnum.LocationCountError);
} }
foreach (var Location in req.locations) foreach (var Location in req.storeArr)
{ {
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId); var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId);
if (loca != null) if (loca != null)
...@@ -932,7 +933,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -932,7 +933,7 @@ namespace Siger.ApiWMS.Controllers
var parentid = 0; var parentid = 0;
foreach (var locationType in sonLocationTypes) foreach (var locationType in sonLocationTypes)
{ {
var Location = req.locations.FirstOrDefault(q => q.id == locationType.id); var Location = req.storeArr.FirstOrDefault(q => q.id == locationType.id);
if (Location == null) if (Location == null)
{ {
throw new BadRequestException(CommonEnum.Fail);//TODO throw new BadRequestException(CommonEnum.Fail);//TODO
...@@ -1017,7 +1018,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -1017,7 +1018,7 @@ namespace Siger.ApiWMS.Controllers
[HttpPost] [HttpPost]
public IActionResult UpdateLocation([FromBody]RequestAddLocationModel req) public IActionResult UpdateLocation([FromBody]RequestAddLocationModel req)
{ {
if (req.storeID.ToInt() <= 0 || req.locations == null || !req.locations.Any() || req.warehouseid <= 0) if (req.storeID.ToInt() <= 0 || req.storeArr == null || !req.storeArr.Any() || req.warehouseid <= 0)
{ {
throw new BadRequestException(RequestEnum.ParameterError); throw new BadRequestException(RequestEnum.ParameterError);
} }
...@@ -1033,12 +1034,12 @@ namespace Siger.ApiWMS.Controllers ...@@ -1033,12 +1034,12 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.WaveHouseIDNotExist); throw new BadRequestException(RequestEnum.WaveHouseIDNotExist);
} }
if (req.locations.Count != locationTypes.Count) if (req.storeArr.Count != locationTypes.Count)
{ {
throw new BadRequestException(RequestEnum.LocationCountError); throw new BadRequestException(RequestEnum.LocationCountError);
} }
foreach (var Location in req.locations) foreach (var Location in req.storeArr)
{ {
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt()); var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt());
if (loca != null) if (loca != null)
...@@ -1050,7 +1051,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -1050,7 +1051,7 @@ namespace Siger.ApiWMS.Controllers
var ids = new List<int>(); var ids = new List<int>();
foreach (var locationType in sonLocationTypes) foreach (var locationType in sonLocationTypes)
{ {
var Location = req.locations.FirstOrDefault(q => q.id == locationType.id); var Location = req.storeArr.FirstOrDefault(q => q.id == locationType.id);
if (Location == null) if (Location == null)
{ {
throw new BadRequestException(CommonEnum.Fail);//TODO throw new BadRequestException(CommonEnum.Fail);//TODO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment