feat(espptemplatesync): Изменение статуса шаблона для робота на Wait при необходимости его обновления в АСУ ЕСПП
This commit is contained in:
@@ -103,13 +103,13 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var mappedTemplate = mapper.Map<EsppTemplate>(template);
|
var mappedTemplate = mapper.Map<EsppTemplate>(template);
|
||||||
if (mappedTemplate == null)
|
if (mappedTemplate == null)
|
||||||
return;
|
return;
|
||||||
var isChanged = IsChanged(mappedTemplate, esppTemplate);
|
var isChanged = IsChanged(mappedTemplate, esppTemplate);
|
||||||
|
|
||||||
if (isChanged)
|
if (isChanged)
|
||||||
{
|
{
|
||||||
SetUpdateStatus(template);
|
SetUpdateStatus(templateService, template);
|
||||||
|
|
||||||
if (!await templateService.CommitAsync())
|
if (!await templateService.CommitAsync())
|
||||||
{
|
{
|
||||||
@@ -117,16 +117,17 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
logger.LogInformation($"----- Установлен принудительный статус обновления Template {template.Name} -----");
|
logger.LogInformation($"----- Установлен принудительный статус обновления Template {template.Name} -----");
|
||||||
}
|
} //надо ли проверять если не изменился, но был статус Updating не понятно. Доверяем роботу пока, что после окончания работ от точно сообщит
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetUpdateStatus(Template template)
|
private void SetUpdateStatus(ITemplateService templateService, Template template)
|
||||||
{
|
{
|
||||||
template.StatusCode = (int)StatusTemplateEnum.Updating;
|
template.StatusCode = (int)StatusTemplateEnum.Updating;
|
||||||
|
templateService.ChangeRobotStatus(RobotStatusEnum.Wait, ref template);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsChanged(EsppTemplate template, EsppTemplate esppTemplate)
|
private bool IsChanged(EsppTemplate template, EsppTemplate esppTemplate)
|
||||||
@@ -147,7 +148,7 @@ namespace PARR.EsppTemplateSync.Services
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user