Browse Source

chore: 呆滞品调整

xyh 2 years ago
parent
commit
215545b918

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

@@ -34,11 +34,13 @@ export function getFinishProductOutStreamExport(data: GetFinishProductListStream
 /** 产成品入库流水 */
 export function getFinishProductInStreamList(
   data: GetFinishProductListStreamParams,
+  signal?: AbortSignal,
 ): BaseListResult<FinishProductListStreamInListData> {
   return request({
     method: 'GET',
     data,
     url: `${BASE_URL2}/getHalf`,
+    signal,
   });
 }
 

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

@@ -25,11 +25,13 @@ const BASE_URL = '/queryList';
 /** 呆滞品查询 */
 export function getDeadProductsList(
   data: GetDeadProductsListParams,
+  signal?: AbortSignal,
 ): BaseListResult<DeadProductsListData> {
   return request({
     method: 'GET',
     url: `${BASE_URL}/dullGoods`,
     data,
+    signal,
   });
 }
 
@@ -194,3 +196,12 @@ export function getDeleteLogList(data: GetDeleteLogListParams): BaseListResult<D
     data,
   });
 }
+
+/** 导出呆滞品 */
+export function exportDeadproduct(data: GetDeadProductsListParams): any {
+  return request({
+    method: 'GET',
+    data,
+    url: `${BASE_URL}/dullGoodsExport`,
+  });
+}

+ 23 - 0
packages/app/src/models/request/finishProduct.ts

@@ -2,12 +2,35 @@ import {ListParams} from '.';
 
 /** 获取产成品出库流水列表 */
 export type GetFinishProductListStreamParams = {
+  /** 物料名称
+   *
+   */
   /** 物料编号 */
   wllbCode: string;
   /** 开始时间 */
   startTime: string;
   /** 结束时间 */
   endTime: string;
+  /**
+   * 属性
+   */
+  attribute: string;
+  /**
+   * 物料名称
+   */
+  materialName: string;
+  /**
+   * 库位名称
+   */
+  storageLocationName: string;
+  /**
+   * 用户名称
+   */
+  userName: string;
+  /** wbs编号 */
+  wbs: string;
+  /** 利道单号 */
+  storageCode: string;
 } & ListParams;
 
 /** 其他出库 */

+ 10 - 2
packages/app/src/models/request/queryList.ts

@@ -2,10 +2,18 @@ import {BaseOrderListParams, ListParams} from '.';
 
 /** 呆滞品查询 */
 export type GetDeadProductsListParams = {
-  /** 库位编号 */
-  storageLocationCode: string;
+  /** 库位名称 */
+  storageLocationName: string;
   /** 物料编号 */
   wllbCode: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 所属公司 */
+  companyCode: string;
+  /** 供应商编号 */
+  ustomerCode: string;
+  /** wbs */
+  wbs: string;
 } & ListParams;
 
 /** 物料储量预警查询 */

+ 2 - 0
packages/app/src/models/response/finishProduct.ts

@@ -86,6 +86,8 @@ export type FinishProductListStreamInListData = {
    * 库位编号
    */
   storageLocationCode: string;
+  /** 库位名称 */
+  storageLocationName: string;
   /**
    * 用户id
    */

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

@@ -25,6 +25,11 @@ export type DeadProductsListData = {
   storageLocationName: string;
   /** 物料编号 */
   wllbCode: string;
+  /** 所属公司 */
+  companyName: string;
+  /** 供应商 */
+  ustomerName: string;
+  wbs: string;
 };
 
 export type ReserveWarningListData = {

+ 8 - 14
packages/app/src/pages/dead-product/context.ts

@@ -1,21 +1,15 @@
-import {
-  createPageContext,
-  createSearchContext,
-  createTableSearchContext,
-  TableSearchContext,
-} from '@hooks';
+import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
 import {GetDeadProductsListParams, OriginalListParams} from '@models';
 
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 
-export const contextState = {
-  location: '',
-  material: '',
+export const contextState: OriginalListParams<GetDeadProductsListParams> = {
+  storageLocationName: '',
+  wllbCode: '',
+  materialName: '',
+  companyCode: '',
+  ustomerCode: '',
+  wbs: '',
 };
 export const context = createTableSearchContext(contextState);
-export function contextStateSelector([{location, material}]: TableSearchContext<
-  typeof contextState
->): OriginalListParams<GetDeadProductsListParams> {
-  return {storageLocationCode: location, wllbCode: material};
-}

+ 41 - 27
packages/app/src/pages/dead-product/filter/index.tsx

@@ -1,40 +1,54 @@
-import {FilterButtonGroup, FilterField, FilterFieldWrapper, FilterSelect} from '@components';
-import {useContextSection, useFilterField, useStorageOptions, useTableSearchEvent} from '@hooks';
+import {useContextSection, useFilterDB, useFilterField, useTableSearchToolEvents} from '@hooks';
 import {Card} from 'antd';
 import {FC} from 'react';
 import {context, searchContext} from '../context';
+import {FilterSelectorModal, FilterTool} from '@components';
+import {fixedMap, sourceMap} from './state';
 
 const Filter: FC = function () {
-  const [{location, material}, onChange] = useFilterField({location: '', material: ''});
-  const storageOptions = useStorageOptions(true, state => state.storageLocationCode);
-  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
-  const onSearch = useTableSearchEvent(context, {location, material});
+  const [fields, {onChange, resetState}] = useFilterField(
+    {
+      storageLocationName: '',
+      wllbCode: '',
+      materialName: '',
+      companyCode: '',
+      ustomerCode: '',
+      wbs: '',
+    },
+    true,
+  );
+  const {isSearching} = useContextSection(searchContext, state => state[0]);
+  const [visible, {onSearch, onReset, onShowModal, onCloseModal}] = useTableSearchToolEvents(
+    context,
+    fields,
+    {resetCallback: resetState},
+  );
+  const [filterList, {set}] = useFilterDB();
 
   return (
-    <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
-        <FilterField
-          value={material}
-          label='物料编号'
-          onChange={onChange('material')}
-          name='materialCode'
-        />
-        <FilterSelect
-          name='location'
-          label='库位'
-          value={location}
-          onChange={onChange('location')}
-          options={storageOptions}
-        />
-
-        <FilterButtonGroup
-          offset={6}
-          onRefresh={refetch}
+    <>
+      <Card>
+        <FilterTool
+          fields={fields}
+          onChange={onChange}
+          filterData={filterList}
+          onReset={onReset}
           onSearch={onSearch}
           isSearching={isSearching}
+          sourceMap={sourceMap}
+          fixedMap={fixedMap}
+          onFilter={onShowModal}
         />
-      </FilterFieldWrapper>
-    </Card>
+      </Card>
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        onConfirm={set}
+        source={filterList}
+        filtermap={sourceMap}
+      />
+    </>
   );
 };
 

+ 14 - 0
packages/app/src/pages/dead-product/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: 'wllbCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+  {label: '库位名称', type: 'field', value: 'storageLocationName'},
+];
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: '所属公司', type: 'keySelect', selectKey: '公司', value: 'companyCode'}],
+  ['2', {label: '供应商', type: 'keySelect', selectKey: '供应商/客户', value: 'ustomerCode'}],
+  ['3', {label: 'WBS编号', type: 'field', value: 'wbs'}],
+]);

+ 34 - 12
packages/app/src/pages/dead-product/table/index.tsx

@@ -1,38 +1,60 @@
 import {FC} from 'react';
 import {ColumnsType} from 'antd/es/table';
 import {DeadProductsListData} from 'models/response/queryList';
-import {Table} from '@components';
-import {context, contextStateSelector, pageContext, searchContext} from '../context';
+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 {getDeadProductsList} 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 {exportDeadproduct, getDeadProductsList} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<DeadProductsListData> = [
-  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
-  {title: '物料编号', dataIndex: 'wllbCode', key: 'wllbCode', width: NORMAL_TABLE_WIDTH},
+  {title: '物料编号', dataIndex: 'wllbCode', width: MIDDLE_TABLE_WIDTH},
+  {title: '物料名称', dataIndex: 'materialName', width: HUGE_TABLE_WIDTH},
   {
     title: '库位名称',
     dataIndex: 'storageLocationName',
-    key: 'storageLocationName',
+
     width: NORMAL_TABLE_WIDTH,
   },
-  {title: '数量', dataIndex: 'amount', key: 'amount', width: SMALL_TABLE_WIDTH},
-  {title: '入库时间', dataIndex: 'scrq', key: 'scrq', width: MIDDLE_TABLE_WIDTH},
+  {title: '所属公司', dataIndex: 'companyName', width: LARGE_TABLE_WIDTH},
+  {title: '供应商', dataIndex: 'ustomerName', width: LARGE_TABLE_WIDTH},
+  {title: 'WBS编号', dataIndex: 'wbs', width: NORMAL_TABLE_WIDTH},
+  {title: '数量', dataIndex: 'amount', width: SMALL_TABLE_WIDTH, align: 'right'},
+  {title: '入库时间', dataIndex: 'scrq', width: MIDDLE_TABLE_WIDTH},
 ];
 
 const TabelList: FC = function () {
-  const params = useContextSection(context, contextStateSelector);
+  const params = useContextSection(context, state => state[0]);
 
-  const [{data, count}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getDeadProductsList,
     params,
     pageContext,
     searchContext,
   });
 
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportDeadproduct,
+  });
+
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        onRefresh={refetch}
+        isRefreshing={isFetching}
+        isExporting={isExporting}
+        onExport={onExport}
+      />
+
       <Table
         data={data}
         count={count}

+ 6 - 0
packages/app/src/pages/product-in-stream/context.ts

@@ -7,5 +7,11 @@ export const contextState: OriginalListParams<GetFinishProductListStreamParams>
   wllbCode: '',
   startTime: '',
   endTime: '',
+  materialName: '',
+  storageCode: '',
+  userName: '',
+  wbs: '',
+  attribute: '',
+  storageLocationName: '',
 };
 export const context = createTableSearchContext(contextState);

+ 65 - 30
packages/app/src/pages/product-in-stream/filter/index.tsx

@@ -1,46 +1,81 @@
-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 {getFinishProductInStreamExport} from '@apis';
+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(
+    {
+      wllbCode: '',
+      startTime: '',
+      endTime: '',
+      materialName: '',
+      storageCode: '',
+      userName: '',
+      wbs: '',
+      attribute: '',
+      storageLocationName: '',
+    },
+    true,
+  );
+  const {isSearching} = useContextSection(searchContext, state => state[0]);
+  const [filterList, {set}] = useFilterDB();
+  const [visible, {onCloseModal, onSearch, onShowModal, onReset}] = useTableSearchToolEvents(
     context,
-    fn: getFinishProductInStreamExport,
-  });
+    fields,
+    {
+      resetCallback() {
+        resetState();
+        onDatesChange([null, null]);
+      },
+    },
+  );
 
   return (
-    <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
-        <FilterField
-          name='finishProductInCode'
-          label='物料编号'
-          value={code}
-          onChange={onCodeChange}
-        />
-        <FilterDatePicker
-          name='finishProductInDates'
-          label='入库时间'
-          value={dates}
-          onChange={onDatesChange}
-        />
-        <FilterButtonGroup
-          offset={6}
+    <>
+      <Card>
+        <FilterTool
+          onChange={onChange}
+          onDatesChange={onDatesChange}
+          fields={fields}
+          dates={dates}
           onSearch={onSearch}
-          onRefresh={refetch}
+          onReset={onReset}
+          onFilter={onShowModal}
           isSearching={isSearching}
-          onExport={onExport}
-          isExporting={isExporting}
+          filterData={filterList}
+          sourceMap={sourceMap}
+          fixedMap={fixedMap}
         />
-      </FilterFieldWrapper>
-    </Card>
+      </Card>
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        onConfirm={set}
+        filtermap={sourceMap}
+        source={filterList}
+      />
+    </>
   );
 };
 

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

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

+ 28 - 15
packages/app/src/pages/product-in-stream/table/index.tsx

@@ -2,7 +2,7 @@ import {FC} from 'react';
 import {ColumnsType} from 'antd/es/table';
 import {FinishProductListStreamInListData} from '@models';
 import {Card} from 'antd';
-import {Table} from '@components';
+import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
 import {
   HUGE_TABLE_WIDTH,
@@ -11,33 +11,34 @@ import {
   NORMAL_TABLE_WIDTH,
   SMALL_TABLE_WIDTH,
 } from '@utils';
-import {getFinishProductInStreamList} from '@apis';
-import {useContextSection, useQueryTableList} from '@hooks';
+import {getFinishProductInStreamExport, getFinishProductInStreamList} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<FinishProductListStreamInListData> = [
   {
-    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: LARGE_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: 'capacity', key: 'capacity', width: SMALL_TABLE_WIDTH},
-  {title: '用户名称', dataIndex: 'userName', key: 'userName', width: NORMAL_TABLE_WIDTH},
+  {title: '数量', dataIndex: 'capacity', key: 'capacity', width: SMALL_TABLE_WIDTH, align: 'right'},
+  {title: '操作人', dataIndex: 'userName', key: 'userName', width: NORMAL_TABLE_WIDTH},
   {
-    title: '库位编号',
+    title: '库位名称',
     dataIndex: 'storageLocationCode',
     key: 'storageLocationCode',
     width: NORMAL_TABLE_WIDTH,
   },
+  {
+    title: 'WBS编号',
+    dataIndex: 'wbs',
+    key: 'wbs',
+    width: NORMAL_TABLE_WIDTH,
+  },
   {title: '入库时间', dataIndex: 'scrq', key: 'scrq', width: MIDDLE_TABLE_WIDTH},
   {title: '连番号', dataIndex: 'serial', key: 'serial', width: SMALL_TABLE_WIDTH},
   {title: '属性', dataIndex: 'attribute', key: 'attribute', width: LARGE_TABLE_WIDTH},
@@ -46,15 +47,27 @@ const columns: ColumnsType<FinishProductListStreamInListData> = [
 const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
 
-  const [{data, count}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getFinishProductInStreamList,
     params,
     pageContext,
     searchContext,
   });
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: getFinishProductInStreamExport,
+  });
 
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        onRefresh={refetch}
+        isRefreshing={isFetching}
+        onExport={onExport}
+        isExporting={isExporting}
+      />
+
       <Table
         columns={columns}
         data={data}

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

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

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

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

+ 1 - 0
packages/app/src/pages/product-report/table/hooks.tsx

@@ -36,6 +36,7 @@ const columns: ColumnsType<NoticeListData> = [
       return type === '0' ? '未入库' : '已入库';
     },
     width: SMALL_TABLE_WIDTH,
+    align: 'center',
   },
 ];
 

+ 1 - 0
packages/app/src/pages/purchase-order/table/index.tsx

@@ -29,6 +29,7 @@ const columns: ColumnsType<ReceiveListData> = [
       return type === '1' ? '已收货' : '未收货';
     },
     width: SMALL_TABLE_WIDTH,
+    align: 'center',
   },
 ];
 const TableList: FC = function () {

+ 1 - 0
packages/app/src/pages/semi-report/table/hooks.tsx

@@ -37,6 +37,7 @@ const tableColumns: ColumnsType<NoticeListData> = [
       return type === '0' ? '未入库' : '已入库';
     },
     width: SMALL_TABLE_WIDTH,
+    align: 'center',
   },
 ];