Compare commits

..

No commits in common. '7e9f5beb4ae9f0fd11262ddcc40555bf5230aec4' and '13db8caf4659d7dbc372fc966c54c30a05eb93f0' have entirely different histories.

Binary file not shown.

Binary file not shown.

@ -50,7 +50,7 @@ class TbCombox(QComboBox):
def initUI(self):
# 创建ComboBox
self.addItems(["压力转换块", "温度转换块", "物位转换块", "流量转换块", 'WIKA液位计','开封流量计'])
self.addItems(["压力转换块", "温度转换块", "物位转换块", "流量转换块", 'WIKA液位计'])
self.setEditable(True) # 设置为可编辑以应用样式表隐藏文本
self.setObjectName('tbcombox')
@ -80,8 +80,8 @@ class DynamicAddBlock(QHBoxLayout):
self.blockViewlist = []
self.tbtypeList = TbtypeList #存放转换块的各种类型
# print(self.tbtypeList)
self.tbList = ['PressureTranslationBlock', 'TemperatureTranslationBlock', 'LevelTranslationBlock', 'FlowTranslationBlock', 'WiKaLevelTranslationBlock', 'KaiFengFlowTranslationBlock'] #存放四个转换块
self.enumList = [TBType.pressureTB, TBType.tempTB, TBType.levelTB, TBType.flowTB, TBType.wikaLevelTB, TBType.kfFlowTB]
self.tbList = ['PressureTranslationBlock', 'TemperatureTranslationBlock', 'LevelTranslationBlock', 'FlowTranslationBlock', 'WiKaLevelTranslationBlock'] #存放四个转换块
self.enumList = [TBType.pressureTB, TBType.tempTB, TBType.levelTB, TBType.flowTB, TBType.wikaLevelTB]
self.initUI()
def initUI(self):
@ -149,7 +149,7 @@ class DynamicAddBlock(QHBoxLayout):
case None:
tbcombox.setCurrentIndex(4)
tblockBtn = QPushButton(tbcombox.currentText() + str(i + 1))
print(1)
@ -194,7 +194,7 @@ class DynamicAddBlock(QHBoxLayout):
buttonNumber = button.text()[-1]
button.setText(tbType + str(buttonNumber))
if button.isChecked():
stackIndex = (int(self.blocklist[0]) + int(self.blocklist[2]) + index) + (int(buttonNumber) - 1) * 6
stackIndex = (int(self.blocklist[0]) + int(self.blocklist[2]) + index) + (int(buttonNumber) - 1) * 5
print(stackIndex)
self.parameStackWidget.setCurrentIndex(stackIndex)
@ -362,7 +362,6 @@ class BlockParameterManageWidget(QWidget):
TbtypeList = self.blockManage.TBTypeList
self.blockLayout = DynamicAddBlock(blocklist, TbtypeList)
self.scroWidget = QWidget()
self.scroWidget.setObjectName('scroWidget')
self.scroWidget.setLayout(self.blockLayout)
self.scroArea.setWidget(self.scroWidget)

@ -52,7 +52,7 @@ class VarTableModel(QAbstractTableModel):
return
# for row in range(self.rowCount()):
if 'unit' in self.datas[row][2].lower() or 'unt' in self.datas[row][2].lower():
if 'unit' in self.datas[row][2].lower():
unit = UnitTable.getUnitSymbolByUnitValue(value)
value = unit if unit else value
self.datas[row][6] = value
@ -140,7 +140,7 @@ class VarTableModel(QAbstractTableModel):
def updateValue(self, valueList):
for index, value in enumerate(valueList):
if 'unit' in self.datas[index][2].lower() or 'unt' in self.datas[index][2].lower():
if 'unit' in self.datas[index][2].lower():
unit = UnitTable.getUnitSymbolByUnitValue(value)
value = unit if unit else value
self.datas[index][6] = value
@ -202,7 +202,7 @@ class VarButtonDelegate(QItemDelegate):
boxLayout.addWidget(refreshButton,1)
combox.index = [index.row(), index.column()]
elif 'unit' in objectType.lower() or 'unt' in objectType.lower():
elif 'unit' in objectType.lower():
comboxUnit = QComboBox()
comboxUnit.setObjectName('modeCombox')
comboxUnit.addItem('下拉选择')

@ -18,6 +18,6 @@ class Client(object):
else:
self.deviceDB = SqliteDatabase(dbPath)
client_proxy.initialize(self.deviceDB)
modelsArr = [DeviceDB, PressureTranslationBlock, PhysicalBlock, AIFunctionBlock, TemperatureTranslationBlock, LevelTranslationBlock, FlowTranslationBlock, WiKaLevelTranslationBlock, KaiFengFlowTranslationBlock, UnitTable]
modelsArr = [DeviceDB, PressureTranslationBlock, PhysicalBlock, AIFunctionBlock, TemperatureTranslationBlock, LevelTranslationBlock, FlowTranslationBlock, WiKaLevelTranslationBlock, UnitTable]
self.deviceDB.connect()
self.deviceDB.create_tables(modelsArr, safe = True)

@ -40,7 +40,6 @@ class TBType(Enum):
levelTB = -3 # 物位转换块
pressureTB = -4
wikaLevelTB = -5
kfFlowTB = -6
class BlockManage():
_instance = None
@ -116,7 +115,6 @@ class BlockManage():
for key, value in dirMesDic.items():
# print(key, value)
if key == 1:
entryTuples = []
data = self.DPV1Master.readParm(address = self.address, slot = 1, index = 1, length = dirLength + 4 * value)
else:
data = self.DPV1Master.readParm(address = self.address, slot = 1, index = key, length = 4 * value)
@ -138,7 +136,7 @@ class BlockManage():
# print(blkIndex, blkoffect, numBlk)
for i in range(numBlk):
blkEntryListIndex = blkoffect - 1 + i
print(blkEntryListIndex, entryTuples)
# print(blkEntryListIndex, entryTuples)
blkPointerByte = struct.pack('>h', entryTuples[blkEntryListIndex][0])
numBlkParms = entryTuples[blkEntryListIndex][1]
blkSlot = int(blkPointerByte[0])
@ -219,8 +217,7 @@ class Block():
TBType.pressureTB: PressureTranslationBlock.getallParame,
TBType.tempTB: TemperatureTranslationBlock.getallParame,
TBType.levelTB: LevelTranslationBlock.getallParame,
TBType.wikaLevelTB: WiKaLevelTranslationBlock.getallParame,
TBType.kfFlowTB: KaiFengFlowTranslationBlock.getallParame
TBType.wikaLevelTB: WiKaLevelTranslationBlock.getallParame
}.get(self.blockType, lambda: [])
parmsData = getParmsFunc()

@ -150,7 +150,7 @@ class DPV1Master():
closeProtocolHex = b'\x05\x00'
closeProtocolData = struct.unpack('>h', closeProtocolHex)
self.writeMultipleRegister(1, 750, closeProtocolData)
time.sleep(1.5)
time.sleep(1)
# print(identNumer)
idHighHex = int(identNumer[:2], 16).to_bytes(1, byteorder='little')
idLowHex = int(identNumer[2:], 16).to_bytes(1, byteorder='little')
@ -159,7 +159,7 @@ class DPV1Master():
editAddressDate = struct.unpack('>hhhh', editAddressStream)
# print(editAddressDate)
self.writeMultipleRegister(1, 750, self.resetData)
time.sleep(0.7)
time.sleep(0.2)
self.writeMultipleRegister(1, 750, editAddressDate)
time.sleep(0.4)
value = self.readHoldingRegisters(1, 750, 2)

@ -154,18 +154,6 @@ class WiKaLevelTranslationBlock(PressureTranslationBlock):
description = CharField()
createTime = CharField()
class KaiFengFlowTranslationBlock(PressureTranslationBlock):
index = CharField()
paramName = CharField()
objectType = CharField()
dataType = CharField()
saveType = CharField()
dataSize = CharField()
accessType = CharField()
transferType = CharField()
description = CharField()
createTime = CharField()
class UnitTable(BaseModel):
unitValue = CharField()

Loading…
Cancel
Save