Commit fa982333 by xin.yang

fix bug

parent c26b36f0
......@@ -924,6 +924,7 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound);
}
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);
if (waveHouse == null)
{
......@@ -934,18 +935,27 @@ namespace Siger.ApiWMS.Controllers
{
throw new BadRequestException(RequestEnum.LocationCountError);
}
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)
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.DataExist);
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>();
......@@ -1047,6 +1057,7 @@ namespace Siger.ApiWMS.Controllers
throw new BadRequestException(RequestEnum.LocationTypeNotFound);
}
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);
if (waveHouse == null)
{
......@@ -1060,15 +1071,25 @@ namespace Siger.ApiWMS.Controllers
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)
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.DataExist);
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>();
......
......@@ -1470,5 +1470,8 @@ namespace Siger.Middlelayer.Common
[Description("未找到工装信息")]
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