import request from '@/utils/request'

// 查询班产任务列表
export function listShiftTask(query) {
	return request({
		url: '/mes/shiftTask/list',
		method: 'get',
		params: query
	})
}



// 查询班产任务列表以及关联的数据
export function listShiftTaskWithAssociatedData(query) {
	return request({
		url: '/mes/shiftTask/withAssociatedData/list',
		method: 'get',
		params: query
	})
}


// 高级查询班产任务列表
export function advListShiftTask(query) {
	return request({
		url: '/mes/shiftTask/advList',
		method: 'get',
		params: query
	})
}

// 查询班产任务详细
export function getShiftTask(id) {
	return request({
		url: '/mes/shiftTask/' + id,
		method: 'get'
	})
}

// 新增班产任务
export function addShiftTask(data) {
	return request({
		url: '/mes/shiftTask',
		method: 'post',
		data: data
	})
}

// 修改班产任务
export function updateShiftTask(data) {
	return request({
		url: '/mes/shiftTask',
		method: 'put',
		data: data
	})
}

// 删除班产任务
export function delShiftTask(id) {
	return request({
		url: '/mes/shiftTask/' + id,
		method: 'delete'
	})
}


// 根据工单生成班产任务、班产作业
export function generateShiftTaskFromPwo(data) {
	return request({
		url: '/mes/shiftTask/generate/fromPwo',
		method: 'post',
		data: data
	})
}

// 根据工单生成班产任务、班产作业并打印
export function generateShiftTaskAndPrintFromPwo(data) {
	return request({
		url: '/mes/shiftTask/generateAndPrint/fromPwo',
		method: 'post',
		data: data
	})
}


export function mergeTaskPdfs(ids, template) {
	return request({
		url: '/mes/shiftTask/mergeTaskPdfs/' + template,
		method: 'post',
		data: ids
	})
}


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