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'删除设计方案失败!')
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 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 fillDatas(self): # 查找煤层 coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: return # 查找掘进面的抽采技术 goaf_tech = SQLClientHelper.GetDesignGoafTechnologyById(self.design_id) if goaf_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' % goaf_tech.l1) self.ui.l2.setText(u'%.1f' % goaf_tech.l2) self.ui.w.setText(u'%.1f' % goaf_tech.w) self.ui.h.setText(u'%.1f' % goaf_tech.h) self.ui.dp.setText(u'%.1f' % goaf_tech.dp) self.ui.gp.setText(u'%.1f' % goaf_tech.gp) self.ui.pore_stubble.setText(u'%.1f' % goaf_tech.pore_stubble) self.ui.close_length.setText(u'%.1f' % goaf_tech.close_length) # 填空终孔参数列表 self.ui.pore.clearContents() # 从数据库中提取钻孔参数数据 pore_lists = SQLClientHelper.GetDesignGoafPoreListByForeignKey( 'design_goaf_technology_id', goaf_tech.id) if len(pore_lists) == 0: return # 保存到终孔列表 n1 = len(pore_lists) self.ui.pore.setRowCount(n1) for i, pore in enumerate(pore_lists): # 添加到表格中 self.ui.pore.setItem( i, 0, QtGui.QTableWidgetItem(pore.name.decode('utf-8'))) self.ui.pore.setItem( i, 1, QtGui.QTableWidgetItem(u'%.1f' % pore.h_offset)) self.ui.abc.setItem( i, 2, QtGui.QTableWidgetItem(u'%.1f' % pore.v_offset))
def onSave(self): coal = SQLClientHelper.GetCoalById(self.coal_id) if coal.id <= 0: UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:140)') return # 查找掘进面的抽采技术 goaf_tech = SQLClientHelper.GetDesignGoafTechnologyById(self.design_id) if goaf_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 # 保存抽采技术参数到数据库 goaf_tech.l1, ok = self.ui.l1.text().toDouble() goaf_tech.l2, ok = self.ui.l2.text().toDouble() goaf_tech.w, ok = self.ui.w.text().toDouble() goaf_tech.h, ok = self.ui.h.text().toDouble() goaf_tech.dp, ok = self.ui.dp.text().toDouble() goaf_tech.gp, ok = self.ui.gp.text().toDouble() goaf_tech.pore_stubble, ok = self.ui.pore_stubble.text().toDouble() goaf_tech.pore_angle, ok = self.ui.pore_angle.text().toDouble() goaf_tech.close_length, ok = self.ui.close_length.text().toDouble() # 保存终孔参数 # 保存到数据库 if not SQLClientHelper.UpdateDesignGoafTechnology(goaf_tech): UiHelper.MessageBox(u'sorry,出了点问题,请联系技术人员(错误码:143)') else: UiHelper.MessageBox(u'恭喜您,保存数据成功!')