import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MouldChangePlanVO, MouldChangePlanForm, MouldChangePlanQuery } from '@/api/mes/mouldChangePlan/types';

/**
 * 查询模具换模计划列表
 * @param query
 * @returns {*}
 */

export const listMouldChangePlan = (query?: MouldChangePlanQuery): AxiosPromise<MouldChangePlanVO[]> => {
  return request({
    url: '/mes/mouldChangePlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询模具换模计划详细
 * @param mouldChangePlanId
 */
export const getMouldChangePlan = (mouldChangePlanId: string | number): AxiosPromise<MouldChangePlanVO> => {
  return request({
    url: '/mes/mouldChangePlan/' + mouldChangePlanId,
    method: 'get'
  });
};

/**
 * 新增模具换模计划
 * @param data
 */
export const addMouldChangePlan = (data: MouldChangePlanForm) => {
  return request({
    url: '/mes/mouldChangePlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改模具换模计划
 * @param data
 */
export const updateMouldChangePlan = (data: MouldChangePlanForm) => {
  return request({
    url: '/mes/mouldChangePlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除模具换模计划
 * @param mouldChangePlanId
 */
export const delMouldChangePlan = (mouldChangePlanId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/mouldChangePlan/' + mouldChangePlanId,
    method: 'delete'
  });
};


/**
 * 下拉框查询模具换模计划列表
 * @param query
 * @returns {*}
 */
export function getProdMouldChangePlanList(query) {
  return request({
    url: '/mes/mouldChangePlan/getProdMouldChangePlanList',
    method: 'get',
    params: query
  });
};
