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

//新增采购收货单
export function addReceive(data) {
	return request({
		url: '/purchase/receive',
		method: 'post',
		data: data
	})
}

// 修改采购收货单
export function updateReceive(data) {
	return request({
		url: '/purchase/receive',
		method: 'put',
		data: data
	})
}

export function updateReceiveDetail(data) {
	return request({
		url: '/purchase/receive/updateDetail',
		method: 'put',
		data: data
	})
}

// 查询采购收货单明细信息
export function getReceiveDetail(id) {
	return request({
		url: '/purchase/receive/getReceiveDetail/' + id,
		method: 'get'
	})
}

// 查询采购收货单明细信息join
export function getReceiveDetailJoin(id) {
	return request({
		url: '/purchase/receive/getReceiveDetailJoin/' + id,
		method: 'get'
	})
}

// 查询采购收货单明细信息
export function getQualityDetail(data) {
	return request({
		url: '/purchase/quality/getQualityDetail',
		method: 'get',
		params: data
	})
}

//收货单列表
export function listReceive(query) {
	return request({
		url: '/purchase/receive/list',
		method: 'get',
		params: query
	})
}


// 新增采购入库单
export function addIn(data) {
	return request({
		url: '/purchase/in',
		method: 'post',
		data: data
	})
}

// 查询采购入库质检单列表
export function listQuality(query) {
	return request({
		url: '/purchase/quality/list',
		method: 'get',
		params: query
	})
}

// 查询采购入库质检单详细
export function getQuality(id) {
	return request({
		url: '/purchase/quality/' + id,
		method: 'get'
	})
}

// 新增采购入库质检单
export function addQuality(data) {
	return request({
		url: '/purchase/quality',
		method: 'post',
		data: data
	})
}

// 新增采购入库质检单
export function addQualityDetail(data) {
	return request({
		url: '/purchase/quality/detail',
		method: 'post',
		data: data
	})
}

// 修改采购入库质检单
export function updateQuality(data) {
	return request({
		url: '/purchase/quality',
		method: 'put',
		data: data
	})
}

// 删除采购入库质检单
export function delQuality(id) {
	return request({
		url: '/purchase/quality/' + id,
		method: 'delete'
	})
}

// 查询采购任务单详细
export function getTask(id) {
	return request({
		url: '/purchase/task/' + id,
		method: 'get'
	})
}

// 查询采购收货单详细
export function getReceive(id) {
	return request({
		url: '/purchase/receive/' + id,
		method: 'get'
	})
}

// 查询采购任务单列表
export function listTask(query) {
	return request({
		url: '/purchase/task/list',
		method: 'get',
		params: query
	})
}

// 新增采购任务单
export function addTask(data) {
	return request({
		url: '/purchase/task',
		method: 'post',
		data: data
	})
}

// 修改采购任务单
export function updateTask(data) {
	return request({
		url: '/purchase/task',
		method: 'put',
		data: data
	})
}

// 删除采购任务单
export function delTask(purchaseTaskCodes) {
	return request({
		url: '/purchase/task/' + purchaseTaskCodes,
		method: 'delete'
	})
}

// 查询采购入库单列表
export function listIn(query) {
	return request({
		url: '/purchase/in/list',
		method: 'get',
		params: query
	})
}

// 查询采购入库单详细
export function getIn(id) {
	return request({
		url: '/purchase/in/' + id,
		method: 'get'
	})
}

// 查询批号分批详细
export function getListDetail(batchNo) {
	return request({
		url: '/purchase/in/detail/' + batchNo,
		method: 'get'
	})
}


// 修改采购入库单
export function updateIn(data) {
	return request({
		url: '/purchase/in',
		method: 'put',
		data: data
	})
}

// 删除采购入库单
export function delIn(id) {
	return request({
		url: '/purchase/in/' + id,
		method: 'delete'
	})
}

//根据批号和箱号查询拆分详情
export function getListDetailByBL(data) {
	return request({
		url: '/purchase/in/listDetailByBL',
		method: 'post',
		data: data
	})
}

// 新增分批入库详情
export function addInDetail(data, type) {
	return request({
		url: '/purchase/in/detail/' + type,
		method: 'post',
		data: data
	})
}

// 新增采购入库单
export function addLotInfo(data) {
	return request({
		url: '/purchase/in/detail',
		method: 'put',
		data: data
	})
}

//获取采购任务单明细
export function getDetail(data) {
	return request({
		url: '/purchase/receive/getDetail',
		method: 'post',
		data: data
	})
}

/**根据订单号获取单据信息以新增*/
export function getDetailByPoCode(poCode) {
	return request({
		url: '/purchase/receive/getDetailByPoCode/' + poCode,
		method: 'post'
	})
}

// 新增分批入库详情
export function uploadU9(data) {
	return request({
		url: '/purchase/in/detail/uploadU9',
		method: 'post',
		data: data
	})
}

/**根据订单号/ASN单号/ASN行号查询收货、质检、退货、入库明细列表*/
export function getDetailListsBySRM(data) {
	return request({
		url: '/purchase/in/getDetailListsBySRM',
		method: 'post',
		data: data
	})
}

//选中收货单编码，回显子表
export function getQualityReceiveDetail(data) {
	return request({
		url: '/purchase/quality/getDetail',
		method: 'post',
		data: data
	})
}


// 查询供应商列表
export function listSupplier(query) {
	return request({
		url: '/basic/supplier/list',
		method: 'get',
		params: query
	})
}