kts-component-invoice-operate 3.2.43 → 3.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1786,7 +1786,12 @@ function _mergeDetails() {
1786
1786
  case 26:
1787
1787
  sum.priceIncludeTax = _context.sent;
1788
1788
  // 计算税额
1789
- sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber();
1789
+ sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber(); // 校验数据 是否数量和金额是否同号
1790
+
1791
+ _context.next = 30;
1792
+ return checkSameNumber(sum);
1793
+
1794
+ case 30:
1790
1795
  p = state.goodsListState.goodsList.indexOf(goodsList[0]);
1791
1796
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1792
1797
  return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
@@ -1800,20 +1805,20 @@ function _mergeDetails() {
1800
1805
  state.goodsListState.goodsMap.set(e.$index, e);
1801
1806
  });
1802
1807
  state.goodsListState.selectedGoodIndex = [];
1803
- _context.next = 40;
1808
+ _context.next = 42;
1804
1809
  break;
1805
1810
 
1806
- case 37:
1807
- _context.prev = 37;
1811
+ case 39:
1812
+ _context.prev = 39;
1808
1813
  _context.t0 = _context["catch"](5);
1809
1814
  showError(_context.t0);
1810
1815
 
1811
- case 40:
1816
+ case 42:
1812
1817
  case "end":
1813
1818
  return _context.stop();
1814
1819
  }
1815
1820
  }
1816
- }, _callee, null, [[5, 37]]);
1821
+ }, _callee, null, [[5, 39]]);
1817
1822
  }));
1818
1823
  return _mergeDetails.apply(this, arguments);
1819
1824
  }
@@ -2007,7 +2012,7 @@ function _fillingInformationGood() {
2007
2012
  function checkTaxTate(_x11) {
2008
2013
  return _checkTaxTate.apply(this, arguments);
2009
2014
  }
2010
- /** 显示错误信息 */
2015
+ /** 校验数据 是否数量和金额是否同号 */
2011
2016
 
2012
2017
 
2013
2018
  function _checkTaxTate() {
@@ -2048,6 +2053,56 @@ function _checkTaxTate() {
2048
2053
  return _checkTaxTate.apply(this, arguments);
2049
2054
  }
2050
2055
 
2056
+ function checkSameNumber(_x12) {
2057
+ return _checkSameNumber.apply(this, arguments);
2058
+ }
2059
+ /** 显示错误信息 */
2060
+
2061
+
2062
+ function _checkSameNumber() {
2063
+ _checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(good) {
2064
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2065
+ while (1) {
2066
+ switch (_context9.prev = _context9.next) {
2067
+ case 0:
2068
+ if (good.quantity) {
2069
+ _context9.next = 2;
2070
+ break;
2071
+ }
2072
+
2073
+ return _context9.abrupt("return");
2074
+
2075
+ case 2:
2076
+ if (good.lineAmountExcludeTax) {
2077
+ _context9.next = 5;
2078
+ break;
2079
+ }
2080
+
2081
+ message$1.error('金额不能为空');
2082
+ throw new Error('金额不能为空');
2083
+
2084
+ case 5:
2085
+ if (!(good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0)) {
2086
+ _context9.next = 9;
2087
+ break;
2088
+ }
2089
+
2090
+ return _context9.abrupt("return");
2091
+
2092
+ case 9:
2093
+ message$1.error('金额和数量需要同号');
2094
+ throw new Error('金额和数量需要同号');
2095
+
2096
+ case 11:
2097
+ case "end":
2098
+ return _context9.stop();
2099
+ }
2100
+ }
2101
+ }, _callee9);
2102
+ }));
2103
+ return _checkSameNumber.apply(this, arguments);
2104
+ }
2105
+
2051
2106
  function showError(error) {
2052
2107
  console.log(error);
2053
2108
  message$1.error({
package/dist/index.js CHANGED
@@ -1796,7 +1796,12 @@ function _mergeDetails() {
1796
1796
  case 26:
1797
1797
  sum.priceIncludeTax = _context.sent;
1798
1798
  // 计算税额
1799
- sum.taxAmount = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).subtract(mathjs.bignumber(sum.lineAmountExcludeTax)).done().toNumber();
1799
+ sum.taxAmount = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).subtract(mathjs.bignumber(sum.lineAmountExcludeTax)).done().toNumber(); // 校验数据 是否数量和金额是否同号
1800
+
1801
+ _context.next = 30;
1802
+ return checkSameNumber(sum);
1803
+
1804
+ case 30:
1800
1805
  p = state.goodsListState.goodsList.indexOf(goodsList[0]);
1801
1806
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1802
1807
  return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
@@ -1810,20 +1815,20 @@ function _mergeDetails() {
1810
1815
  state.goodsListState.goodsMap.set(e.$index, e);
1811
1816
  });
1812
1817
  state.goodsListState.selectedGoodIndex = [];
1813
- _context.next = 40;
1818
+ _context.next = 42;
1814
1819
  break;
1815
1820
 
1816
- case 37:
1817
- _context.prev = 37;
1821
+ case 39:
1822
+ _context.prev = 39;
1818
1823
  _context.t0 = _context["catch"](5);
1819
1824
  showError(_context.t0);
1820
1825
 
1821
- case 40:
1826
+ case 42:
1822
1827
  case "end":
1823
1828
  return _context.stop();
1824
1829
  }
1825
1830
  }
1826
- }, _callee, null, [[5, 37]]);
1831
+ }, _callee, null, [[5, 39]]);
1827
1832
  }));
1828
1833
  return _mergeDetails.apply(this, arguments);
1829
1834
  }
@@ -2017,7 +2022,7 @@ function _fillingInformationGood() {
2017
2022
  function checkTaxTate(_x11) {
2018
2023
  return _checkTaxTate.apply(this, arguments);
2019
2024
  }
2020
- /** 显示错误信息 */
2025
+ /** 校验数据 是否数量和金额是否同号 */
2021
2026
 
2022
2027
 
2023
2028
  function _checkTaxTate() {
@@ -2058,6 +2063,56 @@ function _checkTaxTate() {
2058
2063
  return _checkTaxTate.apply(this, arguments);
2059
2064
  }
2060
2065
 
2066
+ function checkSameNumber(_x12) {
2067
+ return _checkSameNumber.apply(this, arguments);
2068
+ }
2069
+ /** 显示错误信息 */
2070
+
2071
+
2072
+ function _checkSameNumber() {
2073
+ _checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(good) {
2074
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2075
+ while (1) {
2076
+ switch (_context9.prev = _context9.next) {
2077
+ case 0:
2078
+ if (good.quantity) {
2079
+ _context9.next = 2;
2080
+ break;
2081
+ }
2082
+
2083
+ return _context9.abrupt("return");
2084
+
2085
+ case 2:
2086
+ if (good.lineAmountExcludeTax) {
2087
+ _context9.next = 5;
2088
+ break;
2089
+ }
2090
+
2091
+ ktsXui.message.error('金额不能为空');
2092
+ throw new Error('金额不能为空');
2093
+
2094
+ case 5:
2095
+ if (!(good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0)) {
2096
+ _context9.next = 9;
2097
+ break;
2098
+ }
2099
+
2100
+ return _context9.abrupt("return");
2101
+
2102
+ case 9:
2103
+ ktsXui.message.error('金额和数量需要同号');
2104
+ throw new Error('金额和数量需要同号');
2105
+
2106
+ case 11:
2107
+ case "end":
2108
+ return _context9.stop();
2109
+ }
2110
+ }
2111
+ }, _callee9);
2112
+ }));
2113
+ return _checkSameNumber.apply(this, arguments);
2114
+ }
2115
+
2061
2116
  function showError(error) {
2062
2117
  console.log(error);
2063
2118
  ktsXui.message.error({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.43",
3
+ "version": "3.2.44",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -40,6 +40,9 @@ export default async function mergeDetails(state: InvoiceControllerState) {
40
40
  // 计算税额
41
41
  sum.taxAmount = chain(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber()
42
42
 
43
+ // 校验数据 是否数量和金额是否同号
44
+ await checkSameNumber(sum);
45
+
43
46
  const p = state.goodsListState.goodsList.indexOf(goodsList[0]);
44
47
  state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0);
45
48
  state.goodsListState.goodsList.splice(p, 0, sum);
@@ -112,6 +115,23 @@ async function checkTaxTate(goodsList: IGood[]) {
112
115
  }
113
116
  }
114
117
 
118
+ /** 校验数据 是否数量和金额是否同号 */
119
+ async function checkSameNumber(good: IGood) {
120
+ if (!good.quantity) return;
121
+
122
+ if (!good.lineAmountExcludeTax) {
123
+ message.error('金额不能为空');
124
+ throw new Error('金额不能为空');
125
+ }
126
+
127
+ if (good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0) {
128
+ return;
129
+ }else{
130
+ message.error('金额和数量需要同号');
131
+ throw new Error('金额和数量需要同号');
132
+ }
133
+ }
134
+
115
135
  /** 显示错误信息 */
116
136
  function showError(error: Error) {
117
137
  console.log(error);