import request from '@/utils/request'

// 查询入库通知单列表
export function listTrkNotice(query) {
  return request({
    url: '/system/trkNotice/list',
    method: 'get',
    params: query
  })
}

// 查询入库通知单详细
export function getTrkNotice(id) {
  return request({
    url: '/system/trkNotice/' + id,
    method: 'get'
  })
}

// 新增入库通知单
export function addTrkNotice(data) {
  return request({
    url: '/system/trkNotice',
    method: 'post',
    data: data
  })
}

// 修改入库通知单
export function updateTrkNotice(data) {
  return request({
    url: '/system/trkNotice',
    method: 'put',
    data: data
  })
}

export function confirmNoticeTab(data) {
  return request({
    url: '/system/trkNotice/confirmNoticeTab',
    method: 'post',
    data: data
  })
}

export function sendOrderNotice(data) {
  return request({
    url: '/system/trkNotice/sendOrderNotice',
    method: 'post',
    data: data
  })
}

export function sendIwms(data) {
  return request({
    url: '/system/trkNotice/sendIwms',
    method: 'post',
    data: data
  })
}
export function sendTwoIwms(data) {
  return request({
    url: '/system/trkNotice/sendTwoIwms',
    method: 'post',
    data: data
  })
}


export function saveNoticeTab(data) {
  return request({
    url: '/system/trkNotice/saveNoticeTab',
    method: 'post',
    data: data
  })
}

export function manualCompletion(data) {
  return request({
    url: '/system/trkNotice/manualCompletion',
    method: 'post',
    data: data
  })
}

// 删除入库通知单
export function delTrkNotice(id) {
  return request({
    url: '/system/trkNotice/' + id,
    method: 'delete'
  })
}

// 删除入库通知单明细
export function delTrkNoticeTabs(id) {
  return request({
    url: '/system/trkNotice/tabs/' + id,
    method: 'delete'
  })
}

// 启用
export function enabled(id) {
  return request({
    url: '/system/trkNotice/enable/' + id,
    method: 'delete'
  })
}

// 禁用
export function disabled(id) {
  return request({
    url: '/system/trkNotice/disable/' + id,
    method: 'delete'
  })
}

// 状态修改
export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/system/trkNotice/changeStatus',
    method: 'put',
    data: data
  })
}

// 车间退货入库
export function workshopReturn(data) {
  return request({
    url: '/system/trkNotice/workshopReturn',
    method: 'post',
    data: data
  })
}