Commit fa982333 by xin.yang

fix bug

parent c26b36f0
...@@ -924,6 +924,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -924,6 +924,7 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound); throw new BadRequestException(RequestEnum.LocationTypeNotFound);
} }
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList(); var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
var locationTypeId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid); var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid);
if (waveHouse == null) if (waveHouse == null)
{ {
...@@ -933,19 +934,28 @@ namespace Siger.ApiWMS.Controllers ...@@ -933,19 +934,28 @@ namespace Siger.ApiWMS.Controllers
if (req.storeArr.Count != locationTypes.Count) if (req.storeArr.Count != locationTypes.Count)
{ {
throw new BadRequestException(RequestEnum.LocationCountError); throw new BadRequestException(RequestEnum.LocationCountError);
} }
foreach (var Location in req.storeArr) foreach (var Location in req.storeArr)
{ {
if (req.storeArr.Count(q => q.val == Location.val) > 1) if (Location.id == locationTypeId)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId);
if (loca != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); var locationIdExist = location.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.typeid == locationTypeId &&
q.locationid == req.storeID.ToInt());
if (locationIdExist != null)
{
throw new BadRequestException(RequestEnum.IDExist);
}
} }
//判断名称重复
//if (req.storeArr.Count(q => q.val == Location.val) > 1)
//{
// throw new BadRequestException(RequestEnum.DataExist);
//}
//var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId);
//if (loca != null)
//{
// throw new BadRequestException(RequestEnum.DataExist);
//}
} }
var ids = new List<int>(); var ids = new List<int>();
...@@ -1047,6 +1057,7 @@ namespace Siger.ApiWMS.Controllers ...@@ -1047,6 +1057,7 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound); throw new BadRequestException(RequestEnum.LocationTypeNotFound);
} }
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList(); var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
var locationTypeId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid); var waveHouse = storage.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.warehouseid);
if (waveHouse == null) if (waveHouse == null)
{ {
...@@ -1057,18 +1068,28 @@ namespace Siger.ApiWMS.Controllers ...@@ -1057,18 +1068,28 @@ namespace Siger.ApiWMS.Controllers
{ {
throw new BadRequestException(RequestEnum.LocationCountError); throw new BadRequestException(RequestEnum.LocationCountError);
} }
foreach (var Location in req.storeArr) foreach (var Location in req.storeArr)
{ {
if (req.storeArr.Count(q => q.val == Location.val) > 1) if(Location.id == locationTypeId)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt());
if (loca != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); var locationIdExist = location.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.typeid == locationTypeId &&
q.locationid == req.storeID.ToInt() && q.id != Location.locationid.ToInt());
if (locationIdExist != null)
{
throw new BadRequestException(RequestEnum.IDExist);
}
} }
//判断名称重复
//if (req.storeArr.Count(q => q.val == Location.val) > 1)
//{
// throw new BadRequestException(RequestEnum.DataExist);
//}
//var loca = location.Get(q => q.realname == Location.val && q.projectid == ProjectId && q.id != Location.locationid.ToInt());
//if (loca != null)
//{
// throw new BadRequestException(RequestEnum.DataExist);
//}
} }
var ids = new List<int>(); var ids = new List<int>();
......
...@@ -1470,5 +1470,8 @@ namespace Siger.Middlelayer.Common ...@@ -1470,5 +1470,8 @@ namespace Siger.Middlelayer.Common
[Description("未找到工装信息")] [Description("未找到工装信息")]
FixtureToolNotFound, FixtureToolNotFound,
[Description("ID重复")]
IDExist,
} }
} }
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