157 lines
5.7 KiB
Python
157 lines
5.7 KiB
Python
|
|
from hardware.transmitter import TransmitterController
|
|||
|
|
from core.core_utils import CoreUtils
|
|||
|
|
import math
|
|||
|
|
|
|||
|
|
|
|||
|
|
class PdVolume:
|
|||
|
|
|
|||
|
|
@staticmethod
|
|||
|
|
def get_fact_volume_12(transmitter_controller:TransmitterController,mould_code:str='') -> float:
|
|||
|
|
"""获取实际派单发量"""
|
|||
|
|
# _now_volume=0
|
|||
|
|
block_number = mould_code.split('-')[0][-2:]
|
|||
|
|
if not block_number:
|
|||
|
|
print('分块号不能为空')
|
|||
|
|
return 0
|
|||
|
|
_pd_volume=0
|
|||
|
|
_init_lower_weight=transmitter_controller.read_data(2)
|
|||
|
|
if _init_lower_weight is None:
|
|||
|
|
print(f'获取重量异常,上料斗传感器错误')
|
|||
|
|
print(f'获取重量异常,上料斗传感器错误')
|
|||
|
|
return None
|
|||
|
|
print(f'get_fact_volumn当前重量:{_init_lower_weight}')
|
|||
|
|
_per_volume=2480
|
|||
|
|
_left_volume=_init_lower_weight/_per_volume
|
|||
|
|
|
|||
|
|
if block_number=='B1':
|
|||
|
|
_left_volume=_left_volume-0.5
|
|||
|
|
if _left_volume>0:
|
|||
|
|
_pd_volume=1.6-_left_volume
|
|||
|
|
_pd_volume=math.ceil(_pd_volume*10)/10
|
|||
|
|
else:
|
|||
|
|
_pd_volume=1.6
|
|||
|
|
elif block_number in ['B3','L1']:
|
|||
|
|
_pd_volume=1.5
|
|||
|
|
elif block_number=='B2':
|
|||
|
|
#浇B3
|
|||
|
|
_pd_volume=1.6
|
|||
|
|
#调整
|
|||
|
|
elif block_number=='L2':
|
|||
|
|
|
|||
|
|
if _init_lower_weight>950 and _init_lower_weight<=1350:
|
|||
|
|
_pd_volume=1.5
|
|||
|
|
elif _init_lower_weight>1350 and _init_lower_weight<=1600:
|
|||
|
|
_pd_volume=1.4
|
|||
|
|
elif _init_lower_weight<=950 and _init_lower_weight>800:
|
|||
|
|
_pd_volume=1.6
|
|||
|
|
else:
|
|||
|
|
|
|||
|
|
#1.9方,大约L2和F的量
|
|||
|
|
_pd_volume=1.9
|
|||
|
|
# if _weight>1300:
|
|||
|
|
#留0.15 math.floor(_now_volume*10)/10 保留一位小数,丢掉其他的
|
|||
|
|
# if prev_pd_volume>0:
|
|||
|
|
# _pd_volume=_pd_volume-(_left_volume+prev_pd_volume-1.86)
|
|||
|
|
# else:
|
|||
|
|
#不知道上一块叫的多少
|
|||
|
|
_pd_volume=_pd_volume-(_left_volume+1.6-1.46)
|
|||
|
|
_pd_volume=math.ceil(_pd_volume*10)/10+0.1
|
|||
|
|
# _pd_volume=math.ceil(_pd_volume*10)/10
|
|||
|
|
if _pd_volume>2.1:
|
|||
|
|
_pd_volume=2.1
|
|||
|
|
elif _pd_volume<0.8:
|
|||
|
|
_pd_volume=0.8
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
return _pd_volume
|
|||
|
|
|
|||
|
|
@staticmethod
|
|||
|
|
def get_fact_volume(transmitter_controller:TransmitterController,mould_code:str='') -> float:
|
|||
|
|
"""获取实际派单发量"""
|
|||
|
|
# _now_volume=0
|
|||
|
|
block_number = mould_code.split('-')[0][-2:]
|
|||
|
|
if not block_number:
|
|||
|
|
print('分块号不能为空')
|
|||
|
|
return 0
|
|||
|
|
_pd_volume=0
|
|||
|
|
_init_lower_weight=transmitter_controller.read_data(2)
|
|||
|
|
if _init_lower_weight is None:
|
|||
|
|
print(f'获取重量异常,上料斗传感器错误')
|
|||
|
|
print(f'获取重量异常,上料斗传感器错误')
|
|||
|
|
return None
|
|||
|
|
print(f'get_fact_volumn当前重量:{_init_lower_weight}')
|
|||
|
|
_per_volume=2480
|
|||
|
|
_left_volume=_init_lower_weight/_per_volume
|
|||
|
|
|
|||
|
|
if block_number=='B1':
|
|||
|
|
_left_volume=_left_volume-0.6
|
|||
|
|
if _left_volume>0:
|
|||
|
|
_pd_volume=2-_left_volume
|
|||
|
|
_pd_volume=math.ceil(_pd_volume*10)/10
|
|||
|
|
else:
|
|||
|
|
_pd_volume=2
|
|||
|
|
elif block_number in ['B3','L1']:
|
|||
|
|
_pd_volume=1.9
|
|||
|
|
elif block_number=='B2':
|
|||
|
|
#浇B3
|
|||
|
|
_pd_volume=2
|
|||
|
|
#调整
|
|||
|
|
elif block_number=='L2':
|
|||
|
|
if _init_lower_weight>1300 and _init_lower_weight<=1700:
|
|||
|
|
_pd_volume=1.9
|
|||
|
|
elif _init_lower_weight>1700 and _init_lower_weight<=1950:
|
|||
|
|
_pd_volume=1.8
|
|||
|
|
elif _init_lower_weight<=1300 and _init_lower_weight>1150:
|
|||
|
|
_pd_volume=2
|
|||
|
|
else:
|
|||
|
|
|
|||
|
|
#2.4方,大约L2和F的量
|
|||
|
|
_pd_volume=2.4
|
|||
|
|
# if _weight>1300:
|
|||
|
|
#留0.15 math.floor(_now_volume*10)/10 保留一位小数,丢掉其他的
|
|||
|
|
# if prev_pd_volume>0:
|
|||
|
|
# _pd_volume=_pd_volume-(_left_volume+prev_pd_volume-1.86)
|
|||
|
|
# else:
|
|||
|
|
#不知道上一块叫的多少
|
|||
|
|
_pd_volume=_pd_volume-(_left_volume+1.9-1.86)
|
|||
|
|
_pd_volume=math.ceil(_pd_volume*10)/10+0.1
|
|||
|
|
# _pd_volume=math.ceil(_pd_volume*10)/10
|
|||
|
|
if _pd_volume>2.2:
|
|||
|
|
_pd_volume=2.2
|
|||
|
|
elif _pd_volume<0.8:
|
|||
|
|
_pd_volume=0.8
|
|||
|
|
|
|||
|
|
return _pd_volume
|
|||
|
|
|
|||
|
|
|
|||
|
|
@staticmethod
|
|||
|
|
def get_volume_expect(mould_code:str=''):
|
|||
|
|
"""获取模具预期方量"""
|
|||
|
|
_block_number=CoreUtils.get_number_by_mould_code(mould_code)
|
|||
|
|
_size=CoreUtils.get_size_by_mould_code(mould_code)
|
|||
|
|
_volume_expect=0.0
|
|||
|
|
if _size=='6600*1500':
|
|||
|
|
if _block_number=='B1':
|
|||
|
|
_volume_expect=2
|
|||
|
|
elif _block_number=='B2':
|
|||
|
|
_volume_expect=2
|
|||
|
|
elif _block_number=='B3':
|
|||
|
|
_volume_expect=1.9
|
|||
|
|
elif _block_number=='L1':
|
|||
|
|
_volume_expect=1.9
|
|||
|
|
elif _block_number=='L2':
|
|||
|
|
_volume_expect=0
|
|||
|
|
elif _size=='6600*1200':
|
|||
|
|
if _block_number=='B1':
|
|||
|
|
_volume_expect=1.6
|
|||
|
|
elif _block_number=='B2':
|
|||
|
|
_volume_expect=1.6
|
|||
|
|
elif _block_number=='B3':
|
|||
|
|
_volume_expect=1.5
|
|||
|
|
elif _block_number=='L1':
|
|||
|
|
_volume_expect=1.5
|
|||
|
|
elif _block_number=='L2':
|
|||
|
|
_volume_expect=0
|
|||
|
|
|
|||
|
|
return _volume_expect
|