| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- import QtQuick
- import QtQuick.Layouts
- import QtQuick.Controls
- // import com.InteractiveCore 1.0
- import com.InteractiveTask 1.0
- Item {
- id: materialexception
- x: 290
- y: 130
- width: 1600
- height: 920
- property bool takebackstat : false
- property bool opendoor : false
- signal startReader();
- signal signal_openLock();
- signal signal_takebackstat(bool stat);
- Connections {
- target: materialexception
- onVisibleChanged: {
- // 刷新数据缓存
- if (materialexception.visible === true )
- {
- proThread.moveCursorTo(0, 0);
- materialexception_exce_misplace.visible = false;
- // refreshListMode();
- // materialexception_delayTimer.start();
- waitPromptBox.show();
- var taskType = InteractiveTask.TypeMaterialExceptionRefreshListModel;
- interactiveCore.appendTask(
- taskType, "", ()=>{
- refreshInterface();
- waitPromptBox.hide();
- });
- }
- }
- }
- // Timer {
- // id: materialexception_delayTimer
- // interval: 500 // 1秒 = 1000毫秒
- // repeat: false // 只触发一次
- // onTriggered: {
- // refreshListMode();
- // }
- // }
- // 主体区域
- Rectangle {
- id: materialexception_main
- x: 0
- y: 0
- width: parent.width;
- height: parent.height * 0.88
- color: "#272b7ae9"
- radius: 10
- Row {
- x: 20
- y: 20
- width: parent.width - 40
- height: parent.height * 0.88 - 40
- Rectangle {
- id: materialexception_exce_noerror
- width: parent.width
- height: 64
- color: "#00ffffff"
- radius: 10
- visible: false
- Rectangle {
- x: 5
- y: 5
- width: 250
- height: 52
- color: "#ffffff"
- radius: 20
- Text {
- anchors.centerIn: parent
- font.pixelSize: 25
- // font.bold: true
- color: "#ff0000"
- text: "当前无异常发生"
- }
- }
- }
- Rectangle {
- id: materialexception_exce_misplace
- width: parent.width
- height: 400
- color: "#1a3782"
- radius: 10
- visible: false
- Rectangle {
- x: 5
- y: 5
- width: 250
- height: 52
- color: "#ffffff"
- radius: 20
- Text {
- anchors.centerIn: parent
- font.pixelSize: 25
- // font.bold: true
- color: "#ff0000"
- text: "异常类型:物资错放"
- }
- }
- Rectangle {
- x: 5
- y: 60
- width: 412
- height: 50
- color: "#1a3782"
- Text {
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- anchors.fill: parent
- font.pixelSize: 20
- color: "#ffffff"
- text: "以下物资不属于该柜子,请取出!"
- }
- }
- GridView {
- x: 25
- y: 100
- width: parent.width - 50
- height: parent.height - 120
- cellWidth: 250
- cellHeight: 350
- model: materialexception_modelMaterialException
- delegate: Rectangle{
- width: 250
- height: 350
- color: "#00ffffff"
- Image {
- anchors.horizontalCenter: parent.horizontalCenter;
- y: 25
- width: 150
- height: 150
- visible: true
- source: model.materialsTypePicture
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 0
- y: 185
- width: parent.width
- height: 50
- visible: true
- text: model.materialsName
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- Text {
- x: 0
- y: 250
- width: parent.width
- height: 25
- visible: true
- text: model.materialsRfid
- font.pixelSize: 12
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- Rectangle {
- x: 25
- y: 125
- width: 150
- height: 50
- color: {
- if (model.status === "0") return "#00ff00"; // 正常 - 绿色
- if (model.status === "1") return "#ff0000"; // 损坏 - 红色
- if (model.status === "2") return "#ff9900"; // 过期 - 橙色
- if (model.status === "3") return "#ff9900"; // 放错柜子 - 橙色
- return "gray"; // 默认颜色
- }
- visible: {
- return false;
- // return model.status !== "0";
- }
- Text {
- anchors.centerIn: parent
- // text: "待还"
- text:{
- if (model.status === "0") return "正常";
- if (model.status === "1") return "损坏";
- if (model.status === "2") return "过期";
- if (model.status === "3") return "放错柜子";
- return "未知状态"; // 默认值
- }
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- }
- }
- }
- Rectangle {
- id: materialexception_exce_timeout
- width: parent.width
- height: 52
- color: "#1a3782"
- radius: 10
- visible: false
- Rectangle {
- x: 5
- y: 5
- width: 250
- height: 52
- color: "#ffffff"
- radius: 20
- Text {
- anchors.centerIn: parent
- font.pixelSize: 25
- // font.bold: true
- color: "#ff0000"
- text: "异常类型:超时未关锁"
- }
- }
- }
- }
- }
- // 状态栏
- Rectangle {
- id: materialexception_stat
- x: 0
- y: parent.height * 0.88
- width: parent.width;
- height: parent.height * 0.12
- color: "#00ffffff"
- radius: 10
- // 左侧布局
- Row {
- anchors.left: parent.left // 右对齐
- spacing: 10
- // 异常上报按钮
- Button {
- id: materialexception_btn_open
- y: 25
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff0000"
- radius: 10
- }
- text: qsTr("异常上报")
- font.pixelSize: 30
- palette.buttonText: "white"
- Connections {
- target: materialexception_btn_open
- onClicked: {
- materialExceptionReport.visible = true;
- materialexception.visible = false;
- }
- }
- }
- }
- // 右侧布局
- Row {
- anchors.right: parent.right // 右对齐
- spacing: 10
- // 开柜按钮
- Button {
- id: materialexception_btn_cabinet
- y: 25
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff0000"
- radius: 10
- }
- text: qsTr("开柜")
- font.pixelSize: 30
- palette.buttonText: "white"
- Connections {
- target: materialexception_btn_cabinet
- onClicked: {
- takebackstat = true;
- pConfig.mtakebackstat = true;
- pConfig.imaterworkstat = 3;
- signal_openLock();
- }
- }
- }
- }
- }
- Rectangle {
- id: materialexception_rect_autoreplace
- x: 250
- y: 823
- width: 500
- height: 75 // 减去顶部圆角矩形的高度
- color: "#00ffffff"
- visible: false
- Image {
- x: 0
- y: 0
- width: 75
- height: 75
- visible: true
- source: "qrc:/png/takeback.png"
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 200
- y: 0
- width: 220
- height: 75
- visible: true
- text: "等待取出不属于该柜子的物资......"
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- function lockStat_callback(left, right)
- {
- if (pConfig.imaterworkstat === 3)
- {
- if(left === false || right === false)
- {
- // materialreplace_btn_head_openLock.visible = false; // 柜子开时,开柜按钮隐藏
- materialexception_rect_autoreplace.visible = true;
- // materialexception_btn_open.visible = false;
- materialexception_btn_cabinet.enabled = false;
- opendoor = true;
- if(takebackstat === true)
- {
- signal_takebackstat(true);
- }
- }
- else if(left === true && right === true)
- {
- materialexception_rect_autoreplace.visible = false;
- // materialexception_btn_open.visible = true;
- materialexception_btn_cabinet.enabled = true;
- opendoor = false;
- if(takebackstat === true)
- {
- startReader();
- takebackstat = false;
- signal_takebackstat(false);
- pConfig.smaterialStock = true;
- // 开始读rfid
- // materialexception.visible = false;
- mainScreen.switchViewOffEx();
- materialStocktaking.set_userinfo();
- materialStocktaking.materiallistclear();
- materialStocktaking.visible = true;
- // materialreplace_rect_autoreplace.visible = false;
- mainScreen.resetLogin_timeout();
- }
- }
- }
- }
- // 刷新model列表
- function refreshListMode()
- {
- var taskType = InteractiveTask.TypeMaterialExceptionRefreshListModel;
- interactiveCore.appendTask(taskType, "", refreshInterface);
- }
- // 刷新界面显示
- function refreshInterface()
- {
- if (materialexception_modelMaterialException.count() > 0)
- {
- materialexception_exce_misplace.visible = true;
- materialexception_btn_cabinet.visible = true;
- materialexception_exce_noerror.visible = false;
- }
- else
- {
- materialexception_exce_misplace.visible = false;
- materialexception_btn_cabinet.visible = false;
- materialexception_exce_noerror.visible = true;
- }
- materialexception_exce_timeout.visible = pConfig.blocktimeout;
- }
- }
|