Commit 0b279d64 by jiawei.su

fixedbug

parent 971259e2
...@@ -82,70 +82,53 @@ namespace Siger.ApiACC.Controllers ...@@ -82,70 +82,53 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineInfo($"GetloadStation 未配置设备类型字典"); Logger.WriteLineInfo($"GetloadStation 未配置设备类型字典");
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var loadStation=new List<string>(); var loadStation=new List<string>();
//上下料
if (type==0) if (type==0)
{ {
var dictLoad = stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation); var sectionProperty = _sectionPropertyRepository.GetList(f => f.propertytype == 1);
if (!dictLoad.Any()) var sections = sectionProperty.Select(s => s.sectionid).ToList();
var levelSection = _sigerProjectLevelSection.GetList(f => f.parentid == line && sections.Contains(f.id));
if (!levelSection.Any())
{ {
Logger.WriteLineInfo($"GetloadStation 未配置上下料工站字典");
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
loadStation = dictLoad.Select(s => s.dval).ToList(); var result = new List<ResponseLoadStation>();
}else foreach (var lv in levelSection)
{ {
var dictLoad = stationDicts.Where(s => s.dkey == DictKeyValConst.CleanStation); result.Add(new ResponseLoadStation
if (!dictLoad.Any())
{ {
Logger.WriteLineInfo($"GetloadStation 未配置清洗工站字典"); section=lv.id,
throw new BadRequestException(CommonEnum.RecordNotFound); status=1,
title=lv.title,
});
} }
loadStation = dictLoad.Select(s => s.dval).ToList(); return new ObjectResult(result);
//检验
} }
else
var data = new List<ResponseLoadStation>();
foreach (var station in loadStation)
{ {
var section = _sigerProjectLevelSection.Get(f => f.id == station.ToInt() && f.parentid==line && f.status == (int)RowState.Valid); var sectionProperty = _sectionPropertyRepository.GetList(f => f.propertytype == 3);
if (section == null) var sections = sectionProperty.Select(s => s.sectionid).ToList();
continue; var levelSection = _sigerProjectLevelSection.GetList(f => f.parentid == line && sections.Contains(f.id));
var machintAttr = _sigerProjectMachineAttribution.Get(f => f.station == section.id); if (!levelSection.Any())
if(machintAttr==null)
{ {
Logger.WriteLineInfo($"GetloadStation 未配置工站字典"); throw new BadRequestException(CommonEnum.RecordNotFound);
continue;
} }
var loadStatus = (int)Automation.MachineStatus.Waiting; var result = new List<ResponseLoadStation>();
var machineStatus = _automationMachineStatus.Get(f => f.section == section.id); foreach (var lv in levelSection)
if (machineStatus==null)
{
_automationMachineStatus.Insert(new siger_automation_machine_status
{ {
projectId=ProjectId, result.Add(new ResponseLoadStation
enable=1,
machineid=machintAttr.machine,
section=section.id,
updatetime=DateTime.Now
});
}else
{ {
section = lv.id,
status = 1,
title = lv.title,
loadStatus = machineStatus.status;
}
data.Add(new ResponseLoadStation {
section=section.id,
title=section.title,
status=loadStatus
}); });
} }
_unitOfWork.Commit(); return new ObjectResult(result);
}
return new ObjectResult(data);
} }
......
...@@ -15,7 +15,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -15,7 +15,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int sectionid { get; set; } public int sectionid { get; set; }
/// <summary> /// <summary>
/// 1:上下料工位2:加工工位3:检验工位4:装配工位5:存储工位 /// 1:上下料工位2:加工工位3:检验工位4:清洗5:存储工位
/// </summary> /// </summary>
public int propertytype { get; set; } public int propertytype { get; set; }
/// <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