Explorar el Código

feat: 移库单

xyh hace 2 años
padre
commit
f5c0f73376

+ 1 - 1
packages/app/src/models/request/queryList.ts

@@ -59,7 +59,7 @@ export type GetSellOrderListParams = {
 /** 查询移库单 */
 export type GetRelocationOrderListParams = {
   /** 是否移库完成 */
-  type: '0' | '1';
+  type: '0' | '1' | '';
   /** 移库单编号 */
   warehouseTransferCode: string;
 } & BaseOrderListParams &

+ 17 - 0
packages/app/src/pages/home/menu/index.module.css

@@ -1,5 +1,22 @@
 .slider {
+  height: 100%;
+  overflow: auto;
   background-color: #fff !important;
+  border: unset !important;
+
+  & :global(.ant-menu) {
+    border-inline-end: unset;
+  }
+
+  &::-webkit-scrollbar {
+    width: 6px;
+    background-color: #eee;
+  }
+
+  &::-webkit-scrollbar-thumb {
+    background-color: #999;
+    border-radius: 6px;
+  }
 }
 
 .slider-menus {

+ 1 - 1
packages/app/src/pages/production-requisition/filter/index.tsx

@@ -37,7 +37,7 @@ const Filter: FC = function () {
         <Row>
           <FilterField
             name='productionOrder'
-            label='领用单号'
+            label='订单编号'
             value={askGoodsId}
             onChange={onChange('askGoodsId')}
           />

+ 14 - 0
packages/app/src/pages/relocation-order/content.ts

@@ -0,0 +1,14 @@
+import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
+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: '',
+};
+export const context = createTableSearchContext(contextState);

+ 83 - 0
packages/app/src/pages/relocation-order/filter/index.tsx

@@ -0,0 +1,83 @@
+import {FilterButtonGroup, FilterDatePicker, FilterField, FilterSelect} from '@components';
+import {useContextSection, useFilterField, useOnExport, useOnSearch, useRangeDate} from '@hooks';
+import {GetRelocationOrderListParams} from '@models';
+import {Card, Row, Space} 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'},
+];
+
+const Filter: FC = function () {
+  const [fields, onChange] = useFilterField({
+    type: '' as GetRelocationOrderListParams['type'],
+    warehouseTransferCode: '',
+    materialCode: '',
+    materialName: '',
+  });
+  const [{dates, start, end}, onDatesChange] = useRangeDate();
+  const {warehouseTransferCode, materialCode, materialName, type} = fields;
+  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
+  const onSearch = useOnSearch(context, {...fields, startTime: start, endTime: end});
+  const [isExporting, onExport] = useOnExport({
+    pageContext,
+    fn: exportRelocationOrderList,
+    context,
+  });
+
+  return (
+    <Card>
+      <Space direction='vertical' size='middle' className='width-full'>
+        <Row>
+          <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}
+          />
+        </Row>
+        <Row>
+          <FilterDatePicker
+            value={dates}
+            label='单据日期'
+            name='relocationDates'
+            onChange={onDatesChange}
+          />
+          <FilterButtonGroup
+            offset={12}
+            onSearch={onSearch}
+            isSearching={isSearching}
+            onExport={onExport}
+            isExporting={isExporting}
+            onRefresh={refetch}
+          />
+        </Row>
+      </Space>
+    </Card>
+  );
+};
+
+export default Filter;

+ 22 - 0
packages/app/src/pages/relocation-order/index.tsx

@@ -0,0 +1,22 @@
+import {PageProvider, SearchProvider, TableSearchProvider} from '@components';
+import {FC} from 'react';
+import {context, contextState, pageContext, searchContext} from './content';
+import Filter from './filter';
+import TableList from './table';
+
+const RelocationOrder: FC = function () {
+  return (
+    <TableSearchProvider context={context} state={contextState}>
+      <PageProvider context={pageContext}>
+        <SearchProvider context={searchContext}>
+          <section className='content-main'>
+            <Filter />
+            <TableList />
+          </section>
+        </SearchProvider>
+      </PageProvider>
+    </TableSearchProvider>
+  );
+};
+
+export default RelocationOrder;

+ 111 - 0
packages/app/src/pages/relocation-order/table/index.tsx

@@ -0,0 +1,111 @@
+import {useContextSection, useQueryTableList} from '@hooks';
+import {FC} from 'react';
+import {context, pageContext, searchContext} from '../content';
+import {getRelocationOrderList} from '@apis';
+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 {Card} from 'antd';
+import {Table} from '@components';
+
+const columns: ColumnsType<RelocationOrderListData> = [
+  {
+    title: '移库单ID',
+    dataIndex: 'warehouseTransferId',
+    key: 'warehouseTransferId',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '移库单编号',
+    dataIndex: 'warehouseTransferCode',
+    key: 'warehouseTransferCode',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: 'WBS编号',
+    dataIndex: 'WBS',
+    key: 'WBS',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '物料名称',
+    dataIndex: 'materialName',
+    key: 'materialName',
+    width: HUGE_TABLE_WIDTH,
+  },
+  {
+    title: '物料编号',
+    dataIndex: 'materialCode',
+    key: 'materialCode',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: '要货仓库',
+    dataIndex: 'askGoodsWarehouseName',
+    key: 'askGoodsWarehouseName',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: '出货仓库',
+    dataIndex: 'supplyWarehouseName',
+    key: 'supplyWarehouseName',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: '移库类型',
+    dataIndex: 'warehouseTransferType',
+    key: 'warehouseTransferType',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '移库数量',
+    dataIndex: 'num',
+    key: 'num',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '出库数量',
+    dataIndex: 'outNum',
+    key: 'outNum',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '状态',
+    dataIndex: 'type',
+    key: 'type',
+    width: SMALL_TABLE_WIDTH,
+    render(_, {type}) {
+      return type === '1' ? '已移库' : '未移库';
+    },
+  },
+  {
+    title: '单据日期',
+    dataIndex: 'documentTime',
+    key: 'documentTime',
+    width: NORMAL_TABLE_WIDTH,
+  },
+];
+
+const TableList: FC = function () {
+  const params = useContextSection(context, state => state[0]);
+  const [{data, count}] = useQueryTableList({
+    queryFn: getRelocationOrderList,
+    params,
+    pageContext,
+    searchContext,
+  });
+
+  return (
+    <Card className='table-wrapper'>
+      <Table
+        columns={columns}
+        data={data}
+        count={count}
+        pageContext={pageContext}
+        searchContext={searchContext}
+      />
+    </Card>
+  );
+};
+
+export default TableList;

+ 13 - 0
packages/app/src/pages/sell-order/context.ts

@@ -0,0 +1,13 @@
+import {createPageContext, createSearchContext, createTableSearchContext} from '@hooks';
+import {GetSellOrderListParams, OriginalListParams} from '@models';
+
+export const searchContext = createSearchContext();
+export const pageContext = createPageContext();
+export const contextState: OriginalListParams<GetSellOrderListParams> = {
+  deliveryId: '',
+  materialCode: '',
+  materialName: '',
+  startTime: '',
+  endTime: '',
+};
+export const context = createTableSearchContext(contextState);

+ 69 - 0
packages/app/src/pages/sell-order/filter/index.tsx

@@ -0,0 +1,69 @@
+import {FilterButtonGroup, FilterDatePicker, FilterField} from '@components';
+import {useContextSection, useFilterField, useOnExport, useOnSearch, useRangeDate} from '@hooks';
+import {Card, Row, Space} from 'antd';
+import {FC} from 'react';
+import {searchContext, context, pageContext} from '../context';
+import {exportSellOrderList} from '@apis';
+
+const Filter: FC = function () {
+  const [fields, onChange] = useFilterField({
+    deliveryId: '',
+    materialCode: '',
+    materialName: '',
+  });
+  const {materialCode, materialName, deliveryId} = fields;
+  const [{dates, start, end}, onDatesChange] = useRangeDate();
+  const {isSearching, refetch} = useContextSection(searchContext, state => state[0]);
+  const onSearch = useOnSearch(context, {...fields, startTime: start, endTime: end});
+  const [isExporting, onExport] = useOnExport({
+    fn: exportSellOrderList,
+    context,
+    pageContext,
+  });
+
+  return (
+    <Card>
+      <Space direction='vertical' size='middle' className='width-full'>
+        <Row>
+          <FilterField
+            name='sellOrder'
+            label='销售单号'
+            value={deliveryId}
+            onChange={onChange('deliveryId')}
+          />
+          <FilterField
+            name='materialName'
+            label='物料名称'
+            value={materialName}
+            onChange={onChange('materialName')}
+          />
+          <FilterField
+            name='materialCode'
+            label='物料编号'
+            value={materialCode}
+            onChange={onChange('materialCode')}
+          />
+
+          <FilterDatePicker
+            name='askGoodsDates'
+            label='单据日期'
+            value={dates}
+            onChange={onDatesChange}
+          />
+        </Row>
+        <Row>
+          <FilterButtonGroup
+            onSearch={onSearch}
+            onRefresh={refetch}
+            isSearching={isSearching}
+            onExport={onExport}
+            isExporting={isExporting}
+            disableAlign
+          />
+        </Row>
+      </Space>
+    </Card>
+  );
+};
+
+export default Filter;

+ 22 - 0
packages/app/src/pages/sell-order/index.tsx

@@ -0,0 +1,22 @@
+import {PageProvider, SearchProvider, TableSearchProvider} from '@components';
+import {FC} from 'react';
+import {context, contextState, pageContext, searchContext} from './context';
+import Filter from './filter';
+import TableList from './table';
+
+const SellOrder: FC = function () {
+  return (
+    <TableSearchProvider context={context} state={contextState}>
+      <PageProvider context={pageContext}>
+        <SearchProvider context={searchContext}>
+          <section className='content-main'>
+            <Filter />
+            <TableList />
+          </section>
+        </SearchProvider>
+      </PageProvider>
+    </TableSearchProvider>
+  );
+};
+
+export default SellOrder;

+ 90 - 0
packages/app/src/pages/sell-order/table/index.tsx

@@ -0,0 +1,90 @@
+import {useContextSection, useQueryTableList} from '@hooks';
+import {FC} from 'react';
+import {context, pageContext, searchContext} from '../context';
+import {getSellOrderList} from '@apis';
+import {Card} from 'antd';
+import {ColumnsType} from 'antd/es/table';
+import {SellOrderListData} from '@models';
+import {HUGE_TABLE_WIDTH, MIDDLE_TABLE_WIDTH, NORMAL_TABLE_WIDTH, SMALL_TABLE_WIDTH} from '@utils';
+import {Table} from '@components';
+
+const columns: ColumnsType<SellOrderListData> = [
+  {
+    title: '销售单号',
+    dataIndex: 'deliveryId',
+    key: 'deliveryId',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: '物料名称',
+    dataIndex: 'materialName',
+    key: 'materialName',
+    width: HUGE_TABLE_WIDTH,
+  },
+  {
+    title: '物料编号',
+    dataIndex: 'materialCode',
+    key: 'materialCode',
+    width: MIDDLE_TABLE_WIDTH,
+  },
+  {
+    title: 'WBS编号',
+    dataIndex: 'WBS',
+    key: 'WBS',
+    width: NORMAL_TABLE_WIDTH,
+  },
+  {
+    title: '交货数量',
+    dataIndex: 'gsDeliveryNum',
+    key: 'gsDeliveryNum',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '出库数量',
+    dataIndex: 'outNum',
+    key: 'outNum',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '取消数量',
+    dataIndex: 'gsCancelNum',
+    key: 'gsCancelNum',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '公司编号',
+    dataIndex: 'companyNumber',
+    key: 'companyNumber',
+    width: SMALL_TABLE_WIDTH,
+  },
+  {
+    title: '单据日期',
+    dataIndex: 'billsTime',
+    key: 'billsTime',
+    width: NORMAL_TABLE_WIDTH,
+  },
+];
+
+const TableList: FC = function () {
+  const params = useContextSection(context, state => state[0]);
+  const [{data, count}] = useQueryTableList({
+    queryFn: getSellOrderList,
+    params,
+    pageContext,
+    searchContext,
+  });
+
+  return (
+    <Card className='table-wrapper'>
+      <Table
+        columns={columns}
+        pageContext={pageContext}
+        searchContext={searchContext}
+        data={data}
+        count={count}
+      />
+    </Card>
+  );
+};
+
+export default TableList;

+ 6 - 0
packages/app/src/routes/index.tsx

@@ -36,6 +36,8 @@ import {
   DICTIONARY_PATH,
   GS_INTERFACE_LOG_PATH,
   PRODUCTION_REQUISITION_PATH,
+  SELL_ORDER_PATH,
+  RELOCATION_ORDER_PATH,
 } from './name';
 import {
   Container,
@@ -66,11 +68,13 @@ import {
   Dictionary,
   GSInterfaceLog,
   ProductionRequisitionOrder,
+  RelcationOrder,
 } from './routes';
 import DeadProduct from '@pages/dead-product';
 import PurchaseOrder from '@pages/purchase-order';
 import MaterialBind from '@pages/material-bind';
 import MaterialPrint from '@pages/material-print';
+import SellOrder from '@pages/sell-order';
 
 export const routes: RouteObject[] = [
   {
@@ -108,6 +112,8 @@ export const routes: RouteObject[] = [
       {path: DICTIONARY_PATH, element: <Dictionary />},
       {path: GS_INTERFACE_LOG_PATH, element: <GSInterfaceLog />},
       {path: PRODUCTION_REQUISITION_PATH, element: <ProductionRequisitionOrder />},
+      {path: SELL_ORDER_PATH, element: <SellOrder />},
+      {path: RELOCATION_ORDER_PATH, element: <RelcationOrder />},
     ],
   },
   {path: LOGIN_PATH, element: <Login />},

+ 4 - 0
packages/app/src/routes/name.ts

@@ -91,3 +91,7 @@ export const DICTIONARY_PATH = '/dictionary/:type';
 export const GS_INTERFACE_LOG_PATH = '/log/gsinterface';
 /** 生产领用 */
 export const PRODUCTION_REQUISITION_PATH = '/production_requisition';
+/** 销售单 */
+export const SELL_ORDER_PATH = '/sellorder';
+/** 移库单 */
+export const RELOCATION_ORDER_PATH = '/relocation';

+ 6 - 0
packages/app/src/routes/routes.tsx

@@ -198,3 +198,9 @@ export const GSInterfaceLog = lazy(
 export const ProductionRequisitionOrder = lazy(
   () => import(/* webpackChunkName: "productionRequisition" */ '@pages/production-requisition'),
 );
+export const SellOrder = lazy(
+  () => import(/* webpackChunkName: "sellOrder" */ '@pages/sell-order'),
+);
+export const RelcationOrder = lazy(
+  () => import(/** webpackChunkName: "relocationOrder" */ '@pages/relocation-order'),
+);

+ 1 - 0
packages/app/src/styles/index.css

@@ -43,6 +43,7 @@ img {
 .container {
   width: 100vw;
   height: 100vh;
+  overflow: hidden;
 }
 
 .content-main {