merge.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // @ts-ignore
  2. import request from '@/utils/request'
  3. // 库位合并详情
  4. export interface LocationMergeDetails {
  5. id?: number
  6. code?: string
  7. warehouse?: string
  8. sourceLocation?: string
  9. targetLocation?: string
  10. sourceBox?: string
  11. targetBox?: string
  12. status?: string
  13. quantity?: number
  14. moveQty?: number
  15. sku?: string
  16. barcode?: string
  17. productName?: string
  18. lotNumber?: string
  19. owner?: string
  20. qualityStatus?: string
  21. warehouseType?: string
  22. productionDate?: string
  23. expiryDate?: string
  24. involveBox?: string[]
  25. }
  26. // 料箱相关的并库详情VO
  27. export interface BoxRelatedMergeDetailsVO {
  28. boxCode: string
  29. station: string
  30. mergeDetails: LocationMergeDetails[]
  31. boxStatus: number // 0,10-等待调箱, 20-到达, 30-取消, 40-异常
  32. inventoryLocations: string[]
  33. }
  34. /**
  35. * 通过料箱号查看相关作业中任务详情
  36. * @param boxCode 料箱号
  37. */
  38. export function getWorkingDetailsByBox(boxCode: string, warehouse: string) {
  39. return request<BoxRelatedMergeDetailsVO[]>({
  40. url: '/api/wms/location/merge/workingDetailsByBox',
  41. method: 'get',
  42. params: { boxCode, warehouse }
  43. })
  44. }
  45. /**
  46. * 获取料箱库位的隔口种类
  47. * @param warehouse 仓库
  48. * @param locations 库位列表
  49. */
  50. export function getBoxSplitCode(warehouse: string, locations: string[]) {
  51. return request<Record<string, number>>({
  52. url: `/api/basic/location/getBoxSplitCode/${warehouse}`,
  53. method: 'post',
  54. data: locations
  55. })
  56. }
  57. /**
  58. * 执行料箱回库(呼唤机器人)
  59. * @param warehouse 仓库
  60. * @param boxCodes 可选的料箱编码列表,如果不传则回库所有料箱
  61. */
  62. export function boxInbound(warehouse: string, boxCodes?: string[]) {
  63. const params: any = { warehouse }
  64. if (boxCodes && boxCodes.length > 0) {
  65. params.boxCodes = boxCodes
  66. }
  67. return request<[string, string][]>({
  68. url: '/api/wms/location/merge/boxInbound',
  69. method: 'post',
  70. params,
  71. paramsSerializer: (params: any) => {
  72. const searchParams = new URLSearchParams()
  73. Object.keys(params).forEach(key => {
  74. const value = params[key]
  75. if (Array.isArray(value)) {
  76. // Spring @RequestParam List 期望格式: key=v1&key=v2
  77. value.forEach(item => searchParams.append(key, item))
  78. } else {
  79. searchParams.append(key, value)
  80. }
  81. })
  82. return searchParams.toString()
  83. }
  84. })
  85. }
  86. /**
  87. * 重新下发指定站点和料箱的任务
  88. * @param warehouse 仓库
  89. * @param stationCode 站点编码
  90. * @param boxCode 料箱编码
  91. */
  92. export function reissueTask(warehouse: string, stationCode: string, boxCode: string) {
  93. return request<boolean>({
  94. url: '/api/wms/location/merge/reissueTask',
  95. method: 'post',
  96. params: { warehouse, stationCode, boxCode }
  97. })
  98. }
  99. /**
  100. * 获取料箱状态映射
  101. * @param warehouse 仓库
  102. * @param boxCodeList 料箱编码列表
  103. */
  104. export function getBoxStatus(warehouse: string, boxCodeList: string[]) {
  105. return request<Record<string, number>>({
  106. url: '/api/wms/location/merge/boxStatus',
  107. method: 'get',
  108. params: { warehouse, boxCodeList },
  109. paramsSerializer: (params: any) => {
  110. const searchParams = new URLSearchParams()
  111. Object.keys(params).forEach(key => {
  112. const value = params[key]
  113. if (Array.isArray(value)) {
  114. // Spring @RequestParam List 期望格式: key=v1&key=v2
  115. value.forEach(item => searchParams.append(key, item))
  116. } else {
  117. searchParams.append(key, value)
  118. }
  119. })
  120. return searchParams.toString()
  121. }
  122. })
  123. }
  124. /**
  125. * 获取正在作业中的并库任务详情
  126. * @param warehouse 仓库
  127. */
  128. export function getWorkingMergeTasks(warehouse: string) {
  129. return request<LocationMergeDetails[]>({
  130. url: '/api/wms/location/merge/workingTasks',
  131. method: 'get',
  132. params: { warehouse }
  133. })
  134. }