import QtQuick import QtQuick.Controls import QtQuick.Layouts import com.InteractiveTask 1.0 Item { id: materialcheckplan x: 290 y: 130 width: 1600 height: 920 signal signal_getMaterialCheckPlan(); signal signal_postSubmit(); property int planId: 0 property string strMaterialCheckPlanGet: ""; property bool takebackstat : false property bool opendoor : false signal startReader(); signal signal_openLock(); signal signal_takebackstat(bool stat); PromptInfo { id:materialcheckplan_prompt_info } Connections { target: materialcheckplan onVisibleChanged: { if (visible === true) { proThread.moveCursorTo(0, 0); } if (materialcheckplan.visible === true) { materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = false; // signal_getMaterialCheckPlan(); materialCheckSign.imageData = ""; waitPromptBox.show(); var taskType = InteractiveTask.TypeHttpGet_getLastCheckPlanByCabinetCode; interactiveCore.appendTask( taskType, null, (data) =>{ // 解析返回结果 var jsonObjRoot = JSON.parse(data); if (jsonObjRoot.code === 200) { var jsonObjData = jsonObjRoot.data; planId = jsonObjData.planId; pConfig.setScurrentPlanId(parseInt(planId)); var planDate = jsonObjData.planDate; var planStat = jsonObjData.status; var strPlanStat = "未定义"; var signatureImg = jsonObjData.signatureImg; if (planStat === "0") { strPlanStat = "待开始"; materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = true; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = true; materialcheckplan_text_plan_title.visible = false; } else if (planStat === "2") { strPlanStat = "进行中"; materialcheckplan_btn_submit.visible = true; materialcheckplan_btn_proceed_check.visible = true; materialcheckplan_btn_sign.visible = true; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = true; materialcheckplan_text_plan_title.visible = false; } else if (planStat === "1") { strPlanStat = "已完成"; materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = false; materialcheckplan_text_plan_title.visible = true; } else { materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = true; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = false; materialcheckplan_text_plan_title.visible = false; } materialcheckplan_text_plan_date.text = "计划日期:" + planDate; materialcheckplan_text_plan_stat.text = "计划状态:" + strPlanStat; if (signatureImg === "" || signatureImg === null) { materialcheckplan_text_sign.visible = true; materialcheckplan_image_sign.visible = false; materialcheckplan_image_sign.source = ""; materialCheckSign.imageData = ""; } else { materialcheckplan_text_sign.visible = false; materialcheckplan_image_sign.visible = true; materialcheckplan_image_sign.source = signatureImg; materialCheckSign.imageData = signatureImg; } var jsonArrList = jsonObjData.list; for (var i = 0; i < jsonArrList.length; ++i) { var jsonObjList = jsonArrList[i]; var materialType = jsonObjList.materialsTypeName; var materialIcon = jsonObjList.materialsTypeIcon; var mainNumber = jsonObjList.allNumber; var lendNumber = jsonObjList.loanNumber; var waitNumber = jsonObjList.checkNumber; var normalNumber = jsonObjList.normalNumber; var expireNumber = jsonObjList.timeoutNumber; var damageNumber = jsonObjList.badNumber; materialcheckplan_tableModel.append({ materialType: materialType, materialIcon: materialIcon, mainNumber: mainNumber, lendNumber: lendNumber, waitNumber: waitNumber, normalNumber: normalNumber, expireNumber: expireNumber, damageNumber: damageNumber, }); } } else { materialcheckplan_text_plan_date.text = ""; materialcheckplan_text_plan_stat.text = ""; // infoPromptBox.title("提示"); // infoPromptBox.message(jsonObjRoot.msg); // infoPromptBox.button_clear(); // infoPromptBox.button_push("#055eb3", "确定", null, null); // infoPromptBox.show(); materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; materialcheckplan_rect_main.visible = false; materialcheckplan_text_plan_title.visible = true; } waitPromptBox.hide(); }); } else { materialcheckplan_tableModel.clear(); materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = true; materialcheckplan_btn_return.visible = true; } } } ListModel { id: materialcheckplan_tableModel } // 提交结果 Button { id: materialcheckplan_btn_submit x: 928 y: 835 width: 192 height: 75 background: Rectangle { color: "#ff9900" radius: 10 } text: qsTr("提交结果") font.pixelSize: 30 palette.buttonText: "white" Connections { target: materialcheckplan_btn_submit onClicked: { // materialcheckplan_dialog_submit.open(); infoPromptBox.title("操作确认"); infoPromptBox.message("确定要开始提交结果吗?"); infoPromptBox.button_clear(); infoPromptBox.button_push("red", "取消", null, null); infoPromptBox.button_push( "#055eb3", "确定", ()=>{ var taskType = InteractiveTask.TypeHttpPost_insertSubmitPlan; interactiveCore.appendTask( taskType, null, (data) =>{ // 解析返回结果 var jsonObjRoot = JSON.parse(data); if (jsonObjRoot.code === 200) { infoPromptBox.title("提交成功"); infoPromptBox.message("检查结果提交成功"); infoPromptBox.button_clear(); infoPromptBox.button_push("#055eb3", "确定", null, null); infoPromptBox.show(); materialCheckPlan.visible = false; materialSelmodel.visible = true; proThread.slot_getMaterial(); } else { infoPromptBox.title("提交失败"); infoPromptBox.message(jsonObjRoot.msg); infoPromptBox.button_clear(); infoPromptBox.button_push("#055eb3", "确定", null, null); infoPromptBox.show(); } }); }, null); infoPromptBox.show(); } } } // 继续检查 Button { id: materialcheckplan_btn_proceed_check x: 1168 y: 835 width: 192 height: 75 visible: false background: Rectangle { color: "#ff0000" // 设置背景为透明 radius: 10 // 可选,设置圆角 } text: qsTr("继续检查") font.pixelSize: 30 palette.buttonText: "white" // 设置字体颜色为绿色 Connections { target: materialcheckplan_btn_proceed_check onClicked: { mainScreen.changeModel_text("物资检查表"); materialCheckForm.visible = true; materialCheckPlan.visible = false; mainScreen.resetLogin_timeout(); takebackstat = true; pConfig.mtakebackstat = true; pConfig.imaterworkstat = 4; signal_openLock(); } } } // 开始检查 Button { id: materialcheckplan_btn_start_check x: 1168 y: 835 width: 192 height: 75 background: Rectangle { color: "#ff0000" // 设置背景为透明 radius: 10 // 可选,设置圆角 } text: qsTr("开始检查") font.pixelSize: 30 palette.buttonText: "white" // 设置字体颜色为绿色 Connections { target: materialcheckplan_btn_start_check onClicked: { // materialcheckplan_dialog_confirm.open(); infoPromptBox.title("操作确认"); infoPromptBox.message("确定要开始检查物资吗?"); infoPromptBox.button_clear(); infoPromptBox.button_push("red", "取消", null, null); infoPromptBox.button_push( "#055eb3", "确定", ()=>{ var taskType = InteractiveTask.TypeHttpPost_startCheckPlan; interactiveCore.appendTask( taskType, null, ()=>{ mainScreen.changeModel_text("物资检查表"); materialCheckForm.visible = true; materialCheckPlan.visible = false; mainScreen.resetLogin_timeout(); takebackstat = true; pConfig.mtakebackstat = true; pConfig.imaterworkstat = 4; signal_openLock(); }); }, null); infoPromptBox.show(); } } } // 返回按钮 Button { id: materialcheckplan_btn_return x: 1408 y: 835 width: 192 height: 75 background: Rectangle { color: "#055eb3" // 设置背景为透明 radius: 10 // 可选,设置圆角 } text: qsTr("返回") font.pixelSize: 30 palette.buttonText: "white" // 设置字体颜色为绿色 Connections { target: materialcheckplan_btn_return onClicked: { materialcheckplan.visible = false; materialSelmodel.visible = true; mainScreen.resetLogin_timeout(); } } } // 标题区域 Text { id: materialcheckplan_text_plan_title x: 0 y: 0 width: 1600 height: 90 text: "当前无可执行的检查计划" font.pixelSize: 30 color: "#d7d7d2" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter leftPadding: 20 // 添加左边距使文本不紧贴边缘 } // 主体区域 Rectangle { id: materialcheckplan_rect_main width: 1600 height: 800 color: "#272b7ae9" radius: 20 clip: true // 签名 Rectangle { id: materialcheckplan_btn_sign x: 1400 y: 25 width: 180 height: 50 color: "#008000" radius: 10 Text { id: materialcheckplan_text_sign // anchors.fill: parent anchors.centerIn: parent text: qsTr("签名") font.pixelSize: 30 color: "#ffffff" } Image { id: materialcheckplan_image_sign; anchors.fill: parent } MouseArea { anchors.fill: parent onClicked: { materialCheckPlan.visible = false; materialCheckSign.visible = true; mainScreen.resetLogin_timeout(); } } } // 计划日期区域 Text { id: materialcheckplan_text_plan_date x: 0 y: 0 width: 1600 height: 90 text: "计划日期:" font.pixelSize: 30 color: "#d7d7d2" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter leftPadding: 20 // 添加左边距使文本不紧贴边缘 } // 计划状态区域 Text { id: materialcheckplan_text_plan_stat x: 0 y: 0 width: 1600 height: 90 text: "计划状态:" font.pixelSize: 30 color: "#d7d7d2" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter leftPadding: 360 // 添加左边距使文本不紧贴边缘 } // 表格区域 Rectangle { x: 10 y: 90 width: 1580 height: 700 color: "#272b7ae9" radius: 20 // 表格 Column { anchors.fill: parent spacing: 0 // 表头 Row { id: materialcheckplan_header width: parent.width height: 100 spacing: 0 Repeater { model: ["物资类型", "总数量", "借出数量", "待检数量", "正常数量", "过期数量", "损坏数量"] Rectangle { width: parent.width / 7 height: parent.height color: "#33ffffff" border.color: "#47bfff" clip: true Text { anchors.centerIn: parent text: modelData font.pixelSize: 25 color: "#d7d7d2" font.bold: true } } } } // 表格内容 ListView { width: parent.width height: parent.height - materialcheckplan_header.height clip: true model: materialcheckplan_tableModel delegate: Row { width: 1580 height: 100 spacing: 0 property var rowData: [mainNumber, lendNumber, waitNumber, normalNumber, expireNumber, damageNumber] Rectangle { width: parent.width / 7 height: parent.height color: "#272b7ae9" border.color: "#47bfff" ToolButton { anchors.centerIn: parent enabled: false // 不可点击 display: AbstractButton.TextBesideIcon // 文字在图标旁边 icon.source: model.materialIcon icon.width: 36 icon.height: 30 text: model.materialType palette.buttonText: "#d7d7d2" font { pixelSize: 25 } } } Repeater { model: 6 Rectangle { width: parent.width / 7 height: parent.height color: "#272b7ae9" border.color: "#47bfff" Text { anchors.centerIn: parent font.pixelSize: 25 color: "#d7d7d2" text: parent.parent.rowData[index] } } } } } } } } function slot_getMaterialCheckPlan(data) { slot_postSubmit(data); strMaterialCheckPlanGet = data; materialcheckplan_tableModel.clear(); materialCheckSign.imageData = ""; var jsonObjRoot = JSON.parse(data); if (jsonObjRoot.code === 200) { var jsonObjData = jsonObjRoot.data; planId = jsonObjData.planId; pConfig.setScurrentPlanId(parseInt(planId)); var planDate = jsonObjData.planDate; var planStat = jsonObjData.status; var strPlanStat = "未定义"; var signatureImg = jsonObjData.signatureImg; if (planStat === "0") { strPlanStat = "待开始"; materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = true; materialcheckplan_btn_return.visible = true; } else if (planStat === "1") { strPlanStat = "已完成"; materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; } else if (planStat === "2") { strPlanStat = "进行中"; materialcheckplan_btn_submit.visible = true; materialcheckplan_btn_proceed_check.visible = true; materialcheckplan_btn_sign.visible = true; materialcheckplan_btn_start_check.visible = false; materialcheckplan_btn_return.visible = true; }else { materialcheckplan_btn_submit.visible = false; materialcheckplan_btn_proceed_check.visible = false; materialcheckplan_btn_sign.visible = false; materialcheckplan_btn_start_check.visible = true; materialcheckplan_btn_return.visible = true; } materialcheckplan_text_plan_date.text = "计划日期:" + planDate; materialcheckplan_text_plan_stat.text = "计划状态:" + strPlanStat; if (signatureImg === "" || signatureImg === null) { materialcheckplan_text_sign.visible = true; materialcheckplan_image_sign.visible = false; materialCheckSign.imageData = ""; } else { materialcheckplan_text_sign.visible = false; materialcheckplan_image_sign.visible = true; materialcheckplan_image_sign.source = signatureImg; materialCheckSign.imageData = signatureImg; } var jsonArrList = jsonObjData.list; for (var i = 0; i < jsonArrList.length; ++i) { var jsonObjList = jsonArrList[i]; var materialType = jsonObjList.materialsTypeName; var materialIcon = jsonObjList.materialsTypeIcon; var mainNumber = jsonObjList.allNumber; var lendNumber = jsonObjList.loanNumber; var waitNumber = jsonObjList.checkNumber; var normalNumber = jsonObjList.normalNumber; var expireNumber = jsonObjList.timeoutNumber; var damageNumber = jsonObjList.badNumber; materialcheckplan_tableModel.append({ materialType: materialType, materialIcon: materialIcon, mainNumber: mainNumber, lendNumber: lendNumber, waitNumber: waitNumber, normalNumber: normalNumber, expireNumber: expireNumber, damageNumber: damageNumber, }); } } } function slot_postSubmit(data) { var jsonObjRoot = JSON.parse(data); if (jsonObjRoot.code === 200) { // materialchecksign_prompt_info.promptInfoTimeout = 3; // materialchecksign_prompt_info.promptInfoText = jsonObjRoot.msg; // materialchecksign_prompt_info.promptInfoIcon = "qrc:/png/error.png" // materialchecksign_prompt_info.promptInfoColor = "#6600ff00" } else { materialcheckplan_prompt_info.promptInfoTimeout = 3; materialcheckplan_prompt_info.promptInfoText = jsonObjRoot.msg; materialcheckplan_prompt_info.promptInfoIcon = "qrc:/png/error.png" materialcheckplan_prompt_info.promptInfoColor = "#66ea3a0e" } } function lockStat_callback(left, right) { if(left === false || right === false) { opendoor = true; if(takebackstat === true) { signal_takebackstat(true); } } else if(left === true && right === true) { opendoor = false; if(takebackstat === true) { startReader(); takebackstat = false; signal_takebackstat(false); pConfig.smaterialStock = true; // 开始读rfid mainScreen.switchViewOffEx(); materialStocktaking.set_userinfo(); materialStocktaking.materiallistclear(); materialStocktaking.visible = true; mainScreen.resetLogin_timeout(); } } } function start_plan(isStart) { mainScreen.changeModel_text("物资检查表"); materialCheckForm.visible = true; materialCheckPlan.visible = false; materialcheckplan_dialog_confirm.close() takebackstat = true; pConfig.mtakebackstat = true; pConfig.imaterworkstat = 4; signal_openLock(); } }