pd9427
This commit is contained in:
@ -51,6 +51,11 @@ class SystemState:
|
||||
#当前模具状态
|
||||
self._feed_status=FeedStatus.FNone
|
||||
|
||||
#控制派单状态,1为可以派单 0未派单 2完成派单
|
||||
self.pd_status=PD_StatusEnum.PD_Not
|
||||
#记录当前派单编号
|
||||
self.pd_mould_code=''
|
||||
|
||||
#下料比例变频
|
||||
self.vf_frequencys=[{'radio':0,'fre':230},{'radio':0.3,'fre':230},{'radio':0.6,'fre':230}]
|
||||
|
||||
@ -59,6 +64,7 @@ class SystemState:
|
||||
self.mould_vibrate_time=0
|
||||
#当前浇筑模具,ArtifactInfo对象需要属性:ArtifactID,ArtifactActionID,MouldCode (RFID情况下绑定)
|
||||
self.current_mould=None
|
||||
self.current_block_number=''
|
||||
|
||||
|
||||
# 视觉系统状态
|
||||
@ -91,18 +97,14 @@ class SystemState:
|
||||
self.save_db(public_name,value) #有影响的话改成异步
|
||||
else:
|
||||
if public_name=='mould_finish_weight':
|
||||
if time.time()-self.opc_timestamp>=1:
|
||||
self.opc_queue.put_nowait((public_name, value))
|
||||
self.opc_timestamp=time.time()
|
||||
return
|
||||
elif public_name=='mould_finish_ratio':
|
||||
if time.time()-self.opc_timestamp>=1:
|
||||
if time.time()-self.opc_timestamp>=1 or value>=1:
|
||||
if value>1:
|
||||
value=1
|
||||
self.opc_queue.put_nowait((public_name, value))
|
||||
self.opc_queue.put_nowait(('mould_finish_weight', self._mould_finish_weight))
|
||||
self.opc_timestamp=time.time()
|
||||
elif value>=1:
|
||||
#保证比例能到100%
|
||||
self.opc_queue.put_nowait((public_name, value))
|
||||
self.opc_queue.put_nowait(('mould_finish_weight', self._mould_finish_weight))
|
||||
self.opc_timestamp=time.time()
|
||||
else:
|
||||
self.opc_queue.put_nowait((public_name, value))
|
||||
except queue.Full:
|
||||
@ -117,16 +119,21 @@ class SystemState:
|
||||
def save_db(self,public_name,val):
|
||||
if not val:
|
||||
return
|
||||
if public_name=="db_mould_status":
|
||||
_code=val['mould_code']
|
||||
if _code:
|
||||
_status=val['status']
|
||||
if _status==3:
|
||||
#完成生产
|
||||
self.bll_artifact.finish_produce(_code,val['weight'])
|
||||
elif _status==2:
|
||||
#开始生产
|
||||
self.bll_artifact.start_produce(_code)
|
||||
try:
|
||||
if public_name=="db_mould_status":
|
||||
_code=val['mould_code']
|
||||
if _code:
|
||||
_status=val['status']
|
||||
if _status==3:
|
||||
#完成生产
|
||||
self.bll_artifact.finish_produce(_code,val['weight'])
|
||||
self.opc_queue.put_nowait(('sys_segment_refresh',1))
|
||||
elif _status==2:
|
||||
#开始生产
|
||||
self.bll_artifact.start_produce(_code)
|
||||
self.opc_queue.put_nowait(('sys_segment_refresh',1))
|
||||
except queue.Full:
|
||||
pass
|
||||
|
||||
|
||||
class FeedStatus(IntEnum):
|
||||
@ -155,11 +162,32 @@ class Upper_Door_Position(IntEnum):
|
||||
ZDS = 2
|
||||
Returning = 3
|
||||
|
||||
class PD_StatusEnum(IntEnum):
|
||||
# 预定派单
|
||||
PD_Ready = 1
|
||||
# 不派单
|
||||
PD_Not = 0
|
||||
# 完成派单下发
|
||||
PD_Send_Finish = 2
|
||||
#派单超时
|
||||
PD_TimeOut=3
|
||||
#未扫码
|
||||
PD_UnScan=4
|
||||
#已完成
|
||||
PD_Finish=5
|
||||
|
||||
#派单错误
|
||||
PD_Error=1001
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# class Upper_PLC_Status(IntEnum):
|
||||
# # 即将振捣室
|
||||
# PLC_ZDS_Ready = 4
|
||||
# #到达振捣室
|
||||
# #到达
|
||||
# PLC_ZDS_Finish = 5
|
||||
# #即将搅拌楼
|
||||
# PLC_JBL_Ready = 64
|
||||
|
||||
Reference in New Issue
Block a user