|
@@ -1191,31 +1191,64 @@ module.exports = {
|
|
|
},
|
|
|
|
|
|
checkBillsOverRange(bills, posRange, isTz) {
|
|
|
- if (isTz && posRange.length > 0) {
|
|
|
- for (const p of posRange) {
|
|
|
- const end_contract_qty = this.add(p.pre_contract_qty, p.contract_qty);
|
|
|
- if (end_contract_qty > p.quantity) return true;
|
|
|
+ // if (isTz && posRange.length > 0) {
|
|
|
+ // for (const p of posRange) {
|
|
|
+ // const end_contract_qty = this.add(p.pre_contract_qty, p.contract_qty);
|
|
|
+ // if (end_contract_qty > p.quantity) return true;
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // } else {
|
|
|
+ // const end_qc_qty = this.add(bills.qc_qty, bills.pre_qc_qty);
|
|
|
+ // const end_qc_tp = this.add(bills.qc_tp, bills.pre_qc_tp);
|
|
|
+ // const end_gather_qty = this.sum([bills.contract_qty, bills.pre_contract_qty, end_qc_qty]);
|
|
|
+ // const end_gather_tp = this.sum([bills.contract_tp, bills.pre_contract_tp, end_qc_tp]);
|
|
|
+ // if (isTz) {
|
|
|
+ // if (end_gather_qty) {
|
|
|
+ // return !bills.quantity || Math.abs(end_gather_qty) > Math.abs(this.add(bills.quantity, end_qc_qty));
|
|
|
+ // } else if (end_gather_tp) {
|
|
|
+ // return !bills.total_price || Math.abs(end_gather_tp) > Math.abs(this.add(bills.total_price, end_qc_tp));
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // if (end_gather_qty) {
|
|
|
+ // return !bills.deal_qty || Math.abs(end_gather_qty) > Math.abs(this.add(bills.deal_qty, end_qc_qty));
|
|
|
+ // } else if (end_gather_tp) {
|
|
|
+ // return !bills.deal_tp || Math.abs(end_gather_tp) > Math.abs(this.add(bills.deal_tp, end_qc_tp));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if (!bills) return false;
|
|
|
+ if (isTz) {
|
|
|
+ if (posRange.length > 0) {
|
|
|
+ for (const p of posRange) {
|
|
|
+ if (checkUtils.posOver(p)) return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (bills.is_tp) {
|
|
|
+ if (!bills.total_price) return !!bills.end_contract_tp;
|
|
|
+ return bills.total_price >= 0
|
|
|
+ ? bills.end_contract_tp > bills.total_price
|
|
|
+ : bills.end_contract_tp < bills.total_price || bills.end_contract_tp > 0;
|
|
|
+ } else {
|
|
|
+ if (!bills.quantity) return !!bills.end_contract_qty;
|
|
|
+ return bills.quantity >= 0
|
|
|
+ ? bills.end_contract_qty > bills.quantity
|
|
|
+ : bills.end_contract_qty < bills.quantity || bills.end_contract_qty > 0;
|
|
|
}
|
|
|
- return false;
|
|
|
} else {
|
|
|
- const end_qc_qty = this.add(bills.qc_qty, bills.pre_qc_qty);
|
|
|
- const end_qc_tp = this.add(bills.qc_tp, bills.pre_qc_tp);
|
|
|
- const end_gather_qty = this.sum([bills.contract_qty, bills.pre_contract_qty, end_qc_qty]);
|
|
|
- const end_gather_tp = this.sum([bills.contract_tp, bills.pre_contract_tp, end_qc_tp]);
|
|
|
- if (isTz) {
|
|
|
- if (end_gather_qty) {
|
|
|
- return !bills.quantity || Math.abs(end_gather_qty) > Math.abs(this.add(bills.quantity, end_qc_qty));
|
|
|
- } else if (end_gather_tp) {
|
|
|
- return !bills.total_price || Math.abs(end_gather_tp) > Math.abs(this.add(bills.total_price, end_qc_tp));
|
|
|
- }
|
|
|
+ if (bills.is_tp) {
|
|
|
+ if (!bills.deal_tp) return !!bills.end_contract_tp;
|
|
|
+ return bills.deal_tp >= 0
|
|
|
+ ? bills.end_contract_tp > bills.deal_tp
|
|
|
+ : bills.end_contract_tp < bills.deal_tp || bills.end_contract_tp > 0;
|
|
|
} else {
|
|
|
- if (end_gather_qty) {
|
|
|
- return !bills.deal_qty || Math.abs(end_gather_qty) > Math.abs(this.add(bills.deal_qty, end_qc_qty));
|
|
|
- } else if (end_gather_tp) {
|
|
|
- return !bills.deal_tp || Math.abs(end_gather_tp) > Math.abs(this.add(bills.deal_tp, end_qc_tp));
|
|
|
- }
|
|
|
+ if (!bills.deal_qty) return !!bills.end_contract_qty;
|
|
|
+ return bills.deal_qty >= 0
|
|
|
+ ? bills.end_contract_qty > bills.deal_qty
|
|
|
+ : bills.end_contract_qty < bills.deal_qty || bills.end_contract_qty > 0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
checkBillsWithPos2(bills, pos, fields, checkOver, isTz) {
|