Error when use integer signal to trigger work process

Hi,

I am trying to write the integer signal using python script which is used to control the work process.

I wrote the signal:
while True:
d = 0.8
delay(d)

if wf.Value or sensor.Value:
  print wf.Value, sensor.Value
  #initial state
  state = 0
  
  if raySensor.ComponentSignal.Value:
    prodid = raySensor.ComponentSignal.Value.ProdID
    
  if sensor.Value and not trigger.Value and prodid == '000':
    state = 1
    #state_sig.signal(state) 
    print 'Load product at 1st station'
    
  elif sensor.Value and trigger.Value:
    state = 3
    #state_sig.signal(state) 
    print 'Pass product at 1st station'
    
  elif not sensor.Value and wf.Value:
    state = 2
    #state_sig.signal(state)
    print 'Unload product at 1st station'
   
  print state_sig.Value
  if state_sig.Value != state and state != 0:
    state_sig.signal(state)

However, the work process did not get the new signal and trigger the switch case.
How can I update the signal to work process?

testWorkProcess_ATS_step0.vcmx (2.6 MB)
=======Below is the code in work process====
WaitSignal:Works Process:state:0?1?2?3:False
<0>
Delay:0.5
<>
<1>
Print:Load part:True:False
HumanProcess:1:waitForProd:
TransportIn::True
ChangeID::111
Feed:111:pick111:::False:False:
<>
<2>
Print:Unload part:True:False
HumanProcess:1:waitForProd:
Need:101
TransportOut::True
<>
<3>
Print:Pass part:True:False
TransportIn::True
TransportOut::True
<>