Commit 92b52ceb by jiawei.su

someupdate

parent a6972f82
......@@ -17,6 +17,8 @@ using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Utility.Helpers;
using Siger.Middlelayer.Utility.ImportEntities;
using System.IO;
using Siger.Middlelayer.Common.ModuleEnum;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Siger.ApiACC.Controllers
......@@ -28,14 +30,19 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationLineMode _automationLineMode;
private readonly IAutomationSectionPropertyRepository _automationSectionProperty;
public AutomationStateController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationMachineStatus automationMachineStatus, IAutomationTaskListRepository automationTaskList, IAutomationFixtureMonitor automationFixtureMonitor)
public AutomationStateController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationMachineStatus automationMachineStatus, IAutomationTaskListRepository automationTaskList, IAutomationFixtureMonitor automationFixtureMonitor
, IAutomationLineMode automationLineMode, IAutomationSectionPropertyRepository automationSectionProperty)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
_automationMachineStatus = automationMachineStatus;
_automationTaskList = automationTaskList;
_automationFixtureMonitor = automationFixtureMonitor;
_automationLineMode = automationLineMode;
_automationSectionProperty = automationSectionProperty;
}
/// <summary>
......@@ -194,6 +201,44 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (record.send != 0)
{
throw new BadRequestException(AccEnum.TaskIsSend);
}
var _property = _automationSectionProperty.GetList(f => f.propertytype == 1 && (f.upload > 0 || f.down > 0));
if (_property.Any())
{
foreach (var perperty in _property)
{
if (perperty.upload > 0)
{
//重置上料位状态
if (record.sectionid==perperty.sectionid && record.action == Automation.TaskAction.Step_LK_SXLW)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
}
if (perperty.down > 0)
{
//重置下料位置
//去抽检台
if (record.extend1.ToInt()==perperty.sectionid && record.action == Automation.TaskAction.Step_LK_CJT)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
//去下料位
if (record.extend1.ToInt()==perperty.sectionid && record.action== Automation.TaskAction.Step_LK_SXLW)
{
perperty.upload = 0;
_automationSectionProperty.Update(perperty);
}
}
}
}
_automationTaskList.Delete(record);
if (_unitOfWork.Commit() > 0)
......
......@@ -272,9 +272,10 @@ namespace Siger.ApiACC.Controllers
//{
// return new ObjectResult(CommonEnum.Succefull);
//}
var lastTask = _automationTaskList.GetList(f => f.projectId == ProjectId, "id", true).FirstOrDefault();
if (lastTask.extend1 == section.ToStr() && lastTask.action == TaskAction.Step_CJT_SXLW && lastTask.status != (int)TaskResultStatus.Complated)
var lastTask = _automationTaskList.GetList(f => f.projectId == ProjectId && f.action == TaskAction.Step_CJT_SXLW, "id", true).FirstOrDefault();
if ( lastTask.status != (int)TaskResultStatus.Complated)
{
Logger.WriteLineError($"重复检验提交数据,无需创建Task任务");
return new ObjectResult(CommonEnum.Succefull);
}
......@@ -283,6 +284,7 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(CommonEnum.Fail);
}
inspection.workorder = tasklist.ordercode;
CreateTaskList(tasklist, req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt());
AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表
......@@ -353,7 +355,7 @@ namespace Siger.ApiACC.Controllers
action = Automation.TaskAction.Step_CJT_SXLW,
actiontype = Automation.ExcueType.None,
triggertime = DateTime.Now,
tasktype = Automation.TaskActionType.Unload,
tasktype = TaskActionType.Unload,
operater = UserId,
operatetime = DateTime.Now,
sectionid = tasklist.extend1.ToInt(),
......
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