import request from '@/utils/request'

/**
 * 通用
 * */

// 获取生产派工计划
export function getProductPlans(query) {
  return request({
    url: '/mes/api/getProductPlans',
    method: 'get',
    params: query
  })
}

// 完成生产计划明细
export function completeProductPlanDetail(query) {
  return request({
    url: '/mes/api/completeProductPlanDetail',
    method: 'post',
    data: query
  })
}

export function getStockTotal(query) {
  return request({
    url: '/wms/api/getStockTotal',
    method: 'get',
    params: query
  })
}

/**
 * 1、4楼装配
 * */


// 获取生产计划明细
export function getProductPlanDetails(query) {
  return request({
    url: '/mes/api/getProductPlanDetails',
    method: 'get',
    params: query
  })
}

// 获取仓库列表
export function getWarehouses(query) {
  return request({
    url: '/wms/api/getWarehouses',
    method: 'get',
    params: query
  })
}

// 申请领料
export function applyRawOutstock(query) {
  return request({
    url: '/wms/api/applyRawOutstock',
    method: 'post',
    data: query
  })
}

// 生成生产计划明细
export function insertProductPlanDetails(query) {
  return request({
    url: '/mes/api/insertProductPlanDetails',
    method: 'post',
    data: query
  })
}

// 开始生产计划明细
export function startProductPlanDetail(query) {
  return request({
    url: '/mes/api/startProductPlanDetail',
    method: 'post',
    data: query
  })
}


// 一楼成品入库
export function firstFloorProduceInstock(data) {
  return request({
    url: '/wms/api/firstFloorProduceInstock',
    method: 'post',
    data: data
  })
}

// 四楼成品入库
export function fourthFloorProduceInstock(data) {
  return request({
    url: '/wms/api/fourthFloorProduceInstock',
    method: 'post',
    data: data
  })
}

//扫描物料条码确认使用
export function scanMaterial2Confirm(data) {
  return request({
    url: '/mes/api/scanMaterial2Confirm',
    method: 'post',
    data: data
  })
}

/**
 * 4楼折弯、5楼
 * */

// 获取最新的生产计划明细
export function getNewestProductPlanDetail(query) {
  return request({
    url: '/mes/api/getNewestProductPlanDetail/',
    method: 'get',
    params: query
  })
}

// 开始/继续生产派工计划
export function startNextProductPlanDetail(query) {
  return request({
    url: '/mes/api/startNextProductPlanDetail',
    method: 'post',
    data: query
  })
}


// 开始/继续生产派工计划，适用于五楼装配工位
export function scan2StartNextProductPlanDetail(query) {
  return request({
    url: '/mes/api/scan2StartNextProductPlanDetail',
    method: 'post',
    data: query
  })
}

/**
 * 4楼激光
 * */


// 获取最新的生产计划明细
export function getNewestProductPlanDetailJoinAttach(query) {
  return request({
    url: '/mes/api/getNewestProductPlanDetailJoinAttach',
    method: 'get',
    params: query
  })
}


// 开始/继续下一生产计划明细
export function startNextProductPlanDetailAttach(query) {
  return request({
    url: '/mes/api/startNextProductPlanDetailAttach',
    method: 'post',
    data: query
  })
}


// 获取生产派工图纸列表
export function getPlanDrawings(query) {
  return request({
    url: '/mes/api/getProductPlanDrawings',
    method: 'get',
    params: query
  })
}

//激光切割工位板材入库
export function addRawInstock(data) {
  return request({
    url: '/wms/api/addRawInstock',
    method: 'post',
    data: data
  })
}

//激光切割工位板材出库
export function directRawOutstock(data) {
  return request({
    url: '/wms/api/directRawOutstock',
    method: 'post',
    data: data
  })
}



// 柜体绑定
export function bindBarcode(data) {
  return request({
    url: '/mes/api/bindBarcode',
    method: 'post',
    data: data
  })
}

// 返库
export function applyRawBack(data) {
  return request({
    url: '/wms/api/applyRawBack',
    method: 'post',
    data: data
  })
}


//  退库
export function applyRawReturn(data) {
  return request({
    url: '/wms/api/applyRawReturn',
    method: 'post',
    data: data
  })
}


//  下发柜体到具体工位
export function assignTask(data) {
  return request({
    url: '/mes/api/assignTask',
    method: 'post',
    data: data
  })
}
// 查询物料安装情况
export function selectMaterialInstallationCircumstance(query) {
  return request({
    url: '/mes/api/selectMaterialInstallationCircumstance',
    method: 'get',
    params: query
  })
}
