Example #1
0
    def onWorkSurfChanged(self, index):
        work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()
        work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
        if work_surf.id <= 0: return
        work_area = SQLClientHelper.GetWorkAreaById(work_surf.work_area_id)
        if work_area.id <= 0: return
        coal = SQLClientHelper.GetCoalById(work_area.coal_id)
        if coal.id <= 0: return

        # 填充煤层数据
        self.ui.hw.setText(u'%.1f' % coal.hw)
        self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle)

        # 填充高抽巷的数据
        hdt = SQLClientHelper.GetHighDrillingTunnelByForeignKey(
            'work_surf_id', work_surf_id)
        if hdt.id <= 0:
            self.ui.czk.setText(u'0.0')
            self.ui.rock.setCurrentIndex(-1)
            self.ui.hz_min.setText(u'0.0')
            self.ui.hz_max.setText(u'0.0')
        else:
            self.ui.czk.setText(u'%.1f' % hdt.k)
            self.ui.rock.setCurrentIndex(hdt.rock - 1)
            self.ui.hz_min.setText(u'%.1f' % hdt.hz_min)
            self.ui.hz_max.setText(u'%.1f' % hdt.hz_max)
Example #2
0
    def onWcCacl(self):
        index = self.ui.drilling_surf.currentIndex()
        if index < 0: return

        drilling_surf_id, ok = self.ui.drilling_surf.itemData(index).toInt()
        drilling_surf = SQLClientHelper.GetDrillingSurfById(drilling_surf_id)
        if drilling_surf.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G11)!')
            return

        # 保存煤层数据
        work_area_id = drilling_surf.work_area_id
        work_area = SQLClientHelper.GetWorkAreaById(work_area_id)
        if work_area.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G12)!')
            return
        coal_id = work_area.coal_id
        coal = SQLClientHelper.GetCoalById(coal_id)
        if coal.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G13)!')
            return

        # 查看煤质
        if coal.quality < 3 or caol.gas_w0 > 10:
            pass
            # UiHelper.MessageBox(u'弹出对话框让用户选择(尚未实现)')
        else:
            # 通过经验公式计算
            W0 = coal.gas_w0
            Wc = 10.385 * exp(-7.207 * W0)
            coal.gas_wc2 = Wc
        # 更新到界面
        self.ui.gas_wc2.setText(u'%.1f' % coal.gas_wc2)
Example #3
0
    def onAssign(self):
        # 获取当前煤层
        index = self.ui.coal.currentIndex()
        if index < 0: return
        coal_id, ok = self.ui.coal.itemData(index).toInt()
        coal = SQLClientHelper.GetCoalById(coal_id)

        # 获取当前采区
        index = self.ui.work_area.currentIndex()
        if index < 0: return
        work_area_id, ok = self.ui.work_area.itemData(index).toInt()
        work_area = SQLClientHelper.GetWorkAreaById(work_area_id)

        # 采区关联到新的煤层
        work_area.coal_id = coal_id

        # 提交到数据库
        coal_name = coal.name.decode('utf-8')
        work_area_name = work_area.name.decode('utf-8')
        if SQLClientHelper.UpdateWorkArea(work_area):
            UiHelper.MessageBox(u'采区%s成功布置到煤层:%s!' %
                                (work_area_name, coal_name))
        else:
            UiHelper.MessageBox(u'sorry, 尝试将采区%s布置到煤层:%s失败!' %
                                (work_area_name, coal_name))
Example #4
0
	def onWorkSurfChanged(self, index):
		work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()
		work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
		if work_surf.id <= 0:
			# UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N1)!')
			return

		# 填充回采工作面的数据
		# 是否分层开采
		self.ui.method_thin.setChecked(work_surf.layerable == 0)
		self.ui.method_thick.setChecked(work_surf.layerable != 0)
		# 工作面长度和采高
		self.ui.l1.setText(u'%.1f' % work_surf.l1)
		# self.ui.hw.setText(u'%.1f' % work_surf.hw)
		# 工作面瓦斯涌出量数据
		self.ui.qr1.setText(u'%.1f' % work_surf.qr1)
		self.ui.qr2.setText(u'%.1f' % work_surf.qr2)
		self.ui.qr.setText(u'%.1f' % work_surf.qr)
		
		# 煤层厚度
		work_area = SQLClientHelper.GetWorkAreaById(work_surf.work_area_id)
		coal = SQLClientHelper.GetCoalById(work_area.coal_id)
		if coal.id <= 0:
			self.ui.hw.setText(u'0.0')
			self.ui.thick.setText(u'0.0')
			self.ui.ws_thick.setText(u'0.0')
		else:
			self.ui.hw.setText(u'%.1f' % coal.hw)
			self.ui.thick.setText(u'%.1f' % coal.thick)
			self.ui.ws_thick.setText(u'%.1f' % coal.thick)
Example #5
0
	def onSave(self):
		index = self.ui.work_surf.currentIndex()
		work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()
		work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
		if work_surf.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N1)!')
			return
		
		# 煤层厚度
		work_area = SQLClientHelper.GetWorkAreaById(work_surf.work_area_id)
		coal = SQLClientHelper.GetCoalById(work_area.coal_id)
		if coal.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N2)!')
			return

		# 保存工作面数据
		work_surf.layerable = int(not self.ui.method_thin.isChecked())
		print '-+---+--+-->:', work_surf.layerable
		# 工作面长度和采高
		work_surf.l1, ok = self.ui.l1.text().toDouble()
		# self.ui.hw.text(work_surf.hw).toDouble()
		# 工作面瓦斯涌出量数据
		work_surf.qr1, ok = self.ui.qr1.text().toDouble()
		work_surf.qr2, ok = self.ui.qr2.text().toDouble()
		work_surf.qr, ok = self.ui.qr.text().toDouble()

		# 提交工作面到数据库
		# 注意:煤层数据修改了,也不会提交到数据库!!
		if SQLClientHelper.UpdateWorkSurf(work_surf):
			UiHelper.MessageBox(u'恭喜您,工作面数据更新成功啦!')
		else:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N3)!')
Example #6
0
    def onDrillSite(self):
        # 当前选中的工作面
        index = self.ui.work_surf.currentIndex()
        if index < 0: return

        work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()
        work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
        if work_surf.id <= 0:
            UiHelper.MessageBox(u'请选择一个工作面!')
            return

        # 显示钻场设计对话框
        dlg = HighDrillingSiteDlg(work_surf.id)
        dlg.exec_()

        # 计算钻场参数
        hdsp = SQLClientHelper.GetHighDrillingSiteParamByForeignKey(
            'work_surf_id', work_surf.id)
        if hdsp.id <= 0: return
        hn, Rtn, q, hs, theta = hdsp.hn, hdsp.rtn, hdsp.q, hdsp.hs, hdsp.theta
        L1 = hn * sqrt(2.0 * Rtn / q) + 2 * hs / tan(radians(theta))
        L2 = hn * sqrt(2.0 * Rtn / (3 * q))
        Lg = L2

        # 更新到界面
        self.ui.l1.setText(u'%.1f' % L1)
        self.ui.l2.setText(u'%.1f' % L2)
        self.ui.lg.setText(u'%.1f' % Lg)
Example #7
0
	def onQr2Cacl(self):
		# 当前用户选中的回采面
		index = self.ui.work_surf.currentIndex()
		if index < 0:return

		# 根据id查找回采面
		work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()

		# 弹出邻近层计算对话框
		dlg = WsGasFlowPredictAdjDlg(work_surf_id)
		dlg.exec_()

		# 根据id查找回采面->采区->煤层
		work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
		work_area_id = work_surf.work_area_id
		if work_area_id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N4)!')
			return
		work_area = SQLClientHelper.GetWorkAreaById(work_area_id)
		
		# 查找煤层
		coal_id = work_area.coal_id
		if coal_id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:N5)!')
			return
		coal = SQLClientHelper.GetCoalById(coal_id)

		# 调用rpc计算工作面瓦斯涌出量
		q2 = CbmClientHelper.WorkSurfGasFlow2(coal, work_area, work_surf)
		# 更新计算结果到界面
		self.ui.qr2.setText(u'%.1f' % q2)
	def onSave(self):
		# 根据id查找工作面
		work_surf = SQLClientHelper.GetWorkSurfById(self.work_surf_id)
		if work_surf.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:O1)!')
			return
		work_area = SQLClientHelper.GetWorkAreaById(work_surf.work_area_id)
		if work_area.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:O2)!')
			return
		coal = SQLClientHelper.GetCoalById(work_area.coal_id)
		if coal.id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:O3)!')
			return

		# 保存煤层瓦斯涌出量数据
		coal.gas_w0, ok = self.ui.gas_w0.text().toDouble()
		coal.gas_wc2, ok = self.ui.gas_wc2.text().toDouble()
		# 提交到数据库
		if not SQLClientHelper.UpdateCoal(coal):
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:O4)!')
			return
		# 保存工作面数据
		work_surf.k1, ok = self.ui.k1.text().toDouble()
		work_surf.k2, ok = self.ui.k2.text().toDouble()
		work_surf.k3, ok = self.ui.k3.text().toDouble()
		work_surf.kf, ok = self.ui.kf.text().toDouble()
		if not SQLClientHelper.UpdateWorkSurf(work_surf):
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:O5)!')
		else:
			UiHelper.MessageBox(u'恭喜您,更新数据成功!')
Example #9
0
    def onDelDesign(self):
        index = self.ui.design.currentIndex()
        if index < 0: return

        # 从数据库中删除
        design_tech_id, ok = self.ui.design.itemData(index).toInt()
        design_tech = None
        if self.region == 1:
            design_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyById(
                design_tech_id)
        elif self.region == 2:
            design_tech = SQLClientHelper.GetDesignWorkSurfTechnologyById(
                design_tech_id)
        elif self.region == 3:
            design_tech = SQLClientHelper.GetDesignGoafTechnologyById(
                design_tech_id)

        ret = False
        if design_tech is None or design_tech.id <= 0:
            pass
        else:
            # 外键的级联规则可以保证关联的详细设计方案以及钻场和钻孔都被删除掉!!!
            ret = SQLClientHelper.DeleteDesignTechnology(
                design_tech.design_technology_id)

        # 从列表中删除
        if ret:
            self.ui.design.removeItem(index)
            UiHelper.MessageBox(u'删除设计方案成功!')
        else:
            UiHelper.MessageBox(u'删除设计方案失败!')
Example #10
0
    def fillDesignCombox(self, coal_id):
        # 清空设计方案列表
        self.ui.design.clear()

        # 查找设计技术
        tech_lists = SQLClientHelper.GetDesignTechnologyListByField2(
            'coal_id', str(coal_id), 'region', self.region)
        if len(tech_lists) == 0: return

        # 查询与设计技术关联的详细设计技术方案
        design_tech_list = []
        for tech in tech_lists:
            tech_id = tech.id
            if tech_id <= 0: continue

            design_tech = None
            # 查询
            if self.region == 1:
                design_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyByForeignKey(
                    'design_technology_id', tech_id)
            elif self.region == 2:
                design_tech = SQLClientHelper.GetDesignWorkSurfTechnologyByForeignKey(
                    'design_technology_id', tech_id)
            elif self.region == 3:
                design_tech = SQLClientHelper.GetDesignGoafTechnologyByForeignKey(
                    'design_technology_id', tech_id)

            # 添加到数组
            if design_tech is None or design_tech.id <= 0:
                continue
            else:
                design_tech_list.append(design_tech)

        # 添加到列表中
        UiHelper.AddObjectListToCombobox(self.ui.design, design_tech_list)
Example #11
0
    def onSave(self):
        index = self.ui.work_surf.currentIndex()
        if index < 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:U1)!')
            return

        # 查找回采面
        work_surf_id, ok = self.ui.work_surf.itemData(index).toInt()
        work_surf = SQLClientHelper.GetWorkSurfById(work_surf_id)
        if work_surf.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:U2)!')
            return

        # 查找高抽巷
        hdt = SQLClientHelper.GetHighDrillingTunnelByForeignKey(
            'work_surf_id', work_surf.id)
        hdt_id = hdt.id
        if hdt_id <= 0:
            hdt = HighDrillingTunnel()
            hdt.work_surf_id = work_surf_id
        hdt.k, ok = self.ui.czk.text().toDouble()
        hdt.hz_min, ok = self.ui.hz_min.text().toDouble()
        hdt.hz_max, ok = self.ui.hz_max.text().toDouble()
        hdt.rock = self.ui.rock.currentIndex() + 1

        ret = False
        if hdt_id <= 0:
            ret = SQLClientHelper.AddHighDrillingTunnel(hdt) > 0
        else:
            ret = SQLClientHelper.UpdateHighDrillingTunnel(hdt)
        if ret:
            UiHelper.MessageBox(u'更新数据成功!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:U3)!')
Example #12
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)
Example #13
0
    def fillDatas(self):
        # 查找煤层
        coal = SQLClientHelper.GetCoalById(self.coal_id)
        if coal.id <= 0: return
        # 查找掘进面的抽采技术
        ws_tech = SQLClientHelper.GetDesignWorkSurfTechnologyById(
            self.design_id)
        if ws_tech.id <= 0: return

        # 填充煤层数据
        self.ui.thick.setText(u'%.1f' % coal.thick)
        self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle)

        # 填充抽采技术参数
        self.ui.l1.setText(u'%.1f' % ws_tech.l1)
        self.ui.l2.setText(u'%.1f' % ws_tech.l2)
        self.ui.w.setText(u'%.1f' % ws_tech.w)
        self.ui.h.setText(u'%.1f' % ws_tech.h)
        self.ui.dp.setText(u'%.1f' % ws_tech.dp)
        self.ui.gp.setText(u'%.1f' % ws_tech.gp)
        self.ui.pore_stubble.setText(u'%.1f' % ws_tech.pore_stubble)
        self.ui.pore_angle.setText(u'%.1f' % ws_tech.pore_angle)
        self.ui.close_length.setText(u'%.1f' % ws_tech.close_length)

        pore_type = ws_tech.pore_type
        if pore_type == 1:
            self.ui.pore_type1.setChecked(True)
        elif pore_type == 2:
            self.ui.pore_type2.setChecked(True)
        elif pore_type == 3:
            self.ui.pore_type3.setChecked(True)
        elif pore_type == 4:
            self.ui.pore_type4.setChecked(True)
Example #14
0
def design_eval_unit(partition_id):
    # 查询得到评价单元划分
    deup = SQLClientHelper.GetDesignEvalUnitPartitionById(partition_id)
    if deup.id <= 0: return
    # 删除所有与划分id号关联的评价单元
    eval_unit_id_lists = SQLClientHelper.GetDesignEvalUnitIdListByForeignKey(
        'design_eval_unit_partition_id', partition_id)
    SQLClientHelper.DeleteMoreDesignEvalUnit(eval_unit_id_lists)

    # 工作面顺槽长度Ln、巷道掘进速度V、巷道终点钻孔的抽采时间T、抽采半径R
    Ln, V, T, R = deup.l, deup.v, deup.t, deup.r

    # 计算各单元边界线与巷道交点到巷道起点的距离
    Li = Lf(Ln, T, V)
    print Li

    # 计算各单元的起点抽采时间
    g = lambda x: int(round(1.0 * (Ln - x) / V + T))
    Ti = [g(x) for x in Li]

    # 评价单元写入到数据库
    print u'单元号\tLi(m)\tTi(d)'
    for i, (x, t) in enumerate(zip(Li, Ti)):
        print u'%d\t%.1f\t%d' % (i + 1, x, t)
        a_eval_unit = DesignEvalUnit()
        a_eval_unit.num = i + 1
        a_eval_unit.l = x
        a_eval_unit.t = t
        a_eval_unit.design_eval_unit_partition_id = partition_id
        SQLClientHelper.AddDesignEvalUnit(a_eval_unit)
Example #15
0
	def onSave(self):
		if self.coal_id <= 0:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:C3)!')
			return
		
		# 根据id查找煤层
		coal = SQLClientHelper.GetCoalById(self.coal_id)

		# 读取界面上的数据保存到煤层对象
		coal.thick, ok = self.ui.thick.text().toDouble()
		coal.rank = self.ui.rank.currentIndex() + 1
		coal.minable = int(self.ui.minable.isChecked())
		coal.dip_angle, ok = self.ui.dip_angle.text().toDouble()
		coal.hw, ok = self.ui.hw.text().toDouble()
		coal.f_value, ok = self.ui.f_value.text().toDouble()
		coal.pressure, ok = self.ui.pressure.text().toDouble()
		coal.gas_content, ok = self.ui.gas_content.text().toDouble()
		coal.permeability_k, ok = self.ui.permeability_k.text().toDouble()
		coal.res_abundance = self.ui.res_abundance.currentIndex() + 1
		coal.complexity = self.ui.complexity.currentIndex() + 1
		coal.mine_index, ok = self.ui.mine_index.text().toDouble()
		coal.var_coeff, ok = self.ui.var_coeff.text().toDouble()
		coal.czh, ok = self.ui.caving_zone_height.text().toDouble()
		coal.stability = self.ui.stability.currentIndex() + 1
		coal.layer_gap, ok = self.ui.layer_gap.text().toDouble()
		coal.influence_factor, ok = self.ui.influence_factor.text().toDouble()

		# 提交到数据库
		if SQLClientHelper.UpdateCoal(coal):
			UiHelper.MessageBox(u'更新煤层数据成功!')
			#关闭对话框并返回1
			# self.accept()
		else:
			UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:C1)!')
Example #16
0
    def onSave(self):
        # 根据id查找工作面
        work_surf = SQLClientHelper.GetWorkSurfById(self.work_surf_id)
        work_surf_id = work_surf.id
        if work_surf_id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P3)!')
            return

        # 提取钻场参数
        hdsp = SQLClientHelper.GetHighDrillingSiteParamByForeignKey(
            'work_surf_id', work_surf_id)

        if hdsp.id <= 0:
            hdsp = HighDrillingSiteParam()
            hdsp.work_surf_id = work_surf_id

        hdsp.hn, ok = self.ui.hn.text().toDouble()
        hdsp.hs, ok = self.ui.hs.text().toDouble()
        hdsp.theta, ok = self.ui.theta.text().toDouble()
        hdsp.rtn, ok = self.ui.rtn.text().toDouble()
        hdsp.q, ok = self.ui.q.text().toDouble()

        # 保存到数据库
        ret = False
        if work_surf_id <= 0:
            ret = SQLClientHelper.AddHighDrillingSiteParam(hdsp) > 0
        else:
            ret = SQLClientHelper.UpdateHighDrillingSiteParam(hdsp)

        if ret:
            UiHelper.MessageBox(u'更新数据成功!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P4)!')
Example #17
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))
Example #18
0
    def onCreatReport(self):
        coal = SQLClientHelper.GetCoalById(self.coal_id)
        if coal.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:144)')
            return
        # 查找掘进面的抽采技术
        ws_tech = SQLClientHelper.GetDesignWorkSurfTechnologyById(
            self.design_id)
        if ws_tech.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:145)')
            return

        # 向cad发送命令请求生成钻孔数据
        ret = CbmClientHelper.SendCommandToCAD(
            "JL.GeneratePore23 %d %d" % (coal.id, ws_tech.id), True)
        if ret:
            # 显示钻孔报表
            DataHelper.show_report23(coal, ws_tech)
        else:
            UiHelper.MessageBox(u'启动AutoCAD失败!!!')

        # json文件路径(使用绝对路径,避免出错!!!)
        # json_file = os.path.abspath('.\\help\\json\\reportP21.json')
        # 生成json文件
        # self.make_json(coal.id, tws_tech.id, json_file)
        # 生成word报单
        # doc.CreatReport(json_file)
Example #19
0
	def onSave(self):
		# 获取抽采半径对象
		# pore_size = SQLClientHelper.GetPoreSizeById(self.pore_size.id)
		pore_size = self.pore_size
		if pore_size.id  <= 0:
			UiHelper.MessageBox(u'sorry, 出了点问题, 请联系技术人员(错误码:X1)')
			return

		# 从界面读取数据
		pore_size.q, ok = self.ui.q.text().toDouble()
		pore_size.v, ok = self.ui.v.text().toDouble()
		pore_size.d, ok = self.ui.d.text().toDouble()
		pore_size.p, ok = self.ui.p.text().toDouble()
		pore_size.sigma, ok = self.ui.sigma.text().toDouble()
		pore_size.delta, ok = self.ui.delta.text().toDouble()

		# 保存到数据库
		ret = False
		if pore_size.id <= 0:
			ret = SQLClientHelper.AddPoreSize(pore_size) > 0
		else:
			ret = SQLClientHelper.UpdatePoreSize(pore_size)
		if ret:
			UiHelper.MessageBox(u'恭喜您,更新数据成功!')
		else:
			UiHelper.MessageBox(u'sorry, 出了点问题, 请联系技术人员(错误码:W1)')
Example #20
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)!')
Example #21
0
def test_design_eval_unit():
    # 指定一个设计id
    partition_id = 21
    # 查询得到评价单元划分
    deup = SQLClientHelper.GetDesignEvalUnitPartitionById(partition_id)
    if deup.id <= 0: return

    # 工作面顺槽长度Ln、巷道掘进速度V、巷道终点钻孔的抽采时间T、抽采半径R
    Ln, V, T, R = deup.l, deup.v, deup.t, deup.r

    # 计算各单元边界线与巷道交点到巷道起点的距离
    Li = Lf(Ln, T, V)

    # 计算各单元的起点抽采时间
    g = lambda x: int(round(1.0 * (Ln - x) / V + T))
    Ti = [g(x) for x in Li]

    # 评价单元写入到数据库
    print u'单元号\tLi(m)\tTi(d)'
    for i, (x, t) in enumerate(zip(Li, Ti)):
        print u'%d\t%.1f\t%d' % (i + 1, x, t)
        a_eval_unit = DesignEvalUnit()
        a_eval_unit.num = i + 1
        a_eval_unit.l = x
        a_eval_unit.t = t
        a_eval_unit.design_eval_unit_partition_id = partition_id
        SQLClientHelper.AddDesignEvalUnit(a_eval_unit)
Example #22
0
    def fillDatas(self):
        # 查找煤层
        coal = SQLClientHelper.GetCoalById(self.coal_id)
        if coal.id <= 0: return
        # 查找掘进面的抽采技术
        tws_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyById(
            self.design_id)
        if tws_tech.id <= 0: return

        # 填充煤层数据
        self.ui.thick.setText(u'%.1f' % coal.thick)
        self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle)

        # 填充抽采技术参数
        self.ui.lm.setText(u'%.1f' % tws_tech.lm)
        self.ui.w.setText(u'%.1f' % tws_tech.w)
        self.ui.h.setText(u'%.1f' % tws_tech.h)
        self.ui.dp.setText(u'%.1f' % tws_tech.dp)
        self.ui.left.setText(u'%.1f' % tws_tech.left_side)
        self.ui.right.setText(u'%.1f' % tws_tech.right_side)
        self.ui.top.setText(u'%.1f' % tws_tech.top_side)
        self.ui.bottom.setText(u'%.1f' % tws_tech.bottom_side)
        self.ui.leading_dist.setText(u'%.1f' % tws_tech.leading_dist)
        self.ui.l_stripe.setText(u'%.1f' % tws_tech.l_stripe)
        self.ui.gbp.setText(u'%.1f' % tws_tech.gbp)
        self.ui.close_length.setText(u'%.1f' % tws_tech.close_length)
Example #23
0
    def onSave(self):
        # 根据id查找工作面
        work_surf = SQLClientHelper.GetWorkSurfById(self.work_surf_id)
        work_surf_id = work_surf.id
        if work_surf_id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P3)!')
            return

        # 提取钻场参数
        hdpp = SQLClientHelper.GetHighDrillingPoreParamByForeignKey(
            'work_surf_id', work_surf_id)

        if hdpp.id <= 0:
            hdpp = HighDrillingPoreParam()
            hdpp.work_surf_id = work_surf_id

        hdpp.lk, ok = self.ui.lk.text().toDouble()
        hdpp.lc, ok = self.ui.lc.text().toDouble()
        hdpp.lw, ok = self.ui.lw.text().toDouble()
        hdpp.beta, ok = self.ui.beta.text().toDouble()
        hdpp.n1, ok = self.ui.n1.text().toDouble()
        hdpp.n2, ok = self.ui.n2.text().toDouble()

        # 保存到数据库
        ret = False
        if work_surf_id <= 0:
            ret = SQLClientHelper.AddHighDrillingPoreParam(hdpp) > 0
        else:
            ret = SQLClientHelper.UpdateHighDrillingPoreParam(hdpp)

        if ret:
            UiHelper.MessageBox(u'更新数据成功!')
        else:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P4)!')
Example #24
0
    def fillDatas(self):
        # 查找煤层
        coal = SQLClientHelper.GetCoalById(self.coal_id)
        if coal.id <= 0: return
        # 查找掘进面的抽采技术
        tws_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyById(
            self.design_id)
        if tws_tech.id <= 0: return

        # 填充煤层数据
        self.ui.thick.setText(u'%.1f' % coal.thick)
        self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle)

        # 填充抽采技术参数
        self.ui.l1.setText(u'%.1f' % tws_tech.l1)
        self.ui.l2.setText(u'%.1f' % tws_tech.l2)
        self.ui.w.setText(u'%.1f' % tws_tech.w)
        self.ui.h.setText(u'%.1f' % tws_tech.h)
        self.ui.wd.setText(u'%.1f' % tws_tech.wd)
        self.ui.hd.setText(u'%.1f' % tws_tech.hd)
        self.ui.v_offset.setText(u'%.1f' % tws_tech.v_offset)
        self.ui.h_offset.setText(u'%.1f' % tws_tech.h_offset)
        self.ui.dp.setText(u'%.1f' % tws_tech.dp)
        self.ui.gp.setText(u'%.1f' % tws_tech.gp)
        self.ui.left.setText(u'%.1f' % tws_tech.left_side)
        self.ui.right.setText(u'%.1f' % tws_tech.right_side)
        self.ui.top.setText(u'%.1f' % tws_tech.top_side)
        self.ui.bottom.setText(u'%.1f' % tws_tech.bottom_side)
        self.ui.ls.setText(u'%.1f' % tws_tech.ls)
        self.ui.ws.setText(u'%.1f' % tws_tech.ws)
        self.ui.gs.setText(u'%.1f' % tws_tech.gs)
        self.ui.hs.setText(u'%.1f' % tws_tech.hs)
        self.ui.close_length.setText(u'%.1f' % tws_tech.close_length)
Example #25
0
def sql_create_mine(name, province, city, region, account_id):
    mine = Mine()
    mine.name = name
    mine.province = province
    mine.city = city
    mine.mine_region_id = SQLClientHelper.GetMineRegionIdByField1(
        'name', region)
    mine.account_id = account_id
    return SQLClientHelper.AddMine(mine)
Example #26
0
 def initPoreFlow(self):
     # 查找所有的抽采管径对象
     pore_flow_lists = SQLClientHelper.GetPoreFlowList()
     if len(pore_flow_lists) == 0:
         pore_flow = PoreFlow()
         pore_flow_id = SQLClientHelper.AddPoreFlow(pore_flow)
         self.pore_flow = SQLClientHelper.GetPoreFlowById(pore_flow_id)
     else:
         # 目前只使用第1个数据
         self.pore_flow = pore_flow_lists[0]
Example #27
0
	def initPoreSize(self):
		# 查找所有的抽采管径对象
		pore_size_lists = SQLClientHelper.GetPoreSizeList()
		if len(pore_size_lists) == 0:
			pore_size = PoreSize()
			pore_size_id = SQLClientHelper.AddPoreSize(pore_size)
			self.pore_size = SQLClientHelper.GetPoreSizeById(pore_size_id)
		else:
			# 目前只使用第1个数据
			self.pore_size = pore_size_lists[0]
Example #28
0
    def onReg(self):
        uname = unicode(self.ui.username.text()).encode('utf-8')
        pwd = unicode(self.ui.password.text()).encode('utf-8')
        # 检查用户名是否已注册
        if DataHelper.sql_check_user(uname, pwd):
            UiHelper.MessageBox('用户名已经被注册了,换一个吧!')
        else:
            # 注册新用户
            account_id = DataHelper.sql_create_user(uname, pwd)
            if account_id <= 0:
                UiHelper.MessageBox('抱歉,注册失败\n请联系技术人员(错误码:A1)!')
                return

            # 从界面中读取数据
            mine_name = unicode(self.ui.name.text()).encode('utf-8')
            mine_province = unicode(self.ui.province.text()).encode('utf-8')
            mine_city = unicode(self.ui.city.text()).encode('utf-8')
            mine_region = unicode(self.ui.region.currentText()).encode('utf-8')
            # 注册新矿井
            mine_id = DataHelper.sql_create_mine(mine_name, mine_province,
                                                 mine_city, mine_region,
                                                 account_id)
            # 注册新矿井失败
            if mine_id <= 0:
                # 删除新注册用户
                SQLClientHelper.DeleteAccount(account_id)
                UiHelper.MessageBox('抱歉,注册失败\n请联系技术人员(错误码:A2)!')
                return

            # 分解煤层编号(空格分隔)
            mine_coal_names = unicode(self.ui.coal_nums.text()).encode('utf-8')
            # 分解成字符串列表
            mine_coal_names = mine_coal_names.strip().split()
            # 去除重复编号名称
            mine_coal_names = list(set(mine_coal_names))

            # 新建煤层(逐个添加到数据)
            coal_ids = []
            for name in mine_coal_names:
                coal_ids.append(DataHelper.sql_create_coal(name, mine_id))
            # 增加煤层失败,删除添加的所有煤层
            if -1 in coal_ids:
                # 删除已增加的所有煤层
                SQLClientHelper.DeleteMoreCoal(coal_ids)
                # 删除已注册的矿井
                SQLClientHelper.DeleteMine(mine_id)
                # 删除已注册的用户
                SQLClientHelper.DeleteAccount(account_id)
                UiHelper.MessageBox('抱歉,注册失败\n请联系技术人员(错误码:A3)!')
            else:
                UiHelper.MessageBox('恭喜您,注册成功啦!')
                # 记录注册成功的用户(用于外部调用)
                self.reg_user_name = uname
                # 关闭对话框,并返回1
                self.accept()
Example #29
0
 def getDrp(self, coal_id, create_new=False):
     drp = SQLClientHelper.GetDrillingRadiusParamByForeignKey(
         'coal_id', coal_id)
     if drp.id <= 0 and create_new:
         # 新建一个瓦斯半径数据对象提交到数据库
         drp = DrillingRadiusParam()
         drp.coal_id = coal_id
         drp_id = SQLClientHelper.AddDrillingRadiusParam(drp)
         if drp_id <= 0:
             drp.id = -1
         else:
             drp = SQLClientHelper.GetDrillingRadiusParamById(drp_id)
     return drp
Example #30
0
    def onSave(self):
        coal = SQLClientHelper.GetCoalById(self.coal_id)
        if coal.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:130)')
            return

        # 查找掘进面的抽采技术
        ws_tech = SQLClientHelper.GetDesignWorkSurfTechnologyById(
            self.design_id)
        if ws_tech.id <= 0:
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:131)')
            return

        # 保存煤层数据到数据库
        coal.thick, ok = self.ui.thick.text().toDouble()
        coal.dip_angle, ok = self.ui.dip_angle.text().toDouble()
        if not SQLClientHelper.UpdateCoal(coal):
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:132)')
            return

        # 保存抽采技术参数到数据库
        ws_tech.l1, ok = self.ui.l1.text().toDouble()
        ws_tech.l2, ok = self.ui.l2.text().toDouble()
        ws_tech.w, ok = self.ui.w.text().toDouble()
        ws_tech.h, ok = self.ui.h.text().toDouble()
        ws_tech.wd, ok = self.ui.wd.text().toDouble()
        ws_tech.hd, ok = self.ui.hd.text().toDouble()
        ws_tech.v_offset, ok = self.ui.v_offset.text().toDouble()
        ws_tech.h_offset, ok = self.ui.h_offset.text().toDouble()
        ws_tech.dp, ok = self.ui.dp.text().toDouble()
        ws_tech.gp, ok = self.ui.gp.text().toDouble()
        ws_tech.left_side, ok = self.ui.left.text().toDouble()
        ws_tech.right_side, ok = self.ui.right.text().toDouble()
        ws_tech.top_side, ok = self.ui.top.text().toDouble()
        ws_tech.bottom_side, ok = self.ui.bottom.text().toDouble()
        ws_tech.ls, ok = self.ui.ls.text().toDouble()
        ws_tech.ws, ok = self.ui.ws.text().toDouble()
        ws_tech.gs, ok = self.ui.gs.text().toDouble()
        ws_tech.hs, ok = self.ui.hs.text().toDouble()
        ws_tech.single_rock_tunnel = int(
            self.ui.single_rock_tunnel.isChecked())
        ws_tech.d_offset, ok = self.ui.d_offset.text().toDouble()
        ws_tech.p_offset, ok = self.ui.p_offset.text().toDouble()
        ws_tech.close_length, ok = self.ui.close_length.text().toDouble()

        # 保存到数据库
        if not SQLClientHelper.UpdateDesignWorkSurfTechnology(ws_tech):
            UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:133)')
        else:
            UiHelper.MessageBox(u'恭喜您,保存数据成功!')