1
0

ManualWarehousing.ets 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. import EquipmentRequest from '../common/util/request/EquipmentRequest'
  2. import StorageRequest from '../common/util/request/StorageRequest'
  3. import { MaterialInformationModel } from '../model/MaterialInformation'
  4. import RequestParamModel from '../viewmodel/RequestParamModel'
  5. import { Materialpositionclass, ScanStorageclass } from './IntelligentWarehousingOutbound'
  6. import CommonConstants from '../common/constants/CommonConstants'
  7. import promptAction from '@ohos.promptAction'
  8. import { EmptyBoxInfoModel, StationInfoModel } from '../model/StorageSpace'
  9. import { outBoxClass } from './CompleteSet'
  10. export interface stat2 {
  11. statNo?: string
  12. //料箱编号
  13. rfid?: string
  14. //料箱检测的io位,1:有,0:没有
  15. io?: string
  16. //0:无锁定,1:锁定,即机器人正在动作,不能进出库动作
  17. lock?: string
  18. ts?: string
  19. RFID?: string
  20. UID?: string
  21. kg?: number
  22. }
  23. @Entry
  24. @Component
  25. export struct ManualWarehousing {
  26. //料箱等级(类型)
  27. @State vehicleLevel: string = ''
  28. // 叫空料箱数量
  29. @State callBoxNum: number = 1
  30. //取空箱子
  31. @State emptyBox: number = 0
  32. //更改的数量
  33. @State exchangeNumber: number = 0
  34. //料箱中的物料信息
  35. @State private boxMaterials: Array<MaterialInformationModel> = []
  36. //定义物料信息
  37. @State private MaterialInformation: Array<MaterialInformationModel> = []
  38. ///料箱状态
  39. @State materialBox: number = 0
  40. // 中间输入框绑定的值
  41. @State scanCodeValue: string = ""
  42. @State materialNo: string = ''
  43. //1:抽屉在料格内 0:抽屉在料格外
  44. @State drawerPositionStatus: number = 1
  45. //入库口料格状态(1:有料箱 0:无料箱)
  46. @State materialGridStatus: number = 0
  47. //选中取出的物料位置
  48. @State materialPosition: Materialpositionclass = {}
  49. //需要展示和更改的物料信息
  50. @State index: number = 0
  51. @State batchCode: string = ''
  52. @State materialName: string = ''
  53. //齐套料箱状态不可以点击:0,可以点击:1
  54. @State completeSetMaterialState: number = 0
  55. @State num: number = 0
  56. //点击颜色
  57. @State onclick: number = -1
  58. @State seqNo: string = ''
  59. //物料编码
  60. @State materialCode: string = ''
  61. @State spec: string = ''
  62. //扫码控制器
  63. textController: TextInputController = new TextInputController()
  64. //齐套料箱重量
  65. @State BoxWeight: number = 20
  66. @State private recentlyRecordObject: StationInfoModel = {}
  67. currentTimer: number = -1;
  68. //扫码请求
  69. ScanStorageCode = async (itemCode: string) => {
  70. this.scanCodeValue = ""
  71. let res: MaterialInformationModel = await StorageRequest.post("/api/v1/process/circulation/material", {
  72. label: itemCode //"#gys022#sc022#100#20220929#31"
  73. } as MaterialInformationModel)
  74. //let res = await StorageRequest.get("/api/v3/stock/selectSafeList/1")
  75. // {"batchCode":"BM47111400130447;SL5","codeType":"BATCH","materialCode":"47111400130447","materialName":"穿心电容","num":5,"spec":"G CT52-4-1-2C1-63V-103-M","unitDictLabel":"个","unitDictValue":"个"}
  76. let obj: MaterialInformationModel = JSON.parse(JSON.stringify(res))
  77. // 扫码完成之后,如果数组中有对应的值,就添加数量否则就push
  78. let toPushArray: MaterialInformationModel[] = [...this.MaterialInformation]
  79. let has = false
  80. for (let i = 0; i < toPushArray.length; i++) {
  81. let box = toPushArray[i]
  82. if (obj.materialCode == box.materialCode) {
  83. let number = obj.num! + box.num!
  84. box.num = number
  85. has = true
  86. }
  87. }
  88. if (!has) {
  89. toPushArray.push(JSON.parse(JSON.stringify(obj)))
  90. }
  91. this.MaterialInformation = [...toPushArray]
  92. }
  93. //RFID卡读取失败弹窗
  94. RfidCarController: CustomDialogController = new CustomDialogController({
  95. builder: RfidCar({}),
  96. alignment: DialogAlignment.Center,
  97. gridCount: 4,
  98. customStyle: true,
  99. })
  100. //物料详情弹窗
  101. materialDetailsController: CustomDialogController = new CustomDialogController({
  102. builder: materialDetails({
  103. exchangeNumber: this.exchangeNumber,
  104. MaterialInformation: this.MaterialInformation,
  105. index: this.index,
  106. batchCode: this.batchCode,
  107. materialName: this.materialName,
  108. num: this.num,
  109. seqNo: this.seqNo,
  110. spec: this.spec,
  111. materialNo: this.materialNo
  112. }),
  113. alignment: DialogAlignment.Bottom,
  114. gridCount: 4,
  115. customStyle: true,
  116. })
  117. locationRequest = async (): Promise<StationInfoModel> => {
  118. let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
  119. stanCode: CommonConstants.STATION_CODE
  120. } as RequestParamModel)
  121. this.recentlyRecordObject = res
  122. this.materialGridStatus = 0
  123. if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
  124. this.materialGridStatus = 1
  125. this.BoxWeight = Number(this.recentlyRecordObject.weight)
  126. this.recentlyRecordObject.weight = this.recentlyRecordObject.weight + 'Kg'
  127. }
  128. // 有数据 {"code":200,"message":"ok","data":{"RFID":"2024080613602207","UID":"992fa202530104e0","errCode":"0","ts":"1722568500"}}
  129. // 无数据 {"code":200,"message":"ok","data":{"RFID":"","UID":"0000000000000000","errCode":"0","ts":"1722568502"}}
  130. return this.recentlyRecordObject
  131. }
  132. //后端入库操作
  133. Warehousing = async (): Promise<MaterialInformationModel[]> => {
  134. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
  135. houseNo: '1',
  136. stanCode: CommonConstants.STATION_CODE,
  137. vehicleCode: this.recentlyRecordObject.rfid,
  138. detailsList: this.boxMaterials
  139. } as RequestParamModel)
  140. console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
  141. promptAction.showToast({
  142. message: '请求成功,业务处理中。。。',
  143. duration: 2000,
  144. bottom: 150
  145. });
  146. this.boxMaterials = []
  147. return res
  148. }
  149. //硬件请求入库操作
  150. warehousingHttp = async (): Promise<MaterialInformationModel> => {
  151. let res: MaterialInformationModel = await StorageRequest.post("/api/v1/wcs/stockin", {
  152. boxNo: this.recentlyRecordObject.rfid,
  153. position: CommonConstants.STATION_CODE,
  154. mtype: this.vehicleLevel
  155. } as RequestParamModel)
  156. console.log('testTag1', '----------' + JSON.stringify(res));
  157. return res
  158. }
  159. //查询取出料箱里面的物料信息
  160. boxMaterialHttp = async (): Promise<MaterialInformationModel[]> => {
  161. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/list", {
  162. //读取RFId的料箱编码,要根据硬件读到的改
  163. vehicleCode: this.materialNo
  164. } as RequestParamModel)
  165. console.log('testTag', 'aaaaaaaa2' + JSON.stringify(res));
  166. this.MaterialInformation = res
  167. return res
  168. }
  169. callEmptyBoxFun = async () => {
  170. this.emptyBox = 1 //表明正在取的进度
  171. let res: EmptyBoxInfoModel = await StorageRequest.post("/api/v1/stock/queryEmptyBox")
  172. console.log("QQQ", JSON.stringify(res), res?.vehicleNo)
  173. let outRes: outBoxClass = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
  174. stanCode: CommonConstants.STATION_CODE,
  175. vehicleNo: res!.vehicleNo,
  176. houseNo: res!.houseNo
  177. } as RequestParamModel)
  178. promptAction.showToast({
  179. message: "箱子正在运行中....",
  180. duration: 1800,
  181. bottom: '50%'
  182. })
  183. console.log("QQQ", JSON.stringify(outRes), outRes?.orderId)
  184. }
  185. // 获取二楼绑定料箱信息
  186. getUpstairsData = async () => {
  187. // 如果没有rfid就不调用
  188. if (!this.recentlyRecordObject.rfid) {
  189. return
  190. }
  191. let res: MaterialInformationModel = await StorageRequest.get(`/web/wcs/bindInfo/${this.recentlyRecordObject.rfid}` as MaterialInformationModel)
  192. // TODO
  193. // let obj: MaterialInformationModel = JSON.parse(JSON.stringify(res))
  194. //将返回的数据解析后,如果数组不为空 就赋值到下面的数组里面
  195. // this.MaterialInformation = []
  196. }
  197. // 清空的按钮调用这个方法
  198. clearData = () => {
  199. this.MaterialInformation = []
  200. }
  201. //打开页面0.5s请求一次硬件,当io(有无料箱)和weight(重量)发送变化时执行改变数据,同时通过RFID请求读取料箱里面物料信息
  202. async aboutToAppear() {
  203. this.currentTimer = setInterval(async () => {
  204. this.locationRequest()
  205. }, 1000);
  206. }
  207. aboutToDisappear(): void {
  208. clearInterval(this.currentTimer)
  209. }
  210. //删除操作
  211. @Builder
  212. itemEnd(index: number) {
  213. Row() {
  214. Button("删除").margin("4vp")
  215. .onClick(() => {
  216. this.MaterialInformation.splice(index, 1)
  217. })
  218. }.padding("4vp").justifyContent(FlexAlign.SpaceEvenly)
  219. }
  220. build() {
  221. Row() {
  222. Column() {
  223. Row() {
  224. Column() {
  225. Stack() {
  226. Image(this.BoxWeight === 0 ? $r('app.media.no_material_box') : this.BoxWeight <= 15 && this.BoxWeight !== 0 ? $r('app.media.normal_box') : $r('app.media.overweight_box'))
  227. .width(px2vp(608))
  228. .height(px2vp(220))
  229. .borderRadius(px2vp(16))
  230. // RFID的信息
  231. Column() {
  232. Text('料箱重量')
  233. .textAlign(TextAlign.End)
  234. .width('48%')
  235. .height('20%')
  236. .fontWeight(FontWeight.Regular)
  237. .fontSize($r('app.float.fontSize_20'))
  238. .fontColor($r('app.color.process_nameplate_grey_color'))
  239. .focusable(true)
  240. .defaultFocus(true)
  241. // Text(this.BoxWeight.toString() + 'Kg')
  242. Text(this.recentlyRecordObject.weight)
  243. .textAlign(TextAlign.End)
  244. .width('48%')
  245. .height('25%')
  246. .fontWeight(FontWeight.Regular)
  247. .fontSize($r('app.float.fontSize_24'))
  248. .fontColor(this.BoxWeight <= 15 ? $r('app.color.black_90') : $r('app.color.brown_100'))
  249. Blank()
  250. Text('料箱ID')
  251. .textAlign(TextAlign.End)
  252. .width('48%')
  253. .height('20%')
  254. .fontWeight(FontWeight.Regular)
  255. .fontSize($r('app.float.fontSize_20'))
  256. .fontColor($r('app.color.process_nameplate_grey_color'))
  257. .focusable(true)
  258. .defaultFocus(false)
  259. Text(this.recentlyRecordObject.rfid)
  260. .textAlign(TextAlign.End)
  261. .width('100%')
  262. .height('25%')
  263. .fontWeight(FontWeight.Regular)
  264. .fontSize($r('app.float.fontSize_24'))
  265. .fontColor($r('app.color.black_90'))
  266. }
  267. .width(px2vp(608))
  268. .height(px2vp(220))
  269. .borderRadius(px2vp(16))
  270. .padding({ right: $r('app.float.borderRadius_16') })
  271. .alignItems(HorizontalAlign.End)
  272. }
  273. .width(px2vp(608))
  274. .height(px2vp(220))
  275. // 扫码之后在左边rfid下面的列表
  276. Column() {
  277. List() {
  278. ForEach(this.boxMaterials, (item: MaterialInformationModel, index: number) => {
  279. ListItem() {
  280. Row() {
  281. Column() {
  282. Column() {
  283. Row().height('23%')
  284. Text(item.materialName)
  285. .fontSize($r('app.float.fontSize_24'))
  286. .fontColor($r('app.color.general_font_color'))
  287. .fontWeight(FontWeight.Medium)
  288. .opacity($r('app.float.general_font_opacity'))
  289. Text(item.spec)
  290. .fontSize($r('app.float.fontSize_20'))
  291. .fontColor($r('app.color.process_nameplate_grey_color'))
  292. .fontWeight(FontWeight.Medium)
  293. }
  294. .height('50%')
  295. .width('90%')
  296. .alignItems(HorizontalAlign.Start)
  297. Column() {
  298. Row() {
  299. Text(item.num?.toString())
  300. .fontSize($r('app.float.fontSize_38'))
  301. .fontColor($r('app.color.general_font_color'))
  302. .fontWeight(FontWeight.Bold)
  303. Text(item.unitDictLabel)
  304. .fontSize($r('app.float.fontSize_20'))
  305. .fontColor($r('app.color.process_nameplate_grey_color'))
  306. .fontWeight(FontWeight.Medium)
  307. .lineHeight(25)
  308. .margin({ left: 2 })
  309. }
  310. .width('90%')
  311. .margin({ top: 5 })
  312. Blank()
  313. Row() {
  314. Image($r('app.media.subscript_space'))
  315. .height($r('app.float.card_subscript_new_size'))
  316. .width($r('app.float.card_subscript_new_size'))
  317. }
  318. .alignItems(VerticalAlign.Bottom)
  319. .justifyContent(FlexAlign.End)
  320. .width('100%')
  321. }
  322. .height('50%')
  323. .width('100%')
  324. }
  325. .width('100%')
  326. .borderRadius($r('app.float.general_border_radius'))
  327. .alignItems(HorizontalAlign.Center)
  328. .justifyContent(FlexAlign.Center)
  329. .height('100%')
  330. }
  331. .borderRadius(10)
  332. .height('30%')
  333. .onClick(() => {
  334. })
  335. .margin({ top: 3 })
  336. .backgroundColor(this.onclick === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  337. }
  338. })
  339. }
  340. .width(px2vp(608))
  341. .height(px2vp(540))
  342. .margin({ bottom: px2vp(20), top: px2vp(20) })
  343. }
  344. .width(px2vp(608))
  345. .height(px2vp(450))
  346. .borderRadius($r('app.float.borderRadius_16'))
  347. }
  348. .width(px2vp(608))
  349. .height(px2vp(800))
  350. .borderRadius($r('app.float.borderRadius_16'))
  351. // ================= 中间一列扫码
  352. Column() {
  353. // Blank()
  354. Row() {
  355. Image($r('app.media.shaoma'))
  356. .width(px2vp(32))
  357. .height(px2vp(32))
  358. Row() {
  359. TextInput({ text: this.scanCodeValue,
  360. placeholder: '请点击扫码或者输入物料编码',
  361. controller: this.textController })
  362. .width('92%')
  363. .placeholderFont({ size: $r('app.float.fontSize_24') })
  364. .height('100%')
  365. .defaultFocus(false)
  366. .fontWeight(FontWeight.Medium)
  367. .fontSize($r('app.float.fontSize_24'))
  368. .backgroundColor("#ffff")
  369. .borderRadius(21)
  370. .defaultFocus(false)
  371. .onSubmit(() => {
  372. this.materialBox = 1
  373. this.ScanStorageCode(this.scanCodeValue)
  374. })
  375. .onChange((value: string) => {
  376. this.scanCodeValue = value
  377. })
  378. }.width('80%')
  379. .padding({ left: 10 })
  380. Image($r('app.media.search'))
  381. .width(px2vp(32))
  382. .height(px2vp(32))
  383. .onClick(async () => {
  384. this.materialBox = 1
  385. this.ScanStorageCode(this.scanCodeValue)
  386. })
  387. }
  388. .border({ width: 0.1 })
  389. .borderRadius(40)
  390. .width(px2vp(608))
  391. .height(px2vp(80))
  392. .backgroundColor('#fff')
  393. .justifyContent(FlexAlign.Center)
  394. Column() {
  395. List() {
  396. ForEach(this.MaterialInformation, (item: MaterialInformationModel, index: number) => {
  397. // ForEach(this.exchange,(exchangeItem:exchangeClass,exchangeIndex:number)=>{
  398. ListItem() {
  399. Row() {
  400. Column() {
  401. Text(item.materialName)
  402. .fontWeight(FontWeight.Medium)// Text(item.materialCode)
  403. .fontSize($r('app.float.fontSize_24'))
  404. Text(item.spec)
  405. .fontColor("#666666")
  406. .fontWeight(FontWeight.Regular)
  407. .fontSize($r('app.float.fontSize_20'))
  408. Text(item.type)
  409. .fontColor("#666666")
  410. .fontWeight(FontWeight.Regular)
  411. .fontSize($r('app.float.fontSize_20'))
  412. Row() {
  413. Text(item.num?.toString())
  414. .fontWeight(FontWeight.Bold)
  415. .fontSize($r('app.float.fontSize_38'))
  416. Text(item.unitDictLabel)
  417. .fontColor("#666666")
  418. .fontWeight(FontWeight.Medium)
  419. .fontSize($r('app.float.fontSize_24'))
  420. }
  421. }
  422. .width('70%')
  423. .padding({ left: px2vp(30) })
  424. .borderRadius(10)
  425. .alignItems(HorizontalAlign.Start)
  426. .justifyContent(FlexAlign.Center)
  427. .height('100%')
  428. .backgroundColor('#fff')
  429. if (item.exchangeNumber !== undefined) {
  430. Row() {
  431. Image((item.exchangeNumber!) >= 0 ? $r('app.media.plus') : $r('app.media.reduce'))
  432. .width(px2vp(30))
  433. .height((item.exchangeNumber!) >= 0 ? px2vp(30) : px2vp(8))
  434. Text((item.exchangeNumber!) >= 0 ? item.exchangeNumber?.toString() : (-(item.exchangeNumber!))?.toString())// .backgroundColor(item.exchangeNumber>0?$r('app.color.green_100'):item?.exchangeNumber===0?'':$r('app.color.brown_100'))
  435. .fontSize($r('app.float.fontSize_38'))
  436. .fontWeight(FontWeight.Bold)
  437. .fontColor((item.exchangeNumber!) >= 0 ? $r('app.color.green_100') : $r('app.color.brown_100'))
  438. }.width('20%')
  439. .justifyContent(FlexAlign.Center)
  440. .alignItems(VerticalAlign.Center)
  441. .height('100%')
  442. } else {
  443. Column() {
  444. }.width('20%')
  445. .justifyContent(FlexAlign.Center)
  446. .alignItems(HorizontalAlign.Center)
  447. .height('100%')
  448. }
  449. Column() {
  450. Image($r('app.media.subscript_space'))
  451. .width($r('app.float.storage_set_image_effect_height'))
  452. .height($r('app.float.storage_set_image_effect_height'))
  453. }.width('10%')
  454. .justifyContent(FlexAlign.End)
  455. .alignItems(HorizontalAlign.End)
  456. .height('100%')
  457. }
  458. .width(px2vp(608))
  459. .height(px2vp(210))
  460. .borderRadius($r('app.float.borderRadius_16'))
  461. .backgroundColor('#fff')
  462. .onClick(() => {
  463. // this.exchangeIndex=exchangeIndex!
  464. this.index = index
  465. this.batchCode = item.batchCode!
  466. this.materialName = item.materialName!
  467. this.materialNo = item.materialCode!
  468. this.num = item.num!
  469. this.seqNo = item.seqNo!
  470. this.spec = item.spec!
  471. //if (item.exchangeNumber===null){
  472. // this.MaterialInformation[index].exchangeNumber=0
  473. // if (this.exchangeNumber!==0) {
  474. // this.MaterialInformation[index]= {
  475. // taskId: this.MaterialInformation[index].taskId,
  476. // materialName: this.MaterialInformation[index].materialName,
  477. // exchangeNumber:0,
  478. // num:this.MaterialInformation[index].num,
  479. // materialNo: this.MaterialInformation[index].materialNo,
  480. // batchCode: this.MaterialInformation[index].batchCode,
  481. // seqNo: this.MaterialInformation[index].seqNo,
  482. // spec: this.MaterialInformation[index].spec,
  483. // }
  484. // }
  485. // }else if (item.exchangeNumber!==0){
  486. // item.exchangeNumber=0
  487. // }
  488. // this.exchangeNumber=item.exchangeNumber!
  489. // this.scanStorageList[index]= {
  490. // taskId: item.taskId!,
  491. // materialName: item.materialName!,
  492. // num: item.num!,
  493. // exchangeNumber:this.exchangeNumber!,
  494. // materialNo: item.materialNo!,
  495. // batchCode: item.batchCode!,
  496. // seqNo: item.seqNo!,
  497. // spec: item.spec!,
  498. // }
  499. this.materialDetailsController.open()
  500. })
  501. }
  502. .swipeAction({ end: this.itemEnd(index) })
  503. .margin({ right: px2vp(12), top: px2vp(10) })
  504. // })
  505. })
  506. }
  507. // .lanes(2)
  508. .onScrollIndex((first: number) => {
  509. console.info(first.toString())
  510. })
  511. .width('100%')
  512. .height('100%')
  513. }.width(px2vp(610))
  514. .height(px2vp(640))
  515. .margin({ right: px2vp(24), bottom: px2vp(8), top: px2vp(8) })
  516. }.width(px2vp(610))
  517. .height(px2vp(800))
  518. .alignItems(HorizontalAlign.Start)
  519. .margin({ left: $r('app.float.Margins_24') })
  520. }.width(px2vp(1260))
  521. .height(px2vp(800))
  522. Column() {
  523. if (this.MaterialInformation.length === 0) {
  524. Button('绑定料箱')
  525. .fontSize($r('app.float.fontSize_24'))
  526. .fontColor($r('app.color.general_font_white_color'))
  527. .width(px2vp(608))
  528. .height(px2vp(80))
  529. .backgroundColor($r('app.color.blue_20'))
  530. } else {
  531. Button('绑定料箱')
  532. .fontSize($r('app.float.fontSize_24'))
  533. .fontColor($r('app.color.general_font_white_color'))
  534. .width(px2vp(608))
  535. .height(px2vp(80))
  536. .backgroundColor($r('app.color.blue_100'))
  537. .onClick(() => {
  538. // 把中间的数据push到左边的数组,如果xx一样就数量相加
  539. let toPushArray: MaterialInformationModel[] = [...this.boxMaterials]
  540. this.MaterialInformation.forEach((middleBox) => {
  541. let has = false
  542. for (let i = 0; i < toPushArray.length; i++) {
  543. let box = toPushArray[i]
  544. if (middleBox.materialCode == box.materialCode) {
  545. let number = middleBox.num! + box.num!
  546. box.num = number
  547. has = true
  548. }
  549. }
  550. if (!has) {
  551. toPushArray.push(JSON.parse(JSON.stringify(middleBox)))
  552. }
  553. })
  554. this.boxMaterials = [...toPushArray]
  555. this.MaterialInformation = []
  556. })
  557. }
  558. }.width(px2vp(1260))
  559. .height(px2vp(100))
  560. .justifyContent(FlexAlign.Center)
  561. }.width(px2vp(1260))
  562. .height(px2vp(900))
  563. Column() {
  564. Stack() {
  565. Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
  566. (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
  567. .width(px2vp(608))
  568. .height('100%')
  569. .borderRadius($r('app.float.borderRadius_16'))
  570. Column() {
  571. Text('抽屉状态')
  572. .textAlign(TextAlign.End)
  573. .width('48%')
  574. .height('20%')
  575. .fontWeight(FontWeight.Regular)
  576. .fontSize($r('app.float.fontSize_20'))
  577. .fontColor($r('app.color.process_nameplate_grey_color'))
  578. Text(this.recentlyRecordObject.lockStr)
  579. .textAlign(TextAlign.End)
  580. .width('48%')
  581. .height('25%')
  582. .fontWeight(FontWeight.Regular)
  583. .fontSize($r('app.float.fontSize_24'))
  584. .fontColor($r('app.color.black_90'))
  585. Blank()
  586. Text('料箱ID')
  587. .textAlign(TextAlign.End)
  588. .width('48%')
  589. .height('20%')
  590. .fontWeight(FontWeight.Regular)
  591. .fontSize($r('app.float.fontSize_20'))
  592. .fontColor($r('app.color.process_nameplate_grey_color'))
  593. Text(this.recentlyRecordObject.rfid)
  594. .textAlign(TextAlign.End)
  595. .width('100%')
  596. .height('25%')
  597. .fontWeight(FontWeight.Regular)
  598. .fontSize($r('app.float.fontSize_24'))
  599. .fontColor($r('app.color.black_90'))
  600. }
  601. .width('100%')
  602. .height('100%')
  603. .padding({ right: $r('app.float.borderRadius_16') })
  604. .alignItems(HorizontalAlign.End)
  605. .borderRadius($r('app.float.borderRadius_16'))
  606. }.width(px2vp(608))
  607. .height('30%')
  608. .borderRadius($r('app.float.borderRadius_16'))
  609. Button(this.materialGridStatus === 1 ? '入库' : '取空箱')
  610. .fontSize($r('app.float.fontSize_24'))
  611. .fontColor($r('app.color.general_font_white_color'))
  612. .width('100%')
  613. .height('10%')
  614. .margin({ top: $r('app.float.topMargins_20') })
  615. .backgroundColor(this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.color.green_100') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 1 ? $r('app.color.Green_20') :
  616. (this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.color.blue_100') : $r('app.color.blue_20'))))
  617. .onClick(() => {
  618. if (this.materialGridStatus === 0) {
  619. this.callEmptyBoxFun()
  620. }
  621. if (this.materialGridStatus === 1) {
  622. this.Warehousing()
  623. }
  624. })
  625. // if (this.emptyBox === 1) {
  626. //
  627. // Column() {
  628. // Text('正在取空箱,当前进度1/' + this.callBoxNum + '...')
  629. // .textAlign(TextAlign.Center)
  630. // .borderRadius(px2vp(16))
  631. // .width('100%')
  632. // .height('25%')
  633. // .fontWeight(FontWeight.Bold)
  634. // .fontSize($r('app.float.fontSize_24'))
  635. // .fontColor($r('app.color.black_90'))
  636. // Text(this.materialGridStatus === 1 ? '请取出料箱' : this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? '请将料格推入' : '')
  637. // .textAlign(TextAlign.Center)
  638. // .borderRadius(px2vp(16))
  639. // .width('100%')
  640. // .height('25%')
  641. // .fontWeight(FontWeight.Bold)
  642. // .fontSize($r('app.float.fontSize_24'))
  643. // .fontColor($r('app.color.black_90'))
  644. //
  645. // }
  646. // .width('100%')
  647. // .height('60%')
  648. // .justifyContent(FlexAlign.Center)
  649. //
  650. // }
  651. }.width(px2vp(608))
  652. .height('100%')
  653. .focusable(true)
  654. .defaultFocus(false)
  655. }
  656. .width('100%')
  657. .height('92%')
  658. .padding({
  659. left: px2vp(24),
  660. right: px2vp(24),
  661. top: $r('app.float.fontSize_20'),
  662. bottom: $r('app.float.fontSize_20')
  663. })
  664. .focusable(true)
  665. .defaultFocus(false)
  666. }
  667. }
  668. @CustomDialog
  669. ///无批次号物料详情弹窗
  670. struct materialDetails {
  671. @Link exchangeNumber: number
  672. @Link index: number
  673. @Link batchCode: string
  674. @Link materialName: string
  675. @Link num: number
  676. @Link seqNo: string
  677. @Link spec: string
  678. @Link materialNo: string
  679. @Link private MaterialInformation: Array<MaterialInformationModel>
  680. scroller: Scroller = new Scroller()
  681. @State navigation: number = 0
  682. controller: CustomDialogController
  683. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  684. build() {
  685. Column() {
  686. Column() {
  687. }.width('100%')
  688. .height('20%')
  689. .onClick(() => {
  690. this.exchangeNumber = 0
  691. this.controller.close()
  692. })
  693. Row() {
  694. Row() {
  695. }.width('25%')
  696. .height('100%')
  697. .onClick(() => {
  698. this.exchangeNumber = 0
  699. this.controller.close()
  700. })
  701. Column({ space: 20 }) {
  702. Text('物料详情')
  703. .textAlign(TextAlign.Center)
  704. .width('100%')
  705. .height('20%')
  706. .fontSize('51px')
  707. .focusable(true)
  708. .defaultFocus(true)
  709. Column({ space: 10 }) {
  710. Text(this.materialName)
  711. .fontSize('32px')
  712. .width('100%')
  713. Text('物料编码:' + this.materialNo)
  714. .fontSize($r('app.float.robot_state_font_size'))
  715. .textAlign(TextAlign.Start)
  716. .fontColor('#99000000')
  717. .width('100%')
  718. Text('规格描述' + this.spec)
  719. .fontSize($r('app.float.robot_state_font_size'))
  720. .textAlign(TextAlign.Start)
  721. .fontColor('#99000000')
  722. .width('100%')
  723. Text('批次号:' + this.batchCode)
  724. .fontSize($r('app.float.robot_state_font_size'))
  725. .textAlign(TextAlign.Start)
  726. .fontColor('#99000000')
  727. .width('100%')
  728. .textOverflow({ overflow: TextOverflow.Ellipsis })
  729. }.width('80%')
  730. .height('30%')
  731. Divider().vertical(false)
  732. .width('60%')
  733. Column() {
  734. // Text('录入数量')
  735. // .fontSize($r('app.float.robot_state_font_size'))
  736. // .textAlign(TextAlign.Start)
  737. // .fontColor('#99000000')
  738. // .width('40%')
  739. Row() {
  740. Image($r('app.media.subtract_disabled'))
  741. .width(px2vp(120))
  742. .height(px2vp(120))
  743. .border({ width: 0.8 })
  744. .borderRadius({ topLeft: px2vp(16), bottomLeft: px2vp(16) })
  745. .onClick(() => {
  746. this.num--
  747. this.exchangeNumber--
  748. this.MaterialInformation[this.index] = {
  749. taskId: this.MaterialInformation[this.index].taskId,
  750. materialName: this.MaterialInformation[this.index].materialName,
  751. // exchangeNumber:this.MaterialInformation[this.index].exchangeNumber,
  752. exchangeNumber: this.exchangeNumber,
  753. num: this.num,
  754. materialCode: this.MaterialInformation[this.index].materialCode,
  755. batchCode: this.MaterialInformation[this.index].batchCode,
  756. seqNo: this.MaterialInformation[this.index].seqNo,
  757. spec: this.MaterialInformation[this.index].spec,
  758. }
  759. })
  760. TextInput({ text: this.num?.toString() })
  761. .fontSize($r('app.float.title_font_size'))
  762. .fontWeight(FontWeight.Bold)
  763. .fontColor($r('app.color.general_font_color'))// .opacity($r('app.float.general_font_opacity'))
  764. .height('85%')
  765. .width('60%')
  766. .type(InputType.Number)
  767. .textAlign(TextAlign.Center)
  768. .backgroundColor($r('app.color.general_card_background_color'))
  769. .borderRadius(0)
  770. .border({ width: 0.8 })
  771. .onChange(() => {
  772. this.MaterialInformation[this.index] = {
  773. taskId: this.MaterialInformation[this.index].taskId!,
  774. materialName: this.MaterialInformation[this.index].materialName!,
  775. // exchangeNumber:this.MaterialInformation[this.index].exchangeNumber!,
  776. exchangeNumber: this.exchangeNumber,
  777. num: this.num,
  778. materialCode: this.MaterialInformation[this.index].materialCode!,
  779. batchCode: this.MaterialInformation[this.index].batchCode!,
  780. seqNo: this.MaterialInformation[this.index].seqNo!,
  781. spec: this.MaterialInformation[this.index].spec!,
  782. }
  783. })
  784. Image($r('app.media.add_disabled'))
  785. .width(px2vp(120))
  786. .height(px2vp(120))
  787. .border({ width: 0.8 })
  788. .borderRadius({ topRight: px2vp(16), bottomRight: px2vp(16) })
  789. .onClick(() => {
  790. this.exchangeNumber++
  791. this.num++
  792. this.MaterialInformation[this.index] = {
  793. taskId: this.MaterialInformation[this.index].taskId,
  794. materialName: this.MaterialInformation[this.index].materialName,
  795. //exchangeNumber:this.MaterialInformation[this.index].exchangeNumber,
  796. exchangeNumber: this.exchangeNumber,
  797. num: this.num,
  798. materialCode: this.MaterialInformation[this.index].materialCode,
  799. batchCode: this.MaterialInformation[this.index].batchCode,
  800. seqNo: this.MaterialInformation[this.index].seqNo,
  801. spec: this.MaterialInformation[this.index].spec,
  802. }
  803. // this.exchange[this.exchangeIndex]={
  804. // exchangeNumber:this.exchange[this.exchangeIndex].exchangeNumber
  805. // }
  806. })
  807. }
  808. .width('60%')
  809. .height('20%')
  810. }
  811. }.width('50%')
  812. .height('100%')
  813. .backgroundColor('#F1F3F5')
  814. .borderRadius(20)
  815. Row() {
  816. }.width('25%')
  817. .height('100%')
  818. .onClick(() => {
  819. this.exchangeNumber = 0
  820. this.controller.close()
  821. })
  822. }.width('100%')
  823. .height('60%')
  824. Column() {
  825. }.width('100%')
  826. .height('20%')
  827. .onClick(() => {
  828. this.controller.close()
  829. })
  830. }
  831. .width('100%')
  832. .backgroundColor('#4d000000')
  833. .height('100%')
  834. .justifyContent(FlexAlign.Center)
  835. .focusable(true)
  836. .defaultFocus(false)
  837. // dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
  838. }
  839. }
  840. //RFID读取失败弹窗
  841. @CustomDialog
  842. struct RfidCar {
  843. controller: CustomDialogController
  844. build() {
  845. Column() {
  846. Text('RFID读取失败')
  847. .fontWeight(FontWeight.Medium)
  848. .fontSize($r('app.float.fontSize_50'))
  849. Blank()
  850. Text('请检查RFID读卡器或料箱底部识别卡片是否正常!')
  851. .fontWeight(FontWeight.Medium)
  852. .fontSize($r('app.float.fontSize_38'))
  853. Blank()
  854. Button('取消', { type: ButtonType.Normal, stateEffect: true })
  855. .width(px2vp(252))
  856. .height(px2vp(70))
  857. .borderRadius(px2vp(75))
  858. .fontSize($r('app.float.fontSize_20'))
  859. .onClick(() => {
  860. this.controller.close()
  861. })
  862. }
  863. .width(px2vp(924))
  864. .height(px2vp(536))
  865. .padding({ top: px2vp(60), bottom: px2vp(60) })
  866. .borderRadius($r('app.float.borderRadius_16'))
  867. .backgroundColor($r('app.color.white_100'))
  868. }
  869. }
  870. // 自定义键盘
  871. @Builder
  872. function CustomKeyboardBuilderEmpty() {
  873. Column() {
  874. }
  875. .width(0)
  876. .height(0)
  877. }