import request from '@/utils/request'

export function getWorkOrders(workorderCode) {
  return request({
    url:'/plan/pro/workorder/getWorkOrders/'+workorderCode,
    method:'get'
  })
}

// 校验工单是否可以修改
export function checkWorkOrder(workorderId){
  return request({
    url:'/plan/pro/workorder/checkWorkOrder/'+workorderId,
    method:'get'
  })
}

// 提交修改工单接口
export function subChangeWorkOrder(data){
  return request({
    url:'/plan/pro/workorder/subChangeWorkOrder',
    method:'post',
    data:data
  })
}

// 通过子工单查询父工单对应的批次list
export function getWorkBatchList(data){
  return request({
    url:'/plan/pro/workorder/getWorkBatchList',
    method:'post',
    data: data
  })
}

// 通过子工单查询订单信息和工单信息
export function getOrderAndWork(data) {
  return request({
    url: '/plan/pro/workorder/getOrderAndWorkInfo',
    method: 'post',
    data: data
  })
}

// 查询生产工单列表
export function listWorkorder(query) {
	return request({
		url: '/plan/pro/workorder/list',
		method: 'get',
		params: query
	});
}

// 查询生产工单详细
export function getWorkorder(workorderId) {
	return request({
		url: '/plan/pro/workorder/' + workorderId,
		method: 'get'
		});
}

// 新增生产工单
export function addWorkorder(data) {
	return request({
		url: '/plan/pro/workorder',
		method: 'post',
		data: data
	});
}

// 修改生产工单
export function updateWorkorder(data) {
	return request({
		url: '/plan/pro/workorder',
		method: 'put',
		data: data
	});
}

// 删除生产工单
export function delWorkorder(workorderId) {
	return request({
		url: '/plan/pro/workorder/' + workorderId,
		method: 'delete'
	});
}

//下发生产工单
export function downWorkorder(workorderId) {
	return request({
		url: '/plan/pro/workorder/downWorkorder/' + workorderId,
		method: 'post'
	});
}
