ManualOutbound.ets 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028
  1. import EquipmentRequest from '../common/util/request/EquipmentRequest'
  2. import StorageRequest from '../common/util/request/StorageRequest'
  3. import { Materialpositionclass, StorageStatusList, testPost } from '../common/util/request/StorageRequestInstance'
  4. import { boxMaterialClass, outboundClass, outBoxClass, stat3 } from './CompleteSet'
  5. import RequestParamModel from '../viewmodel/RequestParamModel'
  6. import promptAction from '@ohos.promptAction'
  7. import CommonConstants from '../common/constants/CommonConstants'
  8. import { stat2 } from './ManualWarehousing'
  9. import { MaterialInformationModel } from '../model/MaterialInformation'
  10. import { StationInfoModel } from '../model/StorageSpace'
  11. import { SureToDoDialog } from '../common/component/SureToDoDialog'
  12. @Entry
  13. @Component
  14. export struct ManualOutbound {
  15. //取出料箱
  16. @State @Watch('outBoxChanged') private outBox: outBoxClass = {}
  17. @State private outboundMaterials: Array<MaterialInformationModel> = []
  18. //物料位置
  19. @State private Materialposition: Array<Materialpositionclass> = []
  20. //物料信息表
  21. @State private materialList: Array<MaterialInformationModel> = []
  22. // 料箱位置的查看详情数据
  23. @State private positionInfoList: Array<MaterialInformationModel> = []
  24. //物料编码
  25. @State materialCode: string = ''
  26. //料箱编号
  27. @State vehicleNo: string = ''
  28. // 左侧扫描的值
  29. @State scanCodeValue: string = ""
  30. //1:抽屉在料格内 2:抽屉在料格外
  31. @State drawerPositionStatus: number = 1
  32. //出库口料格状态(1:有料箱 0:无料箱)
  33. @State materialGridStatus: number = 0
  34. //点击颜色
  35. @State onclick: number = -1
  36. @State materialName: string = ''
  37. scroller: Scroller = new Scroller()
  38. //料箱等级(类型)
  39. @State vehicleLevel: string = ''
  40. //料箱编码
  41. @State materiaNo: string = ''
  42. //取料箱中物料信息
  43. @State private boxMaterials: Array<MaterialInformationModel> = []
  44. // 打开物料位置弹窗之后的操作
  45. currentBoxStationModel: Materialpositionclass = {}
  46. goingToLookDetail = async (m: Materialpositionclass) => {
  47. this.currentBoxStationModel = m
  48. this.positionInfoList = m?.materials ?? []
  49. this.infoListController.open()
  50. }
  51. goingToOut = (m: Materialpositionclass) => {
  52. this.currentBoxStationModel = m
  53. this.infoDialogController.open()
  54. }
  55. dialogCancel = () => {
  56. this.currentBoxStationModel = {}
  57. this.infoDialogController.close()
  58. this.infoListController.close()
  59. }
  60. dialogSure = async () => {
  61. let res: outBoxClass = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
  62. houseNo: this.currentBoxStationModel?.houseNo ?? "",
  63. vehicleNo: this.currentBoxStationModel?.vehicleNo ?? this.currentBoxStationModel.vehicleCode ?? "",
  64. stanCode: CommonConstants.STATION_CODE
  65. } as RequestParamModel)
  66. this.outBox = res
  67. promptAction.showToast({
  68. message: "任务进行中,请等待....",
  69. duration: 1800,
  70. bottom: '50%'
  71. })
  72. this.infoDialogController.close()
  73. this.materialLocationController.close()
  74. }
  75. infoDialogController: CustomDialogController = new CustomDialogController({
  76. builder: SureToDoDialog(
  77. {
  78. cancel: this.dialogCancel,
  79. confirm: this.dialogSure,
  80. title: "出库确认",
  81. info: '确认出库当前料箱吗?'
  82. }
  83. ),
  84. alignment: DialogAlignment.Center,
  85. customStyle: true,
  86. autoCancel: false,
  87. })
  88. infoListController: CustomDialogController = new CustomDialogController({
  89. builder: LocationInfoListDialog(
  90. {
  91. closeDialog: this.dialogCancel,
  92. materials: this.positionInfoList
  93. }
  94. ),
  95. alignment: DialogAlignment.Center,
  96. customStyle: true,
  97. autoCancel: false,
  98. })
  99. //物料位置
  100. materialLocationController: CustomDialogController = new CustomDialogController({
  101. builder: MaterialLocationDialog({
  102. outBox: this.outBox,
  103. materialName: this.materialName,
  104. Materialposition: this.Materialposition,
  105. boxMaterials: this.boxMaterials,
  106. lookDetail: this.goingToLookDetail,
  107. goToOut: this.goingToOut,
  108. }),
  109. alignment: DialogAlignment.Center,
  110. customStyle: true,
  111. autoCancel: false,
  112. })
  113. //请求物料位置
  114. MaterialpositionHttp = async (item: MaterialInformationModel) => {
  115. let res: Materialpositionclass[] = await StorageRequest.post("/api/v1/stock/groupList", {
  116. materialNo: item.materialNo,
  117. materialCode: item.materialCode,
  118. } as RequestParamModel)
  119. this.Materialposition = res
  120. }
  121. //回库操作
  122. Warehousing = async () => {
  123. let res: boxMaterialClass[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
  124. houseNo: '1',
  125. vehicleCode: this.recentlyRecordObject.rfid,
  126. detailsList: this.boxMaterials
  127. } as RequestParamModel)
  128. promptAction.showToast({
  129. message: "正在回库中...",
  130. bottom: '50%'
  131. })
  132. this.boxMaterials = []
  133. }
  134. //硬件出库位置
  135. locationRequest = async () => {
  136. let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
  137. stanCode: CommonConstants.STATION_CODE
  138. } as RequestParamModel)
  139. this.recentlyRecordObject = res
  140. // 当有料箱之后,根据出库时候的outBox获取物料信息列表。
  141. this.materialGridStatus = 0
  142. if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
  143. this.materialGridStatus = 1
  144. clearInterval(this.currentTimer)
  145. // 重新获取左侧库存列表
  146. this.getStoreList()
  147. let result: Record<string, string | MaterialInformationModel[]> = await StorageRequest.post("/api/v1/wms/order/get", {
  148. id: this.outBox.orderId ?? ""
  149. } as RequestParamModel)
  150. console.log("ppp", JSON.stringify(result))
  151. // {"coordinate":"6-6","created":"2024-08-12 11:00:13","creator":"JGtest-32","deptId":"1","detailsList":[{"batchCode":"BMBL00000111108;SL3","coordinate":"","created":"2024-08-12 11:00:12","creator":"admin","deleted":0,"deptId":"0","houseNo":"","id":"58","locationNo":"","materialCode":"","materialName":"测试物料8","materialNo":"","num":3,"orderId":"57","orgId":"0","position":null,"seqNo":"","spec":"","unit":"","unitDictLabel":"","unitDictValue":"","updated":"2024-08-12 11:00:12","updator":"sys","vehicleCode":""}],"houseNo":"1","id":"57","locationNo":"1-6-6","orgId":"1","position":4,"state":4,"taskId":"","taskNo":"","type":2,"updated":"2024-08-12 11:00:13","updator":"sys","vehicleCode":"ZJ-JG025","vehicleId":"25","vehicleName":"晶格箱子25"}
  152. this.boxMaterials = result.detailsList as MaterialInformationModel[]
  153. // 最右侧也进行赋值 深拷贝
  154. this.outboundMaterials = JSON.parse(JSON.stringify(this.boxMaterials))
  155. this.outboundMaterials.forEach((m) => {
  156. m.useNum = m.num
  157. })
  158. }
  159. }
  160. //查询取出的料箱里面的物料信息
  161. boxMaterialHttp = async () => {
  162. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/list", {
  163. vehicleCode: this.recentlyRecordObject.rfid
  164. } as RequestParamModel)
  165. this.boxMaterials = res
  166. }
  167. // 点击左侧库存表之后,弹出物料信息,点击出库后,开始轮询获取中间料箱的信息
  168. currentTimer: number = -1;
  169. @State private recentlyRecordObject: StationInfoModel = {}
  170. // 当点击了出库后
  171. outBoxChanged(): void {
  172. this.currentTimer = setInterval(async () => {
  173. this.locationRequest()
  174. }, 1300);
  175. }
  176. aboutToAppear(): void {
  177. this.getStoreList()
  178. }
  179. aboutToDisappear(): void {
  180. clearInterval(this.currentTimer)
  181. }
  182. //硬件请求回库操作
  183. warehousingHttp = async (): Promise<boxMaterialClass> => {
  184. let res: boxMaterialClass = await StorageRequest.post("/api/v1/wcs/stockin", {
  185. boxNo: this.vehicleNo,
  186. position: "stat3",
  187. mtype: this.vehicleLevel
  188. } as RequestParamModel)
  189. console.log('testTag1', '----------' + JSON.stringify(res));
  190. return res
  191. }
  192. //扫码控制器
  193. textController: TextInputController = new TextInputController()
  194. // 获取左侧库存列表信息
  195. getStoreList = async () => {
  196. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/mergeList", {
  197. houseType: 1,
  198. materialNo: this.scanCodeValue,
  199. } as RequestParamModel)
  200. this.scanCodeValue = ''
  201. console.log('qqqq' + '列表' + JSON.stringify(res))
  202. if (res && res.length > 0) {
  203. this.materialList = res
  204. }
  205. }
  206. //扫码 从中间的列表里面找对应的数据挪过来,
  207. @State rightScanValue: string = ""
  208. getMaterialByCodeFromMiddleList = async (materialCode: string) => {
  209. // 从中间列表里面筛选数据
  210. let obj: MaterialInformationModel = {}
  211. for (let i = 0; i < this.boxMaterials.length; i++) {
  212. let box = this.boxMaterials[i]
  213. if (materialCode == box.materialCode) {
  214. obj = JSON.parse(JSON.stringify(box))
  215. break
  216. }
  217. }
  218. if (obj && obj.materialCode) {
  219. // 扫码完成之后,如果数组中有对应的值,就添加数量否则就push
  220. let toPushArray: MaterialInformationModel[] = [...this.outboundMaterials]
  221. let has = false
  222. for (let i = 0; i < toPushArray.length; i++) {
  223. let box = toPushArray[i]
  224. if (obj.materialCode == box.materialCode) {
  225. box.num = obj.num! //以左边的数据为准
  226. has = true
  227. }
  228. }
  229. if (!has) {
  230. toPushArray.push(JSON.parse(JSON.stringify(obj)))
  231. }
  232. this.outboundMaterials = [...toPushArray]
  233. }
  234. this.rightScanValue = ""
  235. }
  236. // 点击物料出库
  237. @State outEnable: boolean = true
  238. sureToOutFun = () => {
  239. this.outEnable = false
  240. let toChangeArray: MaterialInformationModel[] = [...this.boxMaterials]
  241. this.outboundMaterials.forEach((outM) => {
  242. // 首先将num的值换成useNum的值,是出库的具体数量,但是后端要求的字段是num
  243. let max = outM.num ?? 0
  244. let useNum = outM?.useNum ?? 0
  245. outM.num = useNum <= max ? useNum : max
  246. // 中间列表遍历,将同一个数据的num进行运算
  247. for (let i = 0; i < toChangeArray.length; i++) {
  248. let box = toChangeArray[i]
  249. if (outM.materialCode == box.materialCode) {
  250. let value = box.num! - outM.num!
  251. box.num = value >= 0 ? value : 0
  252. continue
  253. }
  254. }
  255. })
  256. this.boxMaterials = [...toChangeArray]
  257. this.boxMaterials = this.boxMaterials.filter((m) => {
  258. return m.num! > 0
  259. })
  260. this.outEnable = true
  261. this.outboundMaterials = []
  262. }
  263. tooutCancel = () => {
  264. this.toOUTController.close()
  265. }
  266. toOUTController: CustomDialogController = new CustomDialogController({
  267. builder: SureToDoDialog(
  268. {
  269. cancel: this.dialogCancel,
  270. confirm: this.sureToOutFun,
  271. title: "提示",
  272. info: '确认出库吗?'
  273. }
  274. ),
  275. alignment: DialogAlignment.Center,
  276. customStyle: true,
  277. autoCancel: false,
  278. })
  279. build() {
  280. Row({ space: px2vp(24) }) {
  281. Column() {
  282. Row() {
  283. Image($r('app.media.search'))
  284. .width(px2vp(32))
  285. .height(px2vp(32))
  286. .focusable(true)
  287. .defaultFocus(false)
  288. .onClick(async () => {
  289. this.getStoreList()
  290. })
  291. TextInput({ text: this.scanCodeValue,
  292. placeholder: '请扫码物料序号用于筛选',
  293. controller: this.textController })
  294. .width('92%')
  295. .height('100%')
  296. .defaultFocus(false)
  297. .width('80%')
  298. .enableKeyboardOnFocus(false)
  299. .fontWeight(FontWeight.Medium)
  300. .fontSize('32px')
  301. .backgroundColor("#ffff")
  302. .borderRadius(21)
  303. .onSubmit(() => {
  304. this.getStoreList()
  305. })
  306. .onChange((value: string) => {
  307. this.scanCodeValue = value
  308. })
  309. }
  310. .width(px2vp(608))
  311. .height(px2vp(80))
  312. .borderRadius(px2vp(100))
  313. .justifyContent(FlexAlign.Center)
  314. .alignItems(VerticalAlign.Center)
  315. .backgroundColor($r('app.color.process_divider_white_color'))
  316. .margin({ bottom: px2vp(20) })
  317. Column() {
  318. Grid(this.scroller) {
  319. ForEach(this.materialList, (item: MaterialInformationModel, index: number) => {
  320. GridItem() {
  321. Column() {
  322. Column() {
  323. Row().height('23%')
  324. Text(item.materialName ? item.materialName! : '')
  325. .fontSize($r('app.float.fontSize_24'))
  326. .fontColor($r('app.color.general_font_color'))
  327. .fontWeight(FontWeight.Medium)
  328. .opacity($r('app.float.general_font_opacity'))
  329. Text(item.materialNo ? item.materialNo : '')
  330. .fontSize($r('app.float.fontSize_20'))
  331. .fontColor($r('app.color.process_nameplate_grey_color'))
  332. .fontWeight(FontWeight.Medium)
  333. }
  334. .height('50%')
  335. .width('90%')
  336. .alignItems(HorizontalAlign.Start)
  337. Column() {
  338. Row() {
  339. Text(item.num?.toString())
  340. .fontSize($r('app.float.fontSize_38'))
  341. .fontColor($r('app.color.general_font_color'))
  342. .fontWeight(FontWeight.Bold)
  343. Text(item.unit)
  344. .fontSize($r('app.float.fontSize_20'))
  345. .fontColor($r('app.color.process_nameplate_grey_color'))
  346. .fontWeight(FontWeight.Medium)
  347. }
  348. .width('90%')
  349. Blank()
  350. Row() {
  351. Image($r('app.media.subscript_space'))
  352. .height($r('app.float.card_subscript_new_size'))
  353. .width($r('app.float.card_subscript_new_size'))
  354. }
  355. .alignItems(VerticalAlign.Bottom)
  356. .justifyContent(FlexAlign.End)
  357. .width('100%')
  358. }
  359. .height('50%')
  360. .width('100%')
  361. }
  362. .width(px2vp(608))
  363. .height(px2vp(201))
  364. .borderRadius(px2vp(16))
  365. .alignItems(HorizontalAlign.Center)
  366. .justifyContent(FlexAlign.Center)
  367. .backgroundColor(this.onclick === index ? $r('app.color.blue_100') : "#ffff")
  368. .onClick(() => {
  369. this.materialLocationController.open()
  370. this.onclick = index
  371. this.materialName = item.materialName!
  372. this.MaterialpositionHttp(item)
  373. })
  374. }
  375. })
  376. }
  377. .scrollBar(BarState.Off)
  378. .columnsTemplate('1fr')
  379. .rowsGap(px2vp(20))
  380. .width(px2vp(608))
  381. .height(px2vp(770))
  382. }.width(px2vp(608))
  383. .height(px2vp(800))
  384. }.width(px2vp(608))
  385. .height(px2vp(900))
  386. Column({ space: 5 }) {
  387. Stack() {
  388. Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
  389. (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
  390. .width(px2vp(608))
  391. .height(px2vp(220))
  392. .borderRadius(px2vp(16))
  393. Column() {
  394. Text('抽屉状态')
  395. .textAlign(TextAlign.End)
  396. .width('48%')
  397. .height('20%')
  398. .fontWeight(FontWeight.Regular)
  399. .fontSize($r('app.float.fontSize_20'))
  400. .fontColor($r('app.color.process_nameplate_grey_color'))
  401. Text(this.recentlyRecordObject.lockStr)
  402. .textAlign(TextAlign.End)
  403. .width('48%')
  404. .height('25%')
  405. .fontWeight(FontWeight.Regular)
  406. .fontSize($r('app.float.fontSize_24'))
  407. .fontColor($r('app.color.black_90'))
  408. Blank()
  409. Text('料箱ID')
  410. .textAlign(TextAlign.End)
  411. .width('48%')
  412. .height('20%')
  413. .fontWeight(FontWeight.Regular)
  414. .fontSize($r('app.float.fontSize_20'))
  415. .fontColor($r('app.color.process_nameplate_grey_color'))
  416. Text(this.recentlyRecordObject.rfid ?? "")
  417. .textAlign(TextAlign.End)
  418. .width('100%')
  419. .height('25%')
  420. .fontWeight(FontWeight.Regular)
  421. .fontSize($r('app.float.fontSize_24'))
  422. .fontColor($r('app.color.black_90'))
  423. }
  424. .width(px2vp(608))
  425. .height(px2vp(220))
  426. .borderRadius(px2vp(16))
  427. .padding({ right: $r('app.float.borderRadius_16') })
  428. .alignItems(HorizontalAlign.End)
  429. }
  430. .width(px2vp(608))
  431. .height(px2vp(220))
  432. .borderRadius(px2vp(16))
  433. .margin({ bottom: px2vp(20) })
  434. Button('回库')
  435. .fontSize($r('app.float.fontSize_24'))
  436. .fontColor($r('app.color.general_font_white_color'))
  437. .width(px2vp(608))
  438. .height(px2vp(80))
  439. .margin({ bottom: px2vp(20) })
  440. .backgroundColor(this.materialGridStatus === 1 ? $r('app.color.green_100') : this.materialGridStatus === 0 ? $r('app.color.Green_20') : '')
  441. .onClick(() => {
  442. if (this.materialGridStatus === 1) {
  443. //回库操作
  444. this.Warehousing()
  445. }
  446. })
  447. List({ space: '2%' }) {
  448. ForEach(this.boxMaterials, (item: MaterialInformationModel, index: number) => {
  449. ListItem() {
  450. Row() {
  451. Column() {
  452. Column() {
  453. Row().height('23%')
  454. Text(item.materialName ? item.materialName! : '')
  455. .fontSize($r('app.float.fontSize_24'))
  456. .fontColor($r('app.color.general_font_color'))
  457. .fontWeight(FontWeight.Medium)
  458. .opacity($r('app.float.general_font_opacity'))
  459. Text(item.materialCode ? item.materialCode : '')
  460. .fontSize($r('app.float.fontSize_20'))
  461. .fontColor($r('app.color.process_nameplate_grey_color'))
  462. .fontWeight(FontWeight.Medium)
  463. }
  464. .height('50%')
  465. .width('90%')
  466. .alignItems(HorizontalAlign.Start)
  467. Column() {
  468. Row() {
  469. Text(item.num?.toString())
  470. .fontSize($r('app.float.fontSize_38'))
  471. .fontColor($r('app.color.general_font_color'))
  472. .fontWeight(FontWeight.Bold)
  473. Text(item.unitDictLabel)
  474. .fontSize($r('app.float.fontSize_20'))
  475. .fontColor($r('app.color.process_nameplate_grey_color'))
  476. .fontWeight(FontWeight.Medium)
  477. }
  478. .width('90%')
  479. Blank()
  480. Row() {
  481. Image($r('app.media.subscript_space'))
  482. .height($r('app.float.card_subscript_new_size'))
  483. .width($r('app.float.card_subscript_new_size'))
  484. }
  485. .alignItems(VerticalAlign.Bottom)
  486. .justifyContent(FlexAlign.End)
  487. .width('100%')
  488. }
  489. .height('50%')
  490. .width('100%')
  491. }
  492. .width('100%')
  493. .borderRadius($r('app.float.general_border_radius'))
  494. .alignItems(HorizontalAlign.Center)
  495. .justifyContent(FlexAlign.Center)
  496. .height('100%')
  497. }
  498. .borderRadius(px2vp(16))
  499. .height('30%')
  500. .onClick(() => {
  501. })
  502. .backgroundColor($r('app.color.robot_set_card_white'))
  503. }
  504. })
  505. }
  506. .width(px2vp(608))
  507. .height(px2vp(520))
  508. }
  509. .width(px2vp(608))
  510. .height(px2vp(900))
  511. .borderRadius($r('app.float.borderRadius_16'))
  512. Column() {
  513. Row() {
  514. Image($r('app.media.shaoma'))
  515. .width(px2vp(32))
  516. .height(px2vp(32))
  517. TextInput({ text: this.rightScanValue,
  518. placeholder: '点击扫码添加物料出库',
  519. controller: this.textController })
  520. .width('92%')
  521. .height('100%')
  522. .width('80%')
  523. .fontWeight(FontWeight.Medium)
  524. .fontSize('32px')
  525. .backgroundColor("#ffff")
  526. .borderRadius(21)
  527. .onSubmit(() => {
  528. this.getMaterialByCodeFromMiddleList(this.rightScanValue)
  529. })
  530. .onChange((value: string) => {
  531. this.rightScanValue = value
  532. })
  533. Image($r('app.media.search'))
  534. .width(px2vp(32))
  535. .height(px2vp(32))
  536. .onClick(async () => {
  537. this.getMaterialByCodeFromMiddleList(this.rightScanValue)
  538. })
  539. }
  540. .width(px2vp(608))
  541. .height(px2vp(80))
  542. .borderRadius(px2vp(100))
  543. .justifyContent(FlexAlign.Center)
  544. .alignItems(VerticalAlign.Center)
  545. .backgroundColor($r('app.color.process_divider_white_color'))
  546. .margin({ bottom: px2vp(20) })
  547. List({ space: '2%' }) {
  548. ForEach(this.outboundMaterials, (item: MaterialInformationModel, index: number) => {
  549. ListItem() {
  550. Row() {
  551. Column() {
  552. Column() {
  553. Row().height('23%')
  554. Text(item.materialName + `总数量:${item.num}`)
  555. .fontSize($r('app.float.fontSize_24'))
  556. .fontColor($r('app.color.general_font_color'))
  557. .fontWeight(FontWeight.Medium)
  558. .opacity($r('app.float.general_font_opacity'))
  559. Text(item.materialCode)
  560. .fontSize($r('app.float.fontSize_20'))
  561. .fontColor($r('app.color.process_nameplate_grey_color'))
  562. .fontWeight(FontWeight.Medium)
  563. }
  564. .height('50%')
  565. .width('90%')
  566. .alignItems(HorizontalAlign.Start)
  567. Column() {
  568. Row() {
  569. Text('出库数量:')
  570. .fontSize($r('app.float.fontSize_20'))
  571. .fontColor($r('app.color.process_nameplate_grey_color'))
  572. .fontWeight(FontWeight.Medium)
  573. TextInput({ text: item.num?.toString() })
  574. .fontSize(14)
  575. .fontWeight(FontWeight.Bold)
  576. .fontColor($r('app.color.general_font_color'))// .opacity($r('app.float.general_font_opacity'))
  577. .height('60%')
  578. .width(150)
  579. .type(InputType.Number)
  580. .textAlign(TextAlign.Start)
  581. .backgroundColor($r('app.color.general_card_background_color'))
  582. .borderRadius(0)
  583. .border({ width: 0.4 })
  584. .onChange((value) => {
  585. item.useNum = Number(value) <= item.num! ? Number(value) : item.num!
  586. console.log("iii", JSON.stringify(this.outboundMaterials))
  587. // 这里先不用响应式处理,调接口的时候直接将num的值换成useNum的值就可以了。
  588. // this.outboundMaterials[index] = {
  589. // materialName: item.materialName!,
  590. // num: Number(value),
  591. // materialCode: item.materialCode!,
  592. // batchCode: item.batchCode!,
  593. // seqNo: item.seqNo!,
  594. // spec: item.spec!,
  595. // }
  596. })
  597. Text(item.unitDictLabel)
  598. .fontSize($r('app.float.fontSize_20'))
  599. .fontColor($r('app.color.process_nameplate_grey_color'))
  600. .fontWeight(FontWeight.Medium)
  601. .margin({ left: 5 })
  602. }
  603. .width('90%')
  604. Blank()
  605. Row() {
  606. Image($r('app.media.subscript_space'))
  607. .height($r('app.float.card_subscript_new_size'))
  608. .width($r('app.float.card_subscript_new_size'))
  609. }
  610. .alignItems(VerticalAlign.Bottom)
  611. .justifyContent(FlexAlign.End)
  612. .width('100%')
  613. }
  614. .height('50%')
  615. .width('100%')
  616. }
  617. .width('100%')
  618. .borderRadius($r('app.float.general_border_radius'))
  619. .alignItems(HorizontalAlign.Center)
  620. .justifyContent(FlexAlign.Center)
  621. .height('100%')
  622. }
  623. .borderRadius(10)
  624. .height('30%')
  625. .backgroundColor($r('app.color.robot_set_card_white'))
  626. }
  627. })
  628. }
  629. .width(px2vp(608))
  630. .height(px2vp(670))
  631. .margin({ bottom: px2vp(20) })
  632. if (this.outboundMaterials.length === 0) {
  633. Button('物料出库')
  634. .fontSize($r('app.float.fontSize_24'))
  635. .fontColor($r('app.color.general_font_white_color'))
  636. .width(px2vp(608))
  637. .height(px2vp(80))
  638. .backgroundColor($r('app.color.blue_20'))
  639. } else if (this.outboundMaterials.length > 0) {
  640. Button('物料出库')
  641. .fontSize($r('app.float.fontSize_24'))
  642. .fontColor($r('app.color.general_font_white_color'))
  643. .width(px2vp(608))
  644. .height(px2vp(80))
  645. .backgroundColor($r('app.color.blue_100'))
  646. .enabled(this.outEnable)
  647. .onClick(() => {
  648. this.sureToOutFun()
  649. })
  650. }
  651. }.width(px2vp(608))
  652. .height(px2vp(900))
  653. }.width(px2vp(1920))
  654. .height(px2vp(900))
  655. .padding({ left: px2vp(24), right: px2vp(24) })
  656. }
  657. }
  658. // 物料位置(物料在哪些料箱里面)
  659. @CustomDialog
  660. struct MaterialLocationDialog {
  661. @Link outBox: outBoxClass
  662. @Link boxMaterials: MaterialInformationModel[]
  663. @State selectMaterial: number = -1
  664. @Link Materialposition: Materialpositionclass[]
  665. scroller: Scroller = new Scroller()
  666. @Link materialName: string
  667. @State vehicleNo: string = ''
  668. @State houseNo: string = ''
  669. Controller: CustomDialogController
  670. lookDetail: (m: Materialpositionclass) => void = () => {
  671. }
  672. goToOut: (m: Materialpositionclass) => void = () => {
  673. }
  674. //后端料箱出库
  675. RemoveMaterialBox = async () => {
  676. let res: outBoxClass = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
  677. houseNo: this.houseNo,
  678. vehicleNo: this.vehicleNo,
  679. stanCode: CommonConstants.STATION_CODE
  680. } as RequestParamModel)
  681. this.outBox = res
  682. promptAction.showToast({
  683. message: "任务进行中,请等待....",
  684. duration: 1800,
  685. bottom: '50%'
  686. })
  687. this.Controller?.close()
  688. }
  689. //硬件出库
  690. outboundHttp = async (): Promise<outboundClass> => {
  691. let res: outboundClass = await StorageRequest.post("/api/v1/wcs/stockout", {
  692. boxNo: this.vehicleNo,
  693. position: "stat3"
  694. } as RequestParamModel)
  695. return res
  696. }
  697. build() {
  698. Stack() {
  699. Column() {
  700. }
  701. .width('100%')
  702. .height('100%')
  703. .blur(30)
  704. .backgroundColor('#4d000000')
  705. Column() {
  706. Row() {
  707. Row() {
  708. Image($r('app.media.back_white'))
  709. .width(px2vp(64))
  710. .height(px2vp(64))
  711. .onClick(() => {
  712. this.Controller?.close()
  713. })
  714. }
  715. .width('5%')
  716. .padding({ left: 10 })
  717. Row() {
  718. Text(this.materialName && this.materialName.length > 0 ? this.materialName : '')
  719. .fontSize($r('app.float.fontSize_38'))
  720. .fontWeight(FontWeight.Medium)
  721. .fontColor($r('app.color.process_divider_white_color'))
  722. .width('100%')
  723. .height('100%')
  724. .textAlign(TextAlign.Center)
  725. }
  726. .width('90%')
  727. .justifyContent(FlexAlign.Center)
  728. Row() {
  729. }.width('5%')
  730. }
  731. .width('100%')
  732. .height('15%')
  733. .padding({ top: 8 })
  734. Grid(this.scroller) {
  735. ForEach(this.Materialposition, (item: Materialpositionclass, index: number) => {
  736. GridItem() {
  737. Row() {
  738. Column() {
  739. Text(item.vehicleCode)
  740. .fontSize($r('app.float.fontSize_24'))
  741. .fontWeight(FontWeight.Regular)
  742. .fontColor($r('app.color.black_60'))
  743. .width('100%')
  744. Text("坐标: " + item?.coordinate)
  745. .fontSize($r('app.float.fontSize_24'))
  746. .fontWeight(FontWeight.Regular)
  747. .fontColor($r('app.color.black_90'))
  748. .margin({ right: 15 })
  749. Text("层数: " + item.position)
  750. .fontSize($r('app.float.fontSize_24'))
  751. .fontWeight(FontWeight.Regular)
  752. .fontColor($r('app.color.black_90'))
  753. .margin({ right: 15 })
  754. }
  755. .width('60%')
  756. .alignItems(HorizontalAlign.Start)
  757. .justifyContent(FlexAlign.Center)
  758. .height('100%')
  759. Row() {
  760. Text("详情")
  761. .fontSize($r('app.float.fontSize_24'))
  762. .fontWeight(FontWeight.Regular)
  763. .fontColor($r('app.color.white_100'))
  764. .backgroundColor($r('app.color.blue_100'))
  765. .height(40)
  766. .textAlign(TextAlign.Center)
  767. .borderRadius(10)
  768. .width(60)
  769. .onClick(() => {
  770. this.lookDetail(item)
  771. })
  772. Text("出库")
  773. .fontSize($r('app.float.fontSize_24'))
  774. .fontWeight(FontWeight.Regular)
  775. .fontColor($r('app.color.white_100'))
  776. .margin({ left: 15 })
  777. .backgroundColor($r('app.color.warn_1'))
  778. .height(40)
  779. .textAlign(TextAlign.Center)
  780. .borderRadius(10)
  781. .width(60)
  782. .onClick(() => {
  783. this.goToOut(item)
  784. })
  785. }
  786. .width('40%')
  787. .justifyContent(FlexAlign.End)
  788. .height('100%')
  789. }
  790. .padding(5)
  791. .borderRadius(10)
  792. .height('12%')
  793. .width('100%')
  794. .backgroundColor(this.selectMaterial === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  795. }
  796. .padding({ left: 5 })
  797. })
  798. }
  799. .padding(10)
  800. .columnsTemplate('1fr 1fr 1fr')
  801. .columnsGap(10)
  802. .rowsGap(10)
  803. .width('100%')
  804. .height('85%')
  805. }
  806. .width('100%')
  807. .height('100%')
  808. }
  809. .width('100%')
  810. .height('100%')
  811. }
  812. }
  813. // 物料位置(物料在哪些料箱里面)
  814. @CustomDialog
  815. struct LocationInfoListDialog {
  816. @Link materials: MaterialInformationModel[]
  817. scroller: Scroller = new Scroller()
  818. Controller: CustomDialogController
  819. closeDialog: () => void = () => {
  820. }
  821. build() {
  822. Stack() {
  823. Column() {
  824. Grid(this.scroller) {
  825. ForEach(this.materials, (item: MaterialInformationModel, index: number) => {
  826. GridItem() {
  827. Column() {
  828. Row() {
  829. Text(item?.materialName)
  830. .fontSize($r('app.float.fontSize_24'))
  831. .fontWeight(FontWeight.Regular)
  832. .fontColor($r('app.color.black_90'))
  833. .margin({ right: 15 })
  834. Row() {
  835. Text(item.num?.toString())
  836. .fontSize($r('app.float.fontSize_38'))
  837. .fontWeight(FontWeight.Bold)
  838. .fontColor($r('app.color.black_90'))
  839. Text(item.unit)
  840. .fontSize($r('app.float.fontSize_24'))
  841. .fontWeight(FontWeight.Regular)
  842. .fontColor($r('app.color.black_60'))
  843. }
  844. }
  845. .justifyContent(FlexAlign.SpaceBetween)
  846. .width('100%')
  847. Text(item.materialNo)
  848. .fontSize($r('app.float.fontSize_24'))
  849. .fontWeight(FontWeight.Regular)
  850. .fontColor($r('app.color.black_60'))
  851. .width('100%')
  852. Text(item.spec)
  853. .fontSize($r('app.float.fontSize_24'))
  854. .fontWeight(FontWeight.Regular)
  855. .fontColor($r('app.color.black_60'))
  856. .width('100%')
  857. }
  858. .width('100%')
  859. .alignItems(HorizontalAlign.Start)
  860. .justifyContent(FlexAlign.Center)
  861. .padding({ left: 8, right: 10 })
  862. .height('60')
  863. }
  864. .padding({ left: 5, bottom: 8 })
  865. .borderRadius(5)
  866. .border({ width: 2, color: Color.Gray })
  867. })
  868. }
  869. .padding(10)
  870. .columnsTemplate('1fr')
  871. .columnsGap(10)
  872. .rowsGap(10)
  873. .width('100%')
  874. .height('100%')
  875. }
  876. .width('100%')
  877. .height('100%')
  878. }
  879. .width('60%')
  880. .height('80%')
  881. .backgroundColor($r('app.color.page_general_background'))
  882. .borderRadius(20)
  883. .onClick(() => {
  884. this.closeDialog()
  885. })
  886. }
  887. }
  888. export class outboundMaterialsClass {
  889. //批次号
  890. batchCode?: string;
  891. ///完成数量
  892. completedNum?: number
  893. //已经占用箱数
  894. useNum?: number
  895. //空箱数
  896. emptyBoxNum?: string
  897. //可用箱数
  898. canUsedNum?: string
  899. //总容量箱数
  900. allNum?: number
  901. //仓储类型
  902. type?: string
  903. //批次号
  904. coordinate?: string
  905. //创建时间
  906. created?: string
  907. //
  908. creator?: string
  909. //仓库编码
  910. houseNo?: string
  911. deptId?: string
  912. houseType?: string
  913. //主键
  914. id?: string
  915. locationNo?: string
  916. // 物料名称
  917. materialName?: string
  918. //物料编码
  919. materialNo?: string
  920. //出入库数量
  921. num?: number
  922. orgId?: string
  923. relPlanNo?: string
  924. relOrderNo?: string
  925. relOutOrderNo?: string
  926. progress?: string
  927. planNo?: string
  928. position?: string
  929. // 序列号
  930. seqNo?: string
  931. // 状态;1-待处理;2-处理中;3-处理异常;4-已完成
  932. state?: number
  933. // 库存数量
  934. stockNum?: string
  935. //出入库任务单号
  936. taskNo?: string
  937. unit?: string
  938. updated?: string
  939. //任务名称
  940. taskName?: string
  941. updator?: string
  942. vehicleNo?: string
  943. materialCode?: string
  944. spec?: string
  945. }