merge.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. */
  60. export interface BoxInboundResult {
  61. t1: string // 料箱编码
  62. t2: string // 执行结果消息
  63. }
  64. /**
  65. * 执行料箱回库(呼唤机器人)
  66. * @param warehouse 仓库
  67. * @param boxCodes 可选的料箱编码列表,如果不传则回库所有料箱
  68. */
  69. export function boxInbound(warehouse: string, boxCodes?: string[]): Promise<BoxInboundResult[]> {
  70. const params: any = { warehouse }
  71. if (boxCodes && boxCodes.length > 0) {
  72. params.boxCodes = boxCodes
  73. }
  74. return request<BoxInboundResult[]>({
  75. url: '/api/wms/location/merge/boxInbound',
  76. method: 'post',
  77. params,
  78. paramsSerializer: (params: any) => {
  79. const searchParams = new URLSearchParams()
  80. Object.keys(params).forEach(key => {
  81. const value = params[key]
  82. if (Array.isArray(value)) {
  83. // Spring @RequestParam List 期望格式: key=v1&key=v2
  84. value.forEach(item => searchParams.append(key, item))
  85. } else {
  86. searchParams.append(key, value)
  87. }
  88. })
  89. return searchParams.toString()
  90. }
  91. })
  92. }
  93. /**
  94. * 重新下发指定站点和料箱的任务
  95. * @param warehouse 仓库
  96. * @param stationCode 站点编码
  97. * @param boxCode 料箱编码
  98. */
  99. export function reissueTask(warehouse: string, stationCode: string, boxCode: string) {
  100. return request<boolean>({
  101. url: '/api/wms/location/merge/reissueTask',
  102. method: 'post',
  103. params: { warehouse, stationCode, boxCode }
  104. })
  105. }
  106. /**
  107. * 获取料箱状态映射
  108. * @param warehouse 仓库
  109. * @param boxCodeList 料箱编码列表
  110. */
  111. export function getBoxStatus(warehouse: string, boxCodeList: string[]) {
  112. return request<Record<string, number>>({
  113. url: '/api/wms/location/merge/boxStatus',
  114. method: 'get',
  115. params: { warehouse, boxCodeList },
  116. paramsSerializer: (params: any) => {
  117. const searchParams = new URLSearchParams()
  118. Object.keys(params).forEach(key => {
  119. const value = params[key]
  120. if (Array.isArray(value)) {
  121. // Spring @RequestParam List 期望格式: key=v1&key=v2
  122. value.forEach(item => searchParams.append(key, item))
  123. } else {
  124. searchParams.append(key, value)
  125. }
  126. })
  127. return searchParams.toString()
  128. }
  129. })
  130. }
  131. /**
  132. * 获取正在作业中的并库任务详情
  133. * @param warehouse 仓库
  134. */
  135. export function getWorkingMergeTasks(warehouse: string) {
  136. return request<LocationMergeDetails[]>({
  137. url: '/api/wms/location/merge/workingTasks',
  138. method: 'get',
  139. params: { warehouse }
  140. })
  141. }
  142. /**
  143. * 海康-站点解绑
  144. * @param data
  145. */
  146. export function boxAndStationUnbindTask(params:any) {
  147. return request({
  148. url: '/api/wms/location/merge/boxAndStationUnbindTask',
  149. method: 'post',
  150. params
  151. })
  152. }