def init(self): if self.coal_id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:C2)!') return coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0:return self.ui.thick.setText(u'%.1f' % coal.thick) self.ui.rank.setCurrentIndex(coal.rank-1) self.ui.minable.setChecked(coal.minable != 0) self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle) self.ui.hw.setText(u'%.1f' % coal.hw) self.ui.f_value.setText(u'%.2f' % coal.f_value) self.ui.pressure.setText(u'%.1f' % coal.pressure) self.ui.gas_content.setText(u'%.1f' % coal.gas_content) self.ui.permeability_k.setText(u'%.1f' % coal.permeability_k) self.ui.res_abundance.setCurrentIndex(coal.res_abundance - 1) self.ui.complexity.setCurrentIndex(coal.complexity - 1) self.ui.mine_index.setText(u'%.1f' % coal.mine_index) self.ui.var_coeff.setText(u'%.1f' % coal.var_coeff) self.ui.caving_zone_height.setText(u'%.1f' % coal.czh) self.ui.stability.setCurrentIndex(coal.stability - 1) self.ui.layer_gap.setText(u'%.1f' % coal.layer_gap) self.ui.influence_factor.setText(u'%.1f' % coal.influence_factor)
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)
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)
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))
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)!')
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)
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)
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)
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)!')
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'恭喜您,更新数据成功!')
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)
def onCoalChanged(self, index): if index < 0: return # 查询当前煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: return # 查询煤层关联的抽采半径参数对象 # 如果没有就内部新建一个 drp = self.getDrp(coal.id, True) if drp.id <= 0: return # 填充煤层数据 self.ui.thick.setText(u'%.1f' % coal.thick) self.ui.permeability_lambda.setText(u'%.1f' % coal.permeability_lambda) # 填充瓦斯抽采半径数据 self.ui.alpha.setText(u'%.1f' % drp.a) self.ui.p0.setText(u'%.1f' % drp.p0) self.ui.p1.setText(u'%.1f' % drp.p1) self.ui.r0.setText(u'%d' % int(drp.r0)) self.ui.t0.setText(u'%d' % int(drp.t)) self.ui.r1.setText(u'%d' % int(drp.r1)) self.ui.eta.setText(u'%.1f' % drp.eta)
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)
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 deup = SQLClientHelper.GetDesignEvalUnitPartitionByForeignKey('work_surf_id', work_surf_id) if deup.id <= 0: deup = DesignEvalUnitPartition() deup.work_surf_id = work_surf_id deup_id = SQLClientHelper.AddDesignEvalUnitPartition(deup) deup = SQLClientHelper.GetDesignEvalUnitPartitionById(deup_id) if deup.id <= 0:return # 填充评价单元划分数据 # 这里做了点手脚,所有的数据都放在design_eval_unit_partition表里面,并没有从其它的coal、worksurf里读取数据,仅仅保持了与工作面的外键关系 self.ui.l1.setText(u'%.1f' % deup.l1) self.ui.l2.setText(u'%.1f' % deup.l2) self.ui.l.setText(u'%.1f' % deup.l) self.ui.w.setText(u'%.1f' % deup.w) self.ui.h.setText(u'%.1f' % deup.h) self.ui.r.setText(u'%.1f' % deup.r) self.ui.t.setText(u'%.1f' % deup.t) self.ui.v.setText(u'%d' % int(deup.v)) # 填充煤层数据 self.ui.thick.setText(u'%.1f' % coal.thick) self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle)
def onCoalChanged(self, index): if index < 0: return # 查询当前煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: return # 查询煤层关联的抽采半径参数对象 # 如果没有就内部新建一个 drp = self.getDrp(coal.id, True) if drp.id <= 0: return # 填充煤层数据 self.ui.hw.setText(u'%.1f' % coal.hw) self.ui.gas_w0.setText(u'%.1f' % coal.gas_w0) self.ui.gas_wc3.setText(u'%.1f' % coal.gas_wc3) # 填充瓦斯抽采半径数据 self.ui.rho.setText(u'%.1f' % drp.rho) self.ui.a.setText(u'%.1f' % drp.a) self.ui.t.setText(u'%.1f' % drp.t) self.ui.l.setText(u'%.1f' % drp.l) self.ui.q0.setText(u'%.1f' % drp.q0) self.ui.r.setText(u'%.1f' % drp.r) self.ui.qm.setText(u'%.1f' % drp.qm) self.ui.qsum.setText(u'%.1f' % drp.qsum) self.ui.eta.setText(u'%.1f' % drp.eta) self.ui.k1.setText(u'%.1f' % drp.k1)
def onSave(self): index = self.ui.work_surf.currentIndex() if index < 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:Z1)') 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,出了点问题,请联系技术人员(错误码:Z2)') return work_area = SQLClientHelper.GetWorkAreaById(work_surf.work_area_id) if work_area.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:Z3)') return coal = SQLClientHelper.GetCoalById(work_area.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:Z4)') return deup = SQLClientHelper.GetDesignEvalUnitPartitionByForeignKey('work_surf_id', work_surf_id) if deup.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:Z5)') return # 从界面读取评价单元划分数据 # 这里做了点手脚,所有的数据都放在design_eval_unit_partition表里面, # 并没有从其它的coal、worksurf里读取数据,仅仅保持了与工作面的外键关系 deup.l1, ok = self.ui.l1.text().toDouble() deup.l2, ok = self.ui.l2.text().toDouble() deup.l, ok = self.ui.l.text().toDouble() deup.w, ok = self.ui.w.text().toDouble() deup.h, ok = self.ui.h.text().toDouble() deup.r, ok = self.ui.r.text().toDouble() deup.t, ok = self.ui.t.text().toDouble() deup.v, ok = self.ui.v.text().toDouble() # 提交到数据库 if not SQLClientHelper.UpdateDesignEvalUnitPartition(deup): UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:Z6)') 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,出了点问题,请联系技术人员(错误码:Z7)') return UiHelper.MessageBox(u'恭喜您,更新数据成功!')
def onCoalChanged(self, index): if index < 0: return # 查询当前煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: return # 填充界面数据 self.ui.permeability_k.setText(u'%.1f' % coal.permeability_k) self.ui.permeability_lambda.setText(u'%.1f' % coal.permeability_lambda) self.ui.decay_alpha.setText(u'%.1f' % coal.decay_alpha) self.ui.eval_difficult.setCurrentIndex(coal.eval_difficult - 1)
def onCoalChanged(self, index): if index < 0: return # 查询当前煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: return # 填充界面数据 self.ui.thick.setText(u'%.1f' % coal.thick) self.ui.dip_angle.setText(u'%.1f' % coal.dip_angle) # 填充设计方案 self.fillDesignCombox(coal_id)
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'恭喜您,保存数据成功!')
def dip_graph(self): coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:144)') return # 查找掘进面的抽采技术 goaf_tech = SQLClientHelper.GetDesignGoafTechnologyById(self.design_id) if goaf_tech.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:145)') return # 向cad发送命令请求绘图 ret = CbmClientHelper.SendCommandToCAD( "JL.DrawDipGraph32 %d %d" % (coal.id, goaf_tech.id), True) if not ret: UiHelper.MessageBox(u'启动AutoCAD失败')
def head_graph(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.DrawHeadGraph23 %d %d" % (coal.id, ws_tech.id), True) if not ret: UiHelper.MessageBox(u'启动AutoCAD失败')
def plane_graph(self): coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:114)') return # 查找掘进面的抽采技术 tws_tech = SQLClientHelper.GetDesignDrillingSurfTechnologyById( self.design_id) if tws_tech.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:115)') return # 向cad发送命令请求绘图 ret = CbmClientHelper.SendCommandToCAD( "JL.DrawPlaneGraph11 %d %d" % (coal.id, tws_tech.id), True) if not ret: UiHelper.MessageBox(u'启动AutoCAD失败')
def onDrillingSurfChanged(self, index): 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,出了点问题,请联系技术人员(错误码:G1)!') return # 填充掘进面的数据 self.ui.q4.setText(u'%.1f' % drilling_surf.q4) self.ui.qa.setText(u'%.1f' % drilling_surf.qa) # 填充煤层数据 work_area_id = drilling_surf.work_area_id work_area = SQLClientHelper.GetWorkAreaById(work_area_id) if work_area.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G2)!') return coal_id = work_area.coal_id coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:G3)!') return # 填充煤层数据 self.ui.vr.setText(u'%.1f' % coal.vr) self.ui.rho.setText(u'%.1f' % coal.rho) self.ui.gas_w0.setText(u'%.1f' % coal.gas_w0) self.ui.gas_wc2.setText(u'%.1f' % coal.gas_wc2) # 填充掘进巷道数据 tunnel_id = drilling_surf.tunnel_id if tunnel_id <= 0: self.ui.d.setText(u'0.0') self.ui.v.setText(u'0.0') self.ui.l.setText(u'0.0') self.ui.s.setText(u'0.0') self.ui.q0.setText(u'0.0') self.ui.q3.setText(u'0.0') else: tunnel = SQLClientHelper.GetTunnelById(tunnel_id) self.ui.d.setText(u'%.1f' % tunnel.d) self.ui.v.setText(u'%.1f' % tunnel.v) self.ui.l.setText(u'%.1f' % tunnel.l) self.ui.s.setText(u'%.1f' % tunnel.s) self.ui.q0.setText(u'%.1f' % tunnel.q0) self.ui.q3.setText(u'%.1f' % tunnel.q3)
def onSave(self): coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:140)') return # 查找掘进面的抽采技术 ws_tech = SQLClientHelper.GetDesignWorkSurfTechnologyById( self.design_id) if ws_tech.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:141)') 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,出了点问题,请联系技术人员(错误码:142)') 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.dp, ok = self.ui.dp.text().toDouble() ws_tech.gp, ok = self.ui.gp.text().toDouble() ws_tech.pore_stubble, ok = self.ui.pore_stubble.text().toDouble() ws_tech.pore_angle, ok = self.ui.pore_angle.text().toDouble() ws_tech.close_length, ok = self.ui.close_length.text().toDouble() if self.ui.pore_type1.isChecked(): ws_tech.pore_type = 1 elif self.ui.pore_type2.isChecked(): ws_tech.pore_type = 2 elif self.ui.pore_type3.isChecked(): ws_tech.pore_type = 3 elif self.ui.pore_type4.isChecked(): ws_tech.pore_type = 4 # 保存到数据库 if not SQLClientHelper.UpdateDesignWorkSurfTechnology(ws_tech): UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:143)') else: UiHelper.MessageBox(u'恭喜您,保存数据成功!')
def onSave(self): index = self.ui.adj_layer.currentIndex() if index < 0: return adj_layer_id, ok = self.ui.adj_layer.itemData(index).toInt() adj_layer = SQLClientHelper.GetAdjLayerById(adj_layer_id) if adj_layer.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P1)!') return # 得到邻近层关联的煤层 coal_id = adj_layer.coal_id coal = None if coal_id <= 0: coal = Coal() else: coal = SQLClientHelper.GetCoalById(coal_id) # 读取界面数据到煤层 coal.thick, ok = self.ui.thick.text().toDouble() coal.gas_eta, ok = self.ui.gas_eta.text().toDouble() coal.gas_w0, ok = self.ui.gas_w0.text().toDouble() coal.gas_wc2, ok = self.ui.gas_wc2.text().toDouble() # 保存煤层到数据库(如果煤层为空) if coal_id <= 0: coal_id = SQLClientHelper.AddCoal(coal) if coal_id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:P2)!') return else: adj_layer.coal_id = coal_id adj_layer.hp, ok = self.ui.hp.text().toDouble() adj_layer.h, ok = self.ui.h.text().toDouble() adj_layer.in_cz = int(self.ui.in_cz.isChecked()) # 保存煤层到数据库 if not SQLClientHelper.UpdateCoal(coal): UiHelper.MessageBox(u'更新邻近层数据失败!') return # 保存邻近层到数据库 if not SQLClientHelper.UpdateAdjLayer(adj_layer): UiHelper.MessageBox(u'更新邻近层数据失败!') else: UiHelper.MessageBox(u'更新邻近层数据成功!')
def onSave(self): index = self.ui.coal.currentIndex() if index < 0: return # 根据id查找煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) # 读取界面上的数据保存到煤层对象 coal.thick, ok = self.ui.thick.text().toDouble() coal.dip_angle, ok = self.ui.dip_angle.text().toDouble() # 提交到数据库 if SQLClientHelper.UpdateCoal(coal): UiHelper.MessageBox(u'更新煤层数据成功!') #关闭对话框并返回1 # self.accept() else: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:101)!')
def onWorkAreaChanged(self, index): # 用户选择的采区id work_area_id, ok = self.ui.work_area.itemData(index).toInt() if work_area_id <= 0: return # 根据id查找采区 work_area = SQLClientHelper.GetWorkAreaById(work_area_id) if work_area.id <= 0: return # 更新界面上的数据 self.ui.work_area_a.setText(u'%.1f' % work_area.a) self.ui.work_area_qr.setText(u'%.1f' % work_area.qr) if work_area.coal_id <= 0: self.ui.coal.setCurrentIndex(-1) else: coal = SQLClientHelper.GetCoalById(work_area.coal_id) coal_name = coal.name.decode('utf-8') index = self.ui.coal.findText(coal_name) self.ui.coal.setCurrentIndex(index)
def onCreatReport(self): coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:144)') return # 查找掘进面的抽采技术 goaf_tech = SQLClientHelper.GetDesignGoafTechnologyById(self.design_id) if goaf_tech.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:145)') return # 向cad发送命令请求生成钻孔数据 ret = CbmClientHelper.SendCommandToCAD( "JL.GeneratePore32 %d %d" % (coal.id, goaf_tech.id), True) if ret: # 显示钻孔报表 DataHelper.show_report32(coal, goaf_tech) else: UiHelper.MessageBox(u'启动AutoCAD失败!!!')
def onSave(self): index = self.ui.coal.currentIndex() if index < 0: UiHelper.MessageBox(u'sorry, 出了点问题,请联系技术人员(错误码:Y1)') return # 查询当前煤层 coal_id, ok = self.ui.coal.itemData(index).toInt() coal = SQLClientHelper.GetCoalById(coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry, 出了点问题,请联系技术人员(错误码:Y2)') return # 查询煤层关联的抽采半径参数对象 # 如果没有就内部新建一个 drp = self.getDrp(coal.id, False) if drp.id <= 0: UiHelper.MessageBox(u'sorry, 出了点问题,请联系技术人员(错误码:Y3)') return # 保存煤层 coal.hw, ok = self.ui.hw.text().toDouble() coal.gas_w0, ok = self.ui.gas_w0.text().toDouble() coal.gas_wc3, ok = self.ui.gas_wc3.text().toDouble() if not SQLClientHelper.UpdateCoal(coal): UiHelper.MessageBox(u'sorry, 出了点问题,请联系技术人员(错误码:Y4)') return # 保存瓦斯抽采半径数据 drp.rho, ok = self.ui.rho.text().toDouble() drp.a, ok = self.ui.a.text().toDouble() drp.t, ok = self.ui.t.text().toDouble() drp.l, ok = self.ui.l.text().toDouble() drp.q0, ok = self.ui.q0.text().toDouble() drp.r, ok = self.ui.r.text().toDouble() drp.qm, ok = self.ui.qm.text().toDouble() drp.qsum, ok = self.ui.qsum.text().toDouble() drp.eta, ok = self.ui.eta.text().toDouble() drp.k1, ok = self.ui.k1.text().toDouble() if not SQLClientHelper.UpdateDrillingRadiusParam(drp): UiHelper.MessageBox(u'sorry, 出了点问题,请联系技术人员(错误码:Y5)') UiHelper.MessageBox(u'恭喜您,更新数据成功!')