import request from '@/utils/request'

export function createPick(data) {
  return request({
    url: '/wpm/wmaterial/pick/',
    method: 'post',
    data
  })
}

export function getwmaterialList(query) {
  return request({
    url: '/wpm/wmaterial/',
    method: 'get',
    params: query
  })
}
//车间生产计划
export function getsubplanList(query) {
  return request({
    url: '/wpm/subplan/',
    method: 'get',
    params: query
  })
}

//车间操作
export function createWork(data) {
  return request({
    url: '/wpm/do/init/',
    method: 'post',
    data
  })
}
//提交
export function submitWork(data) {
  return request({
    url: '/wpm/do/submit/',
    method: 'post',
    data
  })
}
//子工序半成品
export function getwproductList(query) {
  return request({
    url: '/wpm/wproduct/',
    method: 'get',
    params: query
  })
}

//半成品检验

export function wproductTest(data) {
  return request({
    url: '/wpm/wproduct/test/',
    method: 'post',
    data
  })
}


//半成品入库

export function wproductPutin(id, data) {
  return request({
    url: `/wpm/wproduct/${id}/putin/`,
    method: 'post',
    data
  })
}
//车间领半成品


export function getpickhalfList(id) {
  return request({
    url: `/wpm/subplan/${id}/pick_half/`,
    method: 'get'
  })
}

//子计划半成品领料
export function createpickhalf(id, data) {
  return request({
    url: `/wpm/subplan/${id}/pick_half/`,
    method: 'post',
    data
  })
}

//车间点击对应工序的子工序，创建操作记录


export function createOperation(data) {
  return request({
    url: '/wpm/operation/',
    method: 'post',
    data
  })
}

//生产记录操作记录列表


export function getoperationList(query) {
  return request({
    url: '/wpm/operation/',
    method: 'get',
    params: query
  })
}

//生产操作，提交边角料
export function createoperation(id, data) {
  return request({
    url: `/wpm/operation/${id}/`,
    method: 'put',
    data
  })
}

//调取一条操作记录
export function getoperation(id) {
  return request({
    url: `/wpm/operation/${id}/`,
    method: 'get'
  })
}

//操作使用的半成品列表
export function getoperationwproductList(query) {
  return request({
    url: '/wpm/operation_wproduct/',
    method: 'get',
    params: query
  })
}
//操作半成品删除
export function deleteOperationwproduct(id) {
  return request({
    url: `/wpm/operation_wproduct/${id}/`,
    method: 'delete',
  })
}


//删除操作记录
export function deleteOperation(id) {
  return request({
    url: `/wpm/operation/${id}/`,
    method: 'delete',
  })
}

//操作设备
export function getequList(query) {
  return request({
    url: '/wpm/operation_equip/',
    method: 'get',
    params: query
  })
}
//操作设备删除
export function deleteOperationequip(id) {
  return request({
    url: `/wpm/operation_equip​/${id}/`,
    method: 'delete',
  })
}



//操作自定义表
export function getrecordList(query) {
  return request({
    url: '/wpm/operation_record/',
    method: 'get',
    params: query
  })
}
//操作提交自定义表
export function createRecord(id, data) {
  return request({
    url: `/wpm/operation_record/${id}/submit/`,
    method: 'post',
    data
  })
}

//操作消耗物料

export function getinputList(query) {
  return request({
    url: '/wpm/operation_input/',
    method: 'get',
    params: query
  })
}

//车间物料消耗


export function createInput(data) {
  return request({
    url: '/wpm/operation_input/',
    method: 'post',
    data
  })
}
//操作，产出物料
export function getoutputList(query) {
  return request({
    url: '/wpm/operation_output/',
    method: 'get',
    params: query
  })
}
//产出物料

export function createOutput(data) {
  return request({
    url: '/wpm/operation_output/',
    method: 'post',
    data
  })
}

//提交本次操作

export function submitOperation(id, data) {
  return request({
    url: `/wpm/operation/${id}/submit/`,
    method: 'post',
    data
  })
}

//操作，工序工装
export function gettoolList(query) {
  return request({
    url: '/wpm/operation_tool/',
    method: 'get',
    params: query
  })
}
//操作工序工装

export function createTool(data) {
  return request({
    url: '/wpm/operation_tool/',
    method: 'post',
    data
  })
}

//检验合格的半成品批量入库
export function createputins(data) {
  return request({
    url: '/wpm/wproduct/putins/',
    method: 'post',
    data
  })
}
//车间领料批量提交
export function createInputs(data) {
  return request({
    url: '/wpm/operation_input/creates/',
    method: 'post',
    data
  })
}
//产出批量提交
export function createOutputs(data) {
  return request({
    url: '/wpm/operation_output/creates/',
    method: 'post',
    data
  })
}


//表格初始化

export function recordInit(id) {
  return request({
    url: `/wpm/operation_record/${id}/init/`,
    method: 'GET',
  })
}

//半产品复检
export function wproductReview(data) {
  return request({
    url: '/wpm/wproduct/test_init/',
    method: 'post',
    data
  })
}



