Skip to end of metadata
Go to start of metadata

Problem

You are trying to delete a Schedule Entry in the MES Schedule View or force run it in the MES Schedule Selector Component
and get this error in the Console

GatewayException: There can only be one property of type Response Equipment for object (<Material+Equipment>_CO, RequestSegment, <some UUID>) and one already exists (<some Equipment>, <some UUID>).

Solution

It is unclear how you got there?
maybe you changed the Equipment (rename, update, add a cell ?) after the Material was already assigned?
maybe you changed the Operation Segments or Definition although a WorkOrder was already created?

  1. first note the 
    MESOperationsRequestUUID
    that you can find in the MES Schedule Selector



  2. in the Database Browser of the Designer 

    update MESOperationsSchedule set Enabled = 0 where MESOperationsScheduleUUID = 
    (select ScheduleRefUUID from MESOperationsRequest where MESOperationsRequestUUID = '<the UUID you found in step 1>')
    
    update MESRequestSegment set Enabled = 0  where OperationsRequestRefUUID = '<the UUID you found in step 1>'
    
    update MESOperationsRequest set Enabled = 0 where MESOperationsRequestUUID = '<the UUID you found in step 1>'
  3. refresh the Cache
    in theScript Console

    #This code removes the cache from the gateway
    system.mes.invalidateCache()
    system.mes.analysis.invalidateAnalysisCache()

  4. you will probably either have to close the Work Order window or change to a different Equipment (Line)
    to see the  effect (i.e. the ghost Schedule entry) disappear

Specifically for MES 2.0

one way the system can get in this state is by not reloading an object after executing and it can end up creating the property twice.
(in 3.0 when we encounter this we automatically disable all but one property so this doesn't trigger that error)

you could get this error for example doing in the Script Console 
system.mes.loadMESObject('79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd')
returning the dreaded

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: 
There can only be one property of type Response Equipment for object 
(<some Operation Segment name>, RequestSegment, 79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd) 
and one already exists (<some Equipment name>, a14a3b8a-49c0-470d-8003-4169483df1f2).

the operationsRequestUUID here is 79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd


To fix it:

1) select * from MESResponseEquipmentProperty where MESObjectUUID = '79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd'
that should (wrongfully!) return two rows, 

2) then set one of the above to  enabled = 0
update MESResponseEquipmentProperty set Enable = 0 where MESPropertyUUID = 'c0bf0842-5864-4e13-847f-7fc1a5eff4e5

3) check that the problem is fixed
system.mes.loadMESObject('79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd')

will return only one row now:

>>>
RequestSegment (79a0f9bb-f7d8-491b-a7d2-ffd2f34bdffd, <some Operation Segment name>, 0 parents, 0 children, 0 custom properties, 7 complex properties)

>>>

4) refresh the Cache
in theScript Console

#This code removes the cache from the gateway
system.mes.invalidateCache()
system.mes.analysis.invalidateAnalysisCache()

Create an Operation that will start Automatically, on Schedule