LittleMaterialOutBound.ets 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /*
  2. * 零星物料出库
  3. * */
  4. import {
  5. ProcessFlow,
  6. BoxGrid,
  7. MaterialListComponent,
  8. OrderListComponent,
  9. MaterialBoxGrid
  10. } from "../component/OrderMaterialsStorageView"
  11. import { OrderParams, MaterialBox, EmptyBox } from "../params/OrderMaterialsStorageParams"
  12. import router from '@ohos.router';
  13. import { NavigationBar } from '../component/NavigationBar'
  14. import { TimeAndTitle } from "../component/TimeAndTitle"
  15. import { InBoundView } from '../component/InBoundView'
  16. import WmsRequest from '../common/util/request/WmsRequest'
  17. import RequestParamModel from '../viewmodel/wms/RequestParamModel'
  18. import WorkOrderInfo from '../viewmodel/wms/WorkOrderInfo'
  19. import WorkOrderMaterialInfo from "../viewmodel/wms/WorkOrderMaterialInfo"
  20. @Entry
  21. @Component
  22. struct LittleMaterialsOutBound {
  23. @State materialNum: number=0
  24. @State currentStep: number = 1;
  25. @State nextStepButtonClick :number = 1
  26. @State preStepButtonClick :number = 1
  27. @State outBoundButtonClick :number = 1
  28. @State materialData: WorkOrderMaterialInfo[] = [];
  29. @State emptyBoxes: EmptyBox[] = [
  30. { position: 'X-1Y-2' },
  31. { position: 'X-1Y-2' },
  32. { position: 'X-1Y-2' },
  33. { position: 'X-1Y-2' },
  34. { position: 'X-1Y-2' },
  35. { position: 'X-1Y-2' },
  36. { position: 'X-1Y-2' },
  37. { position: 'X-1Y-2' },
  38. { position: 'X-1Y-2' },
  39. { position: 'X-1Y-2' }// 图片显示6个空箱位置
  40. ]
  41. @State materialBoxes: MaterialBox[] = [
  42. // 第一行物料箱
  43. {
  44. id: '1',
  45. type: 'material',
  46. name: '物料名称XXXXX',
  47. boxNumber: 'LX-12345',
  48. boxType: '通用类型',
  49. order: 'XXXXX订单',
  50. quantity: 10,
  51. position: 'X-1 Y-2'
  52. },
  53. // 其他2个物料箱...
  54. // 第二行空箱
  55. {
  56. id: '4',
  57. type: 'empty',
  58. name: '空箱',
  59. boxNumber: 'LX-67890',
  60. boxType: '通用类型',
  61. position: 'X-3 Y-1'
  62. },
  63. {
  64. id: '1',
  65. type: 'material',
  66. name: '物料名称XXXXX',
  67. boxNumber: 'LX-12345',
  68. boxType: '通用类型',
  69. order: 'XXXXX订单',
  70. quantity: 10,
  71. position: 'X-1 Y-2'
  72. },
  73. // 其他2个物料箱...
  74. // 第二行空箱
  75. {
  76. id: '4',
  77. type: 'empty',
  78. name: '空箱',
  79. boxNumber: 'LX-67890',
  80. boxType: '通用类型',
  81. position: 'X-3 Y-1'
  82. },
  83. {
  84. id: '1',
  85. type: 'material',
  86. name: '物料名称XXXXX',
  87. boxNumber: 'LX-12345',
  88. boxType: '通用类型',
  89. order: 'XXXXX订单',
  90. quantity: 10,
  91. position: 'X-1 Y-2'
  92. },
  93. // 其他2个物料箱...
  94. // 第二行空箱
  95. {
  96. id: '4',
  97. type: 'empty',
  98. name: '空箱',
  99. boxNumber: 'LX-67890',
  100. boxType: '通用类型',
  101. position: 'X-3 Y-1'
  102. },
  103. {
  104. id: '1',
  105. type: 'material',
  106. name: '物料名称XXXXX',
  107. boxNumber: 'LX-12345',
  108. boxType: '通用类型',
  109. order: 'XXXXX订单',
  110. quantity: 10,
  111. position: 'X-1 Y-2'
  112. },
  113. // 其他2个物料箱...
  114. // 第二行空箱
  115. {
  116. id: '4',
  117. type: 'empty',
  118. name: '空箱',
  119. boxNumber: 'LX-67890',
  120. boxType: '通用类型',
  121. position: 'X-3 Y-1'
  122. },
  123. {
  124. id: '1',
  125. type: 'material',
  126. name: '物料名称XXXXX',
  127. boxNumber: 'LX-12345',
  128. boxType: '通用类型',
  129. order: 'XXXXX订单',
  130. quantity: 10,
  131. position: 'X-1 Y-2'
  132. },
  133. // 其他2个物料箱...
  134. // 第二行空箱
  135. {
  136. id: '4',
  137. type: 'empty',
  138. name: '空箱',
  139. boxNumber: 'LX-67890',
  140. boxType: '通用类型',
  141. position: 'X-3 Y-1'
  142. },
  143. {
  144. id: '1',
  145. type: 'material',
  146. name: '物料名称XXXXX',
  147. boxNumber: 'LX-12345',
  148. boxType: '通用类型',
  149. order: 'XXXXX订单',
  150. quantity: 10,
  151. position: 'X-1 Y-2'
  152. },
  153. // 其他2个物料箱...
  154. {
  155. id: '1',
  156. type: 'material',
  157. name: '物料名称XXXXX',
  158. boxNumber: 'LX-12345',
  159. boxType: '通用类型',
  160. order: 'XXXXX订单',
  161. quantity: 10,
  162. position: 'X-1 Y-2'
  163. },
  164. // 其他2个物料箱...
  165. // 第二行空箱
  166. {
  167. id: '4',
  168. type: 'empty',
  169. name: '空箱',
  170. boxNumber: 'LX-67890',
  171. boxType: '通用类型',
  172. position: 'X-3 Y-1'
  173. }, {
  174. id: '1',
  175. type: 'material',
  176. name: '物料名称XXXXX',
  177. boxNumber: 'LX-12345',
  178. boxType: '通用类型',
  179. order: 'XXXXX订单',
  180. quantity: 10,
  181. position: 'X-1 Y-2'
  182. },
  183. // 其他2个物料箱...
  184. // 第二行空箱
  185. {
  186. id: '4',
  187. type: 'empty',
  188. name: '空箱',
  189. boxNumber: 'LX-67890',
  190. boxType: '通用类型',
  191. position: 'X-3 Y-1'
  192. },
  193. // 第二行空箱
  194. {
  195. id: '4',
  196. type: 'empty',
  197. name: '空箱',
  198. boxNumber: 'LX-67890',
  199. boxType: '通用类型',
  200. position: 'X-3 Y-1'
  201. },
  202. // 其他2个空箱...
  203. ];
  204. @State orders: OrderParams[] = [
  205. { orderName: '订单名称XXXXX', orderNo: '123123213', date: '2025/11/11', progress: '50%' },
  206. { orderName: '订单名称XXXX', orderNo: '123123213', date: '2025/11/11', progress: '75%' },
  207. { orderName: '特殊订单', orderNo: 'SH2024001', date: '2024/03/01', progress: '100%' },
  208. { orderName: '订单名称XXXXX', orderNo: '123123213', date: '2025/11/11', progress: '50%' },
  209. { orderName: '订单名称XXXX', orderNo: '123123213', date: '2025/11/11', progress: '75%' },
  210. { orderName: '特殊订单', orderNo: 'SH2024001', date: '2024/03/01', progress: '100%' }
  211. ]
  212. @State selectWorkOrder: WorkOrderInfo = {}
  213. @State workOrderArray: WorkOrderInfo[] = []
  214. loadWorkOrders = async () => {
  215. this.workOrderArray = await WmsRequest.post('/api/v1/plan/workOrder/list', {
  216. queryComplete: 0,
  217. } as RequestParamModel) as WorkOrderInfo[]
  218. }
  219. aboutToAppear(): void {
  220. this.loadWorkOrders();
  221. }
  222. build() {
  223. Row() {
  224. Column() {
  225. Row() {
  226. TimeAndTitle()
  227. }.width('100%')
  228. .height('3.4%')
  229. .alignItems(VerticalAlign.Bottom)
  230. .justifyContent(FlexAlign.End)
  231. Row() {
  232. Image($r('app.media.general_return'))
  233. .height($r('app.float.virtualSize_22_4'))
  234. .width($r('app.float.virtualSize_22_4'))
  235. .fillColor($r('app.color.FFFFFF'))
  236. // .onClick(()=> {
  237. // router.back()
  238. // })
  239. Text('零星物料出库')
  240. .fontColor($r('app.color.FFFFFF'))
  241. .fontSize($r('app.float.fontSize_15_2'))
  242. }
  243. .height('4%')
  244. .width('100%')
  245. .justifyContent(FlexAlign.Start)
  246. .margin({ left: '5%' })
  247. .onClick(() => {
  248. router.back()
  249. })
  250. Row() {
  251. Row() {
  252. ProcessFlow({
  253. currentStep: this.currentStep,
  254. firstStepTitle: "选择物料",
  255. secondStepTitle: "零星出库",
  256. thirdStepTitle: "",
  257. })
  258. }.width('20%')
  259. .margin({ right: '20%' })
  260. NavigationBar().width('20%')
  261. }
  262. .width('100%')
  263. .height('4%')
  264. .margin({ top: '1%' })
  265. .justifyContent(FlexAlign.End)
  266. .alignItems(VerticalAlign.Bottom)
  267. if (this.currentStep === 1) {
  268. Column() {
  269. Row() {
  270. Column() {
  271. Column() {
  272. Row() {
  273. Text('查询物料')
  274. .fontColor($r('app.color.FFFFFF'))
  275. .fontSize($r('app.float.fontSize_15_2'))
  276. .margin({ top: '4%' })
  277. }.height('10%')
  278. Row() {
  279. // 左侧二维码图标
  280. Image($r('app.media.material_qr_code'))// 请替换为您的二维码图片资源
  281. .width($r('app.float.virtualSize_16_8'))
  282. .height($r('app.float.virtualSize_16_8'))
  283. .fillColor($r('app.color.FFFFFF'))
  284. .margin({ left: '2%' })
  285. // 扫码输入框
  286. TextInput({ placeholder: '请扫描物料编码' })
  287. .type(InputType.Normal)
  288. .placeholderFont({ size: $r('app.float.fontSize_12') })
  289. .placeholderColor($r('app.color.30FFFFFF'))
  290. .fontSize($r('app.float.fontSize_12'))
  291. .fontColor($r('app.color.FFFFFF'))
  292. }
  293. .margin({ top: '3%' })
  294. .height('8%')
  295. .width('80%')
  296. .borderRadius($r('app.float.virtualSize_7_2'))
  297. .backgroundColor($r('app.color.000000'))
  298. // 操作说明
  299. Text('通过物料扫码查询当前库存是否有同型号物')
  300. .fontSize($r('app.float.fontSize_8'))
  301. .fontColor($r('app.color.60FFFFFF'))
  302. .width('100%')
  303. .textAlign(TextAlign.Center)
  304. .margin({ top: '2%' })
  305. Column() {
  306. OrderListComponent({
  307. workOrders: this.workOrderArray,
  308. selectWorkOrder: this.selectWorkOrder,
  309. materialData:this.materialData}).height('100%')
  310. }.margin({ top: '4%' }).height('70%')
  311. }.height('100%').width('95%').justifyContent(FlexAlign.Start)
  312. }.width('30%').backgroundColor($r('app.color.10FFFFFF'))
  313. Image($r('app.media.arrow_right'))
  314. .width($r('app.float.virtualSize_23'))
  315. .height($r('app.float.virtualSize_23'))
  316. .fillColor($r('app.color.FFFFFF'))
  317. .margin({ left: '-2%', right: '-2%' })
  318. Column() {
  319. Row() {
  320. Text("选择料箱")
  321. .fontColor($r('app.color.FFFFFF'))
  322. .fontSize($r('app.float.fontSize_15_2'))
  323. }.height('10%')
  324. Row() {
  325. MaterialBoxGrid({ materialBoxes: this.materialBoxes })
  326. .width('100%')
  327. .height('100%')
  328. }.width('100%').height('90%')
  329. }.width('62%').backgroundColor($r('app.color.10FFFFFF'))
  330. }
  331. .height('85%')
  332. .justifyContent(FlexAlign.SpaceEvenly)
  333. .width('100%')
  334. Row({ space: 15 }) {
  335. Button({ type: ButtonType.Normal }) {
  336. Text("料箱出库")
  337. .fontSize($r('app.float.fontSize_12'))
  338. .fontColor($r('app.color.0A84FF')) // 图片中的蓝色
  339. }
  340. .width('22%')
  341. .height('100%')
  342. .backgroundColor($r('app.color.20FFFFFF'))
  343. .borderRadius($r('app.float.virtualSize_6_4'))
  344. .scale({ x: this.outBoundButtonClick, y: this.outBoundButtonClick })
  345. .animation({
  346. duration: 200,
  347. curve: Curve.Linear // 弹性曲线更生动
  348. })
  349. //.enabled(!!this.selectedOrderNo) // 只有选中订单时才启用按钮
  350. .onClick(() => {
  351. this.outBoundButtonClick = 0.9; // 点击时缩小
  352. setTimeout(() => {
  353. this.outBoundButtonClick = 1; // 0.2秒后恢复
  354. }, 200);
  355. this.currentStep = 1;
  356. })
  357. Button({ type: ButtonType.Normal }) {
  358. Text("下一步")
  359. .fontSize($r('app.float.fontSize_12'))
  360. .fontColor($r('app.color.0A84FF')) // 图片中的蓝色
  361. }
  362. .width('22%')
  363. .height('100%')
  364. .backgroundColor($r('app.color.20FFFFFF'))
  365. .borderRadius($r('app.float.virtualSize_6_4'))
  366. .scale({ x: this.nextStepButtonClick, y: this.nextStepButtonClick })
  367. .animation({
  368. duration: 200,
  369. curve: Curve.Linear // 弹性曲线更生动
  370. })
  371. //.enabled(!!this.selectedOrderNo) // 只有选中订单时才启用按钮
  372. .onClick(() => {
  373. this.nextStepButtonClick = 0.9; // 点击时缩小
  374. setTimeout(() => {
  375. this.nextStepButtonClick = 1; // 0.2秒后恢复
  376. }, 200);
  377. this.currentStep = 2
  378. })
  379. }.width('100%').height('6%').justifyContent(FlexAlign.End).margin({ bottom: '3%', right: '5%' })
  380. }
  381. .height('83.6%')
  382. .margin({ top: '3%' })
  383. .width('100%')
  384. .justifyContent(FlexAlign.SpaceAround)
  385. .width('100%')
  386. }
  387. else if (this.currentStep === 2) {
  388. Column() {
  389. Row() {
  390. Column() {
  391. InBoundView({ materialNum: this.materialNum })
  392. }.width('29%').backgroundColor($r('app.color.10FFFFFF'))
  393. Image($r('app.media.arrow_right'))
  394. .width($r('app.float.virtualSize_23'))
  395. .height($r('app.float.virtualSize_23'))
  396. .fillColor($r('app.color.FFFFFF'))
  397. .margin({ left: '-2%', right: '-2%' })
  398. Column() {
  399. Row() {
  400. Column() {
  401. Text("扫码出库")
  402. .fontColor($r('app.color.FFFFFF'))
  403. .fontSize($r('app.float.fontSize_15_2'))
  404. }.height('100%').width('65%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Center)
  405. Row() {
  406. // 左侧二维码图标
  407. Image($r('app.media.material_qr_code'))// 请替换为您的二维码图片资源
  408. .width($r('app.float.virtualSize_16_8'))
  409. .height($r('app.float.virtualSize_16_8'))
  410. .fillColor($r('app.color.FFFFFF'))
  411. .margin({ left: '2%' })
  412. // 扫码输入框
  413. TextInput({ placeholder: '请扫描物料编码' })
  414. .type(InputType.Normal)
  415. .placeholderFont({ size: $r('app.float.fontSize_12') })
  416. .placeholderColor($r('app.color.30FFFFFF'))
  417. .fontSize($r('app.float.fontSize_12'))
  418. .fontColor($r('app.color.FFFFFF'))
  419. }.width('35%')
  420. .borderRadius($r('app.float.virtualSize_7_2'))
  421. .backgroundColor($r('app.color.000000'))
  422. }.justifyContent(FlexAlign.Start)
  423. .height('10%')
  424. .width('95%')
  425. .justifyContent(FlexAlign.Center)
  426. Row() {
  427. MaterialListComponent({
  428. ScanMaterialList:this.orders,
  429. materialNum:this.materialNum
  430. }).width('95%')
  431. }.width('100%').height('78%').justifyContent(FlexAlign.Center)
  432. //Column(){
  433. Button({type:ButtonType.Normal}) {
  434. Text("确认出库")
  435. .fontSize($r('app.float.fontSize_12'))
  436. .fontColor($r('app.color.0A84FF')) // 图片中的蓝色
  437. }
  438. .width('35%')
  439. .height('7%')
  440. .backgroundColor($r('app.color.20FFFFFF'))
  441. .borderRadius($r('app.float.virtualSize_6_4'))
  442. .margin({top:'2%',bottom:'1%'})
  443. .scale({ x: this.outBoundButtonClick, y: this.outBoundButtonClick })
  444. .animation({
  445. duration: 200,
  446. curve: Curve.Linear // 弹性曲线更生动
  447. })
  448. // .enabled(!!this.selectedOrderNo) // 只有选中订单时才启用按钮
  449. .onClick(() => {
  450. this.outBoundButtonClick = 0.9; // 点击时缩小
  451. setTimeout(() => {
  452. this.outBoundButtonClick = 1; // 0.2秒后恢复
  453. }, 200);
  454. this.currentStep = 1;
  455. })
  456. //}.height('10%').justifyContent(FlexAlign.Center)
  457. }.width('62%').backgroundColor($r('app.color.10FFFFFF'))
  458. }
  459. .height('85%')
  460. .justifyContent(FlexAlign.SpaceEvenly)
  461. .width('100%')
  462. Row({ space: 15 }) {
  463. Button({type:ButtonType.Normal}) {
  464. Text("上一步")
  465. .fontSize($r('app.float.fontSize_12'))
  466. .fontColor($r('app.color.0A84FF')) // 图片中的蓝色
  467. }
  468. .width('22%')
  469. .height('100%')
  470. .backgroundColor($r('app.color.20FFFFFF'))
  471. .margin({left:'22%'})
  472. .borderRadius($r('app.float.virtualSize_6_4'))
  473. .scale({ x: this.preStepButtonClick, y: this.preStepButtonClick })
  474. .animation({
  475. duration: 200,
  476. curve: Curve.Linear // 弹性曲线更生动
  477. })
  478. // .enabled(!!this.selectedOrderNo) // 只有选中订单时才启用按钮
  479. .onClick(() => {
  480. this.preStepButtonClick = 0.9; // 点击时缩小
  481. setTimeout(() => {
  482. this.preStepButtonClick = 1; // 0.2秒后恢复
  483. }, 200);
  484. this.currentStep = 1;
  485. })
  486. }.width('100%').height('6%').justifyContent(FlexAlign.Start).margin({ bottom: '3%', left: '5%' })
  487. }
  488. .height('83.6%')
  489. .margin({ top: '3%' })
  490. .width('100%')
  491. .justifyContent(FlexAlign.SpaceAround)
  492. .width('100%')
  493. }
  494. }
  495. .width('100%')
  496. .height('100%')
  497. .backgroundColor($r('app.color.000000'))
  498. }
  499. .height('100%')
  500. }
  501. }