Commit 0a0810a3021ee1da5d160dfbae6e62ecf0bb1a17

Authored by 曾国涛
1 parent b4527016

feat: 开票功能开发

src/pages/Order/index.tsx
... ... @@ -5,6 +5,7 @@ import ReissueModal from '@/pages/Order/components/ReissueModal';
5 5 import {
6 6 postKingdeeRepSalBillOutbound,
7 7 postKingdeeRepSalOrderSave,
  8 + postServiceConstCanApplyAfterInvoicingStatus,
8 9 postServiceOrderCancelSend,
9 10 postServiceOrderNoNeedSend,
10 11 postServiceOrderOrderCancel,
... ... @@ -193,6 +194,8 @@ const OrderPage = () => {
193 194 shippingWarehouseChangeModalVisible,
194 195 setShippingWarehouseChangeModalVisible,
195 196 ] = useState(false);
  197 + const [canApplyAfterInvoicingStatus, setCanApplyAfterInvoicingStatus] =
  198 + useState([]);
196 199 const [ids, setIds] = useState([]);
197 200 const roleCode = userInfo?.roleSmallVO?.code;
198 201  
... ... @@ -4012,6 +4015,22 @@ const OrderPage = () => {
4012 4015 key="inv"
4013 4016 onClick={() => {
4014 4017 setIsMainOrder(true);
  4018 + if (isMainOrder) {
  4019 + let flat = [...subOrderSelectedMap.values()].flat();
  4020 + //获取flat的中每个元素的afterInvoicingStatus
  4021 + let afterInvoicingStatusList = flat.map((item) => {
  4022 + return item.afterInvoicingStatus;
  4023 + });
  4024 + //判断flat中的每个元素是否都存在于canApplyAfterInvoicingStatus中
  4025 + if (
  4026 + !afterInvoicingStatusList.every((item) => {
  4027 + return canApplyAfterInvoicingStatus.includes(item);
  4028 + })
  4029 + ) {
  4030 + message.error('订单状态不正确,请检查!');
  4031 + return;
  4032 + }
  4033 + }
4015 4034 setInvoicingDrawerFormVisible(true);
4016 4035 }}
4017 4036 disabled={selectedSubOrderKeys?.length === 0}
... ... @@ -4066,7 +4085,15 @@ const OrderPage = () => {
4066 4085 return toolBtns;
4067 4086 }
4068 4087  
  4088 + let initEnum = async () => {
  4089 + let invoiceTypeRet = await postServiceConstCanApplyAfterInvoicingStatus();
  4090 + if (invoiceTypeRet.result === RESPONSE_CODE.SUCCESS) {
  4091 + setCanApplyAfterInvoicingStatus(invoiceTypeRet.data);
  4092 + }
  4093 + };
  4094 +
4069 4095 useEffect(() => {
  4096 + initEnum();
4070 4097 // 使用URLSearchParams来解析查询参数
4071 4098 const params = new URLSearchParams(location.search);
4072 4099 const id = params.get('id');
... ...
src/services/request.ts
... ... @@ -54,7 +54,6 @@ import type {
54 54 MaterialUnitListRes,
55 55 MeasureUnitListRes,
56 56 MessageQueryDTO,
57   - ModelAndView,
58 57 OrderAddVO,
59 58 OrderAuditLogQueryVO,
60 59 OrderBaseInfoQueryVO,
... ... @@ -1541,7 +1540,9 @@ export interface GetErrorResponse {
1541 1540 * @description
1542 1541 * OK
1543 1542 */
1544   - 200: ModelAndView;
  1543 + 200: {
  1544 + [propertyName: string]: any;
  1545 + };
1545 1546 /**
1546 1547 * @description
1547 1548 * Unauthorized
... ... @@ -1562,9 +1563,9 @@ export interface GetErrorResponse {
1562 1563 export type GetErrorResponseSuccess = GetErrorResponse[200];
1563 1564 /**
1564 1565 * @description
1565   - * errorHtml
  1566 + * error
1566 1567 * @tags basic-error-controller
1567   - * @produces text/html
  1568 + * @produces *
1568 1569 */
1569 1570 export const getError = /* #__PURE__ */ (() => {
1570 1571 const method = 'get';
... ... @@ -1588,7 +1589,9 @@ export interface PutErrorResponse {
1588 1589 * @description
1589 1590 * OK
1590 1591 */
1591   - 200: ModelAndView;
  1592 + 200: {
  1593 + [propertyName: string]: any;
  1594 + };
1592 1595 /**
1593 1596 * @description
1594 1597 * Created
... ... @@ -1614,9 +1617,9 @@ export interface PutErrorResponse {
1614 1617 export type PutErrorResponseSuccess = PutErrorResponse[200];
1615 1618 /**
1616 1619 * @description
1617   - * errorHtml
  1620 + * error
1618 1621 * @tags basic-error-controller
1619   - * @produces text/html
  1622 + * @produces *
1620 1623 * @consumes application/json
1621 1624 */
1622 1625 export const putError = /* #__PURE__ */ (() => {
... ... @@ -1641,7 +1644,9 @@ export interface PostErrorResponse {
1641 1644 * @description
1642 1645 * OK
1643 1646 */
1644   - 200: ModelAndView;
  1647 + 200: {
  1648 + [propertyName: string]: any;
  1649 + };
1645 1650 /**
1646 1651 * @description
1647 1652 * Created
... ... @@ -1667,9 +1672,9 @@ export interface PostErrorResponse {
1667 1672 export type PostErrorResponseSuccess = PostErrorResponse[200];
1668 1673 /**
1669 1674 * @description
1670   - * errorHtml
  1675 + * error
1671 1676 * @tags basic-error-controller
1672   - * @produces text/html
  1677 + * @produces *
1673 1678 * @consumes application/json
1674 1679 */
1675 1680 export const postError = /* #__PURE__ */ (() => {
... ... @@ -1694,7 +1699,9 @@ export interface DeleteErrorResponse {
1694 1699 * @description
1695 1700 * OK
1696 1701 */
1697   - 200: ModelAndView;
  1702 + 200: {
  1703 + [propertyName: string]: any;
  1704 + };
1698 1705 /**
1699 1706 * @description
1700 1707 * No Content
... ... @@ -1715,9 +1722,9 @@ export interface DeleteErrorResponse {
1715 1722 export type DeleteErrorResponseSuccess = DeleteErrorResponse[200];
1716 1723 /**
1717 1724 * @description
1718   - * errorHtml
  1725 + * error
1719 1726 * @tags basic-error-controller
1720   - * @produces text/html
  1727 + * @produces *
1721 1728 */
1722 1729 export const deleteError = /* #__PURE__ */ (() => {
1723 1730 const method = 'delete';
... ... @@ -1741,7 +1748,9 @@ export interface OptionsErrorResponse {
1741 1748 * @description
1742 1749 * OK
1743 1750 */
1744   - 200: ModelAndView;
  1751 + 200: {
  1752 + [propertyName: string]: any;
  1753 + };
1745 1754 /**
1746 1755 * @description
1747 1756 * No Content
... ... @@ -1762,9 +1771,9 @@ export interface OptionsErrorResponse {
1762 1771 export type OptionsErrorResponseSuccess = OptionsErrorResponse[200];
1763 1772 /**
1764 1773 * @description
1765   - * errorHtml
  1774 + * error
1766 1775 * @tags basic-error-controller
1767   - * @produces text/html
  1776 + * @produces *
1768 1777 * @consumes application/json
1769 1778 */
1770 1779 export const optionsError = /* #__PURE__ */ (() => {
... ... @@ -1789,7 +1798,9 @@ export interface HeadErrorResponse {
1789 1798 * @description
1790 1799 * OK
1791 1800 */
1792   - 200: ModelAndView;
  1801 + 200: {
  1802 + [propertyName: string]: any;
  1803 + };
1793 1804 /**
1794 1805 * @description
1795 1806 * No Content
... ... @@ -1810,9 +1821,9 @@ export interface HeadErrorResponse {
1810 1821 export type HeadErrorResponseSuccess = HeadErrorResponse[200];
1811 1822 /**
1812 1823 * @description
1813   - * errorHtml
  1824 + * error
1814 1825 * @tags basic-error-controller
1815   - * @produces text/html
  1826 + * @produces *
1816 1827 * @consumes application/json
1817 1828 */
1818 1829 export const headError = /* #__PURE__ */ (() => {
... ... @@ -1837,7 +1848,9 @@ export interface PatchErrorResponse {
1837 1848 * @description
1838 1849 * OK
1839 1850 */
1840   - 200: ModelAndView;
  1851 + 200: {
  1852 + [propertyName: string]: any;
  1853 + };
1841 1854 /**
1842 1855 * @description
1843 1856 * No Content
... ... @@ -1858,9 +1871,9 @@ export interface PatchErrorResponse {
1858 1871 export type PatchErrorResponseSuccess = PatchErrorResponse[200];
1859 1872 /**
1860 1873 * @description
1861   - * errorHtml
  1874 + * error
1862 1875 * @tags basic-error-controller
1863   - * @produces text/html
  1876 + * @produces *
1864 1877 * @consumes application/json
1865 1878 */
1866 1879 export const patchError = /* #__PURE__ */ (() => {
... ... @@ -7883,6 +7896,61 @@ export const postServiceBankStatementQueryBankStatement =
7883 7896 return request;
7884 7897 })();
7885 7898  
  7899 +/** @description response type for postServiceConstCanApplyAfterInvoicingStatus */
  7900 +export interface PostServiceConstCanApplyAfterInvoicingStatusResponse {
  7901 + /**
  7902 + * @description
  7903 + * OK
  7904 + */
  7905 + 200: ServerResult;
  7906 + /**
  7907 + * @description
  7908 + * Created
  7909 + */
  7910 + 201: any;
  7911 + /**
  7912 + * @description
  7913 + * Unauthorized
  7914 + */
  7915 + 401: any;
  7916 + /**
  7917 + * @description
  7918 + * Forbidden
  7919 + */
  7920 + 403: any;
  7921 + /**
  7922 + * @description
  7923 + * Not Found
  7924 + */
  7925 + 404: any;
  7926 +}
  7927 +
  7928 +export type PostServiceConstCanApplyAfterInvoicingStatusResponseSuccess =
  7929 + PostServiceConstCanApplyAfterInvoicingStatusResponse[200];
  7930 +/**
  7931 + * @description
  7932 + * 开具类型
  7933 + * @tags front-const-controller
  7934 + * @produces *
  7935 + * @consumes application/json
  7936 + */
  7937 +export const postServiceConstCanApplyAfterInvoicingStatus =
  7938 + /* #__PURE__ */ (() => {
  7939 + const method = 'post';
  7940 + const url = '/service/const/canApplyAfterInvoicingStatus';
  7941 + function request(): Promise<PostServiceConstCanApplyAfterInvoicingStatusResponseSuccess> {
  7942 + return requester(request.url, {
  7943 + method: request.method,
  7944 + }) as unknown as Promise<PostServiceConstCanApplyAfterInvoicingStatusResponseSuccess>;
  7945 + }
  7946 +
  7947 + /** http method */
  7948 + request.method = method;
  7949 + /** request url */
  7950 + request.url = url;
  7951 + return request;
  7952 + })();
  7953 +
7886 7954 /** @description response type for postServiceConstInvoiceType */
7887 7955 export interface PostServiceConstInvoiceTypeResponse {
7888 7956 /**
... ...