import React, { useEffect, useMemo, useRef, useState } from "react";
import { Dropdown, Menu, Button, Tooltip } from "antd";
import { ProTable } from "@ant-design/pro-table";
import { doFetch } from "@/utils/doFetch";
import AutoTable from "@/components/AutoTable";


function Instore(props) {
  const columns = [
    {
      title: "操作时间",
      dataIndex: "operateTime",
      key: "operateTimeList",
      valueType: "dateRange",
      render: (_, row) => {
        return <div>{row.operateTime}</div>;
      },
    },
    {
      title: "操作人",
      dataIndex: "operateUserName",
      key: "operateUserName",
    },
    {
      title: "物料编码",
      dataIndex: "materieCode",
      key: "materieCode",
    },
    {
      title: "物料名称",
      dataIndex: "materieName",
      key: "materieName",
    },
    {
      title: "批次号/SN号",
      dataIndex: "materieControlNo",
      key: "materieControlNo",
    },
    {
      title: "当时库存数量",
      dataIndex: "currentNum",
      key: "currentNum",
      search: false,
    },
    {
      title: "操作数量",
      dataIndex: "operateNum",
      key: "operateNum",
      search: false,
    },
    {
      title: "库存单位",
      dataIndex: "productionUnitName",
      key: "productionUnitName",
      search: false,
    },
    {
      title: "操作类型",
      dataIndex: "stockDetailTypeName",
      key: "stockDetailTypeName",
    },
    {
      title: "仓库",
      dataIndex: "storeName",
      key: "storeId",
      fieldProps: {
        allowClear: true,
        showSearch: true,
      },
      options: {
        database: () =>
          doFetch({
            url: "/ngic-auth/sysStore/selectionBox",
            params: { factoryIdList: [] },
          }),
        params: {},
      },
      valueType: "select",
    },
    {
      title: "库位",
      dataIndex: "storePositionName",
      key: "storePositionName",
    },
    {
      title: "相关单号",
      dataIndex: "relatedNo",
      key: "relatedNo",
    },
  ]

  return (
    <div>
      <AutoTable
        {...props}
        pageextra="none"
        path="/ngic-workmanship/wmsMaterieStockRecord/queryList"
        columns={columns}
      ></AutoTable>
    </div>
  );
}

export default Instore;
