index.uts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. * 物料分类接口
  3. */
  4. import { request } from '../../utils/request'
  5. /**
  6. * 根据父ID查询子分类列表
  7. * @param parentId 父分类ID
  8. * @returns
  9. */
  10. export const getItemTypeListByParentId = (parentId: number): Promise<any> => {
  11. return request({
  12. url: `/mes/md/itemtype/listByParentId?parentId=${parentId}`,
  13. method: 'GET'
  14. })
  15. }
  16. /**
  17. * 物料列表查询
  18. * @param itemTypeCode 物料分类编码(模糊查询)
  19. * @param pageNum 页码
  20. * @param pageSize 每页数量
  21. * @param keyword 物料名称关键字
  22. * @returns
  23. */
  24. export const getItemList = (itemTypeCode: string, pageNum: number, pageSize: number, keyword: string): Promise<any> => {
  25. let url = `/mes/md/mditem/listByTypeCode?itemTypeCode=${itemTypeCode}&pageNum=${pageNum}&pageSize=${pageSize}`
  26. if (keyword != null && keyword.length > 0) {
  27. url += `&itemName=${encodeURIComponent(keyword)}`
  28. }
  29. return request({
  30. url: url,
  31. method: 'GET'
  32. })
  33. }
  34. /**
  35. * 保存采购申请
  36. * @param data 采购申请数据
  37. * @returns
  38. */
  39. export const savePurchaseApply = (data: UTSJSONObject | null): Promise<any> => {
  40. return request({
  41. url: '/mes/wm/purchaseApply',
  42. method: 'POST',
  43. data: data
  44. })
  45. }
  46. /**
  47. * 确认采购申请
  48. * @param data 采购申请数据
  49. * @returns
  50. */
  51. export const confirmPurchaseApply = (data: UTSJSONObject | null): Promise<any> => {
  52. return request({
  53. url: '/mes/wm/purchaseApply/confirm',
  54. method: 'PUT',
  55. data: data
  56. })
  57. }
  58. /**
  59. * 获取采购申请列表
  60. * @param pageNum 页码
  61. * @param pageSize 每页数量
  62. * @param keyword 关键字
  63. * @param status 状态
  64. * @returns
  65. */
  66. export const getPurchaseApplyList = (pageNum: number, pageSize: number, keyword: string, status: string | null): Promise<any> => {
  67. let url = `/mes/wm/purchaseApply/list?pageNum=${pageNum}&pageSize=${pageSize}`
  68. if (keyword != null && keyword.length > 0) {
  69. url += `&applyCode=${encodeURIComponent(keyword)}`
  70. }
  71. if (status != null && status.length > 0) {
  72. url += `&status=${encodeURIComponent(status)}`
  73. }
  74. return request({
  75. url: url,
  76. method: 'GET'
  77. })
  78. }
  79. /**
  80. * 获取采购申请详情
  81. * @param applyId 申请ID
  82. * @returns
  83. */
  84. export const getPurchaseApplyById = (applyId: string): Promise<any> => {
  85. return request({
  86. url: `/mes/wm/purchaseApply/${applyId}`,
  87. method: 'GET'
  88. })
  89. }
  90. /**
  91. * 新增物料
  92. * @param data 物料数据
  93. * @returns
  94. */
  95. export const addMaterial = (data: UTSJSONObject | null): Promise<any> => {
  96. return request({
  97. url: '/mes/md/mditem',
  98. method: 'POST',
  99. data: data
  100. })
  101. }
  102. /**
  103. * 删除采购申请
  104. * @param applyId 申请ID
  105. * @returns
  106. */
  107. export const deletePurchaseApply = (applyId: string): Promise<any> => {
  108. return request({
  109. url: `/mes/wm/purchaseApply/${applyId}`,
  110. method: 'DELETE'
  111. })
  112. }
  113. /**
  114. * 获取单位列表
  115. * @returns
  116. */
  117. export const getMeasureList = (): Promise<any> => {
  118. return request({
  119. url: '/mes/md/unitmeasure/selectall',
  120. method: 'GET'
  121. })
  122. }