Commit 7b8adb92 by jiawei.su

someupdate

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