Prechádzať zdrojové kódy

chore: 半成品领料单调整

xyh 2 rokov pred
rodič
commit
ec55f7c190

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

@@ -35,11 +35,13 @@ export function exportWarehousing(data: GetWarehousingFlowingListParams): any {
 /** 出库流水 */
 export function getRawOutList(
   data: GetRawOutListParams,
+  signal?: AbortSignal,
 ): BaseListResult<RawMaterialOutStreamListData> {
   return request({
     method: 'GET',
     url: '/askGoods/getRemoval',
     data,
+    signal,
   });
 }
 

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

@@ -30,7 +30,21 @@ export type GetRawOutListParams = {
   endTime: string;
   /** 物料编号 */
   wllbCode: string;
+  /** 出库类型 */
   type: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 领用部门 */
+  department: string;
+  /** 出库单号 */
+  storageCode: string;
+  wbs: string;
+  /** 供应商 */
+  supplierId: string;
+  /** 用户名称 */
+  userName: string;
+  /** 库位信息 */
+  storageLocationName: string;
 } & ListParams;
 
 /** 半成品入库流水 */

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

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

+ 54 - 41
packages/app/src/pages/raw-out-stream/filter/index.tsx

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

+ 17 - 0
packages/app/src/pages/raw-out-stream/filter/state.ts

@@ -0,0 +1,17 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../context';
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: '领用部门', type: 'keySelect', selectKey: '部门字典', value: 'department'}],
+  ['2', {label: '库位名称', type: 'field', value: 'storageLocationName'}],
+  ['3', {label: '出库用户', type: 'field', value: 'userName'}],
+  ['4', {label: '出库日期', type: 'date', value: 'startTime'}],
+  ['5', {label: '供应商', type: 'keySelect', selectKey: '供应商/客户', value: 'supplierId'}],
+  ['6', {label: 'WBS编号', type: 'field', value: 'wbs'}],
+]);
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '出库编号', type: 'field', value: 'storageCode'},
+  {label: '物料编号', type: 'field', value: 'wllbCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+];

+ 55 - 39
packages/app/src/pages/raw-out-stream/table/index.tsx

@@ -1,31 +1,31 @@
 import {FC} from 'react';
 import {RawMaterialOutStreamListData} 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 {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
-import {getRawOutList} 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 {exportRawOut, getRawOutList} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<RawMaterialOutStreamListData> = [
   {
-    title: '利道编号',
+    title: '出库编号',
     dataIndex: 'storageCode',
     key: 'storageCode',
     width: NORMAL_TABLE_WIDTH,
   },
-  {
-    title: 'wbs编号',
-    dataIndex: 'wbs',
-    key: 'wbs',
-    width: NORMAL_TABLE_WIDTH,
-  },
   {
     title: '物料编号',
     dataIndex: 'wllbCode',
     key: 'wllbCode',
-    width: NORMAL_TABLE_WIDTH,
+    width: LARGE_TABLE_WIDTH,
   },
   {
     title: '物料名称',
@@ -34,22 +34,23 @@ const columns: ColumnsType<RawMaterialOutStreamListData> = [
     width: HUGE_TABLE_WIDTH,
   },
   {
-    title: '供应商名称',
-    dataIndex: 'supplierName',
-    key: 'supplierName',
+    title: '领用部门',
+    dataIndex: 'department',
+    key: 'department',
     width: NORMAL_TABLE_WIDTH,
   },
   {
-    title: '连番号',
-    dataIndex: 'serial',
-    key: 'serial',
-    width: SMALL_TABLE_WIDTH,
+    title: '库位名称',
+    dataIndex: 'storageLocationName',
+    key: 'storageLocationName',
+    width: NORMAL_TABLE_WIDTH,
   },
   {
-    title: '类型',
-    dataIndex: 'type',
-    key: 'type',
-    width: NORMAL_TABLE_WIDTH,
+    title: '出库数量',
+    dataIndex: 'num',
+    key: 'num',
+    width: SMALL_TABLE_WIDTH,
+    align: 'right',
   },
   {
     title: '出库用户',
@@ -57,18 +58,6 @@ const columns: ColumnsType<RawMaterialOutStreamListData> = [
     key: 'userName',
     width: NORMAL_TABLE_WIDTH,
   },
-  {
-    title: '领用部门',
-    dataIndex: 'department',
-    key: 'department',
-    width: NORMAL_TABLE_WIDTH,
-  },
-  {
-    title: '库位名称',
-    dataIndex: 'storageLocationName',
-    key: 'storageLocationName',
-    width: NORMAL_TABLE_WIDTH,
-  },
   {
     title: '出库日期',
     dataIndex: 'scrq',
@@ -76,25 +65,52 @@ const columns: ColumnsType<RawMaterialOutStreamListData> = [
     width: MIDDLE_TABLE_WIDTH,
   },
   {
-    title: '出库数量',
-    dataIndex: 'num',
-    key: 'num',
+    title: '供应商名称',
+    dataIndex: 'supplierName',
+    key: 'supplierName',
+    width: HUGE_TABLE_WIDTH,
+  },
+  {
+    title: '连番号',
+    dataIndex: 'serial',
+    key: 'serial',
     width: SMALL_TABLE_WIDTH,
   },
+  {
+    title: 'WBS编号',
+    dataIndex: 'wbs',
+    key: 'wbs',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '类型',
+    dataIndex: 'type',
+    key: 'type',
+    width: NORMAL_TABLE_WIDTH,
+  },
 ];
 
 const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
 
-  const [{data, count}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getRawOutList,
     params,
     pageContext,
     searchContext,
   });
 
+  const [isExporting, onExport] = useTableExportEvent({pageContext, context, fn: exportRawOut});
+
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        isExporting={isExporting}
+        onExport={onExport}
+        isRefreshing={isFetching}
+        onRefresh={refetch}
+      />
+
       <Table
         data={data}
         count={count}