|
@@ -680,7 +680,52 @@ class checkData {
|
|
|
this._checkLeafBills3fLimit(checkType, bills, result, checkInfo);
|
|
|
}
|
|
|
}
|
|
|
- check3fLimit(tender, bills, pos) {
|
|
|
+
|
|
|
+ loadData(bills, pos) {
|
|
|
+ this.checkBills.loadDatas(bills);
|
|
|
+ this.checkPos.loadDatas(pos);
|
|
|
+ }
|
|
|
+
|
|
|
+ checkSibling() {
|
|
|
+ const error = [];
|
|
|
+ for (const node of this.checkBills.nodes) {
|
|
|
+ if (!node.children || node.children.length === 0) continue;
|
|
|
+ let hasXmj, hasGcl;
|
|
|
+ for (const child of node.children) {
|
|
|
+ if (child.b_code) hasXmj = true;
|
|
|
+ if (!child.b_code) hasGcl = true;
|
|
|
+ }
|
|
|
+ if (hasXmj && hasGcl) error.push({
|
|
|
+ ledger_id: node.ledger_id,
|
|
|
+ b_code: node.b_code,
|
|
|
+ name: node.name,
|
|
|
+ errorType: 'sibling',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return error;
|
|
|
+ }
|
|
|
+
|
|
|
+ checkSameCode() {
|
|
|
+ const error = [];
|
|
|
+ let xmj = this.checkBills.nodes.filter(x => { return /^((GD*)|G)?[0-9]+/.test(x.code); });
|
|
|
+ let check = null;
|
|
|
+ while (xmj.length > 0) {
|
|
|
+ [check, xmj] = this.ctx.helper._.partition(xmj, x => { return x.code === xmj[0].code; });
|
|
|
+ if (check.length > 1) {
|
|
|
+ for (const c of check) {
|
|
|
+ error.push({
|
|
|
+ ledger_id: c.ledger_id,
|
|
|
+ b_code: c.b_code,
|
|
|
+ name: c.name,
|
|
|
+ errorType: 'same_code',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return error;
|
|
|
+ }
|
|
|
+
|
|
|
+ check3fLimit(tender) {
|
|
|
const result = {
|
|
|
error: [],
|
|
|
source: {bills: [], pos: []},
|
|
@@ -691,9 +736,6 @@ class checkData {
|
|
|
if (tender.s2b_dagl_limit) check.push('dagl');
|
|
|
if (check.length === 0) return result;
|
|
|
|
|
|
- this.checkBills.loadDatas(bills);
|
|
|
- this.checkPos.loadDatas(pos);
|
|
|
-
|
|
|
for (const b of this.checkBills.children) {
|
|
|
this._recursiveCheckBills3fLimit(check, b, result, {});
|
|
|
}
|