Commit 64d233a9 by xin.yang

fix bug

parent f4713769
......@@ -135,12 +135,12 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.ProductNotFound);
}
//var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
// q.productid == req.productid.ToInt()));
//if (data != null)
//{
// throw new BadRequestException(RequestEnum.DataExist);
//}
var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixtureTool.guid &&
q.productid == req.productid.ToInt());
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var entity = new siger_automation_fixture_tools_product
{
......@@ -190,8 +190,8 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.ProductNotFound);
}
var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
q.productid == req.productid.ToInt()) && q.id != req.id);
var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixtureTool.guid &&
q.productid == req.productid.ToInt() && q.id != req.id);
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
......
......@@ -171,15 +171,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
if(fixtureTool != null && product != null)
{
var data = _context.siger_automation_fixture_tools_product.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
q.productid == product.id));
var data = _context.siger_automation_fixture_tools_product.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid && q.fixturetools == fixtureTool.guid &&
q.productid == product.id);
if (data != null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
}
if(list.Count(q => q.FixtureTool == item.FixtureTool || q.Product == item.Product) > 1)
if(list.Count(q => q.FixtureTool == item.FixtureTool && q.Product == item.Product) > 1)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
......
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