import { request } from '../../boot/axios';
import { Pagination } from '../class';
import { DnSearchEntity } from './model/outbound';
const pathName = 'dn/';
class OutBoundApi {
  getPage = (val?: Pagination<DnSearchEntity>) => {
    return request.postForPage('dn/page', val);
  };
  // pathName + 'updateRemark/' + row.id + '/' + row.remark
  saveRemark = (val?: any) => {
    return request.post(`${pathName}updateRemark/${val.id}/${val.remark}`, {});
  };
  // 获取状态字典
  getDnStatus = () => {
    return request.get('/dict/type/dn_status');
  };
  //  获取包装单位
  getPackUnitMap = () => {
    return request.get('materialsunit/getUnitList/1/');
  };
  // 获取记账单位
  getRecordUnitMap = () => {
    return request.get('materialsunit/getUnitList/2/', {});
  };
  // 获取所有客户列表
  getCustomerLists = () => {
    return request.get('customer/customer-list', {});
  };
  getStock = (val?: any) => {
    return request.post(`${pathName}getStock/${val}`, {});
  };
  getStockPage = (val?: any) => {
    return request.post('stock/getStockPage/', val);
  };
  getCustomer = (val?: any) => {
    return request.post('customer/customer-list/', { customerName: val });
  };
  getArea = (val?: any) => {
    return request.post('area/list/', { areaName: val });
  };
  getAreas = () => {
    return request.post('area/list/', {});
  };
  getBinset = (val?: any) => {
    return request.post('binset/list/', { binName: val });
  };
  getBinsets = () => {
    return request.post('binset/list/', {});
  };
  getMaterialList = (val?: any) => {
    return request.post('dnDetail/pickList', val);
  };
  getConfirmList = (val?: any) => {
    return request.post('dn-detail-material/page', val);
  };
  getStockList = (val?: any) => {
    return request.post('stock/getStockPage/', val);
  };
  confirmSubmit = (val?: any) => {
    return request.post(`${val.pathname}confim/${val.dnid}`, {});
  };
  pickedDataSubmit = (val?: any) => {
    return request.post(`${val.pathname}updateQtyAll/`, val.pickedFormData);
  };
  pickedSubmit = (val?: any) => {
    return request.post(`${val.pathname}pickedAll/`, val.pickedFormData);
  };
  getPrintTable = (val?: any) => {
    return request.post('dnDetail/list', { dnId: val });
  };
  deleteDataSubmit = (val?: any) => {
    return request.delete(`${val.pathname}del/${val.deleteid}`);
  };
  getCustomerList = () => {
    return request.post('customer/customer-list/', {});
  };
  getWarehouseList = () => {
    return request.post('warehouse/getWarehouseList/', {});
  };
  //新增出库单
  addDeliveryOrder = (val?: any) => {
    return request.post(`${val.pathname}add/`, val.newFormData);
  };
  deleteDeliveryOrder = (val?: any) => {
    return request.delete(`${val.pathname}del/${val.deleteid}`);
  };
  getpickDetail = (val?: any) => {
    return request.post(`${val.pathname}pickDetail/${val.id}`);
  };
  getConfirmDetail = (val?: any) => {
    return request.post(`${val.pathname}confirmDetail/${val.id}`, {});
  };
  getConfirm = (val?: any) => {
    return request.post(`${val.pathname}confirm/${val.dnId}`, {});
  };
  getDnDetailMaterial = (val?: any) => {
    return request.post('dn-detail-material/list', { dnId: val });
  };
}
const outBoundApi = new OutBoundApi();
export { outBoundApi };
