Commit 7b8adb92 by jiawei.su

someupdate

parent b9dcda6c
......@@ -193,7 +193,11 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.LineIsAutoMode);
}
var attr = _sigerProjectMachineAttribution.Get(f => f.station == taskobj.sectionid && f.status == 1);
if (attr==null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var host = GetHost();
if (string.IsNullOrEmpty(host))
{
......@@ -202,7 +206,7 @@ namespace Siger.ApiACC.Controllers
var sendToPLC = new RequestPLC
{
LineID=levelsection.parentid,
RStation = taskobj.sectionid,
RStation = attr.machine,
Fixture = taskobj.fixtureguid,
RequestForm = taskobj.no,
RobotStep = (int)taskobj.action,
......
......@@ -38,10 +38,16 @@ namespace Siger.ApiACC.Tasks
var tasks = tasklist.OrderBy(s => s.actiontype);
var task = tasks.FirstOrDefault();
var levelsction = dbhelper.GetLevelsection(task.sectionid);
if (levelsction == null)
return;
var attr = dbhelper.GetAttribution(task.sectionid);
if (attr == null)
return;
var sendToPLC = new RequestPLC
{
LineID= levelsction.parentid,
RStation = task.sectionid,
RStation = attr.machine,
Fixture = task.fixtureguid,
RequestForm = task.no,
RobotStep = (int)task.action,
......
......@@ -57,6 +57,11 @@ namespace Siger.ApiACC.Tasks
{
return AccDbContext.siger_project_level_section.FirstOrDefault(f => f.id==id);
}
public siger_project_machine_attribution GetAttribution(int section)
{
return AccDbContext.siger_project_machine_attribution.FirstOrDefault(f => f.station==section && f.status==1);
}
public void Dispose()
{
CncDbContext?.Dispose();
......
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