示例#1
0
    def onOk(self):
        # 数据库中查找id对应的矿井
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:H1)!')
            return

        # 更新数据到界面
        mine.reserve_w1, ok = self.ui.reserve_w1.text().toDouble()
        mine.reserve_w2, ok = self.ui.reserve_w2.text().toDouble()
        mine.rock_gas_k2, ok = self.ui.rock_gas_k2.text().toDouble()
        mine.reserve_w3, ok = self.ui.reserve_w3.text().toDouble()

        # 计算W
        W1, W2, W3 = mine.reserve_w1, mine.reserve_w2, mine.reserve_w3
        W = W1 + W2 + W3
        mine.reserve_gas = W

        # 提交到数据库
        if SQLClientHelper.UpdateMine(mine):
            # 更新外部传入的变量
            self.reserve_gas = W
            UiHelper.MessageBox(u'恭喜您,更新数据成功!!!')
            # 关闭对话框并返回1
            self.accept()
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:H2)!')
示例#2
0
	def onCacl(self):
		# 数据库中查找id对应的矿井
		mine = SQLClientHelper.GetMineById(self.mine_id)
		if mine.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:I1)!')
			return
		
		# 更新数据到界面(与onOk的代码有重复,逻辑有点混乱)
		mine.pump_k2, ok = self.ui.pump_k2.text().toDouble()
		mine.pump_k3, ok = self.ui.pump_k3.text().toDouble()
		mine.pump_k4, ok = self.ui.pump_k4.text().toDouble()
		mine.gas_w0, ok = self.ui.gas_w0.text().toDouble()
		mine.gas_wc2, ok = self.ui.gas_wc2.text().toDouble()	 

		K2, K3, K4, My, Mc = mine.pump_k2, mine.pump_k3, mine.pump_k4, mine.gas_w0, mine.gas_wc2

		if My <= 0:
			UiHelper.MessageBox(u'煤层原始瓦斯含量My的值必须大于0!!!')
		else:
			# 计算瓦斯涌出程度系数K1
			K1 = K4 * ( My - Mc ) / My
			self.ui.pump_k1.setText(u'%.1f' % K1)
			# 计算可抽系数K
			K = K1 * K2 * K3
			self.ui.pump_k.setText(u'%.1f' % K)
示例#3
0
    def fillProtectLayerTable(self):
        # 清空
        self.ui.protect_layer_table.clearContents()
        # 查找矿井辖属的煤层
        coal_lists = SQLClientHelper.GetCoalListByForeignKey(
            'mine_id', self.mine_id)
        self.ui.protect_layer_table.setRowCount(len(coal_lists))
        for i, coal in enumerate(coal_lists):
            self.ui.protect_layer_table.setItem(
                i, 0, QtGui.QTableWidgetItem(u'%d' % (i + 1)))
            self.ui.protect_layer_table.setItem(
                i, 1,
                QtGui.QTableWidgetItem(u'%s' % coal.name.decode('utf-8')))
            self.ui.protect_layer_table.setItem(
                i, 2, QtGui.QTableWidgetItem(u'%.1f' % coal.dip_angle))
            self.ui.protect_layer_table.setItem(
                i, 3, QtGui.QTableWidgetItem(u'%.1f' % coal.thick))

            mine = SQLClientHelper.GetMineById(self.mine_id)
            if mine.id <= 0 or mine.protect_layer_condition == 0:
                self.ui.protect_layer_table.setItem(
                    i, 4, QtGui.QTableWidgetItem(u'—'))
            else:
                protect_item = u'保护层' if coal.is_protectable != 0 else u'被保护层'
                self.ui.protect_layer_table.setItem(
                    i, 4, QtGui.QTableWidgetItem(protect_item))
示例#4
0
    def fillMineDatas(self):
        # 数据库中查找id对应的矿井
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:E2)!')
            return

        # 填充数据
        name = mine.name.decode('utf-8')
        capacity = mine.capacity
        province = mine.province.decode('utf-8')
        city = mine.city.decode('utf-8')
        topo_geo = mine.topo_geo
        hydr_geo = mine.hydr_geo
        ground_condition = mine.ground_condition
        protect_layer_condition = mine.protect_layer_condition
        # 查找矿区
        mine_region = SQLClientHelper.GetMineRegionById(mine.mine_region_id)
        # combobox里的text好像不需要unicode,貌似不需要"编码"(encode)
        region_name = 'null' if mine_region.id < 0 else mine_region.name
        # 根据矿区名称反查煤炭基地
        base_name = CbmClientHelper.GetBaseByRegion(region_name)

        # 填充矿井数据
        self.ui.name.setText(name)
        self.ui.capacity.setText(u'%.2f' % capacity)
        self.ui.province.setText(province)
        self.ui.city.setText(city)
        self.ui.topo_geo.setCurrentIndex(topo_geo - 1)
        self.ui.hydr_geo.setCurrentIndex(hydr_geo - 1)
        self.ui.ground_cond.setChecked(ground_condition != 0)
        self.ui.base.setCurrentIndex(self.ui.base.findText(base_name))
        self.ui.region.setCurrentIndex(self.ui.region.findText(region_name))
        self.ui.protect_layer_condition.setChecked(
            protect_layer_condition != 0)
示例#5
0
 def init(self):
     # 数据库中查找id对应的矿井
     mine = SQLClientHelper.GetMineById(self.mine_id)
     if mine.id <= 0:
         UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G1)!')
         return
     # 更新数据到界面
     self.ui.reserve_gas.setText(u'%.1f' % mine.reserve_gas)
     self.ui.pump_wc.setText(u'%.1f' % mine.pump_wc)
示例#6
0
    def fillMineData(self):
        # 根据id在数据库中查找矿井
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0: return

        # 更新数据到界面
        self.ui.k1_gas.setText(u'%.1f' % mine.gas_k1)
        self.ui.k2_gas.setText(u'%.1f' % mine.gas_k2)
        self.ui.qr.setText(u'%.1f' % mine.qr)
示例#7
0
 def init(self):
     # 数据库中查找id对应的矿井
     mine = SQLClientHelper.GetMineById(self.mine_id)
     if mine.id <= 0:
         UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:H1)!')
         return
     # 更新数据到界面
     self.ui.reserve_w1.setText(u'%.1f' % mine.reserve_w1)
     self.ui.reserve_w2.setText(u'%.1f' % mine.reserve_w2)
     self.ui.rock_gas_k2.setText(u'%.1f' % mine.rock_gas_k2)
     self.ui.reserve_w3.setText(u'%.1f' % mine.reserve_w3)
示例#8
0
def show_report12(coal, tws_tech):
    # 生成参数
    params = {}
    # 矿井名称
    mine = SQLClientHelper.GetMineById(coal.mine_id)
    params['mine_name'] = mine.name
    # 工作面名称
    # 搜索矿井的所有工作面中的第一个(按道理应该是从界面中提供工作面名称!!!)
    work_surf_list = CbmClientHelper.GetWorkSurfsOfMine(mine.id)
    if len(work_surf_list) == 0:
        params['face_name'] = 'W292'
    else:
        params['face_name'] = work_surf_list[0].name
    # 条带长度
    params['strip_length'] = tws_tech.l_stripe
    # 上下左右帮距
    params['contrl_range_up'] = tws_tech.top_side
    params['contrl_range_down'] = tws_tech.bottom_side
    params['contrl_range_left'] = tws_tech.left_side
    params['contrl_range_right'] = tws_tech.right_side
    # 孔底间距
    params['gbp'] = tws_tech.gbp
    # 钻孔直径
    params['pore_diameter'] = tws_tech.dp
    # 钻孔间距
    params['pore_gap'] = tws_tech.gp
    # 封孔长度(界面中没有输入,网上搜的一个参照值)
    # http://wenku.baidu.com/link?url=4QOLWZsUfFu5zLewMQCeF_WRzYTWmBYE3SRyk1Cj_JTc1UzbZR54NNkrXUsKc1PDj1Kg4492gfSNaKweJTSWxVqz7VbM-b7G3IAbtcdifBy
    params['close_length'] = tws_tech.close_length
    # 巷道长度
    params['tunnel_length'] = tws_tech.lm
    # 循环个数
    params['cycle_num'] = int(tws_tech.lm /
                              (tws_tech.l_stripe - tws_tech.leading_dist))
    # 模板文件路径(必须参数)
    params['reportlet'] = 'cbm12.cpt'
    # 设计方案id(必须参数)
    params['design_id'] = tws_tech.design_technology_id
    # 是否按页面大小显示
    params['__bypagesize__'] = 'true'
    # 查询所有钻孔
    pore_lists = CbmClientHelper.GetAllPores(tws_tech.design_technology_id)
    # 计算钻孔个数
    params['pore_num'] = len(pore_lists)
    # 计算钻孔总长度
    params['pore_sum'] = sum([pore.length for pore in pore_lists])

    # 显示报表
    # params参数中的字符串数据包括key即可以是utf8编码的str字节数组,也可以是unicode字符串
    # show_report方法内部会自动处理
    show_report(params)
示例#9
0
    def onOk(self):
        # 数据库中查找id对应的矿井
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G1)!')
            return
        # 更新数据到界面
        mine.reserve_gas, ok = self.ui.reserve_gas.text().toDouble()
        mine.pump_wc, ok = self.ui.pump_wc.text().toDouble()

        if SQLClientHelper.UpdateMine(mine):
            UiHelper.MessageBox(u'恭喜您,更新数据成功!!!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:D1)!')
示例#10
0
	def init(self):
		# 数据库中查找id对应的矿井
		mine = SQLClientHelper.GetMineById(self.mine_id)
		if mine.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:H1)!')
			return
		# 更新数据到界面
		self.ui.pump_k2.setText(u'%.1f' % mine.pump_k2)
		self.ui.pump_k3.setText(u'%.1f' % mine.pump_k3)
		self.ui.pump_k4.setText(u'%.1f' % mine.pump_k4)
		self.ui.gas_w0.setText(u'%.1f' % mine.gas_w0)
		self.ui.gas_wc2.setText(u'%.1f' % mine.gas_wc2)
		self.ui.pump_k.setText(u'%.1f' % mine.pump_k)
		self.ui.pump_k1.setText(u'%.1f' % mine.pump_k1)
示例#11
0
    def onWorkAreaCacl(self):
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0: return

        # 将数据保存到矿井对象中用于后续计算
        mine.gas_k2, ok = self.ui.k2_gas.text().toDouble()
        # 调用rpc进行计算
        qr = CbmClientHelper.MineGasFlow(mine)

        if qr <= 0:
            UiHelper.MessageBox(u'错误:采区的日产量必须要大于0!!!')
            qr = 0.0
        else:
            UiHelper.MessageBox(u'更新"相对瓦斯涌出量"计算结果!')
        # 更新计算结果到界面
        self.ui.qr.setText(u'%.1f' % qr)
示例#12
0
def show_report32(coal, goaf_tech):
    # 生成参数
    params = {}
    # 矿井名称
    mine = SQLClientHelper.GetMineById(coal.mine_id)
    params['mine_name'] = mine.name
    # 工作面名称
    # 搜索矿井的所有工作面中的第一个(按道理应该是从界面中提供工作面名称!!!)
    work_surf_list = CbmClientHelper.GetWorkSurfsOfMine(mine.id)
    if len(work_surf_list) == 0:
        params['face_name'] = 'W292'
    else:
        params['face_name'] = work_surf_list[0].name
    # 工作面走向长度
    params['strike_length'] = goaf_tech.l1
    # 工作面倾向长度
    params['tendency_length'] = goaf_tech.l2
    # 钻孔压茬长度
    params['pore_stubble'] = goaf_tech.pore_stubble
    # 钻孔间距
    params['pore_gap'] = goaf_tech.gp
    # 钻孔直径
    params['pore_diameter'] = goaf_tech.dp
    # 钻孔间距
    params['pore_gap'] = goaf_tech.gp
    # 封孔长度(界面中没有输入,网上搜的一个参照值)
    # http://wenku.baidu.com/link?url=4QOLWZsUfFu5zLewMQCeF_WRzYTWmBYE3SRyk1Cj_JTc1UzbZR54NNkrXUsKc1PDj1Kg4492gfSNaKweJTSWxVqz7VbM-b7G3IAbtcdifBy
    params['close_length'] = goaf_tech.close_length
    # 模板文件路径(必须参数)
    params['reportlet'] = 'cbm32.cpt'
    # 设计方案id(必须参数)
    params['design_id'] = goaf_tech.design_technology_id
    # 是否按页面大小显示
    params['__bypagesize__'] = 'true'
    # 查询所有钻孔
    pore_lists = CbmClientHelper.GetAllPores(goaf_tech.design_technology_id)
    # 计算钻孔个数
    params['pore_num'] = len(pore_lists)
    # 计算钻孔总长度
    params['pore_sum'] = sum([pore.length for pore in pore_lists])

    # 显示报表
    # params参数中的字符串数据包括key即可以是utf8编码的str字节数组,也可以是unicode字符串
    # show_report方法内部会自动处理
    show_report(params)
示例#13
0
	def onOk(self):
		# 数据库中查找id对应的矿井
		mine = SQLClientHelper.GetMineById(self.mine_id)
		if mine.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:I1)!')
			return
		
		# 更新数据到界面
		mine.pump_k2, ok = self.ui.pump_k2.text().toDouble()
		mine.pump_k3, ok = self.ui.pump_k3.text().toDouble()
		mine.pump_k4, ok = self.ui.pump_k4.text().toDouble()
		mine.gas_w0, ok = self.ui.gas_w0.text().toDouble()
		mine.gas_wc2, ok = self.ui.gas_wc2.text().toDouble()
		mine.pump_k, ok = self.ui.pump_k.text().toDouble()
		mine.pump_k1, ok = self.ui.pump_k1.text().toDouble()		

		K2, K3, K4, My, Mc = mine.pump_k2, mine.pump_k3, mine.pump_k4, mine.gas_w0, mine.gas_wc2
		W = self.reserve_gas

		if My <= 0:
			UiHelper.MessageBox(u'煤层原始瓦斯含量My的值必须大于0!!!')
		else:
			# 计算可抽瓦斯量
			K1 = K4 * ( My - Mc ) / My
			Wc = K1 * K2 * K3 * W
			mine.pump_k = K1 * K2 * K3
			mine.pump_k1 = K1
			mine.pump_k2 = K2
			mine.pump_k3 = K3
			mine.pump_k4 = K4
			mine.pump_wc = Wc
			mine.gas_w0 = My
			mine.gas_wc2 = Mc

			# 提交到数据库
			if SQLClientHelper.UpdateMine(mine):
				# 更新外部传入的变量
				self.pump_wc = Wc
				UiHelper.MessageBox(u'恭喜您,更新数据成功!!!')
				# 关闭对话框并返回1
				self.accept()
			else:
				UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:I2)!')
示例#14
0
    def onSave(self):
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:M4)!')
            return

        mine.name = unicode(self.ui.name.text()).encode('utf-8')
        mine.capacity, ok = self.ui.capacity.text().toDouble()
        mine.province = unicode(self.ui.province.text()).encode('utf-8')
        mine.city = unicode(self.ui.city.text()).encode('utf-8')
        mine.topo_geo = self.ui.topo_geo.currentIndex() + 1
        mine.hydr_geo = self.ui.hydr_geo.currentIndex() + 1
        mine.ground_condition = int(self.ui.ground_cond.isChecked())
        region_name = unicode(self.ui.region.currentText()).encode('utf-8')
        mine.mine_region_id = SQLClientHelper.GetMineRegionIdByField1(
            'name', region_name)
        if SQLClientHelper.UpdateMine(mine):
            UiHelper.MessageBox(u'恭喜您,更新矿井数据成功!!!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:D1)!')
示例#15
0
def generateJsonFileOfPoreReport(coal_id, design_id, json_file):
    # 查找煤层
    coal = SQLClientHelper.GetCoalById(coal_id)
    if coal.id <= 0: return False
    # 查找矿井
    mine = SQLClientHelper.GetMineById(coal.mine_id)
    if mine.id <= 0: return False
    # 查找掘进面的抽采技术
    tws_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyById(design_id)
    if tws_tech.id <= 0: return False

    # json模块可以直接将词典转换成json编码串
    # 因此主要的
    json_data = {u"pore_header": [u"钻孔编号", u"钻孔长度", u"钻孔倾角", u"钻孔方位角"]}
    # 写入矿井名称(中文汉字必须要用unicode表示,所以需要进行解码decode)
    json_data[u'$*mine_name*$'] = mine.name.decode('utf-8')
    # 写入工作面名称
    json_data[u'$*work_face_name*$'] = 'F292'.decode('utf-8')
    # 写入底板岩巷距离煤层的垂距
    json_data[u'w_dist'] = tws_tech.v_offset
    # 写入水平投影距离
    json_data[u'h_offset'] = tws_tech.h_offset
    # 写入钻场间距
    json_data[u'site_gap'] = tws_tech.gs
    # 写入钻孔孔径
    json_data[u'pore_diameter'] = tws_tech.gp
    # 写入封孔长度
    json_data[u'$*pore_length*$'] = tws_tech.close_length
    # 写入word模板路径(使用绝对路径,避免出错!!!)
    # 中文汉字必须要用unicode表示,所以需要进行解码decode)
    json_data[u'tplPath'] = os.path.abspath(
        u".\\help\\doc\\tpl\\底板岩巷密集穿层钻孔抽采煤巷条带瓦斯抽采技术.doc")
    # 写入报告默认名称
    json_data[u"reportName"] = u'底板岩巷密集穿层钻孔抽采煤巷条带瓦斯抽采技术报告'
    # print json_data[u'tplPath'].encode('gbk')

    # 写入钻孔信息
    # ***待完善***

    # 生成json文件(utf-8编码)
    write_json_file(json_data, json_file)
示例#16
0
    def onSave(self):
        mine = SQLClientHelper.GetMineById(self.mine_id)
        if mine.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:K1)!')
        else:
            # 读取矿井数据
            mine.gas_k1, ok = self.ui.k1_gas.text().toDouble()
            mine.gas_k2, ok = self.ui.k2_gas.text().toDouble()

            # 提交到数据库
            if SQLClientHelper.UpdateMine(mine):
                UiHelper.MessageBox(u'更新矿井数据成功!')
            else:
                UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:K2)!')
                return

        # 当前用户选中的采区数据保存
        index = self.ui.work_area.currentIndex()
        if index < 0: return
        work_area_id, ok = self.ui.work_area.itemData(index).toDouble
        if work_area_id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:K3)!')
            return
        work_area = SQLClientHelper.GetWorkAreaById(work_area_id)

        # 读取采区数据
        work_area.a, ok = self.ui.work_area.text().toDouble()
        work_area.qr, ok = self.ui.work_area.text().toDouble()
        index = self.ui.coal.currentIndex()
        if index >= 0:
            coal_id, ok = self.ui.coal.itemData(index)
            work_area.coal_id = coal_id  # 采区属于哪个煤层
        # 提交到数据库
        if SQLClientHelper.UpdateWorkArea(work_area):
            UiHelper.MessageBox(u'更新采区数据成功!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误代:K4)!')
示例#17
0
 def decisionProtectLayer(self):
     # 查询矿井对象
     mine = SQLClientHelper.GetMineById(self.mine_id)
     if mine.id <= 0: return 0  # 不具备保护层开采条件
     return mine.protect_layer_condition != 0