Commit fec99e86 by xin.yang

fix bug

parent 5a4f5a6c
...@@ -26,31 +26,24 @@ namespace Siger.ApiACC.Controllers ...@@ -26,31 +26,24 @@ namespace Siger.ApiACC.Controllers
private readonly ISigerTrMaterialsRepository _materialsRepository; private readonly ISigerTrMaterialsRepository _materialsRepository;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository, public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository, IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository)
ISigerTrMaterialsRepository materialsRepository)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository; _toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository; _toolsRepository = toolsRepository;
_autoLocationRepository = autoLocationRepository; _autoLocationRepository = autoLocationRepository;
_materialsRepository = materialsRepository;
} }
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize) public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize)
{ {
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize); var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
var list = new List<ResponseAutomationLocation>();
foreach(var item in data.Data)
{
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize); return new PagedObjectResult(data.Data, data.Total, page, pagesize);
} }
[HttpPost] [HttpPost]
public IActionResult Add([FromBody]RequestAddAutomationLocation req) public IActionResult Add([FromBody]RequestAddAutomationLocation req)
{ {
if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.materialid)) if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid))
{ {
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
...@@ -64,31 +57,13 @@ namespace Siger.ApiACC.Controllers ...@@ -64,31 +57,13 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.LocationNull); throw new BadRequestException(RequestEnum.LocationNull);
} }
var material = _materialsRepository.Get(q => q.id == req.materialid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid); var exsit = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
var data = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixturetool.guid && (q.fixturetools == req.fixturetoolid || q.locationid == req.locationid.ToInt()));
q.locationid == req.locationid.ToInt()); if(exsit != null)
if (data != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
var state = 1;
if (fixturetool != null && material == null)
{
state = 1;//有工装 无工件
}
else if(fixturetool != null && material != null)
{
state = 2;//有工装 有工件
}
else if (fixturetool == null && material == null)
{
state = 3;//无工装 无工件
}
else if (fixturetool == null && material != null)
{
state = 4;//无工装 有工件
}
var entity = new siger_automation_location var entity = new siger_automation_location
{ {
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
...@@ -120,6 +95,10 @@ namespace Siger.ApiACC.Controllers ...@@ -120,6 +95,10 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
var entity = _autoLocationRepository.Get(q => q.id == req.id && q.projectId == ProjectId && q.status == (int)RowState.Valid); var entity = _autoLocationRepository.Get(q => q.id == req.id && q.projectId == ProjectId && q.status == (int)RowState.Valid);
if(entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId); var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (fixturetool == null) if (fixturetool == null)
{ {
...@@ -130,13 +109,13 @@ namespace Siger.ApiACC.Controllers ...@@ -130,13 +109,13 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.LocationNull); throw new BadRequestException(RequestEnum.LocationNull);
} }
var material = _materialsRepository.Get(q => q.id == req.materialid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid); var exsit = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
var data = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixturetool.guid && (q.fixturetools == req.fixturetoolid || q.locationid == req.locationid.ToInt()) && q.id != req.id);
q.locationid == req.locationid.ToInt() && q.id != req.id); if (exsit != null)
if (data != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
entity.locationid = req.locationid.ToInt(); entity.locationid = req.locationid.ToInt();
entity.fixturetools = fixturetool.guid; entity.fixturetools = fixturetool.guid;
entity.attachment = req.fileurl; entity.attachment = req.fileurl;
......
...@@ -127,7 +127,7 @@ namespace Siger.ApiACC.Controllers ...@@ -127,7 +127,7 @@ namespace Siger.ApiACC.Controllers
entity.updator = UserId; entity.updator = UserId;
entity.filename = req.filename; entity.filename = req.filename;
entity.attachment = req.fileurl; entity.attachment = req.fileurl;
_toolsProductRepository.Insert(entity); _toolsProductRepository.Update(entity);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
{ {
return new ObjectResult(CommonEnum.Succefull); return new ObjectResult(CommonEnum.Succefull);
......
...@@ -5,7 +5,7 @@ using System.Text; ...@@ -5,7 +5,7 @@ using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities namespace Siger.Middlelayer.AccRepository.Entities
{ {
/// <summary> /// <summary>
/// 储位信息 /// 储位工装信息
/// </summary> /// </summary>
public class siger_automation_location : AccEntityBase public class siger_automation_location : AccEntityBase
{ {
......
...@@ -43,12 +43,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -43,12 +43,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories
category = c.name, category = c.name,
code = t.code, code = t.code,
specfication = t.specification, specfication = t.specification,
//materialid = q.materialid,
//materialcode = m.pn,
//processid = q.processid,
//processnumber = p == null ? 0 : p.Process_Seq,
//processname = p.Process_name ?? "",
//materialstate = q.materialstate,
fileurl = q.attachment ?? "", fileurl = q.attachment ?? "",
filename = q.filename ?? "", filename = q.filename ?? "",
remark = q.remark, remark = q.remark,
......
...@@ -109,14 +109,6 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -109,14 +109,6 @@ namespace Siger.Middlelayer.AccRepository.Request
/// </summary> /// </summary>
public string fixturetoolid { get; set; } public string fixturetoolid { get; set; }
/// <summary> /// <summary>
/// 物料ID
/// </summary>
public string materialid { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public string processid { get; set; }
/// <summary>
/// 附件 /// 附件
/// </summary> /// </summary>
public string fileurl { get; set; } public string fileurl { get; set; }
......
...@@ -23,16 +23,11 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -23,16 +23,11 @@ namespace Siger.Middlelayer.AccRepository.Response
public string code { get; set; } public string code { get; set; }
public string specfication { get; set; } public string specfication { get; set; }
/// <summary> /// <summary>
/// 物料ID /// 工件
/// </summary> /// </summary>
public int materialid { get; set; } public string sn { get; set; }
public string materialcode { get; set; } public string routenumber { get; set; }
/// <summary> public string route { get; set; }
/// 工序ID
/// </summary>
public int processid { get; set; }
public int processnumber { get; set; }
public string processname { get; set; }
/// <summary> /// <summary>
/// 物料状态 /// 物料状态
/// </summary> /// </summary>
......
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