import request from '@/utils/wms-request'

// 查询物料库存信息列表
export function listStock(query) {
	return request({
		url: '/stock/stock/list',
		method: 'get',
		params: query
	})
}

// 查询物料库存信息列表(模糊查询产品)
export function listStockLike(query) {
	return request({
		url: '/stock/stock/listLike',
		method: 'get',
		params: query
	})
}

// 查询物料库存信息详细
export function getStock(id) {
	return request({
		url: '/stock/stock/' + id,
		method: 'get'
	})
}

// 新增物料库存信息
export function addStock(data) {
	return request({
		url: '/stock/stock',
		method: 'post',
		data: data
	})
}

// 修改物料库存信息
export function updateStock(data) {
	return request({
		url: '/stock/stock',
		method: 'put',
		data: data
	})
}

// 删除物料库存信息
export function delStock(id) {
	return request({
		url: '/stock/stock/' + id,
		method: 'delete'
	})
}

// 导出物料库存信息(现在改成根据ids查询库存信息并导出)
export function exportStock(materialStockIds) {
	return request({
		url: '/stock/stock/export/' + materialStockIds,
		method: 'get'
	})
}

export function print(id) {
	return request({
		url: '/stock/stock/print/' + id,
		method: 'post'
	})
}

export function test(data) {
	return request({
		url: '/stock/history/test',
		method: 'post',
		data: data
	})
}

// 根据物料编码查询物料库存信息列表
export function listStockByMaterialCode(materialCode) {
	return request({
		url: '/stock/stock/listMaterial/' + materialCode,
		method: 'get',
	})
}

// 库位分析看板
export function listLocationByStock() {
	return request({
		url: '/stock/stock/whDashboard',
		method: 'get',
	})
}

// 货架可视化大屏
export function handleShelvesScreen(id) {
	return request({
		url: '/stock/stock/shelvesScreen/' + id,
		method: 'post',
	})
}

//超市补货
export function smSupplyStock(ids) {
	return request({
		url: '/stock/stock/smSupplyStock/' + ids,
		method: 'post'
	})
}

//填充物料信息
export function checkStock(ids) {
	return request({
		url: '/stock/stock/checkStock',
		method: 'post'
	})
}

// 新增物料移库管理
export function addTransfer(data) {
	return request({
		url: '/stock/transfer',
		method: 'post',
		data: data
	})
}

// 修改物料移库管理
export function updateTransfer(data) {
	return request({
		url: '/stock/transfer',
		method: 'put',
		data: data
	})
}

// 查询出库拆分记录列表
export function listOutSplitHistory(query) {
  return request({
    url: '/stock/outSplitHistory/list',
    method: 'get',
    params: query
  })
}