kts-component-invoice-operate 3.2.42 → 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,31 +1786,39 @@ 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;
1793
1798
  });
1794
1799
  state.goodsListState.goodsList.splice(p, 0, sum);
1800
+ state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1801
+ return e.lineAmountExcludeTax !== 0;
1802
+ });
1795
1803
  state.goodsListState.goodsMap = new Map();
1796
1804
  state.goodsListState.goodsList.forEach(function (e) {
1797
1805
  state.goodsListState.goodsMap.set(e.$index, e);
1798
1806
  });
1799
1807
  state.goodsListState.selectedGoodIndex = [];
1800
- _context.next = 39;
1808
+ _context.next = 42;
1801
1809
  break;
1802
1810
 
1803
- case 36:
1804
- _context.prev = 36;
1811
+ case 39:
1812
+ _context.prev = 39;
1805
1813
  _context.t0 = _context["catch"](5);
1806
1814
  showError(_context.t0);
1807
1815
 
1808
- case 39:
1816
+ case 42:
1809
1817
  case "end":
1810
1818
  return _context.stop();
1811
1819
  }
1812
1820
  }
1813
- }, _callee, null, [[5, 36]]);
1821
+ }, _callee, null, [[5, 39]]);
1814
1822
  }));
1815
1823
  return _mergeDetails.apply(this, arguments);
1816
1824
  }
@@ -2004,7 +2012,7 @@ function _fillingInformationGood() {
2004
2012
  function checkTaxTate(_x11) {
2005
2013
  return _checkTaxTate.apply(this, arguments);
2006
2014
  }
2007
- /** 显示错误信息 */
2015
+ /** 校验数据 是否数量和金额是否同号 */
2008
2016
 
2009
2017
 
2010
2018
  function _checkTaxTate() {
@@ -2045,6 +2053,56 @@ function _checkTaxTate() {
2045
2053
  return _checkTaxTate.apply(this, arguments);
2046
2054
  }
2047
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
+
2048
2106
  function showError(error) {
2049
2107
  console.log(error);
2050
2108
  message$1.error({
package/dist/index.js CHANGED
@@ -1796,31 +1796,39 @@ 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;
1803
1808
  });
1804
1809
  state.goodsListState.goodsList.splice(p, 0, sum);
1810
+ state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
1811
+ return e.lineAmountExcludeTax !== 0;
1812
+ });
1805
1813
  state.goodsListState.goodsMap = new Map();
1806
1814
  state.goodsListState.goodsList.forEach(function (e) {
1807
1815
  state.goodsListState.goodsMap.set(e.$index, e);
1808
1816
  });
1809
1817
  state.goodsListState.selectedGoodIndex = [];
1810
- _context.next = 39;
1818
+ _context.next = 42;
1811
1819
  break;
1812
1820
 
1813
- case 36:
1814
- _context.prev = 36;
1821
+ case 39:
1822
+ _context.prev = 39;
1815
1823
  _context.t0 = _context["catch"](5);
1816
1824
  showError(_context.t0);
1817
1825
 
1818
- case 39:
1826
+ case 42:
1819
1827
  case "end":
1820
1828
  return _context.stop();
1821
1829
  }
1822
1830
  }
1823
- }, _callee, null, [[5, 36]]);
1831
+ }, _callee, null, [[5, 39]]);
1824
1832
  }));
1825
1833
  return _mergeDetails.apply(this, arguments);
1826
1834
  }
@@ -2014,7 +2022,7 @@ function _fillingInformationGood() {
2014
2022
  function checkTaxTate(_x11) {
2015
2023
  return _checkTaxTate.apply(this, arguments);
2016
2024
  }
2017
- /** 显示错误信息 */
2025
+ /** 校验数据 是否数量和金额是否同号 */
2018
2026
 
2019
2027
 
2020
2028
  function _checkTaxTate() {
@@ -2055,6 +2063,56 @@ function _checkTaxTate() {
2055
2063
  return _checkTaxTate.apply(this, arguments);
2056
2064
  }
2057
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
+
2058
2116
  function showError(error) {
2059
2117
  console.log(error);
2060
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.42",
3
+ "version": "3.2.44",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -40,9 +40,13 @@ 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);
49
+ state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => e.lineAmountExcludeTax !== 0);
46
50
  state.goodsListState.goodsMap = new Map();
47
51
  state.goodsListState.goodsList.forEach(e => { state.goodsListState.goodsMap.set(e.$index, e) });
48
52
  state.goodsListState.selectedGoodIndex = [];
@@ -111,6 +115,23 @@ async function checkTaxTate(goodsList: IGood[]) {
111
115
  }
112
116
  }
113
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
+
114
135
  /** 显示错误信息 */
115
136
  function showError(error: Error) {
116
137
  console.log(error);