Names of workplaces and operations

From PlcWiki

Jump to: navigation, search

The names of workplaces and operations are stored in SL tables workplace and operation. If workplaces and/or operations are being changed during time, it is possible to define their validity using fields validFrom and validTo.

Below there is an example of when you need to rename an operation. It is necessary to do it the following way:

1. Change the validity of the current record

For example you have the following record:

mysql> select * from operation where id = 'RO2' order by validFrom;
+-------+---------+------+------------------+---------+---------------------+---------+
| place | project | id   | name             | orderid | validFrom           | validTo |
+-------+---------+------+------------------+---------+---------------------+---------+
| vit   |         | RO2  | APRIETES ESPIRAL |     287 | 1990-01-01 00:00:00 | NULL    | 
+-------+---------+------+------------------+---------+---------------------+---------+

So change its validity (validTo):

update operation set validTo = '2014-02-12 10:00' where id = 'RO2' and validTo is null;

2. Create a new record with a new name

insert into operation (place, project, id, name, orderid, validFrom, validTo) values ('vit', '', 'RO2', 'New name', 287, '2014-02-12 10:00' null);

Of course, you can use an alternatives in your gui frontend.

You shouldn’t delete or change the current (or old) records, if they are (were) correct, because in case when old cockpits are searched and displayed, they should show the names of workplaces and operations valid in their time of assembly.

Personal tools