|
|
@@ -497,10 +497,9 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, overWriteUrl
|
|
|
gljArr.push({gljId: theGlj.ID, basePrice: adjBasePrice, gljParentType: gljParentType, unit: theGlj.unit});
|
|
|
} else {
|
|
|
if(theGlj.priceProperty && Object.keys(theGlj.priceProperty).length > 0){
|
|
|
- let priceKeys = Object.keys(theGlj.priceProperty);
|
|
|
gljArr.push({
|
|
|
gljId: theGlj.ID,
|
|
|
- basePrice: parseFloat(theGlj.priceProperty[priceKeys[0]]),
|
|
|
+ basePrice: parseFloat(theGlj.priceProperty.price1),
|
|
|
gljParentType: gljParentType,
|
|
|
unit: theGlj.unit});
|
|
|
} else {
|
|
|
@@ -731,35 +730,33 @@ rationItemDAO.prototype.calcForRation = function (stdGljList, ration, overWriteU
|
|
|
for(let rationGlj of rationGljList) {
|
|
|
let glj = stdGljList[rationGlj.gljId];
|
|
|
let gljPType = parseInt(glj.gljType.toString().match(/\d+?/)[0]);
|
|
|
- if (glj.priceProperty && Object.keys(glj.priceProperty).length > 0) {
|
|
|
- let priceKeys = Object.keys(glj.priceProperty);
|
|
|
- gljArr.push({
|
|
|
- gljId: glj.ID,
|
|
|
- basePrice: parseFloat(glj.priceProperty[priceKeys[0]]),
|
|
|
- consumeAmt: rationGlj.consumeAmt,
|
|
|
- gljParentType: gljPType,
|
|
|
- unit: glj.unit
|
|
|
- });
|
|
|
- } else {
|
|
|
- gljArr.push({gljId: glj.ID, basePrice: parseFloat(glj.basePrice), consumeAmt: rationGlj.consumeAmt, gljParentType: gljPType, unit: glj.unit});
|
|
|
- }
|
|
|
- let updatePrc = null;
|
|
|
- let overWriteCalc = false; //需要重写算法
|
|
|
- if (overWriteUrl) {
|
|
|
- let overWriteExports = require(overWriteUrl);
|
|
|
- if (typeof overWriteExports.calcRation !== 'undefined') {
|
|
|
- overWriteCalc = true;
|
|
|
- updatePrc = overWriteExports.calcRation(gljArr, scMathUtil);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!overWriteCalc) {
|
|
|
- updatePrc = calcRation(gljArr);
|
|
|
+ let newGlj = {
|
|
|
+ gljId: glj.ID,
|
|
|
+ consumeAmt: rationGlj.consumeAmt,
|
|
|
+ gljParentType: gljPType,
|
|
|
+ unit: glj.unit
|
|
|
+ };
|
|
|
+ newGlj.basePrice = glj.priceProperty && Object.keys(glj.priceProperty).length > 0
|
|
|
+ ? parseFloat(glj.priceProperty.price1)
|
|
|
+ : parseFloat(glj.basePrice);
|
|
|
+ gljArr.push(newGlj);
|
|
|
+ }
|
|
|
+ let updatePrc = null;
|
|
|
+ let overWriteCalc = false; //需要重写算法
|
|
|
+ if (overWriteUrl) {
|
|
|
+ let overWriteExports = require(overWriteUrl);
|
|
|
+ if (typeof overWriteExports.calcRation !== 'undefined') {
|
|
|
+ overWriteCalc = true;
|
|
|
+ updatePrc = overWriteExports.calcRation(gljArr, scMathUtil);
|
|
|
}
|
|
|
- ration.labourPrice = updatePrc.labourPrice.toString();
|
|
|
- ration.materialPrice = updatePrc.materialPrice.toString();
|
|
|
- ration.machinePrice = updatePrc.machinePrice.toString();
|
|
|
- ration.basePrice = updatePrc.basePrice.toString();
|
|
|
}
|
|
|
+ if (!overWriteCalc) {
|
|
|
+ updatePrc = calcRation(gljArr);
|
|
|
+ }
|
|
|
+ ration.labourPrice = updatePrc.labourPrice.toString();
|
|
|
+ ration.materialPrice = updatePrc.materialPrice.toString();
|
|
|
+ ration.machinePrice = updatePrc.machinePrice.toString();
|
|
|
+ ration.basePrice = updatePrc.basePrice.toString();
|
|
|
};
|
|
|
|
|
|
/**
|