CompleteSet.ets 62 KB

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