Browse Source

chore: 半成品入库明细调整

xyh 2 years ago
parent
commit
0e03ff30d9

+ 4 - 1
packages/app/src/apis/semiManufactures.ts

@@ -10,6 +10,7 @@ import {
   GetSemiManufacturesDrawList,
   SemiDrawListData,
   SemiOutStreamListData,
+  GetSemiInStreamParams,
 } from '@models';
 import {request} from './request';
 
@@ -79,12 +80,14 @@ export async function semiManufacturesOut(data: SemiManufacturesOutParams): Base
 
 /** 半成品入库流水单 */
 export function getSemiManufacturesInStream(
-  data: GetWarehousingFlowingListParams,
+  data: GetSemiInStreamParams,
+  signal?: AbortSignal,
 ): BaseListResult<SemiInStreamListData> {
   return request({
     method: 'GET',
     url: `${BASE_URL}/getProduct`,
     data,
+    signal,
   });
 }
 

+ 18 - 0
packages/app/src/models/request/rawMaterial.ts

@@ -32,3 +32,21 @@ export type GetRawOutListParams = {
   wllbCode: string;
   type: string;
 } & ListParams;
+
+/** 半成品入库流水 */
+export type GetSemiInStreamParams = {
+  /** 物料名称 */
+  materialName: string;
+  /** 入库人 */
+  userName: string;
+  /** 生产时间 */
+  producBatch: string;
+  /** 物料编号 */
+  wllbCode: string;
+  /** wbs编号 */
+  wbs: string;
+  /** 利道单号 */
+  storageCode: string;
+  startTime: string;
+  endTime: string;
+} & ListParams;

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

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

+ 65 - 27
packages/app/src/pages/semi-in-stream/filter/index.tsx

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

+ 14 - 0
packages/app/src/pages/semi-in-stream/filter/state.ts

@@ -0,0 +1,14 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../context';
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '入库编号', type: 'field', value: 'storageCode'},
+  {label: '物料编号', type: 'field', value: 'wllbCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+];
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: 'wbs编号', type: 'field', value: 'wbs'}],
+  ['2', {label: '操作人', type: 'field', value: 'userName'}],
+  ['3', {label: '入库时间', type: 'date', value: 'startTime'}],
+]);

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

@@ -1,45 +1,69 @@
 import {Card} from 'antd';
 import {FC} from 'react';
-import {Table} from '@components';
+import {Table, TableTools} from '@components';
 import {ColumnsType} from 'antd/es/table';
 import {SemiInStreamListData} from '@models';
 import {context, pageContext, searchContext} from '../context';
-import {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
-import {getSemiManufacturesInStream} from '@apis';
-import {useContextSection, useQueryTableList} from '@hooks';
+import {
+  HUGE_TABLE_WIDTH,
+  LARGE_TABLE_WIDTH,
+  MIDDLE_TABLE_WIDTH,
+  NORMAL_TABLE_WIDTH,
+  SMALL_TABLE_WIDTH,
+} from '@utils';
+import {exportSemiManufacturesInStream, getSemiManufacturesInStream} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<SemiInStreamListData> = [
   {
-    title: '利道编号',
+    title: '入库编号',
     dataIndex: 'storageCode',
     key: 'storageCode',
     width: NORMAL_TABLE_WIDTH,
   },
+  {title: '物料编号', dataIndex: 'wllbCode', key: 'wllbCode', width: LARGE_TABLE_WIDTH},
+  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
+  {
+    title: '入库数量',
+    dataIndex: 'warehousingNum',
+    key: 'warehousingNum',
+    width: SMALL_TABLE_WIDTH,
+    align: 'right',
+  },
   {
-    title: 'wbs编号',
+    title: 'WBS编号',
     dataIndex: 'wbs',
     key: 'wbs',
     width: NORMAL_TABLE_WIDTH,
   },
-  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
-  {title: '物料编号', dataIndex: 'wllbCode', key: 'wllbCode', width: NORMAL_TABLE_WIDTH},
-  {title: '生产时间', dataIndex: 'producBatch', key: 'producBatch', width: MIDDLE_TABLE_WIDTH},
-  {title: '数量', dataIndex: 'warehousingNum', key: 'warehousingNum', width: SMALL_TABLE_WIDTH},
-  {title: '用户名称', dataIndex: 'userName', key: 'userName', width: NORMAL_TABLE_WIDTH},
+  {title: '生产批次', dataIndex: 'producBatch', key: 'producBatch', width: MIDDLE_TABLE_WIDTH},
+  {title: '操作人', dataIndex: 'userName', key: 'userName', width: NORMAL_TABLE_WIDTH},
   {title: '入库时间', dataIndex: 'scrq', key: 'scrq', width: MIDDLE_TABLE_WIDTH},
 ];
 
 const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
-  const [{data, count}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getSemiManufacturesInStream,
     params: params as any,
     pageContext,
     searchContext,
   });
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportSemiManufacturesInStream,
+  });
 
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        onRefresh={refetch}
+        isRefreshing={isFetching}
+        isExporting={isExporting}
+        onExport={onExport}
+      />
+
       <Table
         columns={columns}
         data={data}

+ 1 - 9
packages/app/src/pages/semi-report/filter/index.tsx

@@ -1,12 +1,4 @@
-import {
-  FilterButtonGroup,
-  FilterDatePicker,
-  FilterField,
-  FilterFieldWrapper,
-  FilterSelect,
-  FilterSelectorModal,
-  FilterTool,
-} from '@components';
+import {FilterSelectorModal, FilterTool} from '@components';
 import {
   useContextSection,
   useFilterDB,