| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- import QtQuick 2.15
- import QtQuick.Controls 2.15
- Item {
- id: materialreplacehand
- x: 290
- y: 130
- width: 1600
- height: 920
- 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秒"
- ListModel {
- id: materialreplacehand_append_listModel
- }
- ListModel {
- id: materialreplacehand_remove_listModel
- }
- Rectangle {
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- Rectangle {
- width: 1600
- height: 100 // 减去顶部圆角矩形的高度
- radius: 20
- clip: true
- color: "#8f2b7ae9"
- Text {
- id: materialreplacehand_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"
- }
- }
- Rectangle {
- x: 0
- y: 100
- width: parent.width
- height: (parent.height - 100) / 2
- color: "#002b7ae9"
- Text {
- id: materialreplacehand_text_takeDateTime
- x: 50
- y: 0
- width: 260
- height: 50
- visible: true
- text: takeDatetime
- font.pixelSize: 25
- horizontalAlignment: Text.AlignLeft
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#ffffff"
- }
- Text {
- id: materialreplacehand_text_takeName
- x: 310
- y: 0
- width: 120
- height: 50
- visible: true
- text: takeName
- font.pixelSize: 25
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.underline: true
- font.bold: true
- color: "#ffffff"
- }
- Text {
- id: materialreplacehand_text_takeText
- x: 430
- y: 0
- width: 180
- height: 50
- visible: true
- text: "领取以下物资:"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#ffffff"
- }
- GridView {
- x: 25
- y: 50
- width: parent.width - 50
- height: parent.height - 50
- cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
- cellHeight: 350 // 每个单元格的高度
- model: materialreplacehand_append_listModel
- delegate: Rectangle{
- width: 250
- height: 350
- color: "#00ffffff"
- Rectangle {
- x: 25
- y: 25
- width: 200
- height: 300
- color: "#00ffffff"
- Image {
- x: 25
- y: 25
- width: 150
- height: 150
- visible: true
- source: model.png
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 0
- y: 185
- 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"
- }
- }
- }
- }
- }
- Rectangle {
- x: 0
- y: (parent.height - 100) / 2 + 100
- width: parent.width
- height: (parent.height - 100) / 2
- color: "#002b7ae9"
- Text {
- id: materialreplacehand_text_backDateTime
- 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: "#ffffff"
- }
- Text {
- id: materialreplacehand_text_backName
- 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: "#ffffff"
- }
- Text {
- id: materialreplacehand_text_backText
- x: 430
- y: 0
- width: 180
- height: 50
- visible: true
- text: "归还以下物资:"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.bold: true
- color: "#ffffff"
- }
- GridView {
- x: 25
- y: 50
- width: parent.width - 50
- height: parent.height - 50
- cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
- cellHeight: 350 // 每个单元格的高度
- model: materialreplacehand_remove_listModel
- delegate: Rectangle{
- width: 250
- height: 350
- color: "#00ffffff"
- Rectangle {
- x: 25
- y: 25
- width: 200
- height: 300
- color: "#00ffffff"
- Image {
- x: 25
- y: 25
- width: 150
- height: 150
- visible: true
- source: model.png
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 0
- y: 185
- 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"
- }
- }
- }
- }
- }
- Canvas {
- anchors.fill: parent
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 5; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(5, (parent.height - 100) / 2 + 100); // 直线的起点
- ctx.lineTo(parent.width - 5, (parent.height - 100) / 2 + 100); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- }
- Button {
- id: 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: button_return
- onClicked: {
- materialreplacehand.visible = false;
- materialReplace.visible = true;
- }
- }
- }
- Rectangle {
- id: delaymatrailstocknoticehand
- 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)
- {
- materialreplacehand_text_title.text = "请等待物资盘点结束";
- materialreplacehand_text_takeDateTime.visible = false;
- materialreplacehand_text_takeName.visible = false;
- materialreplacehand_text_takeText.visible = false;
- materialreplacehand_text_backDateTime.visible = false;
- materialreplacehand_text_backName.visible = false;
- materialreplacehand_text_backText.visible = false;
- if(takestockviewcount > 0)
- {
- takestockviewcount--;
- }
- else{
- takestockviewcount = 5;
- if(delaymatrailstocknoticehand.visible === true)
- {
- delaymatrailstocknoticehand.visible = false;
- }
- else{
- delaymatrailstocknoticehand.visible = true;
- }
- }
- if(stockcountdown > 0)
- {
- stockcountdown--;
- stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒"
- }
- else{
- }
- }
- else{
- materialreplacehand_text_title.text = "以下物资发生了变动:";
- if (pConfig.stakeMaterialList.length === 0)
- {
- materialreplacehand_text_takeDateTime.visible = true;
- materialreplacehand_text_takeName.visible = false;
- materialreplacehand_text_takeText.visible = false;
- materialreplacehand_text_takeDateTime.text = "本次没有发现物资被拿出";
- }
- else
- {
- materialreplacehand_text_takeDateTime.visible = true;
- materialreplacehand_text_takeName.visible = true;
- materialreplacehand_text_takeText.visible = true;
- materialreplacehand_text_takeDateTime.text = takeDatetime;
- materialreplacehand_text_takeText.text = "拿出以下物资:";
- }
- if (pConfig.sbackMaterialList.length === 0)
- {
- materialreplacehand_text_backDateTime.visible = true;
- materialreplacehand_text_backName.visible = false;
- materialreplacehand_text_backText.visible = false;
- materialreplacehand_text_backDateTime.text = "本次没有发现物资被放入";
- }
- else
- {
- materialreplacehand_text_backDateTime.visible = true;
- materialreplacehand_text_backName.visible = true;
- materialreplacehand_text_backText.visible = true;
- materialreplacehand_text_backDateTime.text = backDatetime;
- materialreplacehand_text_backText.text = "放入以下物资:";
- }
- delaymatrailstocknoticehand.visible = true;
- }
- }
- }
- 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()
- {
- takestock = false;
- takestocknotice = "物资盘点完成!";
- stockcountdownstr = "";
- delaymatrailstocknoticehand.visible = true;
- var takelist = pConfig.stakeMaterialList;
- var backlist = pConfig.sbackMaterialList;
- var materialname = pConfig.smaterialNameList;
- var materialpicture = pConfig.smaterialPictureList;
- for (var i = 0; i < takelist.length; i++) {
- materialreplacehand_append_listModel.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]});
- }
- for (var j = 0; j < backlist.length; j++) {
- materialreplacehand_remove_listModel.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]});
- }
- }
- function materiallistclear()
- {
- materialreplacehand_append_listModel.clear();
- materialreplacehand_remove_listModel.clear();
- }
- }
|