import request from '@/utils/request'

//生产排程
export function getProductionplanList(query) {
  return request({
    url: 'pm/production_plan/',
    method: 'get',
    params: query
  })
}
export function createProductionplan(data) {
  return request({
    url: 'pm/production_plan/',
    method: 'post',
    data
  })
}
//计算物料配置
export function createresource(data) {
  return request({
    url: '/pm/resource/cal/',
    method: 'post',
    data
  })
}
//产品对应的设备
export function createequip(data) {
  return request({
    url: '/pm/resource/cal_equip/',
    method: 'post',
    data
  })
}
//生成子计划
export function createsubplan(id, data) {
  return request({
    url: `/pm/production_plan/${id}/gen_subplan/`,
    method: 'post',
    data
  })
}
//子计划列表
export function getsubproductionplanList(query) {
  return request({
    url: '/pm/subproduction_plan/',
    method: 'get',
    params: query
  })
}
//子计划编辑开始结束时间
export function updatesubproductionplan(id, data) {
  return request({
    url: `/pm/subproduction_plan/${id}/`,
    method: 'put',
    data
  })
}
//子计划详情

export function getProgress(id) {
  return request({
    url: `/pm/subproduction_plan/${id}/progress/`,
    method: 'get'
  })
}

//子计划下达
export function issuesubplan(id) {
  return request({
    url: `/pm/subproduction_plan/${id}/issue/`,
    method: 'post',
    
  })
}

//领料需求单，库存数量
export function createPick_need(id, data) {
  return request({
    url: `/pm/subproduction_plan/${id}/pick_need/`,
    method: 'post',
    data
  })
}

//生产进度表
export function getprogressList(query) {
  return request({
    url: '/pm/subproduction_progress/',
    method: 'get',
    params: query
  })
}
