123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786 |
- import QtQuick 2.15
- import QtQuick.Layouts 1.3
- import QtQuick.Controls 2.14
- import QtQuick.Controls.Styles 1.2
- import Qt.labs.qmlmodels 1.0
- import TService 1.0
- Item{
- id: root
- //anchors.fill: parent
- //width:1024
- //height: 768
- //anchors.centerIn: parent
- property var pagetype:rootitem.Page_Type_Settings
- property string title_str:"信息录入"
- property string standard_name:"国标"
- property string company:""
- property string licenseplate: ""
- property int compartment_num: 1
- property int total_volume: 0
- property var volume_arry: [0,0,0,0,0,0,0,0]
- /*
- Loader{
- id:loader
- anchors.fill: parent
- anchors.margins: 0
- sourceComponent: componet
- }
- */
- /*
- function show(){
- if(loader.sourceComponent === null){
- loader.sourceComponent = componet
- console.debug("avans 1111")
- }
- loader.item.show()
- }
- function exit(){
- if(loader.sourceComponent !== null){
- loader.item.exit()
- }
- }
- */
- function update_standard(){
- var jsonObj = StandardManager.get_names();
- lmd.clear()
- for(var i=0; i<jsonObj.num; i++){
- //console.log("name ===="+jsonArry.names[i]);
- lmd.append({text:jsonObj.names[i]})
- }
- standard_name_comboBox.currentIndex = 0
- }
- function caculate_volume(){
- if(root.total_volume > 0 && root.compartment_num >0){
- var vol = root.total_volume/root.compartment_num;
- var volume = parseInt(vol)
- if(1 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=0
- rectvolume_3.text=0
- rectvolume_4.text=0
- rectvolume_5.text=0
- rectvolume_6.text=0
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(2 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=root.total_volume-volume
- rectvolume_3.text=0
- rectvolume_4.text=0
- rectvolume_5.text=0
- rectvolume_6.text=0
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(3 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=root.total_volume-volume*2
- rectvolume_4.text=0
- rectvolume_5.text=0
- rectvolume_6.text=0
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(4 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=volume
- rectvolume_4.text=root.total_volume-volume*3
- rectvolume_5.text=0
- rectvolume_6.text=0
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(5 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=volume
- rectvolume_4.text=volume
- rectvolume_5.text=root.total_volume-volume*4
- rectvolume_6.text=0
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(6 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=volume
- rectvolume_4.text=volume
- rectvolume_5.text=volume
- rectvolume_6.text=root.total_volume-volume*5
- rectvolume_7.text=0
- rectvolume_8.text=0
- }else if(7 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=volume
- rectvolume_4.text=volume
- rectvolume_5.text=volume
- rectvolume_6.text=volume
- rectvolume_7.text=root.total_volume-volume*6
- rectvolume_8.text=0
- }else if(8 == root.compartment_num){
- rectvolume_1.text=volume
- rectvolume_2.text=volume
- rectvolume_3.text=volume
- rectvolume_4.text=volume
- rectvolume_5.text=volume
- rectvolume_6.text=volume
- rectvolume_7.text=volume
- rectvolume_8.text=root.total_volume-volume*7
- }
- }
- }
- function check_invalid(){
- var valid = true
- if(0 == licenseplate.length){
- valid = false
- log.show("车牌不能为空")
- return valid
- }
- if(0 == company.length){
- valid = false
- log.show("车辆单位不能为空")
- return valid
- }
- if(0 == total_volume){
- valid = false
- log.show("容积不能为空")
- return valid
- }
- if(0 == compartment_num){
- valid = false
- log.show("仓数不能为空")
- return valid
- }
- var all_volume = 0
- for(var i=0; i<compartment_num; i++){
- all_volume = all_volume + volume_arry[i]
- }
- if(all_volume !== total_volume){
- valid = false
- log.show("体积总容量与每仓数据不匹配")
- }
- return valid
- }
- // Component{
- // id:componet
- DynamicGroupBox{
- id:groupbox
- //width: 1020
- //height: 760
- anchors.centerIn: parent
- anchors.fill: parent
- title: title_str
- /*
- function show(){
- animationShow.running = true
- }
- function exit(){
- //BreatheTestJs.exit = true
- animationExit.running = true
- //startStopButton.running = false
- //stopTimer.start()
- }
- //加载任务动画效果
- NumberAnimation {
- id: animationShow
- target: groupbox
- property: "x"
- from: groupbox.x
- to: 0
- duration: 500
- }
- NumberAnimation {
- id: animationExit
- target: groupbox
- property: "x"
- from: groupbox.x
- to: 1024
- duration: 500
- }
- */
- ColumnLayout{
- spacing:2
- Rectangle{
- Layout.alignment: Qt.AlignCenter
- //Layout.fillWidth: true
- color: "transparent"
- Layout.preferredHeight: 600
- Layout.preferredWidth: 1240
- Row{
- anchors.centerIn: parent
- spacing:10
- Column{
- spacing:20
- DynamicGroupBox{
- id:standard_select
- title: "标准选择:"
- //anchors.centerIn: parent
- width: 360
- height: 160
- Column{
- //spacing:5
- // anchors.centerIn: parent
- Rectangle{
- width:320
- height: 30
- color: "transparent"
- Row{
- spacing:30
- Label{
- text: "执行标准"
- //font.pixelSize: 24
- font.bold: true
- font.pixelSize: 20
- //color: "red"
- }
- UserComboBox{
- id:standard_name_comboBox
- //anchors.fill:parent
- implicitWidth: 100
- implicitHeight: 30
- bgColor:"#D2D5D9"
- model: ListModel{
- id:lmd
- }
- onCurrentTextChanged: {
- root.standard_name = currentText
- console.log("choose standard: "+root.standard_name)
- }
- }
- }
- }
- UserButton{
- text: "标准管理"
- font.pixelSize: 20
- implicitHeight: 120
- implicitWidth: 160
- //Layout.leftMargin: -30
- //Layout.topMargin: 10
- onClicked: {
- var compMainPage = Qt.createComponent("PageStandard.qml")
- .createObject(main_window, {x:0, y:0, width:main_window.width, height:main_window.height});
- }
- }
- }
- /*
- GridLayout{
- anchors.centerIn: parent
- columns: 2
- rows:2
- //columnSpacing: 10
- //rowSpacing: 5
- //Layout.rowSpan: 10
- Label{
- text: "执行标准"
- //width:120
- //height: 40
- //font.pixelSize: 24
- font.bold: true
- font.pixelSize: 20
- //color: "red"
- }
- //Rectangle{
- // id:rectcom1
- // implicitWidth: 100
- // implicitHeight:30
- UserComboBox{
- id:standard_name_comboBox
- //anchors.fill:parent
- implicitWidth: 100
- implicitHeight: 30
- bgColor:"#D2D5D9"
- model: ListModel{
- id:lmd
- }
- onCurrentTextChanged: {
- root.standard_name = currentText
- console.log("choose standard: "+root.standard_name)
- }
- }
- // }
- UserButton{
- text: "标准管理"
- font.pixelSize: 24
- implicitHeight: 120
- implicitWidth: 140
- //Layout.leftMargin: -30
- //Layout.topMargin: 10
- onClicked: {
- var compMainPage = Qt.createComponent("PageStandard.qml")
- .createObject(main_window, {x:0, y:0, width:main_window.width, height:main_window.height});
- }
- }
- }
- */
- }
- DynamicGroupBox{
- id:tankinfo
- title: "罐车信息"
- width: 360
- height: 320
- //anchors.centerIn: parent
- //Layout.horizontalCenter: parent.horizontalCenter
- //Layout.verticalCenter: parent.verticalCenter
- ColumnLayout{
- anchors.centerIn: parent
- spacing: 20
- Column{
- spacing: 10
- //Layout.alignment: Qt.AlignLeft
- InputLine{
- id:manufactureInputLine
- paraName: " 车辆单位:"
- paraLength: 200
- onTextChanged: {
- root.company = text
- }
- }
- InputLine{
- id:carplate
- paraName: " 车牌号:"
- paraLength: 200
- onTextChanged: {
- root.licenseplate = text
- }
- }
- InputLine{
- id:t_volume
- paraName: "总容积 (L):"
- text: "0"
- paraLength: 200
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- if(text.length > 0){
- root.total_volume = Number(text)
- if(0 == root.compartment_num){
- compartment.text = "1"
- }
- root.caculate_volume()
- }else{
- root.total_volume=0
- }
- }
- }
- InputLine{
- id:compartment
- paraName: " 仓 数:"
- text: "1"
- paraLength: 200
- validator:IntValidator {
- bottom:1;
- top:8
- }
- onTextChanged: {
- if(text.length > 0){
- var n = Number(text);
- if(n >0 && n<5 ){
- root.compartment_num = Number(text)
- root.caculate_volume()
- //console.log("compartment:"+text)
- }else{
- if(n >4){
- log.show("仓数不能大于4")
- text="4"
- }
- if(n === 0){
- text="1"
- }
- }
- }else{
- root.compartment_num=0;
- }
- }
- }
- }
- GridLayout{
- //anchors.centerIn: parent
- columns: 2
- rows:4
- columnSpacing: 20
- rowSpacing: 5
- //Layout.rowSpan: 5
- InputLine{
- id:rectvolume_1
- paraName: "1仓:"
- text: "0"
- paraLength: 60
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[0] = Number(text)
- //console.log("1:volume[%d]", root.volume_arry[0])
- }
- }
- InputLine{
- id:rectvolume_2
- paraName: "2仓:"
- text: "0"
- paraLength: 60
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[1] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_3
- paraName: "3仓:"
- text: "0"
- paraLength: 60
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[2] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_4
- paraName: "4仓:"
- text: "0"
- paraLength: 60
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[3] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_5
- paraName: "5仓:"
- text: "0"
- paraLength: 60
- visible: false
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[4] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_6
- paraName: "6仓:"
- text: "0"
- paraLength: 60
- visible: false
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[5] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_7
- paraName: "7仓:"
- text: "0"
- paraLength: 60
- visible: false
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[6] = Number(text)
- }
- }
- InputLine{
- id:rectvolume_8
- paraName: "8仓:"
- text: "0"
- paraLength: 60
- visible: false
- validator:RegExpValidator {
- regExp: /[0-9]*/
- }
- onTextChanged: {
- root.volume_arry[7] = Number(text)
- }
- }
- }
- }
- }
- }
- DynamicGroupBox{
- id:visual_inspection
- title: "外观检查"
- //anchors.centerIn: parent
- width: 820
- height: 500
- Row{
- spacing:10
- DynamicGroupBox{
- id:visual_VRS
- title: "油气回收系统"
- titleFontPixel:18
- //anchors.centerIn: parent
- width: 390
- height: 450
- UserTableView{
- id:table_vrs
- table_name: "vrs"
- anchors.fill:parent
- }
- }
- DynamicGroupBox{
- id:visual_BLS
- title: "底部装油系统"
- titleFontPixel:18
- //anchors.centerIn: parent
- width: 390
- height: 450
- UserTableView{
- id:table_bls
- table_name: "bls"
- anchors.fill:parent
- }
- }
- }
- }
- }
- }
- Rectangle{
- Layout.alignment: Qt.AlignBottom
- Layout.fillWidth: true
- color: "transparent"
- Layout.preferredHeight: 100
- Layout.preferredWidth: 300
- UserButton {
- id: prev_step
- text: "返回首页"
- height: 80
- width: 180
- font.pixelSize: 24
- anchors.left: parent.left;
- anchors.leftMargin: 40;
- anchors.bottom: parent.bottom;
- anchors.bottomMargin: 10;
- onClicked: myLoder.sourceComponent = null // 切换显示主页面
- }
- UserButton {
- id: next_step;
- text: "开始检测";
- //visible: false
- font.pixelSize: 24
- anchors.right: parent.right;
- anchors.rightMargin: 60;
- anchors.bottom: parent.bottom;
- anchors.bottomMargin: 10;
- height: 80
- width: 180
- onClicked: {
- //log.show(utr.state)
- //console.log("state ===="+utr.state);
- if(root.check_invalid()){
- var infoArry = [];
- standard_name = standard_name_comboBox.currentText;
- infoArry.push(standard_name)
- infoArry.push(licenseplate);
- infoArry.push(company);
- infoArry.push(total_volume);
- infoArry.push(compartment_num);
- for(var i=0; i<8; i++){
- infoArry.push(volume_arry[i])
- }
- var ret = testService.setTankinfo(infoArry);
- if(false === ret){
- log.show("设置罐车参数不成功")
- }else{
- for(var n=0; n<8; n++){
- switch(n){
- case 0:
- page_recoveryvalve1.volume = volume_arry[n]
- page_recoveryvalve1.organize = company
- page_recoveryvalve1.carplate = licenseplate
- page_recoveryvalve1.total_volume = total_volume
- break
- case 1:
- page_recoveryvalve2.volume = volume_arry[n]
- page_recoveryvalve2.organize = company
- page_recoveryvalve2.carplate = licenseplate
- page_recoveryvalve2.total_volume = total_volume
- break
- case 2:
- page_recoveryvalve3.volume = volume_arry[n]
- page_recoveryvalve3.organize = company
- page_recoveryvalve3.carplate = licenseplate
- page_recoveryvalve3.total_volume = total_volume
- break
- case 3:
- page_recoveryvalve4.volume = volume_arry[n]
- page_recoveryvalve4.organize = company
- page_recoveryvalve4.carplate = licenseplate
- page_recoveryvalve4.total_volume = total_volume
- break
- case 4:
- page_recoveryvalve5.volume = volume_arry[n]
- page_recoveryvalve5.organize = company
- page_recoveryvalve5.carplate = licenseplate
- page_recoveryvalve5.total_volume = total_volume
- break
- case 5:
- page_recoveryvalve6.volume = volume_arry[n]
- page_recoveryvalve6.organize = company
- page_recoveryvalve6.carplate = licenseplate
- page_recoveryvalve6.total_volume = total_volume
- break
- case 6:
- page_recoveryvalve7.volume = volume_arry[n]
- page_recoveryvalve7.organize = company
- page_recoveryvalve7.carplate = licenseplate
- page_recoveryvalve7.total_volume = total_volume
- break
- case 7:
- page_recoveryvalve8.volume = volume_arry[n]
- page_recoveryvalve8.organize = company
- page_recoveryvalve8.carplate = licenseplate
- page_recoveryvalve8.total_volume = total_volume
- break
- }
- }
- swipeView.changePages(compartment_num)
- swipeView.incrementCurrentIndex();
- //swipeView.incrementCurrentIndex();
- }
- }else{
- //log.show("体积或仓数,不正确")
- }
- }
- }
- }
- }
- }
- // }
- Component.onCompleted: {
- var jsonObj = StandardManager.get_names()
- lmd.clear()
- for(var i=0; i<jsonObj.num; i++){
- //console.log("name ===="+jsonArry.names[i]);
- lmd.append({text:jsonObj.names[i]})
- }
- standard_name_comboBox.currentIndex = 0
- var jsonObj_vrs = testService.get_vrs_items()
- for(var j=0; j<jsonObj_vrs.count; j++){
- table_vrs.add_item(jsonObj_vrs.item[j])
- }
- var jsonObj_bls = testService.get_bls_items()
- for( j=0; j<jsonObj_bls.count; j++){
- table_bls.add_item(jsonObj_bls.item[j])
- }
- }
- }
|