Commit c8dff077 by yiyu.li
parents 6ea9d5de 7b8adb92
...@@ -315,10 +315,13 @@ namespace Siger.ApiACC.Controllers ...@@ -315,10 +315,13 @@ namespace Siger.ApiACC.Controllers
_automationLocation.Update(location); _automationLocation.Update(location);
var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid); var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid);
if (monitor != null)
{
monitor.section = 0; monitor.section = 0;
_automationFixtureMonitor.Update(monitor); _automationFixtureMonitor.Update(monitor);
} }
} }
}
} }
......
...@@ -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,
...@@ -268,7 +272,7 @@ namespace Siger.ApiACC.Controllers ...@@ -268,7 +272,7 @@ namespace Siger.ApiACC.Controllers
[HttpGet] [HttpGet]
public IActionResult ScanCode(string code,int id) public IActionResult ScanCode(string code,int id)
{ {
if (string.IsNullOrEmpty(code)) if (!string.IsNullOrEmpty(code))
{ {
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result == null) if (result == null)
...@@ -471,7 +475,7 @@ namespace Siger.ApiACC.Controllers ...@@ -471,7 +475,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound); throw new BadRequestException(AccEnum.MonitorNotfound);
} }
//移出 上料位 //移出 上料位
monitor.section = 0;
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
......
...@@ -50,7 +50,7 @@ namespace Siger.ApiACC.Controllers ...@@ -50,7 +50,7 @@ namespace Siger.ApiACC.Controllers
var item = new ResponseAutomationMachineStatus var item = new ResponseAutomationMachineStatus
{ {
sectionid=d.sectionid, sectionid=d.sectionid,
section=$"{ d.section}({d.linemode})", section=$"{ d.section} {d.linemode}",
enable=d.enable, enable=d.enable,
product="", product="",
location=0, location=0,
......
...@@ -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();
......
...@@ -22,7 +22,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -22,7 +22,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{ {
var data = from atr in _context.siger_project_machine_attribution var data = from atr in _context.siger_project_machine_attribution
join lv in _context.siger_project_level_section on atr.station equals lv.id join lv in _context.siger_project_level_section on atr.station equals lv.id
join lm in _context.siger_automation_line_mode on lv.parentid equals lm.id join lm in _context.siger_automation_line_mode on lv.parentid equals lm.id into lstemp
from lm in lstemp.DefaultIfEmpty()
join ms in _context.siger_automation_machine_status on lv.id equals ms.section into mstemp join ms in _context.siger_automation_machine_status on lv.id equals ms.section into mstemp
join plv in _context.siger_project_level_section on lv.parentid equals plv.id join plv in _context.siger_project_level_section on lv.parentid equals plv.id
from ms in mstemp.DefaultIfEmpty() from ms in mstemp.DefaultIfEmpty()
...@@ -33,7 +34,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -33,7 +34,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
lastupdate = ms != null ? ms.updatetime.ToString() : "", lastupdate = ms != null ? ms.updatetime.ToString() : "",
enable = ms != null ? ms.enable : 1, enable = ms != null ? ms.enable : 1,
status = ms != null ? ms.status : 1, status = ms != null ? ms.status : 1,
linemode = lm.mode == 0 ? "手动模式" : "自动模式", linemode =lm!=null? lm.mode == 0 ? "手动模式" : "自动模式":"",
}; };
Expression<Func<ResponseAutomationMachineStatus, bool>> sectionsExpression = f => true; Expression<Func<ResponseAutomationMachineStatus, bool>> sectionsExpression = f => true;
......
...@@ -49,15 +49,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -49,15 +49,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public string CrateTaskNumber(TaskTrigerType trigerType) public string CrateTaskNumber(TaskTrigerType trigerType)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var lable = date.Year+date.Day+date.Hour + date.Minute + date.Second; var serinum = date.DayOfYear+date.Month +date.Day+ date.Hour + date.Minute + date.Second + date.Millisecond;
var lableUnix = UnixTimeHelper.GetNow(); var dayofyear = GetDayOfYear(date);
if (trigerType== TaskTrigerType.Auto) if (trigerType== TaskTrigerType.Auto)
{ {
return $"{date.Year}{date.DayOfYear}A{lable}"; return $"A{date.Year}{dayofyear}{serinum}";
}else }
else
{ {
return $"{date.Year}{date.DayOfYear}M{lable}"; return $"M{date.Year}{dayofyear}{serinum}";
} }
} }
/// <summary> /// <summary>
...@@ -68,7 +68,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -68,7 +68,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public string CreateRandonSn(string productCode) public string CreateRandonSn(string productCode)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var serinum = date.DayOfYear+date.Hour + date.Minute + date.Second + date.Millisecond; var serinum = date.DayOfYear + date.Month + date.Day + date.Hour + date.Minute + date.Second + date.Millisecond;
var dayofyear = GetDayOfYear(date); var dayofyear = GetDayOfYear(date);
var lable = $"{date.Year}{dayofyear}{serinum}"; var lable = $"{date.Year}{dayofyear}{serinum}";
return lable; return lable;
......
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