LittleMaterialOutBound.ets 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. /*
  2. * 零星物料出库
  3. * */
  4. import {
  5. ProcessFlow,
  6. CommonConfirmDialog,
  7. RemindDialog
  8. } from '../component/OrderMaterialsStorageView'
  9. import router from '@ohos.router';
  10. import { NavigationBar } from '../component/NavigationBar'
  11. import { TimeAndTitle } from '../component/TimeAndTitle'
  12. import { InBoundView } from '../component/InBoundView'
  13. import WmsRequest from '../common/util/request/WmsRequest'
  14. import RequestParamModel from '../viewmodel/wms/RequestParamModel'
  15. import MaterialBoxInfo from '../viewmodel/wms/MaterialBoxInfo';
  16. import HashMap from '@ohos.util.HashMap';
  17. import CommonConstants from '../common/constants/CommonConstants';
  18. import DictInfo from '../viewmodel/DictInfo';
  19. import RobotErrorHandleRequest from '../common/util/request/RobotErrorHandleRequest';
  20. import { ConfirmDialogParams, RgvInfo } from '../viewmodel/wms/rgv/RobotsParam'
  21. import promptAction from '@ohos.promptAction';
  22. import VehicleInfo from '../viewmodel/wms/VehicleInfo';
  23. import MaterialInfo from '../viewmodel/wms/MaterialInfo';
  24. @Entry
  25. @Component
  26. struct LittleMaterialsOutBound {
  27. // 输入的物料名称
  28. @State inputValue: string = ''
  29. // 查询到的物料库存列表
  30. @State materialArray: MaterialBoxInfo[] = []
  31. // 选中的库存的物料编码
  32. @State selectMaterialCode: string = ''
  33. // 物料关联的库存(料箱)信息——选择料箱使用
  34. @State materialBoxInfos: MaterialBoxInfo[] = []
  35. // 选中的料箱
  36. @State selectVehicleIndex: number = -1
  37. // 料箱类型数据字典
  38. vehicleTypeDictType: string = 'vehicle_type'
  39. vehicleTypeDictMap: HashMap<string, string> = new HashMap<string, string>()
  40. // 扫描或手动输入的物料编码
  41. @State scanCode: string = ''
  42. // 出入口料口中的物料信息
  43. @State materialNum: number = 0
  44. // 出库料箱中的库存物料信息
  45. outMaterialBoxInfos: MaterialInfo[] = []
  46. // 扫码待出库的物料
  47. @State scanMaterialList: MaterialInfo[] = []
  48. //扫码后自动滚动第一行
  49. @State scanCodeIndex: number = -1
  50. materialScrollerController: Scroller = new Scroller()
  51. @State currentStep: number = 1;
  52. @State nextStepButtonClick: number = 1
  53. @State preStepButtonClick: number = 1
  54. @State outBoundButtonClick :number = 1
  55. @State confirmOutboundButtonClick :number = 1
  56. // 根据物料编码【模糊】查询库存
  57. getStoreListFunc = async () => {
  58. let res: MaterialBoxInfo[] = await WmsRequest.post('/api/v1/stock/mergeList', {
  59. houseType: '1',
  60. materialNo: this.inputValue
  61. } as RequestParamModel)
  62. this.inputValue = ''
  63. if (res && res.length > 0) {
  64. this.materialArray = res
  65. }
  66. }
  67. //请求物料位置
  68. queryMaterialPositionFunc = async () => {
  69. this.materialBoxInfos = await WmsRequest.post('/api/v1/stock/groupList', {
  70. materialNo: this.selectMaterialCode
  71. } as RequestParamModel)
  72. if (this.materialBoxInfos) {
  73. for (const element of this.materialBoxInfos) {
  74. if (element.coordinate && element.coordinate.length > 0 && element.coordinate.indexOf('-') > 0) {
  75. let coors = element.coordinate.split('-');
  76. element.x = parseInt(coors[0])
  77. element.y = parseInt(coors[1])
  78. }
  79. }
  80. }
  81. }
  82. // 扫码物料编码方法
  83. scanMaterialCodeFunc = async (itemCode: string) => {
  84. this.scanCode = ''
  85. let res: MaterialInfo = await WmsRequest.post('/api/v1/process/circulation/material', {
  86. label: itemCode //'#gys022#sc022#100#20220929#31'
  87. } as RequestParamModel)
  88. // 物料默认都新增在数组头部
  89. this.scanMaterialList.unshift(res)
  90. this.scanCodeIndex = 0
  91. this.materialScrollerController.scrollToIndex(this.scanCodeIndex)
  92. // 出库料箱中的库存物料 需要做出库操作
  93. let toChangeArray: MaterialInfo[] = [...this.outMaterialBoxInfos]
  94. for (let i = 0; i < toChangeArray.length; i++) {
  95. let box = toChangeArray[i]
  96. if (res.materialCode == box.materialCode) {
  97. let value = box.num! - res.num!
  98. box.num = value >= 0 ? value : 0
  99. continue
  100. }
  101. }
  102. this.outMaterialBoxInfos = toChangeArray.filter((m) => {
  103. return m.num! > 0
  104. })
  105. // for (let i = this.outMaterialBoxInfos.length - 1; i >= 0; i--) {
  106. // if (this.outMaterialBoxInfos[i].materialCode! === res.materialCode!) {
  107. // if (this.outMaterialBoxInfos[i].num! > res.num!) {
  108. // this.outMaterialBoxInfos[i].num = this.outMaterialBoxInfos[i].num! - res.num!
  109. // break
  110. // } else if (this.outMaterialBoxInfos[i].num! === res.num!) {
  111. // this.outMaterialBoxInfos.splice(i, 1)
  112. // break
  113. // } else {
  114. // res.num = res.num! - this.outMaterialBoxInfos[i].num!
  115. // this.outMaterialBoxInfos.splice(i, 1);
  116. // }
  117. // }
  118. // }
  119. this.materialNum = this.outMaterialBoxInfos.length
  120. }
  121. // 抽屉称重(根据重量判断抽屉是否有料箱)
  122. @StorageLink('materialBoxWeight') materialBoxWeight: number = 0
  123. // 抽屉状态
  124. @StorageLink('drawerPositionStatus') drawerPositionStatus: number = 1
  125. @State reminds: string = '1'
  126. commonDialogController: CustomDialogController | null = null;
  127. remindController: CustomDialogController = new CustomDialogController({
  128. builder: RemindDialog({
  129. remind: this.reminds,}
  130. ),
  131. customStyle: true,
  132. maskColor: 'rgba(0,0,0,0.6)',
  133. //autoCancel:false
  134. })
  135. private showConfirmDialog(params: ConfirmDialogParams) {
  136. if (this.commonDialogController) {
  137. this.commonDialogController.close()
  138. }
  139. this.commonDialogController = new CustomDialogController({
  140. builder: CommonConfirmDialog({
  141. title: params.title || '提示',
  142. message: params.message,
  143. confirmText: params.confirmText || '确定',
  144. cancelText: params.cancelText || '取消',
  145. onConfirm: params.onConfirm
  146. }),
  147. cancel: () => console.log('用户取消操作'),
  148. customStyle: true,
  149. autoCancel: false,
  150. maskColor: 'rgba(0,0,0,0.6)'
  151. });
  152. this.commonDialogController.open();
  153. }
  154. // 判断小车状态
  155. async queryRgvInfo(): Promise<boolean> {
  156. let res: RgvInfo = await RobotErrorHandleRequest.get('/api/v1/wcs/rgv/rgv1', {}) as RgvInfo;
  157. if (res) {
  158. if (res.status != '0' || res.x != res.rx || res.y != res.ry) {
  159. return false;
  160. }
  161. return true; // 如果条件不满足,返回 true
  162. }
  163. return false; // 如果 res 为 null 或 undefined,返回 false
  164. }
  165. // 料箱出库的方法
  166. callBoxOutboundFunc = async () => {
  167. if (this.selectVehicleIndex < 0) {
  168. this.reminds = '请先选择料箱'
  169. this.remindController.open()
  170. setTimeout(() => {
  171. this.remindController.close()
  172. }, 2000);
  173. return
  174. }
  175. //查询小车的状态
  176. const rgvStatusNormal = await this.queryRgvInfo()
  177. if(!rgvStatusNormal) {
  178. this.reminds = '小车状态异常或位置错误,请检查后重试'
  179. this.remindController.open()
  180. setTimeout(() => {
  181. this.remindController.close()
  182. }, 2000);
  183. return
  184. }
  185. console.info('hhtest', this.drawerPositionStatus+'as')
  186. if(this.drawerPositionStatus == 0) {
  187. this.reminds = '抽屉未缩回,请检查后重试'
  188. this.remindController.open()
  189. setTimeout(() => {
  190. this.remindController.close()
  191. }, 2000);
  192. return
  193. }
  194. if(this.materialBoxWeight > 0) {
  195. this.reminds = '抽屉已有料箱,请检查后重试'
  196. this.remindController.open()
  197. setTimeout(() => {
  198. this.remindController.close()
  199. }, 2000);
  200. return
  201. }
  202. // 弹窗确认出库
  203. // this.showConfirmDialog({
  204. // title: '料箱出库',
  205. // message: `确定要空箱出库吗?`,
  206. // onConfirm: ()=> {
  207. //
  208. // }
  209. // });
  210. let res: VehicleInfo = await WmsRequest.post('/api/v1/wmsOrder/outBox', {
  211. stanCode: CommonConstants.STATION_CODE,
  212. vehicleNo: this.materialBoxInfos[this.selectVehicleIndex].vehicleCode!,
  213. houseNo: this.materialBoxInfos[this.selectVehicleIndex].houseNo!
  214. } as RequestParamModel)
  215. if (res && res.list) {
  216. this.outMaterialBoxInfos = res.list
  217. this.materialNum = res.list.length
  218. }
  219. promptAction.showToast({
  220. message: '箱子正在运行中....',
  221. duration: 1800,
  222. bottom: '50%'
  223. })
  224. }
  225. async aboutToAppear() {
  226. if (!CommonConstants.DICT_DATA || CommonConstants.DICT_DATA.length <= 0) {
  227. let res: DictInfo[] = await WmsRequest.post('/api/v1/sys/dictData/all',)
  228. if (res && res.length > 0) {
  229. for (const dict of res) {
  230. CommonConstants.DICT_DATA.set(dict.dictCode, dict.list)
  231. if (this.vehicleTypeDictType === dict.dictCode) {
  232. for (const element of dict?.list!) {
  233. this.vehicleTypeDictMap.set(element.dictValue, element.dictLabel);
  234. }
  235. }
  236. }
  237. }
  238. } else {
  239. let dictList = CommonConstants.DICT_DATA.get(this.vehicleTypeDictType);
  240. for (const element of dictList) {
  241. this.vehicleTypeDictMap.set(element.dictValue, element.dictLabel);
  242. }
  243. }
  244. }
  245. build() {
  246. Row() {
  247. // 顶部时间和菜单栏
  248. Column() {
  249. Row() {
  250. TimeAndTitle()
  251. }.width('100%')
  252. .height('3.4%')
  253. .alignItems(VerticalAlign.Bottom)
  254. .justifyContent(FlexAlign.End)
  255. // 零星物料出库
  256. Row() {
  257. Image($r('app.media.general_return'))
  258. .height($r('app.float.virtualSize_56'))
  259. .width($r('app.float.virtualSize_56'))
  260. .fillColor($r('app.color.FFFFFF'))
  261. Text('零星物料出库')
  262. .fontSize($r('app.float.fontSize_30'))
  263. .fontColor($r('app.color.FFFFFF'))
  264. .fontWeight(FontWeight.Medium)
  265. }
  266. .width('94.8%')
  267. .height('5.2%')
  268. .alignItems(VerticalAlign.Center)
  269. .justifyContent(FlexAlign.Start)
  270. .onClick(()=> {
  271. router.back()
  272. })
  273. // 当前零星物料出库的步骤和操作栏
  274. Row() {
  275. Row() {
  276. ProcessFlow({
  277. currentStep: this.currentStep,
  278. firstStepTitle: '选择物料',
  279. secondStepTitle: '零星出库',
  280. thirdStepTitle: '',
  281. })
  282. }
  283. .height('80%')
  284. .width('11%')
  285. Row().width('21.5%')
  286. NavigationBar()
  287. .height('80%')
  288. .width('23%')
  289. }
  290. .width('100%')
  291. .height('13%')
  292. .justifyContent(FlexAlign.End)
  293. .alignItems(VerticalAlign.Bottom)
  294. if (this.currentStep === 1) {
  295. Row() {
  296. // 查询物料
  297. Column() {
  298. Row() {
  299. Text('查询物料')
  300. .fontSize($r('app.float.fontSize_30'))
  301. .fontColor($r('app.color.FFFFFF'))
  302. .fontWeight(FontWeight.Medium)
  303. }
  304. .height('10%')
  305. .width('100%')
  306. .justifyContent(FlexAlign.Center)
  307. .onClick(()=>{
  308. this.getStoreListFunc()
  309. })
  310. Row() {
  311. TextInput({ text: this.inputValue, placeholder: '录入物料名称' })
  312. .type(InputType.Normal)
  313. .width('84%')
  314. .placeholderFont({ size: $r('app.float.fontSize_16') })
  315. .placeholderColor($r('app.color.30FFFFFF'))
  316. .fontSize($r('app.float.fontSize_24'))
  317. .fontColor($r('app.color.FFFFFF'))
  318. .onSubmit(() => {
  319. this.getStoreListFunc()
  320. })
  321. .onChange((value: string) => {
  322. this.inputValue = value
  323. })
  324. Row() {
  325. Image($r('app.media.wms_search'))
  326. .width($r('app.float.virtualSize_24'))
  327. .height($r('app.float.virtualSize_24'))
  328. .fillColor($r('app.color.0A84FF'))
  329. }
  330. .width('16%')
  331. .height('100%')
  332. .justifyContent(FlexAlign.Center)
  333. .borderRadius($r('app.float.virtualSize_16'))
  334. .backgroundColor($r('app.color.20FFFFFF'))
  335. .onClick(()=>{
  336. this.getStoreListFunc()
  337. })
  338. }
  339. .height('7.3%')
  340. .width('70.4%')
  341. .borderRadius($r('app.float.virtualSize_16'))
  342. .backgroundColor($r('app.color.000000'))
  343. Row().height('2.6%')
  344. List({space: 8}) {
  345. ForEach(this.materialArray, (item: MaterialBoxInfo)=>{
  346. ListItem() {
  347. Column({space: 1}) {
  348. Row() {
  349. Text(item.materialName! + '-' + item.materialNo)
  350. .fontSize($r('app.float.fontSize_24'))
  351. .fontWeight(FontWeight.Medium)
  352. .fontColor($r('app.color.FFFFFF'))
  353. .maxLines(1)
  354. }
  355. .height('45%')
  356. .width('91%')
  357. .alignItems(VerticalAlign.Bottom)
  358. Column() {
  359. Text('型号:' + item.spec!)
  360. .fontSize($r('app.float.fontSize_16'))
  361. .fontWeight(FontWeight.Lighter)
  362. .fontColor($r('app.color.FFFFFF'))
  363. .maxLines(1)
  364. Text('库存数量:' + item.num! + item.unit!)
  365. .fontSize($r('app.float.fontSize_16'))
  366. .fontWeight(FontWeight.Lighter)
  367. .fontColor($r('app.color.FFFFFF'))
  368. .maxLines(1)
  369. }
  370. .height('38%')
  371. .width('91%')
  372. .justifyContent(FlexAlign.Center)
  373. .alignItems(HorizontalAlign.Start)
  374. }
  375. .height('13%')
  376. .width('100%')
  377. .borderRadius($r('app.float.virtualSize_16'))
  378. .backgroundColor(this.selectMaterialCode === item.materialNo! ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
  379. .borderWidth(1)
  380. .borderColor(this.selectMaterialCode === item.materialNo! ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
  381. .onClick(()=>{
  382. this.selectMaterialCode = item.materialNo!
  383. if (this.selectMaterialCode && this.selectMaterialCode.length > 0) {
  384. this.queryMaterialPositionFunc()
  385. }
  386. })
  387. }
  388. })
  389. }
  390. .width('92.6%')
  391. .height('77.5%')
  392. .alignListItem(ListItemAlign.Center)
  393. }
  394. .height('100%')
  395. .width('29.6%')
  396. .borderRadius($r('app.float.virtualSize_16'))
  397. .justifyContent(FlexAlign.Start)
  398. .backgroundColor($r('app.color.10FFFFFF'))
  399. Image($r('app.media.wms_arrow_right'))
  400. .height($r('app.float.virtualSize_48'))
  401. .width($r('app.float.virtualSize_48'))
  402. // 选择料箱
  403. Column() {
  404. Row() {
  405. Text('选择料箱')
  406. .fontSize($r('app.float.fontSize_30'))
  407. .fontColor($r('app.color.FFFFFF'))
  408. .fontWeight(FontWeight.Medium)
  409. }
  410. .height('10%')
  411. .width('100%')
  412. .justifyContent(FlexAlign.Center)
  413. // 动态排列容器
  414. Scroll() {
  415. Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start}) {
  416. ForEach(this.materialBoxInfos, (item: MaterialBoxInfo, index: number) => {
  417. Column({ space: 5 }) {
  418. Row() {
  419. Text(item.materials?.[0]?.materialName! + '-' + item.materials?.[0]?.materialNo!)
  420. .fontSize($r('app.float.fontSize_24'))
  421. .fontWeight(FontWeight.Medium)
  422. .fontColor($r('app.color.FFFFFF'))
  423. .maxLines(1)
  424. }
  425. .height('28.5%')
  426. .width('87.4%')
  427. .alignItems(VerticalAlign.Bottom)
  428. Column() {
  429. Text('料箱编号:' + item.vehicleCode!)
  430. .fontSize($r('app.float.fontSize_16'))
  431. .fontWeight(FontWeight.Lighter)
  432. .fontColor($r('app.color.FFFFFF'))
  433. .maxLines(1)
  434. Text('料箱类型:' + (this.vehicleTypeDictMap.get(item.vehicleCategory!) ? this.vehicleTypeDictMap.get(item.vehicleCategory!) : item.vehicleCategory!))
  435. .fontSize($r('app.float.fontSize_16'))
  436. .fontWeight(FontWeight.Lighter)
  437. .fontColor($r('app.color.FFFFFF'))
  438. .maxLines(1)
  439. Text('所属订单:')
  440. .fontSize($r('app.float.fontSize_16'))
  441. .fontWeight(FontWeight.Lighter)
  442. .fontColor($r('app.color.FFFFFF'))
  443. .maxLines(1)
  444. Text('数量:' + item.materials?.[0]?.num! + item.materials?.[0].unit!)
  445. .fontSize($r('app.float.fontSize_16'))
  446. .fontWeight(FontWeight.Lighter)
  447. .fontColor($r('app.color.FFFFFF'))
  448. .maxLines(1)
  449. Text('位置:X-' + item.x! + ' Y-' + item.y!)
  450. .fontSize($r('app.float.fontSize_16'))
  451. .fontWeight(FontWeight.Lighter)
  452. .fontColor($r('app.color.FFFFFF'))
  453. .maxLines(1)
  454. }
  455. .height('48.3%')
  456. .width('87.4%')
  457. .justifyContent(FlexAlign.Center)
  458. .alignItems(HorizontalAlign.Start)
  459. }
  460. .width('32.8%')
  461. .height('23%')
  462. .borderRadius($r('app.float.virtualSize_16'))
  463. .backgroundColor(this.selectVehicleIndex === index ? $r('app.color.2030D158') : $r('app.color.20FFFFFF'))
  464. .borderWidth(1)
  465. .borderColor(this.selectVehicleIndex === index ? $r('app.color.30D158') : $r('app.color.20FFFFFF'))
  466. .margin({ top: index > 2 ? '1%' : '0%', left: (index % 3) === 0 ? '0%' : '0.8%' })
  467. .onClick(()=>{
  468. this.selectVehicleIndex = index
  469. })
  470. })
  471. }
  472. .width('100%')
  473. }
  474. .scrollable(ScrollDirection.Vertical) // 垂直滚动
  475. .scrollBar(BarState.Auto)
  476. .width('96.6%')
  477. .height('87.4%')
  478. .align(Alignment.Top)
  479. }
  480. .height('100%')
  481. .width('64.8%')
  482. .borderRadius($r('app.float.virtualSize_16'))
  483. .justifyContent(FlexAlign.Center)
  484. .backgroundColor($r('app.color.10FFFFFF'))
  485. }
  486. .height('71%')
  487. .width('94.8%')
  488. .justifyContent(FlexAlign.SpaceBetween)
  489. }
  490. else if (this.currentStep === 2) {
  491. Row() {
  492. Column() {
  493. InBoundView({
  494. materialNum: this.materialNum,
  495. boxMaterials:this.scanMaterialList
  496. });
  497. }
  498. .height('100%')
  499. .width('29.6%')
  500. .borderRadius($r('app.float.virtualSize_16'))
  501. .justifyContent(FlexAlign.Start)
  502. .backgroundColor($r('app.color.10FFFFFF'))
  503. Image($r('app.media.wms_arrow_right'))
  504. .height($r('app.float.virtualSize_48'))
  505. .width($r('app.float.virtualSize_48'))
  506. Column() {
  507. // 扫码区
  508. Row() {
  509. Row() {
  510. Text('扫码出库')
  511. .fontSize($r('app.float.fontSize_30'))
  512. .fontColor($r('app.color.FFFFFF'))
  513. .fontWeight(FontWeight.Medium)
  514. }
  515. .width('48.3%')
  516. .height('66%')
  517. Row() {
  518. Row().width('33.3%')
  519. Row() {
  520. Row().width('3.4%')
  521. // 左侧二维码图标
  522. Image($r('app.media.general_qr_code'))
  523. .width($r('app.float.virtualSize_24'))
  524. .height($r('app.float.virtualSize_24'))
  525. .fillColor($r('app.color.FFFFFF'))
  526. // 扫码输入框
  527. TextInput({ placeholder: '请扫描物料编码', text: this.scanCode })
  528. .type(InputType.Normal)
  529. .placeholderFont({ size: $r('app.float.fontSize_16')})
  530. .placeholderColor($r('app.color.30FFFFFF'))
  531. .fontSize($r('app.float.fontSize_16'))
  532. .fontColor($r('app.color.FFFFFF'))
  533. .enableKeyboardOnFocus(false)
  534. .onChange((value: string) => {
  535. this.scanCode = value
  536. })
  537. .onSubmit(async () => {
  538. this.scanMaterialCodeFunc(this.scanCode)
  539. })
  540. }
  541. .height('48.7%')
  542. .layoutWeight(1)
  543. .borderRadius($r('app.float.virtualSize_16'))
  544. .backgroundColor($r('app.color.000000'))
  545. }
  546. .width('48.3%')
  547. .height('100%')
  548. .alignItems(VerticalAlign.Center)
  549. .justifyContent(FlexAlign.End)
  550. }
  551. .height('15%')
  552. .width('100%')
  553. .justifyContent(FlexAlign.Center)
  554. .alignItems(VerticalAlign.Top)
  555. // 扫码物料列表
  556. List({ scroller: this.materialScrollerController }) {
  557. ForEach(this.scanMaterialList, (item: MaterialInfo, index: number) => {
  558. ListItem() {
  559. Row() {
  560. Column({space: 1}) {
  561. Text(item.materialName! + '-' + item.materialCode!)
  562. .fontSize($r('app.float.fontSize_24'))
  563. .fontWeight(FontWeight.Medium)
  564. .fontColor($r('app.color.FFFFFF'))
  565. .maxLines(1)
  566. Column() {
  567. Text('型号:' + item.spec!)
  568. .fontSize($r('app.float.fontSize_16'))
  569. .fontWeight(FontWeight.Lighter)
  570. .fontColor($r('app.color.FFFFFF'))
  571. .maxLines(1)
  572. Text('序列号:' + item.batchCode!)
  573. .fontSize($r('app.float.fontSize_16'))
  574. .fontWeight(FontWeight.Lighter)
  575. .fontColor($r('app.color.FFFFFF'))
  576. .maxLines(1)
  577. Text('所属订单:-')
  578. .fontSize($r('app.float.fontSize_16'))
  579. .fontWeight(FontWeight.Lighter)
  580. .fontColor($r('app.color.FFFFFF'))
  581. .maxLines(1)
  582. Text('数量:' + item.num! + item.unit!)
  583. .fontSize($r('app.float.fontSize_16'))
  584. .fontWeight(FontWeight.Lighter)
  585. .fontColor($r('app.color.FFFFFF'))
  586. .maxLines(1)
  587. }
  588. .height('52.8%')
  589. .width('100%')
  590. .justifyContent(FlexAlign.SpaceBetween)
  591. .alignItems(HorizontalAlign.Start)
  592. }
  593. .height('100%')
  594. .width('48%')
  595. .alignItems(HorizontalAlign.Start)
  596. .justifyContent(FlexAlign.Center)
  597. Row() {
  598. Image($r('app.media.material_delete'))
  599. .height($r('app.float.virtualSize_48'))
  600. .width($r('app.float.virtualSize_48'))
  601. .fillColor($r('app.color.FF453A'))
  602. .onClick(()=>{
  603. // 出库料箱中的物料需要加回去
  604. let toChangeArray: MaterialInfo[] = [...this.outMaterialBoxInfos]
  605. let hasFlag: boolean = false
  606. // 出库料箱中还有,则把数量加回去
  607. for (let i = 0; i < toChangeArray.length; i++) {
  608. let box = toChangeArray[i]
  609. if (item.materialCode == box.materialCode) {
  610. let value = box.num! + item.num!
  611. box.num = value >= 0 ? value : 0
  612. hasFlag = true
  613. continue
  614. }
  615. }
  616. // 出库料箱中没有,则把这一项加进去
  617. if (!hasFlag) {
  618. this.outMaterialBoxInfos.push(item)
  619. }
  620. // 扫码待出库的物料删除这一项
  621. this.scanMaterialList.splice(index, 1)
  622. })
  623. Row().width('2%')
  624. }
  625. .height('100%')
  626. .width('50%')
  627. .alignItems(VerticalAlign.Center)
  628. .justifyContent(FlexAlign.End)
  629. }
  630. .height('26%')
  631. .width('100%')
  632. .justifyContent(FlexAlign.Center)
  633. .borderRadius($r('app.float.virtualSize_16'))
  634. .backgroundColor($r('app.color.10FFFFFF'))
  635. }
  636. })
  637. }
  638. .width('96.6%')
  639. .height('72.5%')
  640. .alignListItem(ListItemAlign.Center)
  641. // 确认出库按钮
  642. Row() {
  643. Button('确认出库')
  644. .fontSize($r('app.float.fontSize_24'))
  645. .fontColor($r('app.color.0A84FF'))
  646. .width('42.4%')
  647. .height('56.3%')
  648. .backgroundColor($r('app.color.20FFFFFF'))
  649. .opacity(this.scanMaterialList.length > 0 ? 1 : 0.3)
  650. .scale({ x: this.confirmOutboundButtonClick, y: this.confirmOutboundButtonClick })
  651. .animation({
  652. duration: 200,
  653. curve: Curve.Linear // 弹性曲线更生动
  654. })
  655. .onClick(() => {
  656. if (this.scanMaterialList.length <= 0) {
  657. return
  658. }
  659. this.confirmOutboundButtonClick = 0.9; // 点击时缩小
  660. setTimeout(() => {
  661. this.confirmOutboundButtonClick = 1; // 0.2秒后恢复
  662. }, 200);
  663. this.scanMaterialList = []
  664. })
  665. }
  666. .width('100%')
  667. .height('12.5%')
  668. .justifyContent(FlexAlign.Center)
  669. }
  670. .height('100%')
  671. .width('64.8%')
  672. .borderRadius($r('app.float.virtualSize_16'))
  673. .justifyContent(FlexAlign.Start)
  674. .backgroundColor($r('app.color.10FFFFFF'))
  675. }
  676. .height('71%')
  677. .width('94.8%')
  678. .justifyContent(FlexAlign.SpaceBetween)
  679. }
  680. // 步骤切换按钮
  681. Row() {
  682. Row () {
  683. Text('第一步')
  684. .fontSize($r('app.float.fontSize_24'))
  685. .fontColor($r('app.color.0A84FF'))
  686. .fontWeight(FontWeight.Medium)
  687. }
  688. .height('67%')
  689. .width('24.1%')
  690. .justifyContent(FlexAlign.Center)
  691. .backgroundColor($r('app.color.20FFFFFF'))
  692. .borderRadius($r('app.float.fontSize_16'))
  693. .opacity(this.currentStep > 2 ? 1 : 0.3)
  694. .onClick(()=>{
  695. this.currentStep = 1
  696. })
  697. Row().width('1.2%')
  698. Row () {
  699. Text('上一步')
  700. .fontSize($r('app.float.fontSize_24'))
  701. .fontColor($r('app.color.0A84FF'))
  702. .fontWeight(FontWeight.Medium)
  703. }
  704. .height('67%')
  705. .width('24.1%')
  706. .justifyContent(FlexAlign.Center)
  707. .backgroundColor($r('app.color.20FFFFFF'))
  708. .borderRadius($r('app.float.fontSize_16'))
  709. .opacity(this.currentStep > 1 ? 1 : 0.3)
  710. .scale({ x: this.preStepButtonClick, y: this.preStepButtonClick })
  711. .animation({
  712. duration: 200,
  713. curve: Curve.Linear // 弹性曲线更生动
  714. })
  715. .onClick(() => {
  716. this.preStepButtonClick = 0.9; // 点击时缩小
  717. setTimeout(() => {
  718. this.preStepButtonClick = 1; // 0.2秒后恢复
  719. }, 200);
  720. if (this.currentStep > 1) {
  721. this.currentStep -= 1
  722. }
  723. })
  724. Row().width('1.2%')
  725. Row () {
  726. Text('料箱出库')
  727. .fontSize($r('app.float.fontSize_24'))
  728. .fontColor($r('app.color.0A84FF'))
  729. .fontWeight(FontWeight.Medium)
  730. }
  731. .height('67%')
  732. .width('24.1%')
  733. .justifyContent(FlexAlign.Center)
  734. .backgroundColor($r('app.color.20FFFFFF'))
  735. .borderRadius($r('app.float.fontSize_16'))
  736. .opacity(this.currentStep === 1 ? 1 : 0.3)
  737. .scale({ x: this.outBoundButtonClick, y: this.outBoundButtonClick })
  738. .animation({
  739. duration: 200,
  740. curve: Curve.Linear // 弹性曲线更生动
  741. })
  742. .onClick(() => {
  743. this.outBoundButtonClick = 0.9; // 点击时缩小
  744. setTimeout(() => {
  745. this.outBoundButtonClick = 1; // 0.2秒后恢复
  746. }, 200);
  747. this.callBoxOutboundFunc()
  748. })
  749. Row().width('1.2%')
  750. Row () {
  751. Text('下一步')
  752. .fontSize($r('app.float.fontSize_24'))
  753. .fontColor($r('app.color.0A84FF'))
  754. .fontWeight(FontWeight.Medium)
  755. }
  756. .height('67%')
  757. .width('24.1%')
  758. .justifyContent(FlexAlign.Center)
  759. .backgroundColor($r('app.color.20FFFFFF'))
  760. .borderRadius($r('app.float.fontSize_16'))
  761. .opacity(this.currentStep < 2 ? 1 : 0.3)
  762. .scale({ x: this.nextStepButtonClick, y: this.nextStepButtonClick })
  763. .animation({
  764. duration: 200,
  765. curve: Curve.Linear // 弹性曲线更生动
  766. })
  767. .onClick(() => {
  768. this.nextStepButtonClick = 0.9; // 点击时缩小
  769. setTimeout(() => {
  770. this.nextStepButtonClick = 1; // 0.2秒后恢复
  771. }, 200);
  772. if (this.currentStep < 2) {
  773. this.currentStep += 1
  774. }
  775. })
  776. }
  777. .width('94.8%')
  778. .height('7.4%')
  779. .alignItems(VerticalAlign.Center)
  780. }
  781. .width('100%')
  782. .height('100%')
  783. .backgroundColor($r('app.color.000000'))
  784. }
  785. .height('100%')
  786. }
  787. }