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

// 查询退料入库单列表
export function listIn(query) {
	return request({
		url: '/produce/back/in/list',
		method: 'get',
		params: query
	})
}

// 查询退料入库单详细
export function getIn(id) {
	return request({
		url: '/produce/back/in/' + id,
		method: 'get'
	})
}

// 查询批号分批详细
export function getListDetail(data) {
	return request({
		url: '/produce/back/in/detail/',
		method: 'post',
		data: data
	})
}

// 新增退料入库单
export function addIn(data) {
	return request({
		url: '/produce/back/in',
		method: 'post',
		data: data
	})
}

// 修改退料入库单
export function updateIn(data) {
	return request({
		url: '/produce/back/in',
		method: 'put',
		data: data
	})
}

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

// 删除退料入库单
export function delIn(id) {
	return request({
		url: '/produce/back/in/' + id,
		method: 'delete'
	})
}

// 导出退料入库单
export function exportIn(query) {
	return request({
		url: '/produce/back/in/export',
		method: 'get',
		params: query
	})
}

/**根据上级单号获取单据信息以新增*/
export function getInBySrc(data) {
	return request({
		url: '/produce/back/in/getInBySrc',
		method: 'post',
		data: data
	})
}

// 根据编码查询入库单，参数为入库单对象
export function getInByCode(data) {
	return request({
		url: '/produce/back/in/getInByCode',
		method: 'post',
		data: data
	})
}


/**根据任务明细扫码直接退料入库单
 * data示例:{"backTaskDetailCode": "xxx000001","whCode": "02001","areaCode": "B2B201"}
 * */
export function directBackInByTaskDetail(data) {
	return request({
		url: '/produce/back/in/directBackInByTaskDetail',
		method: 'post',
		data: data
	})
}

// 查询生产退料单详细
export function getTaskDetailByDetailCode(code) {
	return request({
		url: '/produce/back/task/taskDetail/' + code,
		method: 'get'
	})
}