1
0

CompleteSet.ets 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801
  1. import EquipmentRequest from '../common/util/request/EquipmentRequest'
  2. import JGRequest from '../common/util/request/Request'
  3. import StorageRequest from '../common/util/request/StorageRequest'
  4. import OrderInfo from '../model/OrderInfo'
  5. import { Materialpositionclass, Tasklist } from './IntelligentWarehousingOutbound'
  6. import MaterialInfo from '../viewmodel/MaterialInfo'
  7. import PageModel from '../viewmodel/PageModel'
  8. import ProcessData from '../viewmodel/ProcessData'
  9. import RequestParamModel from '../viewmodel/RequestParamModel'
  10. import RequestParamModel2 from '../viewmodel/RequestParamModel2'
  11. import { stat2 } from './ManualWarehousing'
  12. import { MaterialInformationModel } from '../model/MaterialInformation'
  13. import promptAction from '@ohos.promptAction'
  14. import CommonConstants from '../common/constants/CommonConstants'
  15. import { StationInfoModel } from '../model/StorageSpace'
  16. export interface stat3 {
  17. statNo?: string
  18. //料箱编号
  19. rfid?: string
  20. //料箱检测的io位,1:有,0:没有
  21. io?: string
  22. //0:无锁定,1:锁定,即机器人正在动作,不能进出库动作
  23. lock?: string
  24. ts?: string
  25. }
  26. @Entry
  27. @Component
  28. export struct CompleteSet {
  29. //任务单id
  30. @State orderId: string = ''
  31. //齐套料箱重量
  32. @State BoxWeight: number = 20
  33. // 暂时的料箱编码
  34. @State vehicleCode: string = ''
  35. //物料名称
  36. @State materialName: string = ''
  37. //工序id
  38. @State operationId: string = ''
  39. //扫描料箱获得料箱编码绑定料箱为齐套料箱
  40. @State boxInfo: BoxInfo = {}
  41. //取料箱中物料信息
  42. @State private boxMaterials: Array<MaterialInformationModel> = []
  43. //取出料箱
  44. @State private outBox: Array<outBoxClass> = []
  45. //物料位置
  46. @State private Mposition: Array<Materialpositionclass> = []
  47. //查询物料存放的所有位置
  48. @State materialPositionArray: Array<Materialpositionclass> = []
  49. //选中取出的物料位置
  50. @State materialPosition: Materialpositionclass = {}
  51. //暂时固定的料箱编码
  52. //todo
  53. @State binCode: string = 'ZJ-JG031'
  54. //点击任务单
  55. @State selectOrder: number = -2
  56. //任务单列表
  57. @State orderArray: OrderInfo[] = [];
  58. //任务单工单单号
  59. @State taskOrderNumber: string = ''
  60. //工单物料切换(1:显示工单列表 2:显示工序下的物料列表)
  61. @State orderMaterialSwitch: number = 1
  62. //任务单id
  63. @State primaryKeyId: string = ''
  64. //齐套料箱状态不可以点击:0,可以点击:1
  65. @State completeSetMaterialState: number = 0
  66. //物料编码
  67. @State materialCode: string = ''
  68. //1:抽屉在料格内 2:抽屉在料格外
  69. @State drawerPositionStatus: number = 1
  70. //出库口料格状态(1:有料箱 0:无料箱)
  71. @State materialGridStatus: number = 0
  72. //是否取空箱子(1:是 2:否)
  73. @State isTakeOutBox: number = 0
  74. // 叫空料箱数量
  75. @State callBoxNum: number = 1
  76. //点击选择任务单变颜色
  77. @State onclick: number = -1
  78. //点击扫描料箱切换成齐套料箱编码
  79. @State clickScan: number = 0
  80. //物料列表
  81. @State materialArray: MaterialInfo[] = []
  82. // 中间输入框绑定的值
  83. @State scanCodeValue: string = ""
  84. //工单分页查询相关参数
  85. private orderPageNo: number = 1
  86. private orderPageSize: number = 10
  87. orderTotalCount?: number = 0
  88. private orderTotalPages: number = 0
  89. //料箱等级(类型)
  90. @State vehicleLevel: string = ''
  91. //料箱编号
  92. @State vehicleNo: string = ''
  93. //工序列表
  94. @State processes: ProcessData[] = [];
  95. @State currentWorkOrderCode: string = ""
  96. // 选择工序
  97. @State selectProcess: ProcessData = {}
  98. // 工序关联物料分页查询相关参数
  99. private pageNo: number = 1
  100. private pageSize: number = 10
  101. totalCount?: number = 0
  102. private totalPages: number = 0
  103. //硬件数据
  104. @State private entranceWaiting: Array<stat3> = []
  105. //左边任务单列表
  106. @State private TasklistoutboundData: Array<Tasklist> = []
  107. //扫码控制器
  108. textController: TextInputController = new TextInputController()
  109. // //硬件出库位置
  110. // locationRequest = async (): Promise<stat3> => {
  111. // let res: stat3 = await EquipmentRequest.get("api/v1/wcs/stat/stat3")
  112. // console.log('testTag1' + '-------------' + JSON.stringify(res))
  113. // return res
  114. // }
  115. // 通过RFID请求读取料箱的信息
  116. rfidTimer: number = -1
  117. @State preRfid: string = "" //记录上一次的rfid,如果变化了 就清空回库下面的列表
  118. @State private recentlyRecordObject: StationInfoModel = {}
  119. rfidInfoIntervalFun = async () => {
  120. let res: StationInfoModel = await StorageRequest.post("api/v1/wms/common/queryStationInfo", {
  121. stanCode: CommonConstants.STATION_CODE
  122. } as RequestParamModel)
  123. this.recentlyRecordObject = res
  124. // 清空回库下面的数组逻辑
  125. if (this.preRfid && this.preRfid != this.recentlyRecordObject.rfid) {
  126. this.boxMaterials = []
  127. }
  128. this.preRfid = this.recentlyRecordObject.rfid ?? ""
  129. // console.log("jjjj", JSON.stringify(this.recentlyRecordObject))
  130. // 是否有料箱逻辑
  131. this.materialGridStatus = 0
  132. if (this.recentlyRecordObject && this.recentlyRecordObject.rfid) {
  133. this.materialGridStatus = 1
  134. this.BoxWeight = Number(res.weight)
  135. this.recentlyRecordObject.weight = this.recentlyRecordObject.weight + 'Kg'
  136. }
  137. }
  138. //扫码请求
  139. @State private MaterialInformation: Array<MaterialInformationModel> = []
  140. ScanStorageCode = async (itemCode: string) => {
  141. this.scanCodeValue = ""
  142. let res: MaterialInformationModel = await StorageRequest.post("/api/v1/process/circulation/material", {
  143. label: itemCode //"#gys022#sc022#100#20220929#31"
  144. } as MaterialInformationModel)
  145. //let res = await StorageRequest.get("/api/v3/stock/selectSafeList/1")
  146. // {"batchCode":"BM47111400130447;SL5","codeType":"BATCH","materialCode":"47111400130447","materialName":"穿心电容","num":5,"spec":"G CT52-4-1-2C1-63V-103-M","unitDictLabel":"个","unitDictValue":"个"}
  147. let obj: MaterialInformationModel = JSON.parse(JSON.stringify(res))
  148. // 扫码完成之后,如果数组中有对应的值,就添加数量否则就push
  149. let toPushArray: MaterialInformationModel[] = [...this.MaterialInformation]
  150. let has = false
  151. for (let i = 0; i < toPushArray.length; i++) {
  152. let box = toPushArray[i]
  153. if (obj.materialCode == box.materialCode) {
  154. let number = obj.num! + box.num!
  155. box.num = number
  156. has = true
  157. }
  158. }
  159. if (!has) {
  160. toPushArray.push(JSON.parse(JSON.stringify(obj)))
  161. }
  162. this.MaterialInformation = [...toPushArray]
  163. }
  164. async aboutToAppear() {
  165. this.rfidTimer = setInterval(() => {
  166. this.rfidInfoIntervalFun()
  167. }, 1500)
  168. // 查询订单数据
  169. let res = await this.queryOrderPage()
  170. if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  171. return
  172. }
  173. this.orderTotalCount = res.totalCount
  174. this.orderTotalPages = res.totalPages
  175. if (res.records) {
  176. this.orderArray = res.records
  177. }
  178. // 设置默认值
  179. if (this.orderArray && this.orderArray.length > 0) {
  180. this.selectOrder = -1
  181. if (this.orderArray[0]?.workOrderCode) {
  182. this.processes = await JGRequest.get('/api/v1/process/vehicleOperation/operation/' + this.orderArray[0]?.workOrderCode, {
  183. }) as ProcessData[]
  184. }
  185. }
  186. }
  187. aboutToDisappear(): void {
  188. clearInterval(this.rfidTimer)
  189. }
  190. // 未齐套订单分页查询
  191. private async queryOrderPage() {
  192. return await JGRequest.post('/api/v1/plan/workOrder/page', {
  193. pageNo: this.orderPageNo,
  194. pageSize: this.orderPageSize,
  195. itemAllotState: '0'
  196. } as RequestParamModel2) as PageModel<OrderInfo>;
  197. }
  198. // 工序物料分页查询
  199. private async queryMaterialPage() {
  200. return await StorageRequest.post('/api/v1/process/vehicleOperation/operationMaterial', {
  201. operationId: this.selectProcess?.operationId!,
  202. pageNo: this.pageNo,
  203. pageSize: this.pageSize,
  204. workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!
  205. } as RequestParamModel2) as PageModel<MaterialInfo>
  206. }
  207. //查询库存信息
  208. async queryStockList(params: RequestParamModel) {
  209. // todo 删除
  210. if (params.materialNo != undefined && params?.materialNo.length > 0) {
  211. params.materialNo = 'BL00000111188'
  212. }
  213. // todo 删除
  214. if (params.vehicleCode != undefined && params?.vehicleCode.length > 0) {
  215. params.vehicleCode = 'ZJ-JG016'
  216. }
  217. console.log('testTag', JSON.stringify(params))
  218. return await StorageRequest.post('/api/v1/stock/list', params) as Materialpositionclass[]
  219. }
  220. //工序弹窗
  221. selectProcessController: CustomDialogController = new CustomDialogController({
  222. builder: SelectProcessDialog({
  223. selectProcess: this.selectProcess,
  224. processes: this.processes,
  225. orderMaterialSwitch: this.orderMaterialSwitch,
  226. confirm: async () => {
  227. // 查询工序关联的物料信息
  228. let res = await this.queryMaterialPage()
  229. // if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  230. // return
  231. // }
  232. this.totalCount = res.totalCount ?? 0
  233. this.totalPages = res.totalPages ?? 0
  234. // if (res.records) {
  235. //
  236. // }
  237. this.materialArray = res.records ?? []
  238. }
  239. }),
  240. alignment: DialogAlignment.Center,
  241. customStyle: true,
  242. autoCancel: true,
  243. })
  244. //料箱绑定工序操作
  245. //后端回库入库操作
  246. Warehousing = async (): Promise<MaterialInformationModel[]> => {
  247. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/wmsOrder/inBox", {
  248. houseNo: '1',
  249. stanCode: CommonConstants.STATION_CODE,
  250. vehicleCode: this.recentlyRecordObject.rfid,
  251. detailsList: this.boxMaterials
  252. } as RequestParamModel)
  253. promptAction.showToast({
  254. message: '请求成功,业务处理中。。。',
  255. duration: 2000,
  256. bottom: 150
  257. });
  258. if (!this.recentlyRecordObject.rfid) {
  259. // 当盒子被小车吊走了才清空
  260. this.boxMaterials = []
  261. }
  262. return res
  263. }
  264. /////请求物料位置
  265. Materialposition = async (): Promise<Materialpositionclass[]> => {
  266. let res: Materialpositionclass[] = await StorageRequest.post("/api/v1/stock/list", {
  267. materialName: this.materialName
  268. } as RequestParamModel)
  269. console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
  270. this.Mposition = res
  271. return res
  272. }
  273. //物料位置
  274. materialLocationController: CustomDialogController = new CustomDialogController({
  275. builder: MaterialLocationDialog({
  276. orderId: this.orderId,
  277. materialGridStatus: this.materialGridStatus,
  278. outBox: this.outBox,
  279. boxMaterials: this.boxMaterials,
  280. Mposition: this.Mposition,
  281. materialName: this.materialName,
  282. materialPositionArray: this.materialPositionArray,
  283. materialPosition: this.materialPosition,
  284. // confirm: async ()=>{
  285. // if (this.materialPosition?.vehicleCode && JSON.stringify(this.materialPosition) != '{}') {
  286. // let params: RequestParamModel = new RequestParamModel()
  287. // params.vehicleCode = this.materialPosition?.vehicleCode!
  288. // this.boxMaterials = await this.queryStockList(params)
  289. // console.log('testTag', JSON.stringify(this.boxMaterials))
  290. // // todo 需要根据硬件返回数据判断当前出库口的状态
  291. // this.drawerPositionStatus = 1
  292. // this.materialGridStatus = 1
  293. // }
  294. // }
  295. }),
  296. alignment: DialogAlignment.Center,
  297. customStyle: true,
  298. autoCancel: false,
  299. })
  300. //取空箱子弹窗
  301. emptyBoxController: CustomDialogController = new CustomDialogController({
  302. builder: EmptyBoxDialog({
  303. callBoxNum: this.callBoxNum,
  304. isTakeOutBox: this.isTakeOutBox,
  305. }),
  306. alignment: DialogAlignment.Center,
  307. customStyle: true,
  308. autoCancel: true,
  309. })
  310. //扫描料箱弹窗
  311. scanningMaterialBoxController: CustomDialogController = new CustomDialogController({
  312. builder: scanningMaterialBox({
  313. binCode: this.binCode,
  314. boxInfo: this.boxInfo,
  315. clickScan: this.clickScan,
  316. vehicleCode: this.vehicleCode,
  317. selectOrder: this.selectOrder,
  318. orderArray: this.orderArray,
  319. materialCode: this.materialCode
  320. }),
  321. alignment: DialogAlignment.Center,
  322. customStyle: true,
  323. autoCancel: true,
  324. })
  325. // async materialBoxHTTP(vehicleCode: string) {
  326. // return await StorageRequest.post('/api/v1/process/vehicleOperation/vehicleDetail', {
  327. // workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!,
  328. // operationId: Number.parseInt(this.selectProcess?.operationId!),
  329. // vehicleCode: vehicleCode,
  330. // } as RequestParamModel) as BoxInfo
  331. // }
  332. //查询取出的料箱里面的物料信息
  333. boxMaterialHttp = async (): Promise<MaterialInformationModel[]> => {
  334. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/list", {
  335. vehicleCode: this.entranceWaiting[0].rfid!
  336. } as RequestParamModel)
  337. console.log('testTag', 'aaaaaaaa2' + JSON.stringify(res));
  338. this.boxMaterials = res
  339. return res
  340. }
  341. //硬件请求回库操作
  342. warehousingHttp = async (): Promise<boxMaterialClass> => {
  343. let res: boxMaterialClass = await StorageRequest.post("/api/v1/wcs/stockin", {
  344. boxNo: this.vehicleNo,
  345. position: "stat3",
  346. mtype: this.vehicleLevel
  347. } as RequestParamModel)
  348. console.log('testTag1', '----------' + JSON.stringify(res));
  349. return res
  350. }
  351. // 点击齐套料箱的时候需要将右侧的数组push到左侧,但是需要先提前掉一个接口
  352. toCompleteSuitFun = async () => {
  353. let result: boxMaterialClass = await StorageRequest.post("api/v1/process/vehicleOperation/add", {
  354. operationId: this.selectProcess.operationId,
  355. workOrderCode: this.currentWorkOrderCode,
  356. vehicleCode: this.recentlyRecordObject.rfid,
  357. processVehicleMaterialList: this.MaterialInformation
  358. } as RequestParamModel)
  359. // =====================
  360. let toPushArray: MaterialInformationModel[] = [...this.boxMaterials]
  361. this.MaterialInformation.forEach((middleBox) => {
  362. let has = false
  363. for (let i = 0; i < toPushArray.length; i++) {
  364. let box = toPushArray[i]
  365. if (middleBox.materialCode == box.materialCode) {
  366. let number = middleBox.num! + box.num!
  367. box.num = number
  368. has = true
  369. }
  370. }
  371. if (!has) {
  372. toPushArray.push(JSON.parse(JSON.stringify(middleBox)))
  373. }
  374. })
  375. this.boxMaterials = [...toPushArray]
  376. this.MaterialInformation = []
  377. // =====================
  378. // 添加完成之后需要更新最左侧已经选择的工序下边的物料列表
  379. let res = await this.queryMaterialPage()
  380. if (res.totalCount === undefined || res.totalCount <= 0 || res.totalPages === undefined || res.totalPages <= 0) {
  381. return
  382. }
  383. this.totalCount = res.totalCount
  384. this.totalPages = res.totalPages
  385. if (res.records) {
  386. this.materialArray = res.records
  387. }
  388. }
  389. build() {
  390. Row({ space: px2vp(24) }) {
  391. if (this.orderMaterialSwitch === 1) {
  392. Column() {
  393. List({ space: px2vp(20) }) {
  394. ForEach(this.orderArray, (item: OrderInfo, index: number) => {
  395. ListItem() {
  396. Column() {
  397. Row() {
  398. Text(item.orderName)
  399. .fontSize($r('app.float.fontSize_24'))
  400. .fontWeight(FontWeight.Medium)
  401. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  402. .opacity(this.selectOrder === index ? $r('app.float.card_font_select_opacity') : 1)
  403. }
  404. .width('90%')
  405. .height('20%')
  406. .justifyContent(FlexAlign.Start)
  407. Row() {
  408. Text('产品型号 ')
  409. .fontWeight(FontWeight.Regular)
  410. .fontSize($r('app.float.fontSize_20'))
  411. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  412. Text(item.materialModel)
  413. .fontSize($r('app.float.fontSize_20'))
  414. .fontWeight(FontWeight.Medium)
  415. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  416. }
  417. .width('90%')
  418. .height('16%')
  419. .justifyContent(FlexAlign.Start)
  420. Row() {
  421. Text('计划编号 ')
  422. .fontWeight(FontWeight.Regular)
  423. .fontSize($r('app.float.fontSize_20'))
  424. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  425. Text(item.workOrderCode)
  426. .fontSize($r('app.float.fontSize_20'))
  427. .fontWeight(FontWeight.Medium)
  428. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  429. }
  430. .width('90%')
  431. .height('16%')
  432. .justifyContent(FlexAlign.Start)
  433. Row() {
  434. Text('订单编号 ')
  435. .fontWeight(FontWeight.Regular)
  436. .fontSize($r('app.float.fontSize_20'))
  437. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  438. Text(item.orderCode)
  439. .fontSize($r('app.float.fontSize_20'))
  440. .fontWeight(FontWeight.Medium)
  441. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  442. }
  443. .width('90%')
  444. .height('16%')
  445. .justifyContent(FlexAlign.Start)
  446. Row() {
  447. Text('下发时间 ')
  448. .fontSize($r('app.float.fontSize_20'))
  449. .fontWeight(FontWeight.Regular)
  450. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  451. Text(item?.planStartWhen && item.planStartWhen.length > 0 ? item.planStartWhen.split(' ')[0] : '')
  452. .fontSize($r('app.float.fontSize_20'))
  453. .fontWeight(FontWeight.Medium)
  454. .fontColor(this.selectOrder === index ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  455. }
  456. .width('90%')
  457. .height('16%')
  458. .justifyContent(FlexAlign.Start)
  459. }
  460. .justifyContent(FlexAlign.Center)
  461. // .alignItems(HorizontalAlign.Center)
  462. .onClick(async () => {
  463. // 另外选择了工单,则把工序、选择的工序清空
  464. // if (this.selectOrder && this.selectOrder != index) {
  465. // this.selectProcess = {}
  466. // this.processes = []
  467. // }
  468. this.currentWorkOrderCode = item.workOrderCode ?? ""
  469. this.orderId = item.taskId!
  470. if (item?.workOrderCode && item.workOrderCode.length > 0) {
  471. this.processes = await StorageRequest.get("/api/v1/process/vehicleOperation/operation/" + item.workOrderCode, {
  472. })
  473. }
  474. // else {
  475. // this.selectProcess = {}
  476. // this.processes = []
  477. // }
  478. this.selectProcessController.open()
  479. this.selectOrder = index
  480. })
  481. .width(px2vp(608))
  482. .height('20%')
  483. .borderRadius($r('app.float.general_border_radius'))
  484. .backgroundColor(this.selectOrder === index ? $r('app.color.order_select_background') : $r('app.color.general_card_background_color'))
  485. }
  486. })
  487. }
  488. .width(px2vp(608))
  489. .height(px2vp(870))
  490. // 未完成订单大于10条,触底再去查询
  491. .onReachEnd(async () => {
  492. if (!this.orderTotalPages || this.orderTotalPages <= 1) {
  493. return
  494. }
  495. if (this.orderPageNo >= this.orderTotalPages) {
  496. return
  497. }
  498. this.orderPageNo++
  499. let res = await this.queryOrderPage() as PageModel<OrderInfo>
  500. this.orderArray = this.orderArray?.concat(res.records as OrderInfo[])
  501. })
  502. }
  503. .width(px2vp(608))
  504. .height(px2vp(900))
  505. .borderRadius($r('app.float.borderRadius_16'))
  506. } else if (this.orderMaterialSwitch === 2) {
  507. Column() {
  508. Row() {
  509. Image($r('app.media.circular_return'))
  510. .width(px2vp(80))
  511. .height(px2vp(80))
  512. .onClick(() => {
  513. this.orderMaterialSwitch = 1
  514. })
  515. Blank()
  516. Row() {
  517. Column({ space: 10 }) {
  518. Text(this.selectProcess?.operationName && this.selectProcess.operationName.length > 0 ? this.selectProcess.operationName! : '')
  519. .fontWeight(FontWeight.Medium)
  520. .fontSize($r('app.float.fontSize_20'))
  521. .fontColor($r('app.color.blue_100'))
  522. .opacity($r('app.float.general_font_opacity'))
  523. Text(this.orderArray[this.selectOrder]?.orderName && (this.orderArray[this.selectOrder]?.orderName?.length!) > 0 ? this.orderArray[this.selectOrder]?.orderName! : '')
  524. .fontSize($r('app.float.fontSize_20'))
  525. .fontWeight(FontWeight.Regular)
  526. .fontColor($r('app.color.blue_100'))
  527. .opacity($r('app.float.general_font_opacity'))
  528. }
  529. .margin({ left: 10 })
  530. .width('80%')
  531. .height('100%')
  532. .padding({ left: 10 })
  533. .borderRadius(px2vp(15))
  534. .alignItems(HorizontalAlign.Start)
  535. .justifyContent(FlexAlign.Center)
  536. Blank()
  537. Image($r('app.media.subscript'))
  538. .width(px2vp(20))
  539. .height(px2vp(20))
  540. }
  541. .alignItems(VerticalAlign.Bottom)
  542. .width('80%')
  543. .borderRadius(px2vp(15))
  544. .backgroundColor('#0f000000')
  545. .height('100%')
  546. .onClick(() => {
  547. this.selectProcessController.open()
  548. })
  549. }
  550. .width('100%')
  551. .height('10%')
  552. .margin({ bottom: px2vp(20) })
  553. Column() {
  554. List({ space: 5 }) {
  555. ForEach(this.materialArray, (item: MaterialInfo, index: number) => {
  556. ListItem() {
  557. Row() {
  558. Column() {
  559. Text(item.materialName)
  560. .fontSize($r('app.float.fontSize_24'))
  561. .fontWeight(FontWeight.Medium)
  562. .fontColor($r('app.color.black_90'))
  563. .width('100%')
  564. .height('20%')
  565. Text(item.materialCode)
  566. .fontWeight(FontWeight.Regular)
  567. .fontSize($r('app.float.fontSize_20'))
  568. .fontColor($r('app.color.black_60'))
  569. .width('100%')
  570. .height('20%')
  571. Blank()
  572. Text(item.completeNum?.toString() + '/' + item.totalMaterial?.toString())
  573. .fontSize($r('app.float.fontSize_24'))
  574. .fontColor($r('app.color.black_90'))
  575. .fontWeight(FontWeight.Bold)
  576. .width('100%')
  577. .height('20%')
  578. Text('已拣/总需')
  579. .fontSize($r('app.float.fontSize_20'))
  580. .fontColor($r('app.color.black_60'))
  581. .width('100%')
  582. .height('20%')
  583. }
  584. .width('70%')
  585. .padding({ left: 20, right: 20 })
  586. .borderRadius(px2vp(16))
  587. .alignItems(HorizontalAlign.Start)
  588. .justifyContent(FlexAlign.Center)
  589. .height('100%')
  590. if (item.completeNum! === item.totalMaterial!) {
  591. Column() {
  592. Image($r('app.media.collect_completed'))
  593. .width(px2vp(80))
  594. .height(px2vp(80))
  595. .borderRadius(px2vp(16))
  596. }
  597. .justifyContent(FlexAlign.Start)
  598. .width('30%')
  599. .height('100%')
  600. .borderRadius(px2vp(16))
  601. }
  602. }
  603. .padding(10)
  604. .borderRadius(10)
  605. .margin(px2vp(8))
  606. .height('25%')
  607. .width(px2vp(608))
  608. .onClick(async () => {
  609. this.materialName = item.materialName!
  610. this.Materialposition().then((res: Materialpositionclass[]) => {
  611. console.log('testTag', 'result cccccc' + JSON.stringify(res))
  612. if (res && res.length > 0) {
  613. this.Mposition = res
  614. }
  615. })
  616. let params: RequestParamModel = new RequestParamModel()
  617. params.materialNo = item.materialCode!
  618. this.materialPositionArray = await this.queryStockList(params)
  619. this.materialLocationController.open()
  620. })
  621. .backgroundColor(this.onclick === index ?
  622. $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  623. }
  624. })
  625. }
  626. .width('100%')
  627. .height('100%')
  628. .onReachEnd(async () => {
  629. if (!this.totalPages || this.totalPages <= 1) {
  630. return
  631. }
  632. if (this.pageNo >= this.totalPages) {
  633. return
  634. }
  635. this.pageNo++
  636. // 查询工序关联的物料信息
  637. let res = await this.queryMaterialPage()
  638. this.materialArray = this.materialArray?.concat(res.records as MaterialInfo[])
  639. })
  640. }
  641. .width(px2vp(608))
  642. .height('91%')
  643. .borderRadius($r('app.float.borderRadius_16'))
  644. }.width(px2vp(608))
  645. .height(px2vp(900))
  646. .borderRadius($r('app.float.borderRadius_16'))
  647. }
  648. Column() {
  649. Stack() {
  650. Image(this.drawerPositionStatus === 1 && this.materialGridStatus === 0 ? $r('app.media.drawer_inside') : (this.drawerPositionStatus === 2 && this.materialGridStatus === 0 ? $r('app.media.drawer_outside') :
  651. (this.drawerPositionStatus === 1 && this.materialGridStatus === 1 ? $r('app.media.D_W_inside') : $r('app.media.D_W_outside'))))
  652. .width(px2vp(608))
  653. .height(px2vp(220))
  654. .borderRadius(px2vp(16))
  655. Column() {
  656. Text('抽屉状态')
  657. .textAlign(TextAlign.End)
  658. .width('48%')
  659. .height('20%')
  660. .fontWeight(FontWeight.Regular)
  661. .fontSize($r('app.float.fontSize_20'))
  662. .fontColor($r('app.color.process_nameplate_grey_color'))
  663. Text(this.recentlyRecordObject.lockStr)
  664. .textAlign(TextAlign.End)
  665. .width('48%')
  666. .height('25%')
  667. .fontWeight(FontWeight.Regular)
  668. .fontSize($r('app.float.fontSize_24'))
  669. .fontColor($r('app.color.black_90'))
  670. Blank()
  671. Text('料箱ID')
  672. .textAlign(TextAlign.End)
  673. .width('48%')
  674. .height('20%')
  675. .fontWeight(FontWeight.Regular)
  676. .fontSize($r('app.float.fontSize_20'))
  677. .fontColor($r('app.color.process_nameplate_grey_color'))
  678. Text(this.recentlyRecordObject.rfid ?? "")
  679. .textAlign(TextAlign.End)
  680. .width('100%')
  681. .height('25%')
  682. .fontWeight(FontWeight.Regular)
  683. .fontSize($r('app.float.fontSize_24'))
  684. .fontColor($r('app.color.black_90'))
  685. }
  686. .width(px2vp(608))
  687. .height(px2vp(220))
  688. .borderRadius(px2vp(16))
  689. .padding({ right: $r('app.float.borderRadius_16') })
  690. .alignItems(HorizontalAlign.End)
  691. }
  692. .width(px2vp(608))
  693. .height(px2vp(220))
  694. .borderRadius(px2vp(16))
  695. .margin({ bottom: px2vp(20) })
  696. Button('回库')
  697. .fontSize($r('app.float.fontSize_24'))
  698. .fontColor($r('app.color.general_font_white_color'))
  699. .width(px2vp(608))
  700. .height(px2vp(80))
  701. .margin({ bottom: px2vp(20) })
  702. .focusable(false)
  703. .backgroundColor(this.materialGridStatus === 1 ? $r('app.color.green_100') : this.materialGridStatus === 0 ? $r('app.color.Green_20') : '')
  704. .onClick(() => {
  705. if (this.materialGridStatus === 1) {
  706. //执行后端入库操作
  707. this.Warehousing()
  708. }
  709. })
  710. List({ space: '2%' }) {
  711. ForEach(this.boxMaterials, (item: MaterialInformationModel, index: number) => {
  712. ListItem() {
  713. Row() {
  714. Column() {
  715. Column() {
  716. Row().height('23%')
  717. Text(item.materialName ? item.materialName! : '')
  718. .fontSize($r('app.float.fontSize_24'))
  719. .fontColor($r('app.color.general_font_color'))
  720. .fontWeight(FontWeight.Medium)
  721. .opacity($r('app.float.general_font_opacity'))
  722. Text(item.materialCode ? item.materialCode : '')
  723. .fontSize($r('app.float.fontSize_20'))
  724. .fontColor($r('app.color.process_nameplate_grey_color'))
  725. .fontWeight(FontWeight.Medium)
  726. }
  727. .height('50%')
  728. .width('90%')
  729. .alignItems(HorizontalAlign.Start)
  730. Column() {
  731. Row() {
  732. Text(item.num?.toString())
  733. .fontSize($r('app.float.fontSize_38'))
  734. .fontColor($r('app.color.general_font_color'))
  735. .fontWeight(FontWeight.Bold)
  736. Text(item.unitDictLabel ?? "个")
  737. .fontSize($r('app.float.fontSize_20'))
  738. .fontColor($r('app.color.process_nameplate_grey_color'))
  739. .fontWeight(FontWeight.Medium)
  740. }
  741. .width('90%')
  742. Blank()
  743. Row() {
  744. Image($r('app.media.subscript_space'))
  745. .height($r('app.float.card_subscript_new_size'))
  746. .width($r('app.float.card_subscript_new_size'))
  747. }
  748. .alignItems(VerticalAlign.Bottom)
  749. .justifyContent(FlexAlign.End)
  750. .width('100%')
  751. }
  752. .height('50%')
  753. .width('100%')
  754. }
  755. .width('100%')
  756. .borderRadius($r('app.float.general_border_radius'))
  757. .alignItems(HorizontalAlign.Center)
  758. .justifyContent(FlexAlign.Center)
  759. .height('100%')
  760. }
  761. .borderRadius(px2vp(16))
  762. .height('30%')
  763. .onClick(() => {
  764. })
  765. .backgroundColor(this.onclick === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  766. }
  767. })
  768. }
  769. .width(px2vp(608))
  770. .height(px2vp(525))
  771. }
  772. .width(px2vp(608))
  773. .height(px2vp(900))
  774. .borderRadius($r('app.float.borderRadius_16'))
  775. Column() {
  776. Stack() {
  777. 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'))
  778. .width(px2vp(608))
  779. .height(px2vp(220))
  780. .borderRadius(px2vp(16))
  781. Column() {
  782. Text('料箱重量')
  783. .textAlign(TextAlign.End)
  784. .width('48%')
  785. .height('20%')
  786. .fontWeight(FontWeight.Regular)
  787. .fontSize($r('app.float.fontSize_20'))
  788. .fontColor($r('app.color.process_nameplate_grey_color'))
  789. Text(this.recentlyRecordObject.weight)
  790. .textAlign(TextAlign.End)
  791. .width('48%')
  792. .height('25%')
  793. .fontWeight(FontWeight.Regular)
  794. .fontSize($r('app.float.fontSize_24'))
  795. .fontColor(this.BoxWeight <= 15 ? $r('app.color.black_90') : $r('app.color.brown_100'))
  796. Blank()
  797. Text('料箱ID')
  798. .textAlign(TextAlign.End)
  799. .width('48%')
  800. .height('20%')
  801. .fontWeight(FontWeight.Regular)
  802. .fontSize($r('app.float.fontSize_20'))
  803. .fontColor($r('app.color.process_nameplate_grey_color'))
  804. .focusable(true)
  805. .defaultFocus(false)
  806. Text(this.recentlyRecordObject.rfid)
  807. .textAlign(TextAlign.End)
  808. .width('100%')
  809. .height('25%')
  810. .fontWeight(FontWeight.Regular)
  811. .fontSize($r('app.float.fontSize_24'))
  812. .fontColor($r('app.color.black_90'))
  813. }
  814. .width(px2vp(608))
  815. .height(px2vp(220))
  816. .borderRadius(px2vp(16))
  817. .padding({ right: $r('app.float.borderRadius_16') })
  818. .alignItems(HorizontalAlign.End)
  819. }
  820. .width(px2vp(608))
  821. .height(px2vp(220))
  822. Row() {
  823. Image($r('app.media.shaoma'))
  824. .width(px2vp(25))
  825. .height(px2vp(25))
  826. .focusable(true)
  827. .defaultFocus(false)
  828. TextInput({ text: this.scanCodeValue,
  829. placeholder: '点击扫码添加物料',
  830. controller: this.textController })
  831. .width('92%')
  832. .height('100%')
  833. .width('80%')
  834. .fontWeight(FontWeight.Medium)
  835. .fontSize('32px')
  836. .backgroundColor("#ffff")
  837. .borderRadius(21)
  838. .onChange((value: string) => {
  839. this.scanCodeValue = value
  840. })
  841. .onSubmit(() => {
  842. this.ScanStorageCode(this.scanCodeValue)
  843. })
  844. Image($r('app.media.search'))
  845. .width(px2vp(32))
  846. .height(px2vp(32))
  847. .onClick(async () => {
  848. this.ScanStorageCode(this.scanCodeValue)
  849. })
  850. }
  851. .width(px2vp(608))
  852. .height(px2vp(80))
  853. .justifyContent(FlexAlign.Center)
  854. .borderRadius(px2vp(100))
  855. .alignItems(VerticalAlign.Center)
  856. .backgroundColor($r('app.color.process_divider_white_color'))
  857. .margin({ top: px2vp(20) })
  858. Column() {
  859. List() {
  860. ForEach(this.MaterialInformation, (item: MaterialInformationModel, index: number) => {
  861. ListItem() {
  862. Row() {
  863. Column() {
  864. Column() {
  865. Row().height('23%')
  866. Text(item.materialName ? item.materialName! : '')
  867. .fontSize($r('app.float.fontSize_24'))
  868. .fontColor($r('app.color.general_font_color'))
  869. .fontWeight(FontWeight.Medium)
  870. .opacity($r('app.float.general_font_opacity'))
  871. Text(item.materialCode ? item.materialCode : '')
  872. .fontSize($r('app.float.fontSize_20'))
  873. .fontColor($r('app.color.process_nameplate_grey_color'))
  874. .fontWeight(FontWeight.Medium)
  875. }
  876. .height('50%')
  877. .width('90%')
  878. .alignItems(HorizontalAlign.Start)
  879. Column() {
  880. Row() {
  881. Text(item.num?.toString())
  882. .fontSize($r('app.float.fontSize_38'))
  883. .fontColor($r('app.color.general_font_color'))
  884. .fontWeight(FontWeight.Bold)
  885. Text(item.unitDictLabel ?? "个")
  886. .fontSize($r('app.float.fontSize_20'))
  887. .fontColor($r('app.color.process_nameplate_grey_color'))
  888. .fontWeight(FontWeight.Medium)
  889. }
  890. .width('90%')
  891. Blank()
  892. Row() {
  893. Image($r('app.media.subscript_space'))
  894. .height($r('app.float.card_subscript_new_size'))
  895. .width($r('app.float.card_subscript_new_size'))
  896. }
  897. .alignItems(VerticalAlign.Bottom)
  898. .justifyContent(FlexAlign.End)
  899. .width('100%')
  900. }
  901. .height('50%')
  902. .width('100%')
  903. }
  904. .width('100%')
  905. .borderRadius($r('app.float.general_border_radius'))
  906. .alignItems(HorizontalAlign.Center)
  907. .justifyContent(FlexAlign.Center)
  908. .height('100%')
  909. }
  910. .borderRadius(10)
  911. .height('30%')
  912. .margin({ top: 5 })
  913. .onClick(() => {
  914. })
  915. .backgroundColor(this.onclick === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  916. }
  917. })
  918. }
  919. .width(px2vp(608))
  920. .height(px2vp(450))
  921. .margin({ bottom: px2vp(20) })
  922. Button('齐套料箱')
  923. .fontSize($r('app.float.fontSize_24'))
  924. .fontColor($r('app.color.general_font_white_color'))
  925. .width(px2vp(608))
  926. .height(px2vp(80))
  927. .backgroundColor(this.selectProcess.operationId && this.MaterialInformation.length > 0 ? $r('app.color.blue_100') : $r('app.color.blue_20'))
  928. .onClick(() => {
  929. if (this.selectProcess.operationId) {
  930. if (this.MaterialInformation.length > 0) {
  931. // 把中间的数据push到左边的数组,如果xx一样就数量相加
  932. this.toCompleteSuitFun()
  933. }
  934. }
  935. else {
  936. promptAction.showToast({
  937. message: '请先选择工单和工序!',
  938. duration: 1700,
  939. bottom: 150
  940. });
  941. }
  942. })
  943. }
  944. .width(px2vp(608))
  945. .height(px2vp(520))
  946. .borderRadius($r('app.float.borderRadius_16'))
  947. }
  948. .width(px2vp(608))
  949. .height(px2vp(900))
  950. .borderRadius($r('app.float.borderRadius_16'))
  951. }
  952. .width(px2vp(1920))
  953. .height(px2vp(900))
  954. .padding({ left: px2vp(24), right: px2vp(24) })
  955. }
  956. }
  957. // 选择工序
  958. @CustomDialog
  959. struct SelectProcessDialog {
  960. @Link selectProcess: ProcessData
  961. @Link processes: ProcessData[]
  962. @Link orderMaterialSwitch: number
  963. controller?: CustomDialogController
  964. cancel: () => void = () => {
  965. }
  966. confirm: () => void = () => {
  967. }
  968. build() {
  969. Column() {
  970. Row() {
  971. Text('选择工序')
  972. .fontSize($r('app.float.fontSize_38'))
  973. .fontWeight(FontWeight.Medium)
  974. .fontColor($r('app.color.general_font_color'))
  975. .opacity($r('app.float.general_font_opacity'))
  976. }
  977. .height('15%')
  978. .alignItems(VerticalAlign.Center)
  979. List({ space: px2vp(20), initialIndex: 0 }) {
  980. ForEach(this.processes, (item: ProcessData) => {
  981. ListItem() {
  982. Row() {
  983. Text(item.operationName)
  984. .fontSize($r('app.float.fontSize_24'))
  985. .fontWeight(FontWeight.Medium)
  986. .fontColor(JSON.stringify(this.selectProcess) != '{}' && item.operationId === this.selectProcess?.operationId ? $r('app.color.general_font_white_color') : $r('app.color.general_font_color'))
  987. .textAlign(TextAlign.Center)
  988. .width('71%')
  989. .height('12.5%')
  990. .borderRadius($r('app.float.general_border_radius'))
  991. .onClick(() => {
  992. this.selectProcess = item
  993. this.orderMaterialSwitch = 2
  994. this.confirm()
  995. this.controller?.close()
  996. })
  997. if (item.state === 2) {
  998. Image($r('app.media.collect_completed'))
  999. .width(px2vp(80))
  1000. .height(px2vp(80))
  1001. .borderRadius($r('app.float.general_border_radius'))
  1002. }
  1003. Text() {
  1004. }
  1005. .width(px2vp(80))
  1006. .height(px2vp(80))
  1007. .borderRadius($r('app.float.general_border_radius'))
  1008. }
  1009. .borderRadius($r('app.float.general_border_radius'))
  1010. .backgroundColor(JSON.stringify(this.selectProcess) != '{}' && item.operationId === this.selectProcess?.operationId ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  1011. }
  1012. })
  1013. }
  1014. .listDirection(Axis.Vertical) // 排列方向
  1015. // .edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
  1016. .height('80%')
  1017. .width('100%')
  1018. .alignListItem(ListItemAlign.Center)
  1019. }
  1020. .width('48%')
  1021. .height('74%')
  1022. .backgroundColor($r('app.color.page_general_background'))
  1023. .justifyContent(FlexAlign.SpaceEvenly)
  1024. .borderRadius($r('app.float.general_border_radius'))
  1025. }
  1026. }
  1027. // 物料位置(物料在哪些料箱里面)
  1028. @CustomDialog
  1029. struct MaterialLocationDialog {
  1030. @Link orderId: string
  1031. @Link materialGridStatus: number
  1032. @Link outBox: outBoxClass[]
  1033. @Link boxMaterials: MaterialInformationModel[]
  1034. @State selectMaterial: number = -1
  1035. @Link Mposition: Materialpositionclass[]
  1036. @Link materialPositionArray: Materialpositionclass[]
  1037. @Link materialPosition: Materialpositionclass
  1038. @Link materialName: string
  1039. @State houseNo: string = ''
  1040. @State vehicleNo: string = ''
  1041. @State private controlList: Array<controlClass> = []
  1042. Controller: CustomDialogController
  1043. scroller: Scroller = new Scroller()
  1044. //后端料箱出库
  1045. RemoveMaterialBox = async (): Promise<outBoxClass[]> => {
  1046. let res: outBoxClass[] = await StorageRequest.post("/api/v1/wmsOrder/outBox", {
  1047. houseNo: this.houseNo,
  1048. vehicleNo: this.vehicleNo
  1049. } as RequestParamModel)
  1050. console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
  1051. this.outBox = res
  1052. return res
  1053. }
  1054. //后端控制系统料箱出库
  1055. controlHttp = async (): Promise<controlClass[]> => {
  1056. let res: controlClass[] = await StorageRequest.post("/api/v1/wms/common/receiveResult", {
  1057. orderId: this.orderId,
  1058. state: 1
  1059. } as RequestParamModel)
  1060. console.log('testTag', 'aaaaaaaa1' + JSON.stringify(res));
  1061. this.controlList = res
  1062. return res
  1063. }
  1064. //todo 这里删掉,应该是出库位置自动识别rfid读取料箱里面物料信息
  1065. //查询取出的料箱里面的物料信息
  1066. boxMaterialHttp = async (): Promise<MaterialInformationModel[]> => {
  1067. let res: MaterialInformationModel[] = await StorageRequest.post("/api/v1/stock/list", {
  1068. vehicleCode: this.vehicleNo
  1069. } as RequestParamModel)
  1070. console.log('testTag', 'aaaaaaaa2' + JSON.stringify(res));
  1071. this.boxMaterials = res
  1072. return res
  1073. }
  1074. //硬件请求出库操作
  1075. outboundHttp = async (): Promise<outboundClass> => {
  1076. let res: outboundClass = await StorageRequest.post("/api/v1/wcs/stockout", {
  1077. boxNo: this.vehicleNo,
  1078. position: "stat3"
  1079. } as RequestParamModel)
  1080. console.log('testTag1', '----------' + JSON.stringify(res));
  1081. return res
  1082. }
  1083. build() {
  1084. Stack() {
  1085. Column() {
  1086. }.width('100%')
  1087. .height('100%')
  1088. .blur(30)
  1089. .backgroundColor('#4d000000')
  1090. Column() {
  1091. Row() {
  1092. Row() {
  1093. Image($r('app.media.back_white'))
  1094. .width(px2vp(64))
  1095. .height(px2vp(64))
  1096. .onClick(() => {
  1097. this.Controller?.close()
  1098. })
  1099. }
  1100. .width('5%')
  1101. .padding({ left: 10 })
  1102. Row() {
  1103. Text(this.materialName && this.materialName.length > 0 ? this.materialName : '')
  1104. .fontSize($r('app.float.fontSize_38'))
  1105. .fontWeight(FontWeight.Medium)
  1106. .fontColor($r('app.color.process_divider_white_color'))
  1107. .width('100%')
  1108. .height('100%')
  1109. .textAlign(TextAlign.Center)
  1110. }
  1111. .width('90%')
  1112. .justifyContent(FlexAlign.Center)
  1113. Row() {
  1114. }.width('5%')
  1115. }
  1116. .width('100%')
  1117. .height('15%')
  1118. .padding({ top: 8 })
  1119. Grid(this.scroller) {
  1120. ForEach(this.Mposition, (item: Materialpositionclass, index: number) => {
  1121. GridItem() {
  1122. Row() {
  1123. Column() {
  1124. Text(item?.locationNo && item.locationNo.length > 0 ? getMaterialPositionStr(item.locationNo) : '')
  1125. .fontSize($r('app.float.fontSize_24'))
  1126. .fontWeight(FontWeight.Regular)
  1127. .fontColor($r('app.color.black_90'))
  1128. .height('20%')
  1129. .width('100%')
  1130. Text(item.materialName)
  1131. .fontSize($r('app.float.fontSize_24'))
  1132. .fontWeight(FontWeight.Regular)
  1133. .fontColor($r('app.color.black_60'))
  1134. .height('20%')
  1135. .width('100%')
  1136. Blank()
  1137. Row() {
  1138. Text(item.num?.toString())
  1139. .fontSize($r('app.float.fontSize_38'))
  1140. .fontWeight(FontWeight.Bold)
  1141. .fontColor($r('app.color.black_90'))
  1142. Text(item.unit)
  1143. .fontSize($r('app.float.fontSize_24'))
  1144. .fontWeight(FontWeight.Regular)
  1145. .fontColor($r('app.color.black_60'))
  1146. }
  1147. .height('50%')
  1148. }
  1149. .width('100%')
  1150. .padding(10)
  1151. .borderRadius(10)
  1152. .alignItems(HorizontalAlign.Start)
  1153. .justifyContent(FlexAlign.Center)
  1154. .height('100%')
  1155. }
  1156. .padding(5)
  1157. .borderRadius(10)
  1158. .height('25%')
  1159. .width('100%')
  1160. .backgroundColor(this.selectMaterial === index ? $r('app.color.robot_set_card_blue') : $r('app.color.robot_set_card_white'))
  1161. .onClick(async () => {
  1162. this.houseNo = item.houseNo!
  1163. this.vehicleNo = item.vehicleCode!
  1164. this.selectMaterial = index
  1165. this.materialPosition = item
  1166. console.log("testTag1" + '----------++' + this.vehicleNo)
  1167. //先查询点击的料箱物流信息用于展示在回库下面
  1168. this.boxMaterialHttp().then((res: MaterialInformationModel[]) => {
  1169. console.log('testTag', 'result cccccc22' + JSON.stringify(res))
  1170. if (res && res.length > 0) {
  1171. this.boxMaterials = res
  1172. }
  1173. })
  1174. //执行硬件出库
  1175. this.outboundHttp().then((res: outboundClass) => {
  1176. console.log('testTag1', '-------result cccccc11' + JSON.stringify(res))
  1177. })
  1178. // todo 打开执行出库操作后端
  1179. // this.RemoveMaterialBox().then((res :outBoxClass[]) => {
  1180. // console.log('testTag', 'result cccccc11'+JSON.stringify(res))
  1181. // if (res && res.length > 0) {
  1182. // this.outBox = res
  1183. // }
  1184. // })
  1185. //控制终端
  1186. this.controlHttp().then((res: controlClass[]) => {
  1187. console.log('testTag1', '-------result cccccc11' + JSON.stringify(res))
  1188. })
  1189. this.Controller?.close()
  1190. })
  1191. }
  1192. .padding({ left: 5 })
  1193. })
  1194. }
  1195. .padding(10)
  1196. .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr')
  1197. .columnsGap(10)
  1198. .rowsGap(10)
  1199. .width('100%')
  1200. .height('85%')
  1201. }
  1202. .width('100%')
  1203. .height('100%')
  1204. }
  1205. .width('100%')
  1206. .height('100%')
  1207. }
  1208. }
  1209. //取空箱子弹窗
  1210. @CustomDialog
  1211. struct EmptyBoxDialog {
  1212. @Link callBoxNum: number
  1213. @Link isTakeOutBox: number
  1214. controller?: CustomDialogController
  1215. cancel: () => void = () => {
  1216. }
  1217. confirm: () => void = () => {
  1218. }
  1219. build() {
  1220. Column({ space: 10 }) {
  1221. Text('取空箱数量')
  1222. .textAlign(TextAlign.Center)
  1223. .width('80%')
  1224. .height('30%')
  1225. .fontWeight(FontWeight.Regular)
  1226. .fontSize($r('app.float.fontSize_24'))
  1227. .fontColor($r('app.color.black_90'))
  1228. Row() {
  1229. Image($r('app.media.subtract_disabled'))
  1230. .width(px2vp(120))
  1231. .height(px2vp(120))
  1232. .border({ width: 0.8 })
  1233. .borderRadius({ topLeft: px2vp(16), bottomLeft: px2vp(16) })
  1234. .onClick(() => {
  1235. if (this.callBoxNum <= 1) {
  1236. return
  1237. }
  1238. this.callBoxNum--
  1239. })
  1240. TextInput({ text: this.callBoxNum.toString() })
  1241. .fontSize($r('app.float.title_font_size'))
  1242. .fontWeight(FontWeight.Bold)
  1243. .fontColor($r('app.color.general_font_color'))
  1244. .height(px2vp(120))// .opacity($r('app.float.general_font_opacity'))
  1245. //.height('40%')
  1246. .width('50%')
  1247. .type(InputType.Number)
  1248. .textAlign(TextAlign.Center)
  1249. .borderRadius(0)
  1250. .backgroundColor($r('app.color.general_card_background_color'))
  1251. .border({ width: 0.8 })
  1252. .onChange((value: string) => {
  1253. if (!value || value.length === 0) {
  1254. this.callBoxNum = 0
  1255. return
  1256. }
  1257. let num: number = Number.parseInt(value)
  1258. if (num < 1) {
  1259. this.callBoxNum = 1
  1260. }
  1261. })
  1262. Image($r('app.media.add_disabled'))
  1263. .width(px2vp(120))
  1264. .height(px2vp(120))
  1265. .border({ width: 0.8 })
  1266. .borderRadius({ topRight: px2vp(16), bottomRight: px2vp(16) })
  1267. .onClick(() => {
  1268. this.callBoxNum++
  1269. })
  1270. }
  1271. .width('60%')
  1272. .height('40%')
  1273. .justifyContent(FlexAlign.Center)
  1274. Row() {
  1275. Button('取消')
  1276. .fontSize($r('app.float.fontSize_24'))
  1277. .fontColor($r('app.color.blue_100'))
  1278. .width('50%')
  1279. .height('100%')
  1280. .backgroundColor($r('app.color.black_6'))
  1281. .onClick(() => {
  1282. this.isTakeOutBox = 2
  1283. this.callBoxNum = 1
  1284. this.controller?.close()
  1285. })
  1286. Button('确认')
  1287. .fontSize($r('app.float.fontSize_24'))
  1288. .fontColor($r('app.color.general_font_white_color'))
  1289. .width('50%')
  1290. .height('100%')
  1291. .backgroundColor($r('app.color.blue_100'))
  1292. .onClick(() => {
  1293. // todo 调用硬件
  1294. this.isTakeOutBox = 1
  1295. this.controller?.close()
  1296. })
  1297. }
  1298. .width('60%')
  1299. .height('15%')
  1300. }.width('60%')
  1301. .height('50%')
  1302. .borderRadius($r('app.float.borderRadius_16'))
  1303. .backgroundColor($r('app.color.process_divider_white_color'))
  1304. }
  1305. }
  1306. // 扫描齐套料箱弹窗
  1307. @CustomDialog
  1308. struct scanningMaterialBox {
  1309. @Link binCode: string
  1310. @Link boxInfo: BoxInfo
  1311. @Link clickScan: number
  1312. @Link selectOrder: number
  1313. @Link vehicleCode: string
  1314. @Link orderArray: OrderInfo[]
  1315. async materialBoxHTTP(vehicleCode: string) {
  1316. return await StorageRequest.post('/api/v1/process/vehicleOperation/vehicleDetail', {
  1317. workOrderCode: this.orderArray[this.selectOrder]?.workOrderCode!,
  1318. vehicleCode: vehicleCode,
  1319. } as RequestParamModel) as BoxInfo
  1320. }
  1321. @Link materialCode: string
  1322. //扫码控制器
  1323. textController: TextInputController = new TextInputController()
  1324. controller: CustomDialogController
  1325. build() {
  1326. Column() {
  1327. Text('扫描料箱')
  1328. .fontSize($r('app.float.fontSize_38'))
  1329. .fontWeight(FontWeight.Medium)
  1330. .width('100%')
  1331. .height('40%')
  1332. .textAlign(TextAlign.Center)
  1333. Blank()
  1334. Row() {
  1335. Image($r('app.media.shaoma'))
  1336. .width('60px')
  1337. .height('60px')
  1338. TextInput({ text: this.materialCode,
  1339. placeholder: '点击扫码添加编码',
  1340. controller: this.textController })
  1341. .width('92%')
  1342. .height('100%')
  1343. .width('80%')
  1344. .fontWeight(FontWeight.Medium)
  1345. .fontSize('32px')
  1346. .backgroundColor("#ffff")
  1347. .borderRadius(21)
  1348. .onSubmit(() => {
  1349. this.binCode = this.materialCode
  1350. this.clickScan = 1
  1351. this.controller.close()
  1352. //this.boxInfo = await this.materialBoxHTTP(this.binCode)
  1353. })
  1354. Image($r('app.media.search'))
  1355. .width('60px')
  1356. .height('60px')
  1357. .onClick(async () => {
  1358. this.controller.close()
  1359. this.clickScan = 1
  1360. this.boxInfo = await this.materialBoxHTTP(this.binCode)
  1361. })
  1362. }
  1363. .width('60%')
  1364. .height('30%')
  1365. .border({ width: 0.4 })
  1366. .borderRadius(px2vp(100))
  1367. .alignItems(VerticalAlign.Center)
  1368. .backgroundColor($r('app.color.process_divider_white_color'))
  1369. Blank()
  1370. }
  1371. .width('50%')
  1372. .height('40%')
  1373. .padding(10)
  1374. .alignItems(HorizontalAlign.Center)
  1375. .borderRadius($r('app.float.borderRadius_16'))
  1376. .backgroundColor($r('app.color.process_divider_white_color'))
  1377. }
  1378. }
  1379. // 物料详情弹窗(序列号)
  1380. @CustomDialog
  1381. struct MaterialDetailOneDialog {
  1382. @Link material: Materialpositionclass
  1383. scroller: Scroller = new Scroller()
  1384. controller: CustomDialogController
  1385. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  1386. build() {
  1387. Column() {
  1388. Row() {
  1389. Text('物料详情')
  1390. .textAlign(TextAlign.Center)
  1391. .width('100%')
  1392. .height('20%')
  1393. .fontSize($r('app.float.fontSize_24'))
  1394. }
  1395. .height('25%')
  1396. Column({ space: 20 }) {
  1397. Column({ space: 10 }) {
  1398. Text(this.material?.materialName && this.material?.materialName.length > 0 ? this.material.materialName! : '')
  1399. .fontSize($r('app.float.fontSize_20'))
  1400. .fontColor($r('app.color.general_font_white_color'))
  1401. .opacity($r('app.float.card_font_default_opacity'))
  1402. .width('100%')
  1403. Text('100*200')
  1404. .fontSize($r('app.float.robot_state_font_size'))
  1405. .textAlign(TextAlign.Start)
  1406. .fontColor('#99000000')
  1407. .width('100%')
  1408. Text('批次号:' + '1223341232123124121')
  1409. .fontSize($r('app.float.robot_state_font_size'))
  1410. .textAlign(TextAlign.Start)
  1411. .fontColor('#99000000')
  1412. .width('100%')
  1413. Text('计划编号:' + '1231231231233')
  1414. .fontSize($r('app.float.robot_state_font_size'))
  1415. .textAlign(TextAlign.Start)
  1416. .fontColor('#99000000')
  1417. .width('100%')
  1418. Text('订单编号:' + '1231231231233')
  1419. .fontSize($r('app.float.robot_state_font_size'))
  1420. .textAlign(TextAlign.Start)
  1421. .fontColor('#99000000')
  1422. .width('100%')
  1423. Text('出库单号:' + '1231231231233')
  1424. .fontSize($r('app.float.robot_state_font_size'))
  1425. .textAlign(TextAlign.Start)
  1426. .fontColor('#99000000')
  1427. .width('100%')
  1428. }.width('40%')
  1429. .height('30%')
  1430. Divider().vertical(false)
  1431. .width('60%')
  1432. Column() {
  1433. Text('录入数量')
  1434. .fontSize($r('app.float.robot_state_font_size'))
  1435. .textAlign(TextAlign.Start)
  1436. .fontColor('#99000000')
  1437. .width('40%')
  1438. Counter() {
  1439. }
  1440. .width('417px')
  1441. .height('107px')
  1442. .onInc(() => {
  1443. })
  1444. .onDec(() => {
  1445. })
  1446. }
  1447. }
  1448. .width('50%')
  1449. .height('100%')
  1450. .backgroundColor('#F1F3F5')
  1451. .borderRadius(20)
  1452. Row() {
  1453. }.width('25%')
  1454. .height('100%')
  1455. .onClick(() => {
  1456. this.controller.close()
  1457. })
  1458. }
  1459. .width('48%')
  1460. .height('74%')
  1461. .backgroundColor($r('app.color.white_f1f3f5'))
  1462. .height('100%')
  1463. .justifyContent(FlexAlign.Center)
  1464. }
  1465. }
  1466. // 物料详情弹窗(批次号)
  1467. @CustomDialog
  1468. struct MaterialDetailTwoDialog {
  1469. @Link value: number
  1470. @Link CunQuHuo: number
  1471. scroller: Scroller = new Scroller()
  1472. @State navigation: number = 0
  1473. @Link textValue: string
  1474. @Link inputValue: string
  1475. controller: CustomDialogController
  1476. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  1477. build() {
  1478. Column() {
  1479. Column() {
  1480. }
  1481. .width('100%')
  1482. .height('20%')
  1483. .onClick(() => {
  1484. this.controller.close()
  1485. })
  1486. Row() {
  1487. Row() {
  1488. }
  1489. .width('25%')
  1490. .height('100%')
  1491. .onClick(() => {
  1492. this.controller.close()
  1493. })
  1494. Column({ space: 20 }) {
  1495. Text('物料详情')
  1496. .textAlign(TextAlign.Center)
  1497. .width('100%')
  1498. .height('20%')
  1499. .fontSize('51px')
  1500. Column({ space: 10 }) {
  1501. Text('PCBA-ASSSD电路板')
  1502. .fontSize('32px')
  1503. .width('100%')
  1504. Text('100*200')
  1505. .fontSize($r('app.float.robot_state_font_size'))
  1506. .textAlign(TextAlign.Start)
  1507. .fontColor('#99000000')
  1508. .width('100%')
  1509. Text('批次号:' + '1223341232123124121')
  1510. .fontSize($r('app.float.robot_state_font_size'))
  1511. .textAlign(TextAlign.Start)
  1512. .fontColor('#99000000')
  1513. .width('100%')
  1514. Text('计划编号:' + '1231231231233')
  1515. .fontSize($r('app.float.robot_state_font_size'))
  1516. .textAlign(TextAlign.Start)
  1517. .fontColor('#99000000')
  1518. .width('100%')
  1519. Text('订单编号:' + '1231231231233')
  1520. .fontSize($r('app.float.robot_state_font_size'))
  1521. .textAlign(TextAlign.Start)
  1522. .fontColor('#99000000')
  1523. .width('100%')
  1524. Text('出库单号:' + '1231231231233')
  1525. .fontSize($r('app.float.robot_state_font_size'))
  1526. .textAlign(TextAlign.Start)
  1527. .fontColor('#99000000')
  1528. .width('100%')
  1529. }.width('40%')
  1530. .height('30%')
  1531. Divider().vertical(false)
  1532. .width('60%')
  1533. Column() {
  1534. Text('录入数量')
  1535. .fontSize($r('app.float.robot_state_font_size'))
  1536. .textAlign(TextAlign.Start)
  1537. .fontColor('#99000000')
  1538. .width('40%')
  1539. Counter() {
  1540. Text(this.value.toString())
  1541. }
  1542. .width('417px')
  1543. .height('107px')
  1544. .onInc(() => {
  1545. this.value++
  1546. })
  1547. .onDec(() => {
  1548. this.value--
  1549. })
  1550. }
  1551. }.width('50%')
  1552. .height('100%')
  1553. .backgroundColor('#F1F3F5')
  1554. .borderRadius(20)
  1555. Row() {
  1556. }.width('25%')
  1557. .height('100%')
  1558. .onClick(() => {
  1559. this.controller.close()
  1560. })
  1561. }.width('100%')
  1562. .height('60%')
  1563. Column() {
  1564. }.width('100%')
  1565. .height('20%')
  1566. .onClick(() => {
  1567. this.controller.close()
  1568. })
  1569. }.width('100%')
  1570. .backgroundColor('#4d000000')
  1571. .height('100%')
  1572. .justifyContent(FlexAlign.Center)
  1573. // dialog默认的borderRadius为24vp,如果需要使用border属性,请和borderRadius属性一起使用。
  1574. }
  1575. }
  1576. function getMaterialPositionStr(locationNo: string): string {
  1577. if (!locationNo || locationNo.length <= 0 || locationNo.split('-').length != 3) {
  1578. return ''
  1579. }
  1580. let resultStr: string = 'X:'
  1581. let strArray: string[] = locationNo.split('-')
  1582. resultStr += strArray[0]
  1583. resultStr += ' Y:' + strArray[1]
  1584. resultStr += ' ' + strArray[2] + '层'
  1585. return resultStr
  1586. }
  1587. class BoxInfo {
  1588. // 是否可绑定0-否 1-是
  1589. isEnable?: number
  1590. // 物料信息
  1591. list?: MaterialInfo[]
  1592. // 料箱id
  1593. vehicleId?: string
  1594. // 料箱名称
  1595. vehicleName?: string
  1596. // 料箱编号
  1597. vehicleNo?: string
  1598. }
  1599. export interface boxMaterialClass {
  1600. //料箱等级
  1601. vehicleLevel?: string
  1602. materialCode?: string
  1603. //载具编号
  1604. vehicleCode?: string
  1605. //产品规格
  1606. spec?: string
  1607. //批次号
  1608. batchCode?: string;
  1609. ///完成数量
  1610. completedNum?: number
  1611. //已经占用箱数
  1612. useNum?: number
  1613. //空箱数
  1614. emptyBoxNum?: string
  1615. //可用箱数
  1616. canUsedNum?: string
  1617. //总容量箱数
  1618. allNum?: number
  1619. //仓储类型
  1620. type?: string
  1621. //储位坐标
  1622. coordinate?: string
  1623. //储位位置
  1624. position?: string
  1625. //创建时间
  1626. created?: string
  1627. //
  1628. creator?: string
  1629. //仓库编码
  1630. houseNo?: string
  1631. deptId?: string
  1632. houseType?: string
  1633. //主键
  1634. id?: string
  1635. locationNo?: string
  1636. // 物料名称
  1637. materialName?: string
  1638. //物料编码
  1639. materialNo?: string
  1640. //出入库数量
  1641. num?: number
  1642. orgId?: string
  1643. planNo?: string
  1644. // 序列号
  1645. seqNo?: string
  1646. // 状态;1-待处理;2-处理中;3-处理异常;4-已完成
  1647. state?: number
  1648. // 库存数量
  1649. stockNum?: string
  1650. //出入库任务单号
  1651. taskNo?: string
  1652. unit?: string
  1653. updated?: string
  1654. //任务名称
  1655. taskName?: string
  1656. updator?: string
  1657. vehicleNo?: string
  1658. pageNo?: number
  1659. pageSize?: number
  1660. }
  1661. export interface outBoxClass {
  1662. orderId?: string
  1663. orderType?: string
  1664. }
  1665. export interface outboundClass {
  1666. cmdId?: string
  1667. code?: string
  1668. msg?: string
  1669. }
  1670. export class controlClass {
  1671. houseNo?: string
  1672. orderId?: string
  1673. type?: number
  1674. vehicleNo?: string
  1675. }