|
@@ -288,6 +288,7 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
}
|
|
|
}
|
|
|
gljDao.getStdCompleGljItems(compleGljIds, stdGljIds, function (err, allGljs) {
|
|
|
+ const processDecimal = -6;
|
|
|
if(err){
|
|
|
cb(err);
|
|
|
}
|
|
@@ -349,21 +350,21 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, callback) {
|
|
|
if(labourPrc.length > 0){
|
|
|
let sumLaP = 0;
|
|
|
for(let i=0; i<labourPrc.length; i++){
|
|
|
- sumLaP += labourPrc[i];
|
|
|
+ sumLaP = scMathUtil.roundTo(sumLaP + labourPrc[i], processDecimal);
|
|
|
}
|
|
|
updatePrc.labourPrice = scMathUtil.roundTo(sumLaP, -2);
|
|
|
}
|
|
|
if(materialPrc.length > 0){
|
|
|
let sumMtP = 0;
|
|
|
for(let i= 0; i<materialPrc.length; i++){
|
|
|
- sumMtP += materialPrc[i];
|
|
|
+ sumMtP = scMathUtil.roundTo(sumMtP + materialPrc[i], processDecimal);
|
|
|
}
|
|
|
updatePrc.materialPrice = scMathUtil.roundTo(sumMtP, -2);
|
|
|
}
|
|
|
if(machinePrc.length > 0){
|
|
|
let sumMaP = 0;
|
|
|
for(let i =0; i< machinePrc.length; i++){
|
|
|
- sumMaP += machinePrc[i];
|
|
|
+ sumMaP = scMathUtil.roundTo(sumMaP + machinePrc[i], processDecimal);
|
|
|
}
|
|
|
updatePrc.machinePrice = scMathUtil.roundTo(sumMaP, -2);
|
|
|
}
|
|
@@ -518,6 +519,7 @@ rationItemDAO.prototype.updateAnnotation = function (lastOpr, repId, updateArr,
|
|
|
|
|
|
//计算导入数据的价格
|
|
|
rationItemDAO.prototype.calcForRation = function (stdGljList, ration) {
|
|
|
+ const processDecimal = -6;
|
|
|
//根据工料机类型划分价格
|
|
|
const labour = [1], material = [201, 202, 203, 204, 205, 206], machine = [301, 302, 303];
|
|
|
let labourPrc = [], materialPrc = [], machinePrc = [], singlePrc, updatePrc = {labourPrice: 0, materialPrice: 0, machinePrice: 0, basePrice: 0};
|
|
@@ -542,25 +544,25 @@ rationItemDAO.prototype.calcForRation = function (stdGljList, ration) {
|
|
|
if(labourPrc.length > 0){
|
|
|
let sumLaP = 0;
|
|
|
for(let i = 0, len = labourPrc.length; i < len; i++){
|
|
|
- sumLaP += labourPrc[i];
|
|
|
+ sumLaP = scMathUtil.roundTo(sumLaP + labourPrc[i], processDecimal);
|
|
|
}
|
|
|
updatePrc.labourPrice = scMathUtil.roundTo(sumLaP, -2);
|
|
|
}
|
|
|
//材料费
|
|
|
if(materialPrc.length > 0){
|
|
|
- let sumLaP = 0;
|
|
|
+ let sumMtP = 0;
|
|
|
for(let i = 0, len = materialPrc.length; i < len; i++){
|
|
|
- sumLaP += materialPrc[i];
|
|
|
+ sumMtP = scMathUtil.roundTo(sumMtP + materialPrc[i], processDecimal);
|
|
|
}
|
|
|
- updatePrc.materialPrice = scMathUtil.roundTo(sumLaP, -2);
|
|
|
+ updatePrc.materialPrice = scMathUtil.roundTo(sumMtP, -2);
|
|
|
}
|
|
|
//机械费
|
|
|
if(machinePrc.length > 0){
|
|
|
- let sumLaP = 0;
|
|
|
+ let sumMaP = 0;
|
|
|
for(let i = 0, len = machinePrc.length; i < len; i++){
|
|
|
- sumLaP += machinePrc[i];
|
|
|
+ sumMaP = scMathUtil.roundTo(sumMaP + machinePrc[i], processDecimal);
|
|
|
}
|
|
|
- updatePrc.machinePrice = scMathUtil.roundTo(sumLaP, -2);
|
|
|
+ updatePrc.machinePrice = scMathUtil.roundTo(sumMaP, -2);
|
|
|
}
|
|
|
//基价
|
|
|
updatePrc.basePrice = scMathUtil.roundTo(updatePrc.labourPrice + updatePrc.materialPrice + updatePrc.machinePrice, -2);
|