Browse Source

chore: 半成品出库明细调整

xyh 2 years ago
parent
commit
2bd0a60f76

+ 5 - 2
packages/app/src/apis/semiManufactures.ts

@@ -11,6 +11,7 @@ import {
   SemiDrawListData,
   SemiOutStreamListData,
   GetSemiInStreamParams,
+  GetSemiOutStreamListParams,
 } from '@models';
 import {request} from './request';
 
@@ -124,17 +125,19 @@ export function getSemiManufacturesDrawInfo(id: string): BaseListResult<SemiDraw
 }
 /** 半成品出库流水列表 */
 export function getSemiManufacturesDrawStream(
-  data: GetWarehousingFlowingListParams,
+  data: GetSemiOutStreamListParams,
+  signal?: AbortSignal,
 ): BaseListResult<SemiOutStreamListData> {
   return request({
     method: 'GET',
     url: `${BASE_URL2}/getRemovalHalfProduct`,
     data,
+    signal,
   });
 }
 
 /** 半成品出库流水导出 */
-export function exportSemiManufacturesDrawStream(data: GetWarehousingFlowingListParams): any {
+export function exportSemiManufacturesDrawStream(data: GetSemiOutStreamListParams): any {
   return request({
     method: 'GET',
     url: `${BASE_URL2}/getRemovalHalfProductExcel`,

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

@@ -22,6 +22,28 @@ export type GetWarehousingFlowingListParams = {
   supplierId: string;
 } & ListParams;
 
+/** 半成品出库流水 */
+export type GetSemiOutStreamListParams = {
+  /** 开始时间 */
+  startTime: string;
+  /** 结束时间 */
+  endTime: string;
+  /** 出库单编号 */
+  storageCode: string;
+  /** 物料编号 */
+  wllbCode: string;
+  /** 物料名称 */
+  materialName: string;
+  /** 操作人 */
+  userName: string;
+  /** wbs编号 */
+  wbs: string;
+  /** 领用部门 */
+  departmentCode: string;
+  /** 要货单 */
+  askGoodsId: string;
+} & ListParams;
+
 /** 原料出库 */
 export type GetRawOutListParams = {
   /** 开始时间 */

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

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

+ 59 - 30
packages/app/src/pages/semi-out-stream/filter/index.tsx

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

+ 16 - 0
packages/app/src/pages/semi-out-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: 'userName'}],
+  ['2', {label: '领用部门', type: 'keySelect', selectKey: '部门字典', value: 'departmentCode'}],
+  ['3', {label: 'WBS编号', type: 'field', value: 'wbs'}],
+  ['4', {label: '出库时间', type: 'date', value: 'startTime'}],
+]);
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '要货单', type: 'field', value: 'askGoodsId'},
+  {label: '出库编号', type: 'field', value: 'storageCode'},
+  {label: '物料编号', type: 'field', value: 'wllbCode'},
+  {label: '物料名称', type: 'field', value: 'materialName'},
+];

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

@@ -2,46 +2,57 @@ import {Card} from 'antd';
 import {FC} from 'react';
 import {ColumnsType} from 'antd/es/table';
 import {SemiOutStreamListData} from '@models';
-import {Table} from '@components';
+import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
 import {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
-import {getSemiManufacturesDrawStream} from '@apis';
-import {useContextSection, useQueryTableList} from '@hooks';
+import {exportSemiManufacturesDrawStream, getSemiManufacturesDrawStream} from '@apis';
+import {useContextSection, useQueryTableList, useTableExportEvent} from '@hooks';
 
 const columns: ColumnsType<SemiOutStreamListData> = [
+  {title: '要货单', dataIndex: 'askGoodsId', key: 'askGoodsId', width: MIDDLE_TABLE_WIDTH},
   {
-    title: '利道编号',
+    title: '出库编号',
     dataIndex: 'storageCode',
     key: 'storageCode',
     width: NORMAL_TABLE_WIDTH,
   },
+  {title: '物料编号', dataIndex: 'wllbCode', key: 'wllbCode', width: MIDDLE_TABLE_WIDTH},
+  {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
+  {title: '出库数量', dataIndex: 'num', key: 'num', width: SMALL_TABLE_WIDTH, align: 'right'},
+  {title: '出库人', dataIndex: 'userName', key: 'userName', width: SMALL_TABLE_WIDTH},
+  {title: '领用部门', dataIndex: 'department', key: 'department', width: NORMAL_TABLE_WIDTH},
   {
-    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: 'num', key: 'num', width: SMALL_TABLE_WIDTH},
-  {title: '用户名称', dataIndex: 'userName', key: 'userName', width: NORMAL_TABLE_WIDTH},
   {title: '出库时间', dataIndex: 'scrq', key: 'scrq', width: MIDDLE_TABLE_WIDTH},
-  {title: '要货单', dataIndex: 'askGoodsId', key: 'askGoodsId', width: NORMAL_TABLE_WIDTH},
-  {title: '领用部门', dataIndex: 'department', key: 'department', 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: getSemiManufacturesDrawStream,
-    params: params as any,
+    params,
     pageContext,
     searchContext,
   });
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportSemiManufacturesDrawStream,
+  });
 
   return (
     <Card className='table-wrapper'>
+      <TableTools
+        onRefresh={refetch}
+        isRefreshing={isFetching}
+        isExporting={isExporting}
+        onExport={onExport}
+      />
+
       <Table
         columns={columns}
         data={data}

+ 1 - 1
packages/app/src/utils/constants.ts

@@ -11,7 +11,7 @@ export const PAGE_SIZE_LIST = ['5', '10', '30', '50', '80', '100'];
 export const MODAL_PAGE_SIZE_LIST = PAGE_SIZE_LIST;
 /** 请求域名 */
 export const NETWORK_URL =
-  process.env.NODE_ENV === 'development' ? 'http://192.168.147:9560' : 'http://8.142.144.205:9560';
+  process.env.NODE_ENV === 'development' ? 'http://192.168.147:9560' : 'http://10.2.111.91:9560';
 export const E2E_NETWORK_URL = 'http://e2e.test.cn';
 /** 导出错误提示 */
 export const EXPORT_ERROR_TIPS = '导出错误,请稍后再试';