|
@@ -431,14 +431,16 @@ ProjectGLJ.prototype.materialCal = function (id,dataMap,tglj,tfreightList,tprice
|
|
|
if(!glj) return;
|
|
if(!glj) return;
|
|
|
let unitPrice = {projectGLJID:glj.id,id:glj.unit_price.id,'unit_price_file_id':glj.unit_price.unit_price_file_id,doc:{}};
|
|
let unitPrice = {projectGLJID:glj.id,id:glj.unit_price.id,'unit_price_file_id':glj.unit_price.unit_price_file_id,doc:{}};
|
|
|
//先计算原价
|
|
//先计算原价
|
|
|
- let [originalPrice,supplyLocation] = this.priceCalc(glj,dataMap,tpriceList);
|
|
|
|
|
|
|
+ let [originalPrice,supplyLocation,priceHeightFee] = this.priceCalc(glj,dataMap,tpriceList);
|
|
|
doc['originalPrice'] = originalPrice+'';
|
|
doc['originalPrice'] = originalPrice+'';
|
|
|
doc['supplyLocation'] = supplyLocation;
|
|
doc['supplyLocation'] = supplyLocation;
|
|
|
|
|
+ doc['priceHeightFee'] = priceHeightFee;
|
|
|
//再计算运费
|
|
//再计算运费
|
|
|
let grossWeightCoe_n = doc['grossWeightCoe_n']?doc['grossWeightCoe_n']:glj.unit_price.grossWeightCoe_n;
|
|
let grossWeightCoe_n = doc['grossWeightCoe_n']?doc['grossWeightCoe_n']:glj.unit_price.grossWeightCoe_n;
|
|
|
grossWeightCoe_n = scMathUtil.roundForObj(grossWeightCoe_n,process);
|
|
grossWeightCoe_n = scMathUtil.roundForObj(grossWeightCoe_n,process);
|
|
|
- let unitFreight = this.freightCalc(glj,grossWeightCoe_n,dataMap,tfreightList);
|
|
|
|
|
|
|
+ let [unitFreight,freightHeightFee] = this.freightCalc(glj,grossWeightCoe_n,dataMap,tfreightList);
|
|
|
doc['unitFreight'] = unitFreight+'';
|
|
doc['unitFreight'] = unitFreight+'';
|
|
|
|
|
+ doc['freightHeightFee'] = freightHeightFee+'';
|
|
|
//计算场外运输损耗
|
|
//计算场外运输损耗
|
|
|
let sum_o_f = scMathUtil.roundForObj(originalPrice+unitFreight,process);//(原价+单位运费)
|
|
let sum_o_f = scMathUtil.roundForObj(originalPrice+unitFreight,process);//(原价+单位运费)
|
|
|
let totalLoadingTimes = doc["totalLoadingTimes"]?doc["totalLoadingTimes"]:glj.unit_price.totalLoadingTimes;//装卸总次数
|
|
let totalLoadingTimes = doc["totalLoadingTimes"]?doc["totalLoadingTimes"]:glj.unit_price.totalLoadingTimes;//装卸总次数
|
|
@@ -478,10 +480,12 @@ ProjectGLJ.prototype.freightCalc= function (glj,grossWeightCoe_n,dataMap,tfreigh
|
|
|
let unitPirce = getDecimal("glj.unitPrice");
|
|
let unitPirce = getDecimal("glj.unitPrice");
|
|
|
let unitPriceHasMix = getDecimal("glj.unitPriceHasMix");//这里暂时没用到
|
|
let unitPriceHasMix = getDecimal("glj.unitPriceHasMix");//这里暂时没用到
|
|
|
let sum = 0;
|
|
let sum = 0;
|
|
|
|
|
+ let height_sum=0;
|
|
|
let freightList = tfreightList?tfreightList:_.filter(this.datas.freightList,{"connect_key":gljUtil.getIndex(glj)});
|
|
let freightList = tfreightList?tfreightList:_.filter(this.datas.freightList,{"connect_key":gljUtil.getIndex(glj)});
|
|
|
if(dataMap["freight"] && dataMap["freight"]["add"]) freightList = freightList.concat(dataMap["freight"]["add"]); //把添加的加进去
|
|
if(dataMap["freight"] && dataMap["freight"]["add"]) freightList = freightList.concat(dataMap["freight"]["add"]); //把添加的加进去
|
|
|
for(let f of freightList){
|
|
for(let f of freightList){
|
|
|
let unitFreight = f.unitFreight,kmDistance = f.kmDistance,freightIncreaseRate = f.freightIncreaseRate,unitLoadingFee= f.unitLoadingFee,loadingTimes = f.loadingTimes,otherFee = f.otherFee,weightCoe = f.weightCoe,conveyance = f.conveyance,calcType=f.calcType,materialType=f.materialType;
|
|
let unitFreight = f.unitFreight,kmDistance = f.kmDistance,freightIncreaseRate = f.freightIncreaseRate,unitLoadingFee= f.unitLoadingFee,loadingTimes = f.loadingTimes,otherFee = f.otherFee,weightCoe = f.weightCoe,conveyance = f.conveyance,calcType=f.calcType,materialType=f.materialType;
|
|
|
|
|
+ let heightFee= f.heightFee?f.heightFee:0;
|
|
|
if(dataMap["freight"] && dataMap["freight"]["update"]){//覆盖更新的数据
|
|
if(dataMap["freight"] && dataMap["freight"]["update"]){//覆盖更新的数据
|
|
|
let t = dataMap["freight"]["update"][f.ID];
|
|
let t = dataMap["freight"]["update"][f.ID];
|
|
|
if(t){
|
|
if(t){
|
|
@@ -495,6 +499,7 @@ ProjectGLJ.prototype.freightCalc= function (glj,grossWeightCoe_n,dataMap,tfreigh
|
|
|
if(t['conveyance']) conveyance = t['conveyance'];
|
|
if(t['conveyance']) conveyance = t['conveyance'];
|
|
|
if(t['calcType']) calcType = t['calcType'];
|
|
if(t['calcType']) calcType = t['calcType'];
|
|
|
if(t['materialType']) materialType = t['materialType'];
|
|
if(t['materialType']) materialType = t['materialType'];
|
|
|
|
|
+ if(t['heightFee']) heightFee = t['heightFee'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(dataMap["freight"] && dataMap["freight"]["delete"]){//忽略删除的数据
|
|
if(dataMap["freight"] && dataMap["freight"]["delete"]){//忽略删除的数据
|
|
@@ -505,6 +510,7 @@ ProjectGLJ.prototype.freightCalc= function (glj,grossWeightCoe_n,dataMap,tfreigh
|
|
|
freightIncreaseRate = scMathUtil.roundForObj(1+freightIncreaseRate/100,process);//(1+运距增加率%)
|
|
freightIncreaseRate = scMathUtil.roundForObj(1+freightIncreaseRate/100,process);//(1+运距增加率%)
|
|
|
unitFreight = scMathUtil.roundForObj(unitFreight,unitPirce);
|
|
unitFreight = scMathUtil.roundForObj(unitFreight,unitPirce);
|
|
|
kmDistance = scMathUtil.roundForObj(kmDistance,unitPirce);
|
|
kmDistance = scMathUtil.roundForObj(kmDistance,unitPirce);
|
|
|
|
|
+ heightFee = scMathUtil.roundForObj(heightFee,unitPirce);
|
|
|
|
|
|
|
|
let t = getPrice(unitFreight,kmDistance,conveyance,calcType,materialType,process);//单位运价×km运距
|
|
let t = getPrice(unitFreight,kmDistance,conveyance,calcType,materialType,process);//单位运价×km运距
|
|
|
t = scMathUtil.roundForObj(t*freightIncreaseRate,process);//单位运价×km运距×(1+运距增加率%)
|
|
t = scMathUtil.roundForObj(t*freightIncreaseRate,process);//单位运价×km运距×(1+运距增加率%)
|
|
@@ -519,12 +525,14 @@ ProjectGLJ.prototype.freightCalc= function (glj,grossWeightCoe_n,dataMap,tfreigh
|
|
|
weightCoe = scMathUtil.roundForObj(weightCoe,unitPirce);
|
|
weightCoe = scMathUtil.roundForObj(weightCoe,unitPirce);
|
|
|
t = scMathUtil.roundForObj(t*weightCoe,process);//(单位运价×km运距×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
|
|
t = scMathUtil.roundForObj(t*weightCoe,process);//(单位运价×km运距×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
|
|
|
sum = scMathUtil.roundForObj(sum + t,process);
|
|
sum = scMathUtil.roundForObj(sum + t,process);
|
|
|
|
|
+ heightFee = scMathUtil.roundForObj(heightFee*weightCoe,process);
|
|
|
|
|
+ height_sum = scMathUtil.roundForObj(height_sum + heightFee,process);
|
|
|
}
|
|
}
|
|
|
if(freightList.length == 0){//如果运费计算表没有数据,则读取输入的或单价文件的值
|
|
if(freightList.length == 0){//如果运费计算表没有数据,则读取输入的或单价文件的值
|
|
|
let doc = dataMap['material']&&dataMap['material']['update']?dataMap['material']['update']:{};
|
|
let doc = dataMap['material']&&dataMap['material']['update']?dataMap['material']['update']:{};
|
|
|
sum = doc['unitFreight']?doc['unitFreight']:glj.unit_price.unitFreight;
|
|
sum = doc['unitFreight']?doc['unitFreight']:glj.unit_price.unitFreight;
|
|
|
}
|
|
}
|
|
|
- return scMathUtil.roundForObj(sum,unitPirce);
|
|
|
|
|
|
|
+ return [scMathUtil.roundForObj(sum,unitPirce),scMathUtil.roundForObj(height_sum,unitPirce)];
|
|
|
|
|
|
|
|
|
|
|
|
|
function getPrice(unitFreight,kmDistance,conveyance,calcType,materialType,process){
|
|
function getPrice(unitFreight,kmDistance,conveyance,calcType,materialType,process){
|
|
@@ -542,25 +550,31 @@ ProjectGLJ.prototype.priceCalc = function (glj,dataMap,tpriceList) {
|
|
|
let unitPirce = getDecimal("glj.unitPrice");
|
|
let unitPirce = getDecimal("glj.unitPrice");
|
|
|
let unitPriceHasMix = getDecimal("glj.unitPriceHasMix");
|
|
let unitPriceHasMix = getDecimal("glj.unitPriceHasMix");
|
|
|
let original_price = 0;
|
|
let original_price = 0;
|
|
|
|
|
+ let sumFeightFee = 0;
|
|
|
let supplyList = [];
|
|
let supplyList = [];
|
|
|
let supplyLocation = "";
|
|
let supplyLocation = "";
|
|
|
let priceList = tpriceList?tpriceList:_.filter(this.datas.originalList,{"connect_key":gljUtil.getIndex(glj)});
|
|
let priceList = tpriceList?tpriceList:_.filter(this.datas.originalList,{"connect_key":gljUtil.getIndex(glj)});
|
|
|
if(dataMap["price"] && dataMap["price"]["add"]) priceList = priceList.concat(dataMap["price"]["add"]); //把添加的加进去
|
|
if(dataMap["price"] && dataMap["price"]["add"]) priceList = priceList.concat(dataMap["price"]["add"]); //把添加的加进去
|
|
|
for(let p of priceList){
|
|
for(let p of priceList){
|
|
|
let supplyPrice = p.supplyPrice ,coe = p.coe,supplyLocation=p.supplyLocation;
|
|
let supplyPrice = p.supplyPrice ,coe = p.coe,supplyLocation=p.supplyLocation;
|
|
|
|
|
+ let heightFee = p.heightFee?p.heightFee:0;
|
|
|
if(dataMap["price"] && dataMap["price"]["update"]){//覆盖更新的数据
|
|
if(dataMap["price"] && dataMap["price"]["update"]){//覆盖更新的数据
|
|
|
let t = dataMap["price"]["update"][p.ID];
|
|
let t = dataMap["price"]["update"][p.ID];
|
|
|
if(t && t["supplyPrice"]) supplyPrice =t["supplyPrice"];
|
|
if(t && t["supplyPrice"]) supplyPrice =t["supplyPrice"];
|
|
|
if(t && t["coe"]) coe =t["coe"];
|
|
if(t && t["coe"]) coe =t["coe"];
|
|
|
if(t && t["supplyLocation"]) supplyLocation = t["supplyLocation"];
|
|
if(t && t["supplyLocation"]) supplyLocation = t["supplyLocation"];
|
|
|
|
|
+ if(t && t["heightFee"]) heightFee = t["heightFee"];
|
|
|
}
|
|
}
|
|
|
if(dataMap["price"] && dataMap["price"]["delete"]){//忽略删除的数据
|
|
if(dataMap["price"] && dataMap["price"]["delete"]){//忽略删除的数据
|
|
|
if(dataMap["price"]["delete"][p.ID]) continue;
|
|
if(dataMap["price"]["delete"][p.ID]) continue;
|
|
|
}
|
|
}
|
|
|
supplyPrice = scMathUtil.roundForObj(supplyPrice,unitPirce);
|
|
supplyPrice = scMathUtil.roundForObj(supplyPrice,unitPirce);
|
|
|
coe = scMathUtil.roundForObj(coe,unitPirce);
|
|
coe = scMathUtil.roundForObj(coe,unitPirce);
|
|
|
|
|
+ heightFee = scMathUtil.roundForObj(heightFee,unitPirce);
|
|
|
let t_p = scMathUtil.roundForObj(supplyPrice * coe,process);
|
|
let t_p = scMathUtil.roundForObj(supplyPrice * coe,process);
|
|
|
|
|
+ let t_h = scMathUtil.roundForObj(heightFee * coe,process);
|
|
|
original_price=scMathUtil.roundForObj(original_price+t_p,process);
|
|
original_price=scMathUtil.roundForObj(original_price+t_p,process);
|
|
|
|
|
+ sumFeightFee = scMathUtil.roundForObj(sumFeightFee+t_h,process);
|
|
|
supplyList.push(supplyLocation);
|
|
supplyList.push(supplyLocation);
|
|
|
}
|
|
}
|
|
|
supplyLocation = supplyList.join(',');
|
|
supplyLocation = supplyList.join(',');
|
|
@@ -569,7 +583,7 @@ ProjectGLJ.prototype.priceCalc = function (glj,dataMap,tpriceList) {
|
|
|
original_price = doc['originalPrice']!==undefined?doc['originalPrice']:glj.unit_price.originalPrice;
|
|
original_price = doc['originalPrice']!==undefined?doc['originalPrice']:glj.unit_price.originalPrice;
|
|
|
supplyLocation = doc['supplyLocation']!==undefined?doc['supplyLocation']:glj.unit_price.supplyLocation;
|
|
supplyLocation = doc['supplyLocation']!==undefined?doc['supplyLocation']:glj.unit_price.supplyLocation;
|
|
|
}
|
|
}
|
|
|
- return [scMathUtil.roundForObj(original_price,unitPriceHasMix),supplyLocation];
|
|
|
|
|
|
|
+ return [scMathUtil.roundForObj(original_price,unitPriceHasMix),supplyLocation,scMathUtil.roundForObj(sumFeightFee,unitPirce)];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@@ -912,6 +926,7 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
|
|
|
if(temp){
|
|
if(temp){
|
|
|
if(type == "freight" && temp.conveyance !="自办运输") return null;
|
|
if(type == "freight" && temp.conveyance !="自办运输") return null;
|
|
|
let sum =0;
|
|
let sum =0;
|
|
|
|
|
+ let heightFee = 0;
|
|
|
let gljMap = {};
|
|
let gljMap = {};
|
|
|
let decimal = type == "freight"?getDecimal("glj.unitPrice"):getDecimal("glj.unitPriceHasMix");
|
|
let decimal = type == "freight"?getDecimal("glj.unitPrice"):getDecimal("glj.unitPriceHasMix");
|
|
|
//因为材料计算的数据是保存在单价文件里的,有可能存在共享的情况,这样的话就不能用单价文件里的项目工料机ID来匹配,要用5大项匹配
|
|
//因为材料计算的数据是保存在单价文件里的,有可能存在共享的情况,这样的话就不能用单价文件里的项目工料机ID来匹配,要用5大项匹配
|
|
@@ -926,18 +941,21 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
|
|
|
}
|
|
}
|
|
|
if(temp.rations) {
|
|
if(temp.rations) {
|
|
|
for(let r of temp.rations){
|
|
for(let r of temp.rations){
|
|
|
- sum = scMathUtil.roundForObj(sum + calcRation(r,gljMap[r.ID],pgljMap,priceMap),6);
|
|
|
|
|
|
|
+ let [tsum,thei] = calcRation(r,gljMap[r.ID],pgljMap,priceMap);
|
|
|
|
|
+ heightFee = scMathUtil.roundForObj(heightFee+thei,6);
|
|
|
|
|
+ sum = scMathUtil.roundForObj(sum + tsum,6);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
sum = scMathUtil.roundForObj(sum,decimal)+"";
|
|
sum = scMathUtil.roundForObj(sum,decimal)+"";
|
|
|
- if(type == "freight" && temp.unitFreight!= sum) return {ID:temp.ID,doc:{unitFreight:sum}};
|
|
|
|
|
- if(type == "price" && temp.supplyPrice !=sum) return {ID:temp.ID,doc:{supplyPrice:sum}};
|
|
|
|
|
|
|
+ if(type == "freight" && temp.unitFreight!= sum) return {ID:temp.ID,doc:{unitFreight:sum,heightFee:heightFee}};
|
|
|
|
|
+ if(type == "price" && temp.supplyPrice !=sum) return {ID:temp.ID,doc:{supplyPrice:sum,heightFee:heightFee}}
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
function calcRation(ration,gljs,pMap,priceMap){
|
|
function calcRation(ration,gljs,pMap,priceMap){
|
|
|
let result = 0;
|
|
let result = 0;
|
|
|
|
|
+ let heightFee = 0;
|
|
|
if(gljs){
|
|
if(gljs){
|
|
|
let processDecimal = getDecimal("process");
|
|
let processDecimal = getDecimal("process");
|
|
|
let hightFeeRate = projectObj.project.projectGLJ.getHighlandFee(ration.feeType);//高原取费类别费率
|
|
let hightFeeRate = projectObj.project.projectGLJ.getHighlandFee(ration.feeType);//高原取费类别费率
|
|
@@ -960,8 +978,9 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
|
|
|
let hs = scMathUtil.roundForObj(tt*hightFeeRate,processDecimal);//(人工定额消耗量*定额价*定额工程量+机械定额消耗量*定额价*定额工程量)*高原取费类别费率
|
|
let hs = scMathUtil.roundForObj(tt*hightFeeRate,processDecimal);//(人工定额消耗量*定额价*定额工程量+机械定额消耗量*定额价*定额工程量)*高原取费类别费率
|
|
|
result = scMathUtil.roundForObj(as + result,processDecimal);
|
|
result = scMathUtil.roundForObj(as + result,processDecimal);
|
|
|
result = scMathUtil.roundForObj(hs + result,processDecimal);
|
|
result = scMathUtil.roundForObj(hs + result,processDecimal);
|
|
|
|
|
+ heightFee = hs;
|
|
|
}
|
|
}
|
|
|
- return result;
|
|
|
|
|
|
|
+ return [result,heightFee];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|