import request from '@/utils/request'

// 获取物料list
export function selectMaterielList(query) {
  return request({
    url: '/plan/product/list',
    method: 'get',
    params: query
  })
}

// 通过木订单code获取级联订单信息并封装
export function getCascadeProOrder(orderCode) {
  return request({
    url: '/plan/order/getCascadeProOrder/' + orderCode,
    method: 'get'
  })
}

// 获取班次信息
export function getProShifts() {
  return request({
    url: '/plan/order/getProShifts/',
    method: 'get'
  })
}

// 通过物料code获取工艺信息
export function getProRoutes(prodCode) {
  return request({
    url: '/plan/order/getProRoutes/' + prodCode,
    method: 'get'
  })
}

// 通过工艺code获取设备信息
export function getProEquipment(routeCode) {
  return request({
    url: '/plan/order/getProEquipment/' + routeCode,
    method: 'get'
  })
}

// 通过母订单id查询最新工单列表
export function getWorkOrderList(id) {
	return request({
		url: '/plan/order/getWorkOrderList/' + id,
		method: 'get'
	})
}

// 通过母订单id查询最新订单列表
export function getOrderList(id) {
	return request({
		url: '/plan/order/getOrderList/' + id,
		method: 'get'
	})
}

// 提交拆分
export function subSplitOrder(data) {
	return request({
		url: '/plan/order/subSplitOrder',
		method: 'post',
		data: data
	})
}


// 获取换算值
export function getConvert() {
	return request({
		url: '/plan/order/getConvert',
		method: 'get',
	})
}

// 获取线体
export function getprodLineShift(orderType) {
	return request({
		url: '/plan/order/getProdLineShift/'+'?type='+orderType,
		method: 'get',
	})
}

// 查询订单列表
export function listOrder(query) {
	return request({
		url: '/plan/order/list',
		method: 'get',
		params: query
	});
}

// 查询订单详细
export function getOrder(id) {
	return request({
		url: '/plan/order/' + id,
		method: 'get'
	});
}

// 新增订单
export function addOrder(data) {
	return request({
		url: '/plan/order',
		method: 'post',
		data: data
	});
}

// 修改订单
export function updateOrder(data) {
	return request({
		url: '/plan/order',
		method: 'put',
		data: data
	});
}

// 删除订单
export function delOrder(id) {
	return request({
		url: '/plan/order/' + id,
		method: 'delete'
	});
}
// 同步SAP订单
export function syncSAP() {
	return request({
		url: '/plan/order/syncSAP',
		method: 'post'
	});
}
