|
@@ -236,13 +236,14 @@ module.exports = app => {
|
|
|
&& x.sorder && x.sorder === order;
|
|
|
});
|
|
|
if (his) {
|
|
|
+ his.unit_price = d.unit_price;
|
|
|
his.arrive_qty = d.arrive_qty;
|
|
|
his.arrive_tp = d.arrive_tp;
|
|
|
his.deduct_qty = d.deduct_qty;
|
|
|
his.deduct_tp = d.deduct_tp;
|
|
|
} else {
|
|
|
history.push({
|
|
|
- stimes: times, sorder: order,
|
|
|
+ stimes: times, sorder: order, unit_price: d.unit_price,
|
|
|
arrive_qty: d.arrive_qty, arrive_tp: d.arrive_tp,
|
|
|
deduct_qty: d.deduct_qty, deduct_tp: d.deduct_tp
|
|
|
});
|
|
@@ -287,14 +288,15 @@ module.exports = app => {
|
|
|
his.sort(function (x, y) {
|
|
|
return (x.stimes * 1000 + x.sorder) - (y.stimes * 1000 + y.sorder);
|
|
|
});
|
|
|
- updateDatas.push({
|
|
|
+ const ud = {
|
|
|
id: d.id,
|
|
|
shistory: JSON.stringify(his),
|
|
|
arrive_qty: his.length > 0 ? his[his.length - 1].arrive_qty : null,
|
|
|
- arrive_tp: his.length > 0 ? his[his.length - 1].arrive_tp : null,
|
|
|
deduct_qty: his.length > 0 ? his[his.length - 1].deduct_qty : null,
|
|
|
- deduct_tp: his.length > 0 ? his[his.length - 1].deduct_tp : null,
|
|
|
- });
|
|
|
+ arrive_tp: his.length > 0 ? this.ctx.helper.mul(his[his.length - 1].arrive_qty, d.unit_price, this.ctx.tender.info.decimal.tp) : null,
|
|
|
+ deduct_tp: his.length > 0 ? this.ctx.helper.mul(his[his.length - 1].deduct_qty, d.unit_price, this.ctx.tender.info.decimal.tp) : null,
|
|
|
+ };
|
|
|
+ updateDatas.push(ud);
|
|
|
}
|
|
|
await transaction.updateRows(this.tableName, updateDatas);
|
|
|
}
|