Browse Source

feat: 增加其他入库列表

xyh 2 years ago
parent
commit
3cfc7f04f1

+ 15 - 0
packages/app/src/apis/queryList.ts

@@ -19,6 +19,8 @@ import {
   DeleteLogListData,
   GetGSErrorLogListParams,
   GSErrorListData,
+  GetOtherInParams,
+  OtherInListData,
 } from '@models';
 import {request} from './request';
 
@@ -289,3 +291,16 @@ export function exportGSErrorInterface(data: GetGSErrorLogListParams) {
     data,
   });
 }
+
+/** 其他入库 */
+export function getOtherIn(
+  data: GetOtherInParams,
+  signal?: AbortSignal,
+): BaseListResult<OtherInListData> {
+  return request({
+    method: 'GET',
+    data,
+    url: `${BASE_URL}/getOtherReceivingGoods`,
+    signal,
+  });
+}

+ 15 - 0
packages/app/src/models/request/queryList.ts

@@ -169,3 +169,18 @@ export type GetGSErrorLogListParams = {
   /** 请求类型 */
   type: string;
 } & ListParams;
+
+/** 其他入库 */
+export type GetOtherInParams = {
+  /** 入库单编号 */
+  noticeCode: string;
+  /** 物料编号 */
+  materialCode: string;
+  /** 物料名称 */
+  materialName: string;
+  startTime: string;
+  endTime: string;
+  /** 所属公司 */
+  companyNumber: string;
+  wbs: string;
+} & ListParams;

+ 36 - 0
packages/app/src/models/response/queryList.ts

@@ -334,3 +334,39 @@ export type GSErrorListData = {
   /** 请求类型 */
   type: string;
 };
+
+/** 其他入库数据 */
+export type OtherInListData = {
+  id: string;
+  /** 其他入库ID */
+  noticeId: string;
+  /** 其他入库编号 */
+  noticeCode: string;
+  /** 公司编号 */
+  companyNumber: string;
+  /** 通知时间 */
+  noticeTime: Date;
+  /** 来源类型 */
+  sourceType: string;
+  /** 移动类型 */
+  moveType: string;
+  /** 分录号 */
+  entryNumber: string;
+  /** 物料id */
+  materialId: string;
+  wbs: string;
+  /** 计量单位 */
+  measurementId: string;
+  /** shuliang  */
+  num: string;
+  /** 入库数量 */
+  warehousingNum: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 公司名称 */
+  companyName: string;
+  /** 物料类别 */
+  partType: string;
+  /**  物料编号 */
+  materialCode: string;
+};

+ 19 - 0
packages/app/src/pages/other-in/context.ts

@@ -0,0 +1,19 @@
+import {
+  createPageContext,
+  createSearchContext,
+  createTableSearchContext,
+} from '@hooks';
+import {GetOtherInParams, OriginalListParams} from '@models';
+
+export const searchContext = createSearchContext();
+export const pageContext = createPageContext();
+export const contextState: OriginalListParams<GetOtherInParams> = {
+  materialCode: '',
+  materialName: '',
+  startTime: '',
+  endTime: '',
+  companyNumber: '',
+  wbs: '',
+  noticeCode: '',
+};
+export const context = createTableSearchContext(contextState);

+ 66 - 0
packages/app/src/pages/other-in/filter/index.tsx

@@ -0,0 +1,66 @@
+import {
+  useContextSection,
+  useFilterDB,
+  useFilterField,
+  useRangeDate,
+  useTableSearchToolEvents,
+} from '@hooks';
+import {FC} from 'react';
+import {context, contextState, searchContext} from '../context';
+import {FilterSelectorModal, FilterTool} from '@components';
+import {fixedMap, sourceMap} from './state';
+
+const Filter: FC = function () {
+  const [fields, {onChange, resetState}] = useFilterField(
+    {
+      ...contextState,
+    },
+    true,
+  );
+  const [{dates, start, end}, onDatesChange] = useRangeDate();
+  const [visible, {onSearch, onReset, onShowModal, onCloseModal}] =
+    useTableSearchToolEvents(
+      context,
+      {...fields, startTime: start, endTime: end},
+      {
+        resetCallback() {
+          resetState();
+          onDatesChange([null, null]);
+        },
+      },
+    );
+  const isSearching = useContextSection(
+    searchContext,
+    state => state[0].isSearching,
+  );
+  const [filterList, {set}] = useFilterDB();
+
+  return (
+    <>
+      <FilterTool
+        fields={fields}
+        dates={dates}
+        onChange={onChange}
+        onDatesChange={onDatesChange}
+        onReset={onReset}
+        onSearch={onSearch}
+        onFilter={onShowModal}
+        filterData={filterList}
+        sourceMap={sourceMap}
+        fixedMap={fixedMap}
+        isSearching={isSearching}
+        testId='other_in_filter'
+      />
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        filtermap={sourceMap}
+        source={filterList}
+        onConfirm={set}
+      />
+    </>
+  );
+};
+
+export default Filter;

+ 22 - 0
packages/app/src/pages/other-in/filter/state.ts

@@ -0,0 +1,22 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../context';
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {type: 'field', value: 'noticeCode', label: '入库单编号'},
+  {type: 'field', value: 'materialCode', label: '物料编号'},
+  {type: 'field', value: 'materialName', label: '物料名称'},
+];
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {type: 'date', label: '通知时间', value: 'startTime'}],
+  [
+    '2',
+    {
+      type: 'keySelect',
+      label: '所属公司',
+      selectKey: '公司',
+      value: 'startTime',
+    },
+  ],
+  ['3', {type: 'field', label: 'WBS编号', value: 'wbs'}],
+]);

+ 22 - 0
packages/app/src/pages/other-in/index.tsx

@@ -0,0 +1,22 @@
+import {PageProvider, SearchProvider, TableSearchProvider} from '@components';
+import {FC} from 'react';
+import {context, contextState, pageContext, searchContext} from './context';
+import Filter from './filter';
+import TableList from './table';
+
+const OtherIn: FC = function () {
+  return (
+    <TableSearchProvider context={context} state={contextState}>
+      <PageProvider context={pageContext}>
+        <SearchProvider context={searchContext}>
+          <section className='content-main'>
+            <Filter />
+            <TableList />
+          </section>
+        </SearchProvider>
+      </PageProvider>
+    </TableSearchProvider>
+  );
+};
+
+export default OtherIn;

+ 36 - 0
packages/app/src/pages/other-in/table/hooks.tsx

@@ -0,0 +1,36 @@
+import {OtherInListData} from '@models';
+import {
+  HUGE_TABLE_WIDTH,
+  LARGE_TABLE_WIDTH,
+  NORMAL_TABLE_WIDTH,
+  SMALL_TABLE_WIDTH,
+} from '@utils';
+import {ColumnsType} from 'antd/es/table';
+
+const columns: ColumnsType<OtherInListData> = [
+  {title: '入库单编号', dataIndex: 'noticeCode', width: LARGE_TABLE_WIDTH},
+  {title: '物料编号', dataIndex: 'materialCode', width: LARGE_TABLE_WIDTH},
+  {title: '物料名称', dataIndex: 'materialName', width: HUGE_TABLE_WIDTH},
+  {
+    title: '入库数量',
+    dataIndex: 'num',
+    width: SMALL_TABLE_WIDTH,
+    align: 'right',
+  },
+  {
+    title: '已入库数量',
+    dataIndex: 'warehousingNum',
+    width: NORMAL_TABLE_WIDTH,
+    align: 'right',
+  },
+  {title: '所属公司', dataIndex: 'companyName', width: LARGE_TABLE_WIDTH},
+  {title: '公司编号', dataIndex: 'companyNumber', width: SMALL_TABLE_WIDTH},
+  {title: '通知时间', dataIndex: 'noticeTime', width: NORMAL_TABLE_WIDTH},
+  {title: 'WBS编号', dataIndex: 'wbs', width: NORMAL_TABLE_WIDTH},
+];
+
+export function useColumns() {
+  const tableColumns = [...columns];
+
+  return tableColumns;
+}

+ 35 - 0
packages/app/src/pages/other-in/table/index.tsx

@@ -0,0 +1,35 @@
+import {useContextSection, useQueryTableList} from '@hooks';
+import {FC} from 'react';
+import {context, pageContext, searchContext} from '../context';
+import {getOtherIn} from '@apis';
+import {Card} from 'antd';
+import {useColumns} from './hooks';
+import {Table, TableTools} from '@components';
+
+const TableList: FC = function () {
+  const params = useContextSection(context, state => state[0]);
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
+    queryFn: getOtherIn,
+    pageContext,
+    params,
+    searchContext,
+  });
+  const columns = useColumns();
+
+  return (
+    <Card className='table-wrapper'>
+      <TableTools onRefresh={refetch} isRefreshing={isFetching} />
+
+      <Table
+        data={data}
+        count={count}
+        pageContext={pageContext}
+        searchContext={searchContext}
+        columns={columns}
+        data-testid='outer_in_table'
+      />
+    </Card>
+  );
+};
+
+export default TableList;

+ 3 - 0
packages/app/src/routes/index.tsx

@@ -36,6 +36,7 @@ import {
   ORDER_LOG_PATH,
   INVENTORY_PATH,
   GS_ERROR_LOG_PATH,
+  OTHER_IN_PATH,
 } from './name';
 import {
   Container,
@@ -72,6 +73,7 @@ import {
   Inventory,
   Login,
   GSErrorLog,
+  OtherIn,
 } from './routes';
 import Main from '@pages/main';
 import Home from '@pages/home';
@@ -117,6 +119,7 @@ export const routes: RouteObject[] = [
       {path: ORDER_LOG_PATH, element: <OrderDeleteLog />},
       {path: INVENTORY_PATH, element: <Inventory />},
       {path: GS_ERROR_LOG_PATH, element: <GSErrorLog />},
+      {path: OTHER_IN_PATH, element: <OtherIn />},
     ],
   },
   {path: NO_PERMISSION_PATH, element: <NoPermision />},

+ 2 - 0
packages/app/src/routes/name.ts

@@ -95,3 +95,5 @@ export const ORDER_LOG_PATH = '/log/order';
 export const INVENTORY_PATH = '/inventory';
 /** gs错误日志 */
 export const GS_ERROR_LOG_PATH = '/log/error';
+/** 其他入库 */
+export const OTHER_IN_PATH = '/other/in';

+ 3 - 0
packages/app/src/routes/routes.tsx

@@ -197,3 +197,6 @@ export const Inventory = lazy(
 export const GSErrorLog = lazy(
   () => import(/* webpackChunkName: "gsErrorLog" */ '@pages/gs-error-log'),
 );
+export const OtherIn = lazy(
+  () => import(/* webpackChunkName: "otherIn" */ '@pages/other-in'),
+);