Просмотр исходного кода

chore: 原材料入库明细调整

xyh 3 лет назад
Родитель
Сommit
f4a8ec544c

+ 2 - 0
packages/app/src/apis/rawMaterial.ts

@@ -12,11 +12,13 @@ const BASE_URL = '/warehousing';
 /** 获取入库流水 */
 export function getWarehousingFlowList(
   data: GetWarehousingFlowingListParams,
+  signal?: AbortSignal,
 ): BaseListResult<WarehousingListData> {
   return request({
     method: 'GET',
     data,
     url: `${BASE_URL}/warehousingFlowing`,
+    signal,
   });
 }
 

+ 21 - 1
packages/app/src/models/request/rawMaterial.ts

@@ -6,9 +6,29 @@ export type GetWarehousingFlowingListParams = {
   startTime: string;
   /** 结束时间 */
   endTime: string;
+  /** 入库单编号 */
+  storageCode: string;
   /** 物料编号 */
   wllbCode: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 操作人 */
+  userName: string;
+  /** 库位名称 */
+  storageLocationName: string;
+  /** wbs编号 */
+  wbs: string;
+  /** 供应商编号 */
+  supplierId: string;
 } & ListParams;
 
 /** 原料出库 */
-export type GetRawOutListParams = GetWarehousingFlowingListParams & {type: string};
+export type GetRawOutListParams = {
+  /** 开始时间 */
+  startTime: string;
+  /** 结束时间 */
+  endTime: string;
+  /** 物料编号 */
+  wllbCode: string;
+  type: string;
+} & ListParams;

+ 2 - 17
packages/app/src/pages/dictionary/table/index.tsx

@@ -4,8 +4,8 @@ import {Card} from 'antd';
 import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
 import PutModal from './modal';
-import {exportDictionary, getDictionaryList} from '@apis';
-import {useContextSection, useQueryTableList, useSupertube, useTableExportEvent} from '@hooks';
+import {getDictionaryList} from '@apis';
+import {useContextSection, useQueryTableList, useSupertube} from '@hooks';
 import {OriginalListParams, GetDictionaryListParams} from '@models';
 import StorageModal from './type-modal';
 import {useHandle} from './hooks';
@@ -30,19 +30,6 @@ const TableList: FC = function () {
     {columns, visible, editId, editStoreVisible, storeId},
     {onAdd, onClose, onEditStoreClose},
   ] = useHandle(refetch);
-  const [isExporting, onExport] = useTableExportEvent({
-    fn: exportDictionary,
-    pageContext,
-    context,
-    parseParams({name, code, warehouseType}) {
-      return {
-        name,
-        code,
-        type,
-        warehouseType,
-      } as OriginalListParams<GetDictionaryListParams>;
-    },
-  });
   const isSuper = useSupertube();
   return (
     <>
@@ -51,9 +38,7 @@ const TableList: FC = function () {
           title={type.replace('字典', '') + '管理'}
           onAdd={isSuper ? onAdd : void 0}
           isRefreshing={isFetching}
-          isExporting={isExporting}
           onRefresh={refetch}
-          onExport={onExport}
         />
 
         <Table

+ 4 - 1
packages/app/src/pages/purchase-order/filter/index.tsx

@@ -35,7 +35,10 @@ const Filter: FC = function () {
         // 因为这里可能需要变更查询函数
         onCurrentPageChange(1);
       },
-      resetCallback: resetState,
+      resetCallback() {
+        resetState();
+        onDatesChange([null, null]);
+      },
     },
   );
   const [filterList, {set}] = useFilterDB();

+ 3 - 19
packages/app/src/pages/purchase-order/table/index.tsx

@@ -2,13 +2,8 @@ import {FC} from 'react';
 import {Card} from 'antd';
 import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
-import {
-  exportReceive,
-  exportTimeoutReceive,
-  getReceiveOrderList,
-  getTimeoutReceiveOrderList,
-} from '@apis';
-import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
+import {getReceiveOrderList, getTimeoutReceiveOrderList} from '@apis';
+import {useContextSection, useQueryTableList} from '@hooks';
 import {ReceiveListData} from '@models';
 import {
   MIDDLE_TABLE_WIDTH,
@@ -46,20 +41,9 @@ const TableList: FC = function () {
     searchContext,
   });
 
-  const [isExporting, onExport] = useTableExportEvent({
-    pageContext,
-    context,
-    fn: params.type === '1' ? exportReceive : exportTimeoutReceive,
-  });
-
   return (
     <Card className='table-wrapper'>
-      <TableTools
-        onRefresh={refetch}
-        isRefreshing={isFetching}
-        onExport={onExport}
-        isExporting={isExporting}
-      />
+      <TableTools onRefresh={refetch} isRefreshing={isFetching} />
 
       <Table
         data={data}

+ 12 - 1
packages/app/src/pages/raw-in-stream/context.ts

@@ -1,7 +1,18 @@
 import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
+import {GetWarehousingFlowingListParams, OriginalListParams} from '@models';
 
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState = {startTime: '', endTime: '', wllbCode: ''};
+export const contextState: OriginalListParams<GetWarehousingFlowingListParams> = {
+  startTime: '',
+  endTime: '',
+  wllbCode: '',
+  materialName: '',
+  userName: '',
+  wbs: '',
+  storageCode: '',
+  storageLocationName: '',
+  supplierId: '',
+};
 export const context = createTableSearchContext(contextState);

+ 53 - 28
packages/app/src/pages/raw-in-stream/filter/index.tsx

@@ -1,41 +1,66 @@
-import {FilterButtonGroup, FilterDatePicker, FilterField, FilterFieldWrapper} from '@components';
-import {useContextSection, useRangeDate, useTableExportEvent, useTableSearchEvent} from '@hooks';
+import {FilterSelectorModal, FilterTool} from '@components';
+import {
+  useContextSection,
+  useFilterDB,
+  useFilterField,
+  useRangeDate,
+  useTableSearchToolEvents,
+} from '@hooks';
 import {Card} from 'antd';
-import {FC, useState} from 'react';
-import {context, pageContext, searchContext} from '../context';
-import {exportWarehousing} from '@apis';
+import {FC} from 'react';
+import {context, searchContext} from '../context';
+import {fixedMap, sourceMap} from './state';
 
 const Filter: FC = function () {
   const [{dates, start, end}, onDatesChange] = useRangeDate();
-  const [code, onCodeChange] = useState('');
-  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
-  const onSearch = useTableSearchEvent(context, {startTime: start, endTime: end, wllbCode: code});
-  const [isExporting, onExport] = useTableExportEvent({
-    pageContext,
+  const [fields, {onChange, resetState}] = useFilterField(
+    {
+      startTime: '',
+      endTime: '',
+      wllbCode: '',
+      materialName: '',
+      userName: '',
+      wbs: '',
+      storageCode: '',
+      storageLocationName: '',
+      supplierId: '',
+    },
+    true,
+  );
+  const {isSearching} = useContextSection(searchContext, state => state[0]);
+  const [visible, {onSearch, onShowModal, onCloseModal, onReset}] = useTableSearchToolEvents(
     context,
-    fn: exportWarehousing,
-  });
+    {...fields, startTime: start, endTime: end},
+    {resetCallback: resetState},
+  );
+  const [filterList, {set}] = useFilterDB();
 
   return (
-    <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
-        <FilterField name='rawMaterialCode' label='物料编号' value={code} onChange={onCodeChange} />
-        <FilterDatePicker
-          name='rawMaterialDates'
-          label='入库时间'
-          value={dates}
-          onChange={onDatesChange}
-        />
-        <FilterButtonGroup
-          offset={6}
+    <>
+      <Card>
+        <FilterTool
           onSearch={onSearch}
-          onRefresh={refetch}
+          onReset={onReset}
+          onFilter={onShowModal}
+          filterData={filterList}
+          sourceMap={sourceMap}
+          fixedMap={fixedMap}
           isSearching={isSearching}
-          onExport={onExport}
-          isExporting={isExporting}
+          onChange={onChange}
+          onDatesChange={onDatesChange}
+          dates={dates}
+          fields={fields}
         />
-      </FilterFieldWrapper>
-    </Card>
+      </Card>
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        onConfirm={set}
+        source={filterList}
+        filtermap={sourceMap}
+      />
+    </>
   );
 };
 

+ 16 - 0
packages/app/src/pages/raw-in-stream/filter/state.ts

@@ -0,0 +1,16 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../context';
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: '库位名称', type: 'field', value: 'storageLocationName'}],
+  ['2', {label: '供应商', type: 'keySelect', value: 'supplierId', selectKey: '供应商/客户'}],
+  ['3', {label: 'WBS编号', type: 'field', value: 'wbs'}],
+  ['4', {label: '操作人', type: 'field', value: 'userName'}],
+  ['5', {label: '入库时间', type: 'date', value: 'startTime'}],
+]);
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '入库单编号', type: 'field', value: 'storageCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+  {label: '物料编号', type: 'field', value: 'wllbCode'},
+];

+ 38 - 38
packages/app/src/pages/raw-in-stream/table/index.tsx

@@ -1,7 +1,7 @@
 import {FC} from 'react';
 import {WarehousingListData} from '@models';
 import {ColumnsType} from 'antd/es/table';
-import {Table} from '@components';
+import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
 import {Card} from 'antd';
 import {
@@ -11,22 +11,16 @@ import {
   NORMAL_TABLE_WIDTH,
   SMALL_TABLE_WIDTH,
 } from '@utils';
-import {getWarehousingFlowList} from '@apis';
-import {useContextSection, useQueryTableList} from '@hooks';
+import {exportWarehousing, getWarehousingFlowList} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<WarehousingListData> = [
   {
-    title: '采购单编号',
+    title: '入库单编号',
     dataIndex: 'storageCode',
     key: 'storageCode',
     width: MIDDLE_TABLE_WIDTH,
   },
-  {
-    title: 'wbs编号',
-    dataIndex: 'wbs',
-    key: 'wbs',
-    width: MIDDLE_TABLE_WIDTH,
-  },
   {
     title: '物料编号',
     dataIndex: 'wllbCode',
@@ -45,18 +39,6 @@ const columns: ColumnsType<WarehousingListData> = [
     key: 'supplierName',
     width: LARGE_TABLE_WIDTH,
   },
-  {
-    title: '连番号',
-    dataIndex: 'serial',
-    key: 'serial',
-    width: SMALL_TABLE_WIDTH,
-  },
-  {
-    title: '生产日期',
-    dataIndex: 'producDate',
-    key: 'producDate',
-    width: NORMAL_TABLE_WIDTH,
-  },
   {
     title: '生产批次',
     dataIndex: 'producDate',
@@ -70,28 +52,22 @@ const columns: ColumnsType<WarehousingListData> = [
     width: SMALL_TABLE_WIDTH,
   },
   {
-    title: '类型',
-    dataIndex: 'type',
-    key: 'type',
-    width: SMALL_TABLE_WIDTH,
+    title: '库位名称',
+    dataIndex: 'storageLocationName',
+    key: 'storageLocationName',
+    width: NORMAL_TABLE_WIDTH,
   },
   {
-    title: '用户名称',
+    title: '操作人',
     dataIndex: 'userName',
     key: 'userName',
     width: NORMAL_TABLE_WIDTH,
   },
   {
-    title: '部门',
-    dataIndex: 'departmentName',
-    key: 'departmentName',
-    width: NORMAL_TABLE_WIDTH,
-  },
-  {
-    title: '库位名称',
-    dataIndex: 'storageLocationName',
-    key: 'storageLocationName',
-    width: NORMAL_TABLE_WIDTH,
+    title: '类型',
+    dataIndex: 'type',
+    key: 'type',
+    width: SMALL_TABLE_WIDTH,
   },
   {
     title: '入库日期',
@@ -99,20 +75,44 @@ const columns: ColumnsType<WarehousingListData> = [
     key: 'scrq',
     width: MIDDLE_TABLE_WIDTH,
   },
+  {
+    title: 'WBS编号',
+    dataIndex: 'wbs',
+    key: 'wbs',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: '连番号',
+    dataIndex: 'serial',
+    key: 'serial',
+    width: SMALL_TABLE_WIDTH,
+  },
 ];
 
 const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
 
-  const [{data, count}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getWarehousingFlowList,
     params,
     pageContext,
     searchContext,
   });
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportWarehousing,
+  });
 
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        onRefresh={refetch}
+        isRefreshing={isFetching}
+        isExporting={isExporting}
+        onExport={onExport}
+      />
+
       <Table
         data={data}
         count={count}

+ 7 - 1
packages/app/src/pages/raw-out-stream/context.ts

@@ -1,7 +1,13 @@
 import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
+import {OriginalListParams, GetWarehousingFlowingListParams, GetRawOutListParams} from '@models';
 
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState = {startTime: '', endTime: '', wllbCode: '', type: ''};
+export const contextState: OriginalListParams<GetRawOutListParams> = {
+  startTime: '',
+  endTime: '',
+  wllbCode: '',
+  type: '',
+};
 export const context = createTableSearchContext(contextState);

+ 1 - 1
packages/app/src/pages/semi-in-stream/context.ts

@@ -4,7 +4,7 @@ import {GetWarehousingFlowingListParams, OriginalListParams} from '@models';
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState: OriginalListParams<GetWarehousingFlowingListParams> = {
+export const contextState = {
   wllbCode: '',
   startTime: '',
   endTime: '',

+ 1 - 1
packages/app/src/pages/semi-in-stream/table/index.tsx

@@ -33,7 +33,7 @@ const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
   const [{data, count}] = useQueryTableList({
     queryFn: getSemiManufacturesInStream,
-    params,
+    params: params as any,
     pageContext,
     searchContext,
   });

+ 1 - 1
packages/app/src/pages/semi-out-stream/context.ts

@@ -4,7 +4,7 @@ import {GetWarehousingFlowingListParams, OriginalListParams} from '@models';
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState: OriginalListParams<GetWarehousingFlowingListParams> = {
+export const contextState = {
   wllbCode: '',
   startTime: '',
   endTime: '',

+ 1 - 1
packages/app/src/pages/semi-out-stream/table/index.tsx

@@ -35,7 +35,7 @@ const TableList: FC = function () {
 
   const [{data, count}] = useQueryTableList({
     queryFn: getSemiManufacturesDrawStream,
-    params,
+    params: params as any,
     pageContext,
     searchContext,
   });