MaterialReplaceHand.qml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. Item {
  4. id: materialreplacehand
  5. x: 290
  6. y: 130
  7. width: 1600
  8. height: 920
  9. property string takeDatetime : "2025-03-02 13:16:25"
  10. property string takeName : "张天乐"
  11. property string backDatetime : "2025-03-02 13:16:25"
  12. property string backName : "张天乐"
  13. property bool takestock : true
  14. property string takestocknotice : "物资盘点中,请耐心等待......"
  15. property int takestockviewcount : 1
  16. property int stockcountdown : 5
  17. property string stockcountdownstr : "倒计时:99秒"
  18. ListModel {
  19. id: materialreplacehand_append_listModel
  20. }
  21. ListModel {
  22. id: materialreplacehand_remove_listModel
  23. }
  24. Rectangle {
  25. width: 1600
  26. height: 800
  27. color: "#272b7ae9"
  28. radius: 20
  29. clip: true
  30. Rectangle {
  31. width: 1600
  32. height: 100 // 减去顶部圆角矩形的高度
  33. radius: 20
  34. clip: true
  35. color: "#8f2b7ae9"
  36. Text {
  37. id: materialreplacehand_text_title
  38. x: 50
  39. y: 25
  40. width: 500
  41. height: 50
  42. visible: true
  43. text: "本次物资取还记录如下:"
  44. font.pixelSize: 30
  45. horizontalAlignment: Text.AlignLeft
  46. verticalAlignment: Text.AlignVCenter
  47. font.bold: true
  48. color: "#ffffff"
  49. }
  50. }
  51. Rectangle {
  52. x: 0
  53. y: 100
  54. width: parent.width
  55. height: (parent.height - 100) / 2
  56. color: "#002b7ae9"
  57. Text {
  58. id: materialreplacehand_text_takeDateTime
  59. x: 50
  60. y: 0
  61. width: 260
  62. height: 50
  63. visible: true
  64. text: takeDatetime
  65. font.pixelSize: 25
  66. horizontalAlignment: Text.AlignLeft
  67. verticalAlignment: Text.AlignVCenter
  68. font.bold: true
  69. color: "#ffffff"
  70. }
  71. Text {
  72. id: materialreplacehand_text_takeName
  73. x: 310
  74. y: 0
  75. width: 120
  76. height: 50
  77. visible: true
  78. text: takeName
  79. font.pixelSize: 25
  80. horizontalAlignment: Text.AlignHCenter
  81. verticalAlignment: Text.AlignVCenter
  82. font.underline: true
  83. font.bold: true
  84. color: "#ffffff"
  85. }
  86. Text {
  87. id: materialreplacehand_text_takeText
  88. x: 430
  89. y: 0
  90. width: 180
  91. height: 50
  92. visible: true
  93. text: "领取以下物资:"
  94. font.pixelSize: 25
  95. horizontalAlignment: Text.AlignHCenter
  96. verticalAlignment: Text.AlignVCenter
  97. font.bold: true
  98. color: "#ffffff"
  99. }
  100. GridView {
  101. x: 25
  102. y: 50
  103. width: parent.width - 50
  104. height: parent.height - 50
  105. cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
  106. cellHeight: 350 // 每个单元格的高度
  107. model: materialreplacehand_append_listModel
  108. delegate: Rectangle{
  109. width: 250
  110. height: 350
  111. color: "#00ffffff"
  112. Rectangle {
  113. x: 25
  114. y: 25
  115. width: 200
  116. height: 300
  117. color: "#00ffffff"
  118. Image {
  119. x: 25
  120. y: 25
  121. width: 150
  122. height: 150
  123. visible: true
  124. source: model.png
  125. fillMode: Image.PreserveAspectFit
  126. }
  127. Text {
  128. x: 0
  129. y: 185
  130. width: parent.width
  131. height: 50
  132. visible: true
  133. text: model.name
  134. font.pixelSize: 30
  135. horizontalAlignment: Text.AlignHCenter
  136. verticalAlignment: Text.AlignVCenter
  137. color: "#ffffff"
  138. }
  139. Text {
  140. x: 0
  141. y: 250
  142. width: parent.width
  143. height: 25
  144. visible: true
  145. text: model.rfid
  146. font.pixelSize: 12
  147. horizontalAlignment: Text.AlignHCenter
  148. verticalAlignment: Text.AlignVCenter
  149. color: "#ffffff"
  150. }
  151. }
  152. }
  153. }
  154. }
  155. Rectangle {
  156. x: 0
  157. y: (parent.height - 100) / 2 + 100
  158. width: parent.width
  159. height: (parent.height - 100) / 2
  160. color: "#002b7ae9"
  161. Text {
  162. id: materialreplacehand_text_backDateTime
  163. x: 50
  164. y: 0
  165. width: 260
  166. height: 50
  167. visible: true
  168. text: backDatetime
  169. font.pixelSize: 25
  170. horizontalAlignment: Text.AlignLeft
  171. verticalAlignment: Text.AlignVCenter
  172. font.bold: true
  173. color: "#ffffff"
  174. }
  175. Text {
  176. id: materialreplacehand_text_backName
  177. x: 310
  178. y: 0
  179. width: 120
  180. height: 50
  181. visible: true
  182. text: backName
  183. font.pixelSize: 25
  184. horizontalAlignment: Text.AlignHCenter
  185. verticalAlignment: Text.AlignVCenter
  186. font.underline: true
  187. font.bold: true
  188. color: "#ffffff"
  189. }
  190. Text {
  191. id: materialreplacehand_text_backText
  192. x: 430
  193. y: 0
  194. width: 180
  195. height: 50
  196. visible: true
  197. text: "归还以下物资:"
  198. font.pixelSize: 25
  199. horizontalAlignment: Text.AlignHCenter
  200. verticalAlignment: Text.AlignVCenter
  201. font.bold: true
  202. color: "#ffffff"
  203. }
  204. GridView {
  205. x: 25
  206. y: 50
  207. width: parent.width - 50
  208. height: parent.height - 50
  209. cellWidth: 250 // 每个单元格的宽度,这里是平均分配宽度给5列
  210. cellHeight: 350 // 每个单元格的高度
  211. model: materialreplacehand_remove_listModel
  212. delegate: Rectangle{
  213. width: 250
  214. height: 350
  215. color: "#00ffffff"
  216. Rectangle {
  217. x: 25
  218. y: 25
  219. width: 200
  220. height: 300
  221. color: "#00ffffff"
  222. Image {
  223. x: 25
  224. y: 25
  225. width: 150
  226. height: 150
  227. visible: true
  228. source: model.png
  229. fillMode: Image.PreserveAspectFit
  230. }
  231. Text {
  232. x: 0
  233. y: 185
  234. width: parent.width
  235. height: 50
  236. visible: true
  237. text: model.name
  238. font.pixelSize: 30
  239. horizontalAlignment: Text.AlignHCenter
  240. verticalAlignment: Text.AlignVCenter
  241. color: "#ffffff"
  242. }
  243. Text {
  244. x: 0
  245. y: 250
  246. width: parent.width
  247. height: 25
  248. visible: true
  249. text: model.rfid
  250. font.pixelSize: 12
  251. horizontalAlignment: Text.AlignHCenter
  252. verticalAlignment: Text.AlignVCenter
  253. color: "#ffffff"
  254. }
  255. }
  256. }
  257. }
  258. }
  259. Canvas {
  260. anchors.fill: parent
  261. onPaint: {
  262. var ctx = getContext("2d");
  263. ctx.lineWidth = 5; // 设置线的宽度
  264. ctx.strokeStyle = "skyblue"; // 设置线的颜色为白色
  265. ctx.beginPath();
  266. ctx.moveTo(5, (parent.height - 100) / 2 + 100); // 直线的起点
  267. ctx.lineTo(parent.width - 5, (parent.height - 100) / 2 + 100); // 直线的终点
  268. ctx.stroke(); // 绘制直线
  269. }
  270. }
  271. }
  272. Button {
  273. id: button_return
  274. x: 1408
  275. y: 835
  276. width: 192
  277. height: 75
  278. background: Rectangle {
  279. color: "#055eb3" // 设置背景为透明
  280. radius: 10 // 可选,设置圆角
  281. }
  282. text: qsTr("确定")
  283. font.pixelSize: 30
  284. palette.buttonText: "white" // 设置字体颜色为绿色
  285. Connections {
  286. target: button_return
  287. onClicked: {
  288. materialreplacehand.visible = false;
  289. materialReplace.visible = true;
  290. }
  291. }
  292. }
  293. Rectangle {
  294. id: delaymatrailstocknoticehand
  295. x: 0
  296. y: 823
  297. width: 300
  298. height: 75 // 减去顶部圆角矩形的高度
  299. color: "#00ffffff"
  300. visible: true
  301. Image {
  302. x: 0
  303. y: 0
  304. width: 75
  305. height: 75
  306. visible: true
  307. source: "qrc:/png/takeback.png"
  308. fillMode: Image.PreserveAspectFit
  309. }
  310. Text {
  311. x: 80
  312. y: 0
  313. width: 389
  314. height: 75
  315. visible: true
  316. text: takestocknotice
  317. font.pixelSize: 30
  318. horizontalAlignment: Text.AlignLeft
  319. verticalAlignment: Text.AlignVCenter
  320. color: "#ffffff"
  321. }
  322. }
  323. Text {
  324. x: 514
  325. y: 823
  326. width: 389
  327. height: 75
  328. visible: true
  329. font.pixelSize: 30
  330. horizontalAlignment: Text.AlignHCenter
  331. verticalAlignment: Text.AlignVCenter
  332. color: "#ffffff"
  333. text: stockcountdownstr
  334. }
  335. Timer {
  336. interval: 100
  337. running: true
  338. repeat: true
  339. onTriggered: {
  340. if(takestock == true)
  341. {
  342. materialreplacehand_text_title.text = "请等待物资盘点结束";
  343. materialreplacehand_text_takeDateTime.visible = false;
  344. materialreplacehand_text_takeName.visible = false;
  345. materialreplacehand_text_takeText.visible = false;
  346. materialreplacehand_text_backDateTime.visible = false;
  347. materialreplacehand_text_backName.visible = false;
  348. materialreplacehand_text_backText.visible = false;
  349. if(takestockviewcount > 0)
  350. {
  351. takestockviewcount--;
  352. }
  353. else{
  354. takestockviewcount = 5;
  355. if(delaymatrailstocknoticehand.visible === true)
  356. {
  357. delaymatrailstocknoticehand.visible = false;
  358. }
  359. else{
  360. delaymatrailstocknoticehand.visible = true;
  361. }
  362. }
  363. if(stockcountdown > 0)
  364. {
  365. stockcountdown--;
  366. stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒"
  367. }
  368. else{
  369. }
  370. }
  371. else{
  372. materialreplacehand_text_title.text = "以下物资发生了变动:";
  373. if (pConfig.stakeMaterialList.length === 0)
  374. {
  375. materialreplacehand_text_takeDateTime.visible = true;
  376. materialreplacehand_text_takeName.visible = false;
  377. materialreplacehand_text_takeText.visible = false;
  378. materialreplacehand_text_takeDateTime.text = "本次没有发现物资被拿出";
  379. }
  380. else
  381. {
  382. materialreplacehand_text_takeDateTime.visible = true;
  383. materialreplacehand_text_takeName.visible = true;
  384. materialreplacehand_text_takeText.visible = true;
  385. materialreplacehand_text_takeDateTime.text = takeDatetime;
  386. materialreplacehand_text_takeText.text = "拿出以下物资:";
  387. }
  388. if (pConfig.sbackMaterialList.length === 0)
  389. {
  390. materialreplacehand_text_backDateTime.visible = true;
  391. materialreplacehand_text_backName.visible = false;
  392. materialreplacehand_text_backText.visible = false;
  393. materialreplacehand_text_backDateTime.text = "本次没有发现物资被放入";
  394. }
  395. else
  396. {
  397. materialreplacehand_text_backDateTime.visible = true;
  398. materialreplacehand_text_backName.visible = true;
  399. materialreplacehand_text_backText.visible = true;
  400. materialreplacehand_text_backDateTime.text = backDatetime;
  401. materialreplacehand_text_backText.text = "放入以下物资:";
  402. }
  403. delaymatrailstocknoticehand.visible = true;
  404. }
  405. }
  406. }
  407. function set_userinfo()
  408. {
  409. takeDatetime = Qt.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss");
  410. backDatetime = takeDatetime;
  411. takeName = pConfig.susername;
  412. backName = pConfig.susername;
  413. stockcountdown = pConfig.srfidWorkTime / 100;
  414. takestocknotice = "物资盘点中,请耐心等待......";
  415. stockcountdownstr = "倒计时:" + parseInt(stockcountdown / 10) +"秒"
  416. takestock = true;
  417. }
  418. function slot_updatetakebackMaterial()
  419. {
  420. takestock = false;
  421. takestocknotice = "物资盘点完成!";
  422. stockcountdownstr = "";
  423. delaymatrailstocknoticehand.visible = true;
  424. var takelist = pConfig.stakeMaterialList;
  425. var backlist = pConfig.sbackMaterialList;
  426. var materialname = pConfig.smaterialNameList;
  427. var materialpicture = pConfig.smaterialPictureList;
  428. for (var i = 0; i < takelist.length; i++) {
  429. materialreplacehand_append_listModel.append({png:materialpicture[takelist[i]], name: materialname[takelist[i]], rfid: takelist[i]});
  430. }
  431. for (var j = 0; j < backlist.length; j++) {
  432. materialreplacehand_remove_listModel.append({png:materialpicture[backlist[j]], name: materialname[backlist[j]], rfid: backlist[j]});
  433. }
  434. }
  435. function materiallistclear()
  436. {
  437. materialreplacehand_append_listModel.clear();
  438. materialreplacehand_remove_listModel.clear();
  439. }
  440. }