import { transaction, dict, baseServer } from '@/api'
import request from '@/utils/require'

// 列表页
export function list(data) {
  return request({
    url: `${transaction}/entryandexitorder/select?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data: data
  })
}
// detail
export function detail(id) {
  return request({
    url: `${transaction}/entryandexitorder/v2/getDTO/${id}`,
    method: 'get',
  })
}
//
export function del(id) {
  return request({
    url: `${transaction}/entryandexitorder/v2/del/${id}`,
    method: 'delete',
  })
}

//字典查品种
export function varietys(pdictCode) {
  return request({
    url: `${dict}/dataDictionary/getDataGroup?groupId=PM001&pdictCode=11`,
    method: 'get'
  })
}

// 出入库委托书-新增ver2
export function insert(data) {
  return request({
    url: `${transaction}/entryandexitorder/v2/insert`,
    method: 'post',
    data: data
  })
}
// update
export function update(data) {
  return request({
    url: `${transaction}/entryandexitorder/v2/update`,
    method: 'put',
    data: data
  })
}
// shenhe
export function update2NextNode(data) {
  return request({
    url: `${transaction}/entryandexitorder/update2NextNode`,
    method: 'put',
    data: data
  })
}

//pz
export function getPzOptions(data) {
  return request({
    url: `${dict}/dataDictionary/getDataGroup?groupId=PM001&pdictCode=22`,
    method: 'get',
  })
}
// dj
//等级
export function getdjOptions(pdictCode) {
  return request({
    url: `${dict}/dataDictionary/findByGroupId/${pdictCode}`,
    method: 'get'
  })
}
//产地
export function getDataGroup(data) {
  return request({
    url: `${dict}/dataDictionary/getDataGroup/${data.groupId}/${data.pdictCode}`,
    method: 'get'
  })
}
//根据库点查仓号

export function warehouseListByKddm(kddm) {
  return request({
    url: `${baseServer}/warehouseListByKddm/${kddm}`,
    method: 'post'
  })
}
////库点下拉
export function selectkdxxList() {
  return request({
    url: `${baseServer}/sinkpointList`,
    method: 'post',
    data: {}
  })
}
//获取轮换协议号
export function queryProtocolCodeList(data) {
  return request({
    url: `${transaction}/entryandexitorder/queryProtocolCodeList`,
    method: 'post',
    params:data
  })
}