import request from '@/utils/request'

export function addReportOnce(data) {
	return request({
		url: '/mes/report/addOnce',
		method: 'post',
		data: data
	})
}

export function listPwoJob(query) {
	return request({
		url: '/mes/pwoJob/list',
		method: 'get',
		params: query
	})
}

export function addReport(data) {
	return request({
		url: '/mes/report',
		method: 'post',
		data: data
	})
}

export function pieceReport(pieceNo, mesJobReport) {
	return request({
		url: '/mes/report/pieceReport/' + pieceNo,
		method: 'post',
		data: mesJobReport
	})
}

export function addPiece(pieceNo) {
	return request({
		url: '/mes/conversion/addPiece',
		method: 'post',
		data: pieceNo
	})
}

export function getEquipment(id) {
	return request({
		url: '/basic/equipment/' + id,
		method: 'get'
	})
}

export function listEquipment(query) {
	return request({
		url: '/basic/equipment/list',
		method: 'get',
		params: query
	})
}

//查询作业根据id，如作业编码为JOB1000020,那么id就为20；
// 查询生产工单作业详细
export function getPwoJob(id) {
	return request({
		url: '/mes/pwoJob/' + id,
		method: 'get'
	})
}

//修改作业绑定设备必须需要上传作业的id，eqpId；
// 修改生产工单作业
export function updatePwoJob(data) {
	return request({
		url: '/mes/pwoJob',
		method: 'put',
		data: data
	})
}


// 工单报工
export function pwoReport(data) {
	return request({
		url: '/mes/pwoReport/pwoReport',
		method: 'post',
		data: data
	})
}

// 添加件号报工录入
export function addReportEnterPiece(data) {
	return request({
		url: '/mes/report/enterPiece',
		method: 'post',
		data: data
	})
}


// 添加流水线报工
export function addPipelineReport(data) {
	return request({
		url: '/mes/report/addPipeline',
		method: 'post',
		data: data
	})
}

// 查询作业报工详细
export function getReport(id) {
	return request({
		url: '/mes/report/' + id,
		method: 'get'
	})
}

export function confirmReport(mesJobReportCode) {
	return request({
		url: '/mes/report/confirmReport',
		method: 'post',
		data: mesJobReportCode
	})
}