| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- // 物资盘点界面
- Item {
- id: materialstocktaking_item_root
- x: 290
- y: 130
- width: 1600
- height: 920
- onVisibleChanged: {
- proThread.moveCursorTo(0, 0);
- }
- ListModel {
- id: materialstocktaking_model_dissolve
- }
- ListModel {
- id: materialstocktaking_model_misplace
- }
- ListModel {
- id: materialstocktaking_model_binded
- }
- ListModel {
- id: materialstocktaking_model_unbind
- }
- ListModel {
- id: materialstocktaking_model_take
- }
- ListModel {
- id: materialstocktaking_model_back
- }
- Rectangle {
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- Rectangle {
- width: 1600
- height: 100 // 减去顶部圆角矩形的高度
- radius: 20
- clip: true
- color: "#8f2b7ae9"
- Text {
- id: materialstocktaking_text_title;
- x: 50
- y: 25
- width: 500
- height: 50
- visible: true
- text: "本次物资取还记录如下:"
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#ffffff"
- }
- }
- Flickable {
- x: 0
- y: 100
- width: 1600
- height: 700
- contentWidth: 1600 // 内容宽度
- contentHeight: materialstocktaking_column.height // 内容高度
- clip: true // 裁剪超出部分
- Column {
- id: materialstocktaking_column
- width: parent.width
- spacing: 0
- padding: 0
- ReuseMaterialList {
- id: materialstocktaking_list_unchanged
- _color: "#ffffff"
- _title: "没有物资数据发生变化"
- _line: false;
- _date: false;
- _name: false;
- }
- ReuseMaterialList {
- id: materialstocktaking_list_dissolve
- _color: "#00ff00"
- _title: "拿出了不属于该柜子的物资:"
- _model: materialstocktaking_model_dissolve
- }
- ReuseMaterialList {
- id: materialstocktaking_list_misplace
- _color: "#ff0000"
- _title: "放入了不属于该柜子的物资:"
- _model: materialstocktaking_model_misplace
- }
- ReuseMaterialList {
- id: materialstocktaking_list_binded
- _color: "#ffffff"
- _title: "新放入以下物资:"
- _model: materialstocktaking_model_binded
- }
- ReuseMaterialList {
- id: materialstocktaking_list_unbind
- _color: "#ffffff"
- _title: "替换以下物资:"
- _model: materialstocktaking_model_unbind
- }
- ReuseMaterialList {
- id: materialstocktaking_list_take
- _color: "#ffffff"
- _title: "领取以下物资:"
- _model: materialstocktaking_model_take
- }
- ReuseMaterialList {
- id: materialstocktaking_list_back
- _color: "#ffffff"
- _title: "归还以下物资:"
- _model: materialstocktaking_model_back
- }
- }
- }
- }
- // 声明自定义组件
- QtObject {
- id: materialstocktaking_object
- // 自定义物资项
- component ReuseMaterialItem: Rectangle {
- width: 250
- height: 300
- color: "#00ffffff"
- Rectangle {
- x: 25
- y: 0
- width: 200
- height: 200
- color: "#00ffffff"
- Image {
- anchors.fill: parent
- visible: true
- source: model.png
- fillMode: Image.PreserveAspectFit
- }
- }
- Text {
- x: 0
- y: 200
- width: parent.width
- height: 50
- visible: true
- text: model.name
- 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.rfid
- font.pixelSize: 12
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- // 自定义物资列表
- component ReuseMaterialList: Rectangle {
- property var _color;
- property var _model;
- property var _title;
- property bool _line: true;
- property bool _date: true;
- property bool _name: true;
- width: 1600
- height: 350
- color: "#00ffffff"
- // border.color: _color
- // border.width: 2
- Text {
- x: 50
- y: 0
- width: 260
- height: 50
- visible: true
- text: backDatetime
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: _date ? "#ffffff" : "#00ffffff"
- }
- Text {
- x: 310
- y: 0
- width: 120
- height: 50
- visible: true
- text: backName
- font.pixelSize: 25
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.underline: true
- font.bold: true
- color: _name ? "#ffffff" : "#00ffffff"
- }
- Text {
- x: (_date || _name) ? 430 : 50
- y: 0
- width: 1600 - 25
- height: 50
- visible: true
- text: _title
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: _color
- }
- ListView {
- x: 25
- y: 50
- width: parent.width - 50
- height: parent.height - 50
- // spacing: 10 // 间隔
- orientation: ListView.Horizontal // 横向滚动
- model: _model
- delegate: ReuseMaterialItem {
- }
- }
- // 绘制底部线条
- Canvas {
- anchors.fill: parent
- visible: _line;
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 5;
- ctx.strokeStyle = "skyblue";
- ctx.beginPath();
- ctx.moveTo(5, (parent.height));
- ctx.lineTo(parent.width - 5, parent.height);
- ctx.stroke();
- }
- }
- }
- }
- property string takeDatetime : "2025-03-02 13:16:25"
- property string takeName : "张天乐"
- property string backDatetime : "2025-03-02 13:16:25"
- property string backName : "张天乐"
- property bool takestock : true
- property string takestocknotice : "物资盘点中,请耐心等待......"
- property int takestockviewcount : 1
- property int stockcountdown : 5
- property string stockcountdownstr : "倒计时:99秒"
- Button {
- id: materialstocktaking_button_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: materialstocktaking_button_return
- onClicked: {
- materialstocktaking_item_root.visible = false;
- // materialTakeBack.visible = true;
- mainScreen.switchViewOnEx();
- }
- }
- }
- // 闪烁文字
- Rectangle {
- id: materialstocktaking_delaymatrailstocknotice
- x: 0
- y: 823
- width: 300
- height: 75 // 减去顶部圆角矩形的高度
- color: "#00ffffff"
- visible: true
- Image {
- x: 0
- y: 0
- width: 75
- height: 75
- visible: true
- source: "qrc:/png/takeback.png"
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 80
- y: 0
- width: 389
- height: 75
- visible: true
- text: takestocknotice
- font.pixelSize: 30
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- // 倒计时
- Text {
- x: 514
- y: 823
- width: 389
- height: 75
- visible: true
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- text: stockcountdownstr
- }
- Timer {
- interval: 100
- running: true
- repeat: true
- onTriggered: {
- if(takestock == true)
- {
- materialstocktaking_button_return.visible = false;
- materialstocktaking_text_title.text = "请等待物资盘点结束";
- if(takestockviewcount > 0)
- {
- takestockviewcount--;
- }
- else{
- takestockviewcount = 5;
- if(materialstocktaking_delaymatrailstocknotice.visible === true)
- {
- materialstocktaking_delaymatrailstocknotice.visible = false;
- }
- else{
- materialstocktaking_delaymatrailstocknotice.visible = true;
- }
- }
- if(stockcountdown > 0)
- {
- stockcountdown--;
- stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒"
- }
- else{
- }
- }
- else{
- materialstocktaking_text_title.text = "本次物资盘点记录如下:";
- }
- }
- }
- function set_userinfo()
- {
- takeDatetime = Qt.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss");
- backDatetime = takeDatetime;
- takeName = pConfig.susername;
- backName = pConfig.susername;
- stockcountdown = pConfig.srfidWorkTime / 100;
- takestocknotice = "物资盘点中,请耐心等待......";
- stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒"
- takestock = true;
- }
- function slot_updatetakebackMaterial()
- {
- materialstocktaking_button_return.visible = true;
- takestock = false;
- takestocknotice = "物资盘点完成!";
- stockcountdownstr = "";
- materialstocktaking_delaymatrailstocknotice.visible = true;
- var elseTakelist = pConfig.stakeElseMaterialList;
- var elseBacklist = pConfig.sbackElseMaterialList;
- var bindedlist = pConfig.sbindedMaterialList;
- var unbindlist = pConfig.sunbindMaterialList;
- var elseMaterialname = pConfig.smaterialNameListElse;
- var elseMaterialpicture = pConfig.smaterialPictureListElse;
- for (var i1 = 0; i1 < elseTakelist.length; i1++) {
- var elseTakePng = elseMaterialpicture.hasOwnProperty(elseTakelist[i1]) ? elseMaterialpicture[elseTakelist[i1]] : "qrc:/png/unknown.png";
- var elseTakeName = elseMaterialname.hasOwnProperty(elseTakelist[i1]) ? elseMaterialname[elseTakelist[i1]] : "未知物资";
- materialstocktaking_model_dissolve.append({png:elseTakePng, name: elseTakeName, rfid: "RFID:" + elseTakelist[i1]});
- }
- for (var j1 = 0; j1 < elseBacklist.length; j1++) {
- var elseBackPng = elseMaterialpicture.hasOwnProperty(elseBacklist[j1]) ? elseMaterialpicture[elseBacklist[j1]] : "qrc:/png/unknown.png";
- var elseBackName = elseMaterialname.hasOwnProperty(elseBacklist[j1]) ? elseMaterialname[elseBacklist[j1]] : "未知物资";
- materialstocktaking_model_misplace.append({png:elseBackPng, name: elseBackName, rfid: "RFID:" + elseBacklist[j1]});
- }
- for (var i2 = 0; i2 < bindedlist.length; i2++) {
- var bindedlistPng = elseMaterialpicture.hasOwnProperty(bindedlist[i2]) ? elseMaterialpicture[bindedlist[i2]] : "qrc:/png/unknown.png";
- var bindedlistName = elseMaterialname.hasOwnProperty(bindedlist[i2]) ? elseMaterialname[bindedlist[i2]] : "未知物资";
- materialstocktaking_model_binded.append({png:bindedlistPng, name: bindedlistName, rfid: "RFID:" + bindedlist[i2]});
- }
- for (var j2 = 0; j2 < unbindlist.length; j2++) {
- var unbindlistPng = elseMaterialpicture.hasOwnProperty(unbindlist[j2]) ? elseMaterialpicture[unbindlist[j2]] : "qrc:/png/unknown.png";
- var unbindlistName = elseMaterialname.hasOwnProperty(unbindlist[j2]) ? elseMaterialname[unbindlist[j2]] : "未知物资";
- materialstocktaking_model_unbind.append({png:unbindlistPng, name: unbindlistName, rfid: "RFID:" + unbindlist[j2]});
- }
- var takelist = pConfig.stakeMaterialList;
- var backlist = pConfig.sbackMaterialList;
- var materialname = pConfig.smaterialNameList;
- var materialpicture = pConfig.smaterialPictureList;
- for (var i = 0; i < takelist.length; i++) {
- materialstocktaking_model_take.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]});
- }
- for (var j = 0; j < backlist.length; j++) {
- materialstocktaking_model_back.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]});
- }
- materialstocktaking_list_dissolve.visible = elseTakelist.length > 0;
- materialstocktaking_list_misplace.visible = elseBacklist.length > 0;
- materialstocktaking_list_binded.visible = bindedlist.length > 0;
- materialstocktaking_list_unbind.visible = unbindlist.length > 0;
- materialstocktaking_list_take.visible = takelist.length > 0;
- materialstocktaking_list_back.visible = backlist.length > 0;
- if (elseTakelist.length > 0 ||
- elseBacklist.length > 0 ||
- bindedlist.length > 0 ||
- unbindlist.length > 0 ||
- takelist.length > 0 ||
- backlist.length > 0)
- {
- materialstocktaking_list_unchanged.visible = false;
- }
- else
- {
- materialstocktaking_list_unchanged.visible = true;
- }
- }
- function materiallistclear()
- {
- materialstocktaking_model_dissolve.clear();
- materialstocktaking_model_misplace.clear();
- materialstocktaking_model_binded.clear();
- materialstocktaking_model_unbind.clear();
- materialstocktaking_model_take.clear();
- materialstocktaking_model_back.clear();
- materialstocktaking_list_unchanged.visible = false;
- materialstocktaking_list_dissolve.visible = false;
- materialstocktaking_list_misplace.visible = false;
- materialstocktaking_list_binded.visible = false;
- materialstocktaking_list_unbind.visible = false;
- materialstocktaking_list_take.visible = false;
- materialstocktaking_list_back.visible = false;
- }
- }
|