import request from '@/utils/request'

export function handleConvert(id) {
	return request({
		url: '/mes/pwoJob/convert/' + id,
		method: 'post'
	})
}

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

// 查询车间物料转移单详细
export function getConversion(id) {
	return request({
		url: '/mes/conversion/' + id,
		method: 'get'
	})
}


//计算工单已领料各物料总数
export function calculateCvTotalNum(data) {
	return request({
		url: '/mes/conversion/calculateCvTotalNum',
		method: 'post',
		data: data
	})
}
// 查询车间物料转移单列表
export function listConversion(query) {
	return request({
		url: '/mes/conversion/list',
		method: 'get',
		params: query
	})
}

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

// 查询人员上机历史列表
export function listEmpEqpHistory(query) {
	return request({
		url: '/basic/empEqpHistory/list',
		method: 'get',
		params: query
	})
}

// 查询员工管理列表
export function listEmployee(query) {
	return request({
		url: '/basic/employee/list',
		method: 'get',
		params: query
	})
}

// 作业开工
export function pwoStart(id, date) {
	return request({
		url: '/mes/pwoJob/start/' + id + '/' + date,
		method: 'post',
	})
}

// 作业暂停
export function pwoStop(id, date) {
	return request({
		url: '/mes/pwoJob/stop/' + id + '/' + date,
		method: 'post',
	})
}

/** 获取近7天新建的工单状态 */
export function getPwoStatus() {
	return request({
		url: '/report/mes/pwo/pwoStatus',
		method: 'get',
	})
}

/** 获取开屏首页生产报表数据 */
export function getProduceReport() {
	return request({
		url: '/report/mes/pwo/product',
		method: 'get',
	})
}

// 查询报工率
export function reportRate(query) {
	return request({
		url: '/report/mes/pwo/reportRate',
		method: 'get',
		params: query
	})
}

/** 获取近7天新建的工单状态 */
export function getWeekReport() {
	return request({
		url: '/report/mes/pwo/weekReport',
		method: 'get',
	})
}