|
|
@@ -804,37 +804,39 @@ class BaseBillsSerivce extends TreeService {
|
|
|
newBills.ex_qty1 = this.ctx.helper.add(newBills.ex_qty1, newPos.ex_qty1);
|
|
|
if (defaultData) this.ctx.helper._.assignIn(newPos, defaultData);
|
|
|
|
|
|
- for (const ag of pos.ancGcl) {
|
|
|
- const nig = {
|
|
|
- id: this.uuid.v4(), tid: this.ctx.tender.id,
|
|
|
- add_user_id: userId, update_user_id: userId,
|
|
|
- lid: newPos.lid, pid: newPos.id, g_order: ag.g_order,
|
|
|
- is_aux: ag.is_aux || 0, name: ag.name || '', unit: ag.unit || '',
|
|
|
- drawing_code: ag.drawing_code || '', memo: ag.memo || '',
|
|
|
- quantity: ag.quantity || 0, expr: ag.expr || '', calc_template: ag.calc_template || ''
|
|
|
- };
|
|
|
- pasteAncGclData.push(nig);
|
|
|
- if (!ag.calc_template || ag.calcDetail.length === 0) continue;
|
|
|
-
|
|
|
- let sumQty = 0;
|
|
|
- for (const cd of ag.calcDetail) {
|
|
|
- const newDetail = {
|
|
|
- id: this.uuid.v4(), tid: this.ctx.tender.id, lid: newPos.lid, pid: newPos.id, ag_id: nig.id,
|
|
|
- create_user_id: userId, update_user_id: userId,
|
|
|
- agd_order: cd.agd_order,
|
|
|
- str1 : cd.str1 || '', str2 : cd.str1 || '', str3 : cd.str1 || '', str4 : cd.str1 || '',
|
|
|
- num_a : cd.num_a || 0, num_b : cd.num_b || 0, num_c : cd.num_c || 0, num_d : cd.num_d || 0,
|
|
|
- num_e : cd.num_e || 0, num_f : cd.num_f || 0, num_g : cd.num_g || 0, num_h : cd.num_h || 0,
|
|
|
- num_i : cd.num_i || 0, num_j : cd.num_j || 0, num_k : cd.num_k || 0, num_l : cd.num_l || 0,
|
|
|
- num_m : cd.num_m || 0, num_n : cd.num_n || 0, num_o : cd.num_o || 0, num_p : cd.num_p || 0,
|
|
|
- num_q : cd.num_q || 0, num_r : cd.num_r || 0, num_s : cd.num_s || 0, num_t : cd.num_t || 0,
|
|
|
- num_u : cd.num_u || 0,
|
|
|
- qty: cd.qty || 0, expr: cd.expr || 0, spec: cd.spec || ''
|
|
|
+ if(pos.ancGcl && pos.ancGcl instanceof Array) {
|
|
|
+ for (const ag of pos.ancGcl) {
|
|
|
+ const nig = {
|
|
|
+ id: this.uuid.v4(), tid: this.ctx.tender.id,
|
|
|
+ add_user_id: userId, update_user_id: userId,
|
|
|
+ lid: newPos.lid, pid: newPos.id, g_order: ag.g_order,
|
|
|
+ is_aux: ag.is_aux || 0, name: ag.name || '', unit: ag.unit || '',
|
|
|
+ drawing_code: ag.drawing_code || '', memo: ag.memo || '',
|
|
|
+ quantity: ag.quantity || 0, expr: ag.expr || '', calc_template: ag.calc_template || ''
|
|
|
};
|
|
|
- sumQty = this.ctx.helper.add(sumQty, newDetail.qty);
|
|
|
- pasteAncGclDetailData.push(newDetail);
|
|
|
+ pasteAncGclData.push(nig);
|
|
|
+ if (!ag.calc_template || ag.calcDetail.length === 0) continue;
|
|
|
+
|
|
|
+ let sumQty = 0;
|
|
|
+ for (const cd of ag.calcDetail) {
|
|
|
+ const newDetail = {
|
|
|
+ id: this.uuid.v4(), tid: this.ctx.tender.id, lid: newPos.lid, pid: newPos.id, ag_id: nig.id,
|
|
|
+ create_user_id: userId, update_user_id: userId,
|
|
|
+ agd_order: cd.agd_order,
|
|
|
+ str1 : cd.str1 || '', str2 : cd.str1 || '', str3 : cd.str1 || '', str4 : cd.str1 || '',
|
|
|
+ num_a : cd.num_a || 0, num_b : cd.num_b || 0, num_c : cd.num_c || 0, num_d : cd.num_d || 0,
|
|
|
+ num_e : cd.num_e || 0, num_f : cd.num_f || 0, num_g : cd.num_g || 0, num_h : cd.num_h || 0,
|
|
|
+ num_i : cd.num_i || 0, num_j : cd.num_j || 0, num_k : cd.num_k || 0, num_l : cd.num_l || 0,
|
|
|
+ num_m : cd.num_m || 0, num_n : cd.num_n || 0, num_o : cd.num_o || 0, num_p : cd.num_p || 0,
|
|
|
+ num_q : cd.num_q || 0, num_r : cd.num_r || 0, num_s : cd.num_s || 0, num_t : cd.num_t || 0,
|
|
|
+ num_u : cd.num_u || 0,
|
|
|
+ qty: cd.qty || 0, expr: cd.expr || 0, spec: cd.spec || ''
|
|
|
+ };
|
|
|
+ sumQty = this.ctx.helper.add(sumQty, newDetail.qty);
|
|
|
+ pasteAncGclDetailData.push(newDetail);
|
|
|
+ }
|
|
|
+ nig.quantity = this.ctx.helper.round(sumQty, qtyDecimal);
|
|
|
}
|
|
|
- nig.quantity = this.ctx.helper.round(sumQty, qtyDecimal);
|
|
|
}
|
|
|
|
|
|
pastePosData.push(newPos);
|