|
@@ -14,6 +14,7 @@ const stageIm = (function () {
|
|
|
const splitChar = '-';
|
|
|
const mergeChar = ';';
|
|
|
let stage, imType, decimal, details, changes, detailsAtt, ImData, pre, orgImData;
|
|
|
+ let up_field = 'unit_price';
|
|
|
const gsTreeSetting = {
|
|
|
id: 'ledger_id',
|
|
|
pid: 'ledger_pid',
|
|
@@ -67,6 +68,7 @@ const stageIm = (function () {
|
|
|
}
|
|
|
|
|
|
function loadData (ledger, pos, stageDetail, stageChange, stageDetailAtt) {
|
|
|
+ up_field = 'unit_price';
|
|
|
gsTree.loadDatas(ledger);
|
|
|
treeCalc.calculateAll(gsTree);
|
|
|
|
|
@@ -82,6 +84,7 @@ const stageIm = (function () {
|
|
|
}
|
|
|
|
|
|
function loadData4Rela(ledger, pos, stageDetail, stageChange, stageDetailAtt) {
|
|
|
+ up_field = 'org_unit_price';
|
|
|
gsTree.loadDatas(ledger);
|
|
|
treeCalc.calculateAll(gsTree);
|
|
|
|
|
@@ -807,12 +810,12 @@ const stageIm = (function () {
|
|
|
if (!checkUsed(p)) { continue; }
|
|
|
let im = nodeImData.find(function (d) {
|
|
|
return d.lid === node.id &&
|
|
|
- d.code === p.b_code && p.name === d.name && p.unit === d.unit && checkZero(ZhCalc.sub(p.unit_price, d.unit_price));
|
|
|
+ d.code === p.b_code && p.name === d.name && p.unit === d.unit && checkZero(ZhCalc.sub(p[up_field], d.unit_price));
|
|
|
});
|
|
|
if (!im) {
|
|
|
const peg = getPegNode(node);
|
|
|
im = {
|
|
|
- lid: node.id, pid: '', code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price,
|
|
|
+ lid: node.id, pid: '', code: p.b_code, name: p.name, unit: p.unit, unit_price: p[up_field],
|
|
|
jl: 0, contract_jl: 0, qc_jl: 0,
|
|
|
peg: peg ? getPegStr(peg.name) : '',
|
|
|
position: '',
|
|
@@ -857,7 +860,7 @@ const stageIm = (function () {
|
|
|
for (const pp of pPos) {
|
|
|
if (checkZero(pp.contract_qty) && checkZero(pp.qc_qty)) { continue }
|
|
|
const im = {
|
|
|
- lid: node.id, code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price, pid: pp.id,
|
|
|
+ lid: node.id, code: p.b_code, name: p.name, unit: p.unit, unit_price: p[up_field], pid: pp.id,
|
|
|
jl: pp.gather_qty, contract_jl: pp.contract_qty, qc_jl: pp.qc_qty,
|
|
|
//im_code: getNewImCode(),
|
|
|
bw: bw, jldy: pp.name,
|
|
@@ -885,7 +888,7 @@ const stageIm = (function () {
|
|
|
if (checkZero(p.gather_qty) && checkZero(p.gather_tp)) { continue }
|
|
|
|
|
|
const im = {
|
|
|
- lid: node.id, code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price, pid: '',
|
|
|
+ lid: node.id, code: p.b_code, name: p.name, unit: p.unit, unit_price: p[up_field], pid: '',
|
|
|
jl: p.gather_qty, contract_jl: p.contract_qty, qc_jl: p.qc_qty,
|
|
|
im_code: getNewImCode(),
|
|
|
bw: bw,
|
|
@@ -1170,6 +1173,25 @@ const stageIm = (function () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ function getRelaImData4Rela(relaXmj, bills, pos) {
|
|
|
+ if (stage.im_type === imType.tz.value) {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id});
|
|
|
+ } else if (stage.im_type === imType.zl.value) {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id, code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.org_unit_price});
|
|
|
+ } else if (stage.im_type === imType.bw.value) {
|
|
|
+ if (pos) {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id, code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.org_unit_price, pid: pos.id});
|
|
|
+ } else {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id, code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.org_unit_price, pid: ''});
|
|
|
+ }
|
|
|
+ } else if (stage.im_type === imType.bb.value) {
|
|
|
+ if (pos) {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id, pos_name: pos.name});
|
|
|
+ } else {
|
|
|
+ return _.find(ImData, {lid: relaXmj.id, pos_name: ''});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
init,
|
|
@@ -1191,6 +1213,7 @@ const stageIm = (function () {
|
|
|
getFirstUsed: getFirstUsed,
|
|
|
getRelaXmj: getRelaXmj,
|
|
|
getRelaImData: getRelaImData,
|
|
|
+ getRelaImData4Rela: getRelaImData4Rela,
|
|
|
resetFields,
|
|
|
}
|
|
|
})();
|