| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826 |
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- // import com.InteractiveCore 1.0
- import com.InteractiveTask 1.0
- Item {
- id: materialmanualreplace
- x: 290
- y: 130
- width: 1600
- height: 920
- property bool takebackstat : false
- property bool opendoor : false
- property bool isHand : false;
- signal startReader();
- signal signal_openLock();
- signal signal_takebackstat(bool stat);
- onVisibleChanged:
- {
- if (visible)
- {
- proThread.moveCursorTo(0, 0);
- waitPromptBox.show();
- var taskType = InteractiveTask.TypeMaterialManualReplaceRefreshListModel;
- interactiveCore.appendTask(
- taskType, null, ()=>{
- if (materialreplace_modelMaterialManualReplace.count() === 0) {
- }
- waitPromptBox.hide();
- });
- }
- }
- Rectangle {
- id: materialmanualreplace_rect_autoreplace
- x: 0
- y: 823
- width: 300
- 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: 140
- y: 0
- width: 220
- height: 75
- visible: true
- text: "等待维修更换物资......"
- font.pixelSize: 30
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- }
- // 手动更换 开柜
- Button {
- id: materialmanualreplace_btn_head_openLock
- x: 928
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff9900"
- radius: 10
- }
- text: qsTr("开柜")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: materialmanualreplace_btn_head_openLock
- onClicked: {
- materialmanualreplace_rect_autoreplace.visible = true;
- takebackstat = true;
- pConfig.mtakebackstat = true;
- pConfig.imaterworkstat = 1;
- signal_openLock();
- }
- }
- }
- // 手动更换 提交按钮
- Button {
- id: materialmanualreplace_btn_head_submit
- x: 1168
- y: 835
- width: 192
- height: 75
- background: Rectangle {
- color: "#ff0000"
- radius: 10
- }
- text: qsTr("提交")
- font.pixelSize: 30
- palette.buttonText: "white" // 设置字体颜色为绿色
- Connections {
- target: materialmanualreplace_btn_head_submit
- onClicked: {
- if (pConfig.sopenDoor)
- {
- infoPromptBox.title("提示");
- infoPromptBox.message("柜门打开时不允许提交");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- else
- {
- // materialmanualreplace_dialog_handsubmit_prompt.open();
- infoPromptBox.title("提示");
- infoPromptBox.message("确定要提交吗?");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("red", "取消", null, null);
- infoPromptBox.button_push(
- "#055eb3", "确定", ()=>{
- // 如果点击确定按钮
- var taskType = InteractiveTask.TypeMaterialManualReplaceSubmit;
- interactiveCore.appendTask(
- taskType, null, (json)=>{
- var jsonObjRoot = JSON.parse(json);
- if (jsonObjRoot.code === 200)
- {
- infoPromptBox.title("提交成功");
- infoPromptBox.message("提交成功");
- infoPromptBox.button_clear();
- infoPromptBox.button_push(
- "#055eb3", "确定", ()=>{
- var taskType = InteractiveTask.TypeMaterialInfoListRefresh;
- interactiveCore.appendTask(
- taskType, "", ()=>{
- var taskType = InteractiveTask.TypeMaterialManualReplaceRefreshListModel;
- interactiveCore.appendTask(
- taskType, null, ()=>{
- materialmanualreplace_btn_head_return.clicked();
- });
- });
- }, null);
- infoPromptBox.show();
- }
- else
- {
- infoPromptBox.title("提交失败");
- infoPromptBox.message(jsonObjRoot.msg);
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- });
- }, null);
- infoPromptBox.show();
- }
- }
- }
- }
- // 手动更换 返回按钮
- Button {
- id: materialmanualreplace_btn_head_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: materialmanualreplace_btn_head_return
- onClicked: {
- if (pConfig.sopenDoor)
- {
- infoPromptBox.title("提示");
- infoPromptBox.message("柜门打开时不允许返回");
- infoPromptBox.button_clear();
- infoPromptBox.button_push("#055eb3", "确定", null, null);
- infoPromptBox.show();
- }
- else
- {
- materialmanualreplace.visible = false;
- materialReplace.visible = true;
- }
- }
- }
- }
- // 手动更换
- Rectangle {
- id: materialmanualreplace_rect_table_hand
- width: 1600
- height: 800
- color: "#272b7ae9"
- radius: 20
- clip: true
- visible: true
- Rectangle {
- x: 0
- y: 100
- width: parent.width
- height: parent.height - 100
- clip: true
- color: "#002b7ae9"
- GridView {
- width: parent.width
- height: parent.height
- cellWidth: 800
- cellHeight: 700
- model: materialreplace_modelMaterialManualReplace
- delegate: Rectangle{
- width: 800
- height: 700
- color: "#00ffffff"
- Rectangle {
- x: 10
- y: 30
- width: parent.width - 20
- height: 636
- color: "#055eb3"
- border.color: "#47bfff"
- Component.onCompleted: {
- var oldMaterialsTypeName = model.oldMaterialsTypeName;
- var materialsTypeName = model.materialsTypeName;
- var oldPropertiesValue = model.oldPropertiesValue;
- var propertiesValue = model.propertiesValue;
- materialmanualreplace_reusecombobox_oldtype.setModel(model.types);
- materialmanualreplace_reusecombobox_oldtype.setValue(oldMaterialsTypeName);
- materialmanualreplace_reusecombobox_newtype.setModel(model.types);
- materialmanualreplace_reusecombobox_newtype.setValue(materialsTypeName);
- materialmanualreplace_reusecombobox_oldprop.setValue(oldPropertiesValue);
- materialmanualreplace_reusecombobox_newprop.setValue(propertiesValue);
- materialmanualreplace_grid.enabled = (!model.click);
- }
- // 新旧物资
- Rectangle {
- width: parent.width
- height: 62
- clip: true
- Row {
- anchors.fill: parent
- Rectangle {
- width: parent.width / 2
- height: 62
- color: "#3e6aa5"
- Text {
- anchors.centerIn: parent
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- text: "旧物资"
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 62
- color: "#3e6aa5"
- Text {
- anchors.centerIn: parent
- font.pixelSize: 25
- color: "#d7d7d2"
- font.bold: true
- text: "新物资"
- }
- }
- }
- }
- // 确认更换按钮
- Rectangle {
- y: parent.height - 70;
- width: parent.width
- height: 70
- color: "#272b7ae9"
- border.color: "#47bfff"
- // 维修
- Button {
- id: materialmanualreplace_btn_hand_upkeep
- x: parent.width - 192 * 2 - 20 * 2
- y: 10
- width: 192
- height: 50
- visible: {
- return model.status === "1"; // 如果状态是过期,不显示维修按钮
- }
- hoverEnabled: false
- background: Rectangle {
- color: "#e5d7d7d7"
- radius: 5
- }
- text: qsTr("维修")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- onClicked: {
- if (model.click === 1)
- {
- model.click = 0;
- materialmanualreplace_btn_hand_replace.background.color = "#e5d7d7d7";
- materialmanualreplace_btn_hand_upkeep.background.color = "#e5d7d7d7";
- materialmanualreplace_grid.enabled = true;
- }
- else
- {
- model.click = 1;
- materialmanualreplace_btn_hand_replace.background.color = "#e5d7d7d7";
- materialmanualreplace_btn_hand_upkeep.background.color = "#e5ff0000";
- materialmanualreplace_grid.enabled = false;
- }
- }
- }
- // 更换
- Button {
- id: materialmanualreplace_btn_hand_replace
- x: parent.width - 192 - 20
- y: 10
- width: 192
- height: 50
- hoverEnabled: false
- background: Rectangle {
- color: "#e5d7d7d7"
- radius: 5
- }
- text: qsTr("更换")
- font.pixelSize: 25
- palette.buttonText: "white" // 设置字体颜色为绿色
- onClicked: {
- if (model.click === 2)
- {
- model.click = 0;
- materialmanualreplace_btn_hand_replace.background.color = "#e5d7d7d7";
- materialmanualreplace_btn_hand_upkeep.background.color = "#e5d7d7d7";
- materialmanualreplace_grid.enabled = true;
- }
- else
- {
- model.click = 2;
- materialmanualreplace_btn_hand_replace.background.color = "#e5ff0000";
- materialmanualreplace_btn_hand_upkeep.background.color = "#e5d7d7d7";
- materialmanualreplace_grid.enabled = false;
- }
- }
- }
- }
- Grid {
- id: materialmanualreplace_grid;
- x: 0
- y: 62
- width: parent.width
- height: parent.height - 132
- spacing: 0
- columns: 2
- rows: 6
- Rectangle {
- width: parent.width / 2
- height: 214
- color: "#272b7ae9"
- border.color: "#47bfff"
- Image {
- id: materialmanualreplace_image_old
- x: (parent.width - 150) / 2
- y: (parent.height - 150) / 2
- width: 150
- height: 150
- visible: true
- source: model.oldMaterialsTypePicture
- fillMode: Image.PreserveAspectFit
- }
- // 异常处理
- Rectangle {
- x: (parent.width - 120) / 2
- y: (parent.height - 40) / 2
- width: 120
- height: 40
- 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: true
- Text {
- anchors.centerIn: parent
- 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 {
- width: parent.width / 2
- height: 214
- color: "#272b7ae9"
- border.color: "#47bfff"
- Image {
- id: materialmanualreplace_image_new
- x: (parent.width - 150) / 2
- y: (parent.height - 150) / 2
- width: 150
- height: 150
- visible: true
- source: model.materialsTypePicture
- fillMode: Image.PreserveAspectFit
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseTextField {
- id: materialmanualreplace_reusetextfield_oldname
- strTitle: "名称"
- strValue: model.oldMaterialsName
- enabled: false
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseTextField {
- id: materialmanualreplace_reusetextfield_newname
- strTitle: "名称"
- strValue: model.materialsName
- enabled: true
- onStrValueChanged: {
- model.materialsName = materialmanualreplace_reusetextfield_newname.strValue
- }
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseComboBox {
- id: materialmanualreplace_reusecombobox_oldtype
- strTitle: "类型"
- enabled: false
- onObjChildChanged: {
- var item = materialmanualreplace_reusecombobox_oldtype.objChild;
- materialmanualreplace_reusecombobox_oldprop.setModel(item.props);
- materialmanualreplace_image_old.source = item.materialsTypePicture;
- }
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseComboBox {
- id: materialmanualreplace_reusecombobox_newtype
- strTitle: "类型"
- enabled: true
- onObjChildChanged: {
- var item = materialmanualreplace_reusecombobox_newtype.objChild;
- materialmanualreplace_reusecombobox_newprop.setModel(item.props);
- materialmanualreplace_image_new.source = item.materialsTypePicture;
- }
- onStrValueChanged: {
- model.materialsTypeName = materialmanualreplace_reusecombobox_newtype.setValue;
- }
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseComboBox {
- id: materialmanualreplace_reusecombobox_oldprop
- strTitle: "型号"
- enabled: false
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseComboBox {
- id: materialmanualreplace_reusecombobox_newprop
- strTitle: "型号"
- enabled: true
- onStrValueChanged: {
- model.materialsPropName = materialmanualreplace_reusecombobox_newprop.strValue;
- }
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseTextField {
- id: materialmanualreplace_reusetextfield_oldrfid
- strTitle: "RFID"
- strValue: model.oldMaterialsRfid
- enabled: false
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseTextField {
- id: materialmanualreplace_reusetextfield_newrfid
- strTitle: "RFID"
- strValue: model.materialsRfid
- enabled: true
- onStrValueChanged : {
- model.materialsRfid = materialmanualreplace_reusetextfield_newrfid.strValue;
- }
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseDateField {
- id: materialmanualreplace_reusedatefield_olddate
- strTitle: "有效期"
- strValue: model.oldExpirationDate
- enabled: false
- }
- }
- Rectangle {
- width: parent.width / 2
- height: 58
- color: "#272b7ae9"
- border.color: "#47bfff"
- ReuseDateField {
- id: materialmanualreplace_reusedatefield_newdate
- strTitle: "有效期"
- strValue: model.expirationDate
- enabled: true
- onStrValueChanged : {
- model.materialsDate = materialmanualreplace_reusedatefield_newdate.strValue;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- // 表格头
- Rectangle {
- id: materialmanualreplace_rect_table_head
- width: 1600
- height: 100 // 减去顶部圆角矩形的高度
- radius: 20
- clip: true
- color: "#8f2b7ae9"
- enabled: false
- Grid {
- x: 50
- y: 0
- width: parent.width - 150
- height: parent.height
- visible: true
- verticalItemAlignment: Grid.AlignVCenter
- horizontalItemAlignment: Grid.AlignHCenter
- columns: 5
- spacing: 20
- Repeater {
- model: materialreplace_modelMaterialType
- delegate: Rectangle{
- width: 250
- height: 100
- color: "#00ffffff"
- Image {
- x: 0
- y: 25
- width: 50
- height: 50
- visible: true
- source: model.materialsTypeIcon
- fillMode: Image.PreserveAspectFit
- }
- Text {
- x: 55
- y: 25
- width: parent.width - 55
- height: 50
- visible: true
- text: model.materialsTypeName + "(" + model.materialsTypeError + ")"
- font.pixelSize: 25
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- color: "#ffffff"
- }
- Canvas {
- anchors.fill: parent
- visible: model.materialsTypeSelected
- onPaint: {
- var ctx = getContext("2d");
- ctx.lineWidth = 10; // 设置线的宽度
- ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
- ctx.beginPath();
- ctx.moveTo(0, 90); // 直线的起点
- ctx.lineTo(parent.width, 90); // 直线的终点
- ctx.stroke(); // 绘制直线
- }
- }
- MouseArea {
- anchors.fill: parent // 让MouseArea覆盖整个Image区域
- onClicked: {
- var taskType = InteractiveTask.TypeMaterialReplaceRefreshListModel;
- interactiveCore.appendTask(taskType, model.materialsTypeId, null);
- mainScreen.resetLogin_timeout();
- }
- }
- }
- }
- }
- Image {
- id: viewImage
- x: parent.width - 80
- y: 20
- width: 60
- height: 60
- source: "qrc:/png/right.png"
- fillMode: Image.PreserveAspectFit
- MouseArea {
- anchors.fill: parent // 让MouseArea覆盖整个Image区域
- onClicked: {
- var bIsUnfolding = (materialmanualreplace_rect_table_head.height === 100 ? true : false);
- if(bIsUnfolding)
- {
- viewImage.rotation = 90;
- materialmanualreplace_rect_table_head.height = 600;
- }
- else
- {
- viewImage.rotation = 0;
- materialmanualreplace_rect_table_head.height = 100;
- }
- mainScreen.resetLogin_timeout();
- }
- }
- }
- }
- function lockStat_callback(left, right)
- {
- if (pConfig.imaterworkstat === 1)
- {
- if(left === false || right === false)
- {
- materialmanualreplace_btn_head_openLock.visible = false; // 柜子开时,开柜按钮隐藏
- opendoor = true;
- if(takebackstat === true)
- {
- signal_takebackstat(true);
- }
- }
- else if(left === true && right === true)
- {
- materialmanualreplace_btn_head_openLock.visible = true; // 柜子关时,开柜按钮隐藏显示
- materialmanualreplace_btn_head_submit.enabled = true;
- materialmanualreplace_btn_head_return.enabled = true;
- console.log("准备读rfid");
- opendoor = false;
- if(takebackstat === true)
- {
- startReader();
- takebackstat = false;
- signal_takebackstat(false);
- pConfig.smaterialStock = true;
- console.log("盘点界面显示");
- // 开始读rfid
- // materialReplace.visible = false;
- mainScreen.switchViewOffEx();
- materialStocktaking.set_userinfo();
- materialStocktaking.materiallistclear();
- materialStocktaking.visible = true;
- materialmanualreplace_rect_autoreplace.visible = false;
- console.log("完成!!!!!!");
- mainScreen.resetLogin_timeout();
- }
- }
- }
- }
- function slot_requestertakebackMaterial()
- {
- }
- function slot_updateMaterialHand()
- {
- var taskType = InteractiveTask.TypeMaterialReplaceRefreshListModel;
- interactiveCore.appendTask(taskType, "-1", null);
- }
- // 刷新 list 视图
- function refreshListModel()
- {
- // 先刷新数据缓存,然后调用视图刷新
- var taskType = InteractiveTask.TypeMaterialReplaceRefreshListModel;
- interactiveCore.appendTask(taskType, "0", null);
- }
- }
|