Esempio n. 1
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)!')
Esempio n. 2
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)