import {
  BaseListResult,
  FinishProductListStreamInListData,
  FinishProductListStreamOutListData,
  GetFinishProductListStreamParams,
  GetFinishProductOutListStreamParams,
  OtherGoodsOutParams,
} from '@models';
import {request} from './request';

const BASE_URL = '/askGoods',
  BASE_URL2 = '/warehousing';

/** 获取产成品出库流水 */
export function getFinishProductOutStreamList(
  data: GetFinishProductOutListStreamParams,
  signal?: AbortSignal,
): BaseListResult<FinishProductListStreamOutListData> {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL}/getRemovalHalf`,
    signal,
  });
}

/** 导出产成品出库流水  */
export function getFinishProductOutStreamExport(
  data: GetFinishProductOutListStreamParams,
): any {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL}/getRemovalHalfExcel`,
    skipError: true,
  });
}

/** 产成品入库流水 */
export function getFinishProductInStreamList(
  data: GetFinishProductListStreamParams,
  signal?: AbortSignal,
): BaseListResult<FinishProductListStreamInListData> {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL2}/getHalf`,
    signal,
  });
}

/** 产成品入库流水导出 */
export function getFinishProductInStreamExport(
  data: GetFinishProductListStreamParams,
): any {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL2}/getHalfExcel`,
    skipError: true,
  });
}

/** 其他出库 */
export function otherGoodsOut(data: OtherGoodsOutParams): BaseListResult {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL}/otherAskGoods`,
  });
}
