|
@@ -1079,6 +1079,73 @@ class checkData {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ checkSettle() {
|
|
|
+ const settleStatus = this.ctx.service.settle.settleStatus;
|
|
|
+ for (const b of this.checkBills.nodes) {
|
|
|
+ if (b.children && b.children.length > 0) continue;
|
|
|
+ const pr = this.checkPos.getLedgerPos(b.id);
|
|
|
+ if (!pr || pr.length === 0) {
|
|
|
+ if (b.contract_qty || b.contract_tp || b.qc_qty || b.qc_minus_qty || b.positive_qc_qty || b.negative_qc_qty) {
|
|
|
+ this.checkResult.error.push({
|
|
|
+ ledger_id: b.ledger_id,
|
|
|
+ b_code: b.b_code,
|
|
|
+ name: b.name,
|
|
|
+ errorType: 'settle',
|
|
|
+ });
|
|
|
+ if (!this.checkResult.source.bills.find(x => {return x.ledger_id === b.ledger_id})) {
|
|
|
+ this.checkResult.source.bills.push(b);
|
|
|
+ for (const p of pr) {
|
|
|
+ this.checkResult.source.pos.push(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (const p of pr) {
|
|
|
+ if (p.settle_status !== settleStatus.finish) continue;
|
|
|
+ if (p.contract_qty || p.qc_qty || p.qc_minus_qty || p.positive_qc_qty || p.negative_qc_qty) {
|
|
|
+ this.checkResult.error.push({
|
|
|
+ ledger_id: b.ledger_id,
|
|
|
+ b_code: b.b_code,
|
|
|
+ name: b.name,
|
|
|
+ errorType: 'settle',
|
|
|
+ });
|
|
|
+ if (!this.checkResult.source.bills.find(x => {return x.ledger_id === b.ledger_id})) {
|
|
|
+ this.checkResult.source.bills.push(b);
|
|
|
+ for (const p of pr) {
|
|
|
+ this.checkResult.source.pos.push(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const checkData = {},
|
|
|
+ calcData = {};
|
|
|
+ for (const field of fields) {
|
|
|
+ checkData[field] = b[field] ? b[field] : 0;
|
|
|
+ }
|
|
|
+ for (const p of pr) {
|
|
|
+ for (const field of fields) {
|
|
|
+ calcData[field] = this.ctx.helper.add(calcData[field], p[field]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!this.ctx.helper._.isMatch(checkData, calcData)) {
|
|
|
+ this.checkResult.error.push({
|
|
|
+ ledger_id: b.ledger_id,
|
|
|
+ b_code: b.b_code,
|
|
|
+ name: b.name,
|
|
|
+ errorType: 'qty',
|
|
|
+ error: { checkData, calcData },
|
|
|
+ });
|
|
|
+ if (!this.checkResult.source.bills.find(x => {return x.ledger_id === b.ledger_id})) {
|
|
|
+ this.checkResult.source.bills.push(b);
|
|
|
+ for (const p of pr) {
|
|
|
+ this.checkResult.source.pos.push(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class reviseTree extends billsTree {
|