import request from '@/utils/request'
//物料

export function getMaterialList(query) {
  return request({
    url: '/mtm/material/',
    method: 'get',
    params: query
  })
}
export function createMaterial(data) {
  return request({
    url: '/mtm/material/',
    method: 'post',
    data
  })
}
export function getMaterial(id) {
  return request({
    url: `/mtm/material/${id}/`,
    method: 'get'
  })
}
export function updateMaterial(id, data) {
  return request({
    url: `/mtm/material/${id}/`,
    method: 'put',
    data
  })
}
export function deleteMaterial(id, data) {
  return request({
    url: `/mtm/material/${id}/`,
    method: 'delete',
    data
  })
}
//产品分解
export function getsubproducationList(query) {
  return request({
    url: '/mtm/subproducation/',
    method: 'get',
    params: query
  })
}
export function createsubproducation(data) {
  return request({
    url: '/mtm/subproducation/',
    method: 'post',
    data
  })
}

export function updatesubproducation(id, data) {
  return request({
    url: `/mtm/subproducation/${id}/`,
    method: 'put',
    data
  })
}
export function deletesubproducation(id, data) {
  return request({
    url: `/mtm/subproducation/${id}/`,
    method: 'delete',
    data
  })
}
//工序
export function getProcessList(query) {
  return request({
    url: '/mtm/process/',
    method: 'get',
    params: query
  })
}
export function createProcess(data) {
  return request({
    url: '/mtm/process/',
    method: 'post',
    data
  })
}
export function updateProcess(id, data) {
  return request({
    url: `/mtm/process/${id}/`,
    method: 'put',
    data
  })
}
export function deleteProcess(id, data) {
  return request({
    url: `/mtm/process/${id}/`,
    method: 'delete',
    data
  })
}
//子工序
export function getStepList(query) {
  return request({
    url: `/mtm/step/`,
    method: 'get',
    params: query
  })
}

 
export function getStepLists(id) {
  return request({
    url: `/mtm/process/${id}/steps/`,
    method: 'get'
  })
}
export function getStep(id) {
  return request({
    url: `/mtm/step/${id}/`,
    method: 'get'
  })
}
export function createStep(data) {
  return request({
    url: '/mtm/step/',
    method: 'post',
    data
  })
}
export function updateStep(id, data) {
  return request({
    url: `/mtm/step/${id}/`,
    method: 'put',
    data
  })
}
export function deleteStep(id, data) {
  return request({
    url: `/mtm/step/${id}/`,
    method: 'delete',
    data
  })
}
//产品工艺
export function getProductprocessList(query) {
  return request({
    url: '/mtm/productprocess/',
    method: 'get',
    params: query
  })
}
export function createProductprocess(data) {
  return request({
    url: '/mtm/productprocess/',
    method: 'post',
    data
  })
}
export function updateProductprocess(id, data) {
  return request({
    url: `/mtm/productprocess/${id}/`,
    method: 'put',
    data
  })
}
export function deleteProductprocess(id, data) {
  return request({
    url: `/mtm/productprocess/${id}/`,
    method: 'delete',
    data
  })
}
//输入物料

export function getInputmaterialList(query) {
  return request({
    url: '/mtm/inputmaterial/',
    method: 'get',
    params: query
  })
}
export function createInputmaterial(data) {
  return request({
    url: '/mtm/inputmaterial/',
    method: 'post',
    data
  })
}
export function updateInputmaterial(id, data) {
  return request({
    url: `/mtm/inputmaterial/${id}/`,
    method: 'put',
    data
  })
}
export function deleteInputmaterial(id, data) {
  return request({
    url: `/mtm/inputmaterial/${id}/`,
    method: 'delete',
    data
  })
}
//输出物料

export function getOutputmaterialList(query) {
  return request({
    url: '/mtm/outputmaterial/',
    method: 'get',
    params: query
  })
}
export function createOutputmaterial(data) {
  return request({
    url: '/mtm/outputmaterial/',
    method: 'post',
    data
  })
}
export function updateOutputmaterial(id, data) {
  return request({
    url: `/mtm/outputmaterial/${id}/`,
    method: 'put',
    data
  })
}
export function deleteOutputmaterial(id, data) {
  return request({
    url: `/mtm/outputmaterial/${id}/`,
    method: 'delete',
    data
  })
}
//其他材料
export function getOthermaterialList(query) {
  return request({
    url: '/mtm/othermaterial/',
    method: 'get',
    params: query
  })
}
export function createOthermaterial(data) {
  return request({
    url: '/mtm/othermaterial/',
    method: 'post',
    data
  })
}
export function updateOthermaterial(id, data) {
  return request({
    url: `/mtm/othermaterial/${id}/`,
    method: 'put',
    data
  })
}
export function deleteOthermaterial(id, data) {
  return request({
    url: `/mtm/othermaterial/${id}/`,
    method: 'delete',
    data
  })
}

//子工序

export function getUsedstepList(query) {
  return request({
    url: '/mtm/usedstep/',
    method: 'get',
    params: query
  })
}
export function createUsedstep(data) {
  return request({
    url: '/mtm/usedstep/',
    method: 'post',
    data
  })
}
export function deleteUsedstep(id, data) {
  return request({
    url: `/mtm/usedstep/${id}/`,
    method: 'delete',
    data
  })
}
//记录表格

export function getrecordformList(query) {
  return request({
    url: '/mtm/recordform/',
    method: 'get',
    params: query
  })
}
export function createrecordform(data) {
  return request({
    url: '/mtm/recordform/',
    method: 'post',
    data
  })
}
export function updaterecordform(id, data) {
  return request({
    url: `/mtm/recordform/${id}/`,
    method: 'put',
    data
  })
}
export function deleterecordform(id, data) {
  return request({
    url: `/mtm/recordform/${id}/`,
    method: 'delete',
    data
  })
}
//记录表格字段表 

export function getrffieldList(query) {
  return request({
    url: '/mtm/recordform-field/',
    method: 'get',
    params: query
  })
}
export function createrffield(data) {
  return request({
    url: '/mtm/recordform-field/',
    method: 'post',
    data
  })
}
export function updaterffield(id, data) {
  return request({
    url: `/mtm/recordform-field/${id}/`,
    method: 'put',
    data
  })
}
export function deleterffield(id, data) {
  return request({
    url: `/mtm/recordform-field/${id}/`,
    method: 'delete',
    data
  })
}
//技术文件

export function gettechdocList(query) {
  return request({
    url: '/mtm/techdoc/',
    method: 'get',
    params: query
  })
}
export function createtechdoc(data) {
  return request({
    url: '/mtm/techdoc/',
    method: 'post',
    data
  })
}
export function updatetechdoc(id, data) {
  return request({
    url: `/mtm/techdoc/${id}/`,
    method: 'put',
    data
  })
}
export function deletetechdoc(id, data) {
  return request({
    url: `/mtm/techdoc/${id}/`,
    method: 'delete',
    data
  })
}

