|
@@ -564,6 +564,10 @@ class pos {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ getPos(id) {
|
|
|
+ return this.items[itemsPre + id];
|
|
|
+ }
|
|
|
+
|
|
|
getLedgerPos(mid) {
|
|
|
return this.ledgerPos[itemsPre + mid];
|
|
|
}
|
|
@@ -648,7 +652,6 @@ class checkData {
|
|
|
return sc ? sc.ratio : null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
_getValid = function (type, status, limit) {
|
|
|
if (limit) {
|
|
|
const statusConst = type === 'gxby' ? this.ctx.session.sessionProject.gxby_status : this.ctx.session.sessionProject.dagl_status;
|
|
@@ -942,6 +945,40 @@ class checkData {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ checkMinusChangeBills(change, changeBills, finalStageChange) {
|
|
|
+ const error = this.checkResult.error;
|
|
|
+ const helper = this.ctx.helper;
|
|
|
+ const changeIndex = {};
|
|
|
+ change.forEach(c => {
|
|
|
+ changeIndex[c.cid] = c;
|
|
|
+ c.bills = [];
|
|
|
+ c.billsIndex = {};
|
|
|
+ c.stageChange = [];
|
|
|
+ });
|
|
|
+ changeBills.forEach(cb => {
|
|
|
+ const c = changeIndex[cb.cid];
|
|
|
+ if (c) c.bills.push(cb);
|
|
|
+ c.billsIndex[cb.id] = cb;
|
|
|
+ cb.used_qty = 0;
|
|
|
+ cb.qty = parseFloat(cb.samount);
|
|
|
+ });
|
|
|
+ finalStageChange.forEach(sc => {
|
|
|
+ const c = changeIndex[sc.cid];
|
|
|
+ if (c) {
|
|
|
+ c.used = true;
|
|
|
+ const cb = c.billsIndex[sc.cbid];
|
|
|
+ if (cb) cb.used_qty = helper.add(cb.used_qty, sc.used_qty);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ change.forEach(c => {
|
|
|
+ if (!c.used) return;
|
|
|
+ c.bills.forEach(b => {
|
|
|
+ if (b.qty >= 0) return;
|
|
|
+ if (!helper.numEqual(b.used_qty, b.qty)) error.push({ b_code: b.code, name: b.name, errorType: 'minus_cb', memo: c.code });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class reviseTree extends billsTree {
|