import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdInputScanInfoVO, ProdInputScanInfoForm, ProdInputScanInfoQuery } from '@/api/mes/prodInputScanInfo/types';

/**
 * 查询生产投入扫描信息列表
 * @param query
 * @returns {*}
 */

export const listProdInputScanInfo = (query?: ProdInputScanInfoQuery): AxiosPromise<ProdInputScanInfoVO[]> => {
  return request({
    url: '/mes/prodInputScanInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询生产投入扫描信息详细
 * @param prodInputScanInfoId
 */
export const getProdInputScanInfo = (prodInputScanInfoId: string | number): AxiosPromise<ProdInputScanInfoVO> => {
  return request({
    url: '/mes/prodInputScanInfo/' + prodInputScanInfoId,
    method: 'get'
  });
};

/**
 * 新增生产投入扫描信息
 * @param data
 */
export const addProdInputScanInfo = (data: ProdInputScanInfoForm) => {
  return request({
    url: '/mes/prodInputScanInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改生产投入扫描信息
 * @param data
 */
export const updateProdInputScanInfo = (data: ProdInputScanInfoForm) => {
  return request({
    url: '/mes/prodInputScanInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除生产投入扫描信息
 * @param prodInputScanInfoId
 */
export const delProdInputScanInfo = (prodInputScanInfoId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/prodInputScanInfo/' + prodInputScanInfoId,
    method: 'delete'
  });
};


/**
 * 下拉框查询生产投入扫描信息列表
 * @param query
 * @returns {*}
 */
export function getProdInputScanInfoList (query) {
    return request({
        url: '/mes/prodInputScanInfo/getProdInputScanInfoList',
        method: 'get',
        params: query
    });
};
