Відключення RMS від Chain
https://localhost/resto/service/maintance/groovy.jsp http://localhost:8080/resto/service/maintance/groovy.jsp import resto.db.CachedEntity;
import resto.db.EntityManager;
import resto.back.store.ProductGroup;
import resto.replication.ServerInstance;
import com.google.common.collect.Sets;
import resto.HQ.corporation.DepartmentEntity;
import resto.core.EntityUtil;
import resto.db.ByValue;
em.runTransacted() {
// Відновлюємо ТП.
ServerInstance.getCurrent().getRmsDepartment().setDeleted(false);
em.getAll("ProductGroup").each() {
if (it.getParent() == null &&
it.getVisibilityFilter() != null) {
// Скидаємо параметри видимості у груп.
it.setVisibilityFilter(null);
out.println(String.format("%s %-20s %s", it.id, it.name, "Set visibility null"));
}
if (it.isHQRoot()) {
// Підчищаємо "вушка" від чейну, даємо можливість видаляти групу
it.setHQRoot(false);
out.println(String.format("%s %-20s %s", it.id, it.name, "Set isHQRoot false"));
}
}
DepartmentEntity department = ServerInstance.getCurrent().getRmsDepartment();
em.getAll("User").each() {
if (!it.isSystem()) {
// Призначаємо поточне ТП всім співробітникам/контрагентам, крім системних.
it.setAssignedDepartments(Sets.newHashSet(department));
it.setPreferredDepartment(department);
it.setResponsibilityDepartments(Sets.newHashSet(department));
out.println(String.format("%s %-20s %s", it.id, it.name, "Set current department"));
}
}
if (!department.getEgaisConnectionsSettings().isRmsManagedConnection()) {
// Налаштовуємо роботу з УТМ в РМС
department.getEgaisConnectionsSettings().setRmsManagedConnection(true);
EntityUtil.updateEntity(ByValue.wrap(department));
out.println(String.format("%s %-20s %s", department.id, department.name, "EGAIS: set rmsManagedConnection true"));
}
}
Якщо УТМ не використовується з першого скрипту, потрібно прибрати блок з налаштуванням роботи УТМ через РМС:
if (!department.getEgaisConnectionsSettings().isRmsManagedConnection()) {
// Налаштовуємо роботу з УТМ в РМС
department.getEgaisConnectionsSettings().setRmsManagedConnection(true);
EntityUtil.updateEntity(ByValue.wrap(department));
out.println(String.format("%s %-20s %s", department.id, department.name, "EGAIS: set rmsManagedConnection true"));
} import resto.HQ.corporation.Corporation
import resto.replication.ServerInstance
em.runTransacted() {
// Скидаємо прив'язку до Чейну.
ServerInstance.getCurrent().setHQNode(null);
// Розриваємо зв'язок із Чейном.
ServerInstance.getCurrent().setRegistered(false);
// Забуваємо CRM ID Чейна.
// Забуваємо CRM ID Чейна.
Corporation corporation = em.getSingleton(Corporation.class);
corporation.updating();
corporation.update();
corporation.setCrmId(null);
corporation.updating();
corporation.update();
}