Browse Source

chore: 报工单列表调整

xyh 2 years ago
parent
commit
7046a0ee27

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

@@ -165,11 +165,13 @@ export function exportSellOrderList(data: GetSellOrderListParams): any {
 /** 移库单 */
 export function getRelocationOrderList(
   data: GetRelocationOrderListParams,
+  signal?: AbortSignal,
 ): BaseListResult<RelocationOrderListData> {
   return request({
     method: 'GET',
     url: `${BASE_URL}/getWarehouseTransfer`,
     data,
+    signal,
   });
 }
 

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

@@ -76,10 +76,20 @@ export type GetSellOrderListParams = {
 
 /** 查询移库单 */
 export type GetRelocationOrderListParams = {
-  /** 是否移库完成 */
-  type: '0' | '1' | '';
   /** 移库单编号 */
   warehouseTransferCode: string;
+  /** 要货仓库 id */
+  askGoodsWarehouseId: string;
+  /** 出货仓库 id */
+  supplyWarehouseId: string;
+  /** 移库类型 */
+  warehouseTransferType: string;
+  /** wbs */
+  wbs: string;
+  /** 所属公司 */
+  companyCode: string;
+  /** 分录号 */
+  entryNumber: string;
 } & BaseOrderListParams &
   ListParams;
 

+ 3 - 1
packages/app/src/models/response/queryList.ts

@@ -184,7 +184,7 @@ export type SellOrderListData = {
 /** 移库单数据 */
 export type RelocationOrderListData = {
   /**
-   * 要货仓库名城管
+   * 要货仓库
    */
   askGoodsWarehouseaName: string;
   /**
@@ -248,6 +248,8 @@ export type RelocationOrderListData = {
    * WBS
    */
   wbs: string;
+  /** 所属公司 */
+  companyName: string;
 };
 
 /** 单据删除日志 */

+ 0 - 1
packages/app/src/pages/product-report/filter/state.ts

@@ -23,7 +23,6 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
 
 export const fixedMap: MapValue<typeof contextState>[] = [
   {label: '生产单号', value: 'productionCode', type: 'field'},
-  {label: '报工单ID', value: 'noticeId', type: 'field'},
   {label: '报工单编号', value: 'noticeCode', type: 'field'},
   {label: '物料名称', value: 'materialName', type: 'field'},
   {label: '物料编号', value: 'wllbCode', type: 'field'},

+ 7 - 2
packages/app/src/pages/relocation-order/content.ts

@@ -4,11 +4,16 @@ import {GetRelocationOrderListParams, OriginalListParams} from '@models';
 export const pageContext = createPageContext();
 export const searchContext = createSearchContext();
 export const contextState: OriginalListParams<GetRelocationOrderListParams> = {
-  type: '' as GetRelocationOrderListParams['type'],
   warehouseTransferCode: '',
   startTime: '',
   endTime: '',
-  materialCode: '',
   materialName: '',
+  askGoodsWarehouseId: '',
+  supplyWarehouseId: '',
+  wbs: '',
+  entryNumber: '',
+  warehouseTransferType: '',
+  materialCode: '',
+  companyCode: '',
 };
 export const context = createTableSearchContext(contextState);

+ 54 - 69
packages/app/src/pages/relocation-order/filter/index.tsx

@@ -1,89 +1,74 @@
-import {
-  FilterButtonGroup,
-  FilterDatePicker,
-  FilterField,
-  FilterFieldWrapper,
-  FilterSelect,
-} from '@components';
 import {
   useContextSection,
   useFilterField,
-  useTableExportEvent,
-  useTableSearchEvent,
   useRangeDate,
+  useTableSearchToolEvents,
+  useFilterDB,
 } from '@hooks';
 import {GetRelocationOrderListParams} from '@models';
 import {Card} from 'antd';
 import {FC} from 'react';
-import {context, pageContext, searchContext} from '../content';
-import {exportRelocationOrderList} from '@apis';
-
-const options = [
-  {label: '全部', value: ''},
-  {label: '已移库', value: '1'},
-  {label: '未移库', value: '0'},
-];
+import {context, searchContext} from '../content';
+import {FilterSelectorModal, FilterTool} from '@components';
+import {fixedMap, sourceMap} from './state';
 
 const Filter: FC = function () {
-  const [fields, onChange] = useFilterField({
-    type: '' as GetRelocationOrderListParams['type'],
-    warehouseTransferCode: '',
-    materialCode: '',
-    materialName: '',
-  });
+  const [fields, {onChange, resetState}] = useFilterField(
+    {
+      warehouseTransferCode: '',
+      startTime: '',
+      endTime: '',
+      materialName: '',
+      askGoodsWarehouseaId: '',
+      supplyWarehouseId: '',
+      wbs: '',
+      entryNumber: '',
+      warehouseTransferType: '',
+      materialCode: '',
+      companyCode: '',
+    },
+    true,
+  );
   const [{dates, start, end}, onDatesChange] = useRangeDate();
-  const {warehouseTransferCode, materialCode, materialName, type} = fields;
-  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
-  const onSearch = useTableSearchEvent(context, {...fields, startTime: start, endTime: end});
-  const [isExporting, onExport] = useTableExportEvent({
-    pageContext,
-    fn: exportRelocationOrderList,
+  const {isSearching} = useContextSection(searchContext, state => state[0]);
+  const [visible, {onShowModal, onCloseModal, onReset, onSearch}] = useTableSearchToolEvents(
     context,
-  });
+    {...fields, startTime: start, endTime: end},
+    {
+      resetCallback() {
+        resetState();
+        onDatesChange([null, null]);
+      },
+    },
+  );
+  const [filterList, {set}] = useFilterDB();
 
   return (
-    <Card>
-      <FilterFieldWrapper onSearch={onSearch}>
-        <FilterField
-          name='relocationCode'
-          label='移库单编号'
-          value={warehouseTransferCode}
-          onChange={onChange('warehouseTransferCode')}
-        />
-        <FilterField
-          name='materialName'
-          label='物料名称'
-          value={materialName}
-          onChange={onChange('materialName')}
-        />
-        <FilterField
-          name='materialName'
-          label='物料编号'
-          value={materialCode}
-          onChange={onChange('materialCode')}
-        />
-        <FilterSelect
-          name='type'
-          label='移库状态'
-          value={type}
-          onChange={onChange('type')}
-          options={options}
-        />
-        <FilterDatePicker
-          value={dates}
-          label='单据日期'
-          name='relocationDates'
-          onChange={onDatesChange}
-        />
-        <FilterButtonGroup
+    <>
+      <Card>
+        <FilterTool
           onSearch={onSearch}
+          onReset={onReset}
           isSearching={isSearching}
-          onExport={onExport}
-          isExporting={isExporting}
-          onRefresh={refetch}
+          onChange={onChange}
+          onDatesChange={onDatesChange}
+          fields={fields}
+          dates={dates}
+          sourceMap={sourceMap}
+          fixedMap={fixedMap}
+          onFilter={onShowModal}
+          filterData={filterList}
         />
-      </FilterFieldWrapper>
-    </Card>
+      </Card>
+
+      <FilterSelectorModal
+        visible={visible}
+        onClose={onCloseModal}
+        onConfirm={set}
+        filtermap={sourceMap}
+        source={filterList}
+      />
+    </>
   );
 };
 

+ 18 - 0
packages/app/src/pages/relocation-order/filter/state.ts

@@ -0,0 +1,18 @@
+import {FilterGroupMap, MapValue} from '@components';
+import {contextState} from '../content';
+
+export const fixedMap: MapValue<typeof contextState>[] = [
+  {label: '移库单编号', value: 'warehouseTransferCode', type: 'field'},
+  {label: '物料编号', value: 'materialCode', type: 'field'},
+  {label: '物料名称', value: 'materialName', type: 'field'},
+];
+
+export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
+  ['1', {label: '要货仓库', type: 'keySelect', selectKey: '仓库', value: 'askGoodsWarehouseId'}],
+  ['2', {label: '出货仓库', type: 'keySelect', selectKey: '仓库', value: 'supplyWarehouseId'}],
+  ['3', {label: '所属公司', type: 'keySelect', selectKey: '公司', value: 'companyCode'}],
+  ['4', {label: '移库类型', type: 'field', value: 'warehouseTransferType'}],
+  ['5', {label: 'WBS编号', type: 'field', value: 'wbs'}],
+  ['6', {label: '分录号', type: 'field', value: 'entryNumber'}],
+  ['7', {label: '单据日期', type: 'date', value: 'startTime'}],
+]);

+ 37 - 17
packages/app/src/pages/relocation-order/table/hooks.tsx

@@ -1,6 +1,12 @@
 import {ColumnsType} from 'antd/es/table';
 import {RelocationOrderListData} from '@models';
-import {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
+import {
+  HUGE_TABLE_WIDTH,
+  LARGE_TABLE_WIDTH,
+  MIDDLE_TABLE_WIDTH,
+  NORMAL_TABLE_WIDTH,
+  SMALL_TABLE_WIDTH,
+} from '@utils';
 import {useSupertube, useTableDeleteEvent} from '@hooks';
 import {deleRelocationOrder} from '@apis';
 import {Button} from 'antd';
@@ -19,10 +25,10 @@ const columns: ColumnsType<RelocationOrderListData> = [
     width: NORMAL_TABLE_WIDTH,
   },
   {
-    title: 'WBS编号',
-    dataIndex: 'wbs',
-    key: 'wbs',
-    width: NORMAL_TABLE_WIDTH,
+    title: '物料编号',
+    dataIndex: 'materialCode',
+    key: 'materialCode',
+    width: MIDDLE_TABLE_WIDTH,
   },
   {
     title: '物料名称',
@@ -30,12 +36,6 @@ const columns: ColumnsType<RelocationOrderListData> = [
     key: 'materialName',
     width: HUGE_TABLE_WIDTH,
   },
-  {
-    title: '物料编号',
-    dataIndex: 'materialCode',
-    key: 'materialCode',
-    width: MIDDLE_TABLE_WIDTH,
-  },
   {
     title: '要货仓库',
     dataIndex: 'askGoodsWarehouseName',
@@ -48,23 +48,42 @@ const columns: ColumnsType<RelocationOrderListData> = [
     key: 'supplyWarehouseName',
     width: MIDDLE_TABLE_WIDTH,
   },
-  {
-    title: '移库类型',
-    dataIndex: 'warehouseTransferType',
-    key: 'warehouseTransferType',
-    width: NORMAL_TABLE_WIDTH,
-  },
   {
     title: '移库数量',
     dataIndex: 'num',
     key: 'num',
     width: SMALL_TABLE_WIDTH,
+    align: 'right',
   },
   {
     title: '出库数量',
     dataIndex: 'outNum',
     key: 'outNum',
     width: SMALL_TABLE_WIDTH,
+    align: 'right',
+  },
+  {
+    title: '所属公司',
+    dataIndex: 'companyName',
+    key: 'companyName',
+    width: LARGE_TABLE_WIDTH,
+  },
+  {
+    title: '移库类型',
+    dataIndex: 'warehouseTransferType',
+    key: 'warehouseTransferType',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: 'WBS编号',
+    dataIndex: 'wbs',
+    key: 'wbs',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '分录号',
+    dataIndex: 'entryNumber',
+    width: NORMAL_TABLE_WIDTH,
   },
   {
     title: '状态',
@@ -74,6 +93,7 @@ const columns: ColumnsType<RelocationOrderListData> = [
     render(_, {type}) {
       return type === '1' ? '已移库' : '未移库';
     },
+    align: 'center',
   },
   {
     title: '单据日期',

+ 16 - 4
packages/app/src/pages/relocation-order/table/index.tsx

@@ -1,7 +1,7 @@
-import {useContextSection, useQueryTableList, useSupertube} from '@hooks';
+import {useContextSection, useQueryTableList, useSupertube, useTableExportEvent} from '@hooks';
 import {FC} from 'react';
 import {context, pageContext, searchContext} from '../content';
-import {getRelocationOrderList} from '@apis';
+import {exportRelocationOrderList, getRelocationOrderList} from '@apis';
 import {Card} from 'antd';
 import {Table, TableTools} from '@components';
 import {useColumns} from './hooks';
@@ -10,7 +10,7 @@ import AddModal from './modal';
 
 const TableList: FC = function () {
   const params = useContextSection(context, state => state[0]);
-  const [{data, count}, {refetch}] = useQueryTableList({
+  const [{data, count, isFetching}, {refetch}] = useQueryTableList({
     queryFn: getRelocationOrderList,
     params,
     pageContext,
@@ -19,11 +19,23 @@ const TableList: FC = function () {
   const columns = useColumns(refetch);
   const isSuper = useSupertube();
   const [visible, {setTrue, setFalse}] = useBoolean();
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    fn: exportRelocationOrderList,
+    context,
+  });
 
   return (
     <>
       <Card className='table-wrapper'>
-        {isSuper && <TableTools onClick={setTrue} />}
+        <TableTools
+          onAdd={isSuper ? setTrue : void 0}
+          isRefreshing={isFetching}
+          onRefresh={refetch}
+          onExport={onExport}
+          isExporting={isExporting}
+        />
+
         <Table
           columns={columns}
           data={data}

+ 0 - 1
packages/app/src/pages/semi-report/filter/state.ts

@@ -23,7 +23,6 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
 
 export const fixedMap: MapValue<typeof contextState>[] = [
   {label: '生产单号', value: 'productionCode', type: 'field'},
-  {label: '报工单ID', value: 'noticeId', type: 'field'},
   {label: '报工单编号', value: 'noticeCode', type: 'field'},
   {label: '物料名称', value: 'materialName', type: 'field'},
   {label: '物料编号', value: 'wllbCode', type: 'field'},