|
|
@@ -146,7 +146,7 @@ let mbzm_obj={
|
|
|
let selected = projectObj.project.mainTree.selected;
|
|
|
let template = projectObj.project.ration_template.getTemplateByRationID(selected.data.ID);
|
|
|
let createLocation = $("#createLocation").val();
|
|
|
- let rations = {update:[],create:[]},bills={update:[],create:[]};
|
|
|
+ let rations = {update:[],create:[],delete:[]},bills={update:[],create:[]};
|
|
|
if(this.datas.length <= 0) return;
|
|
|
for(let d of this.datas){
|
|
|
if((gljUtil.isDef(d.quantity)&& parseFloat(d.quantity)>0)||(d.coe && d.coe!="0")){
|
|
|
@@ -231,7 +231,7 @@ let mbzm_obj={
|
|
|
let mainRation = projectObj.project.mainTree.getNodeByID(referenceRationID);
|
|
|
let billsID="";
|
|
|
//先检查要更新的定额是否已经存在
|
|
|
- let ration = this.getExistRation(data,referenceRationID,type);
|
|
|
+ let ration = this.getExistRation(data,referenceRationID,type,rations);
|
|
|
if(ration) {//如果存在,则比较清耗量、工程量表达式是否一致
|
|
|
let tem = this.getRationData(ration,data,quantity);//取更新信息
|
|
|
|
|
|
@@ -244,8 +244,7 @@ let mbzm_obj={
|
|
|
//定额不存在的情况下
|
|
|
if(type == mbzm_obj.locateMap.AFTERRATION) {//如果是生成在主定额后面的位置
|
|
|
this.createNewRationAfterMain(data,mainRation,quantity,rations);
|
|
|
- }
|
|
|
- if(type == mbzm_obj.locateMap.INMEASURE){//生成在措施项目下
|
|
|
+ }else if(type == mbzm_obj.locateMap.INMEASURE){//生成在措施项目下
|
|
|
this.createNewRationInMeasure(data,mainRation,quantity,rations,bills);
|
|
|
}else {
|
|
|
this.createNewRationInFBFX(data,mainRation,quantity,rations,bills);
|
|
|
@@ -261,6 +260,7 @@ let mbzm_obj={
|
|
|
if(!_.isEmpty(tem)) {
|
|
|
tem.projectID = ration.projectID;
|
|
|
tem.ID = ration.ID;
|
|
|
+ tem.contain = projectObj.project.Ration.getContain(projectObj.project.mainTree.findNode(ration.billsItemID),tem.quantity);
|
|
|
return tem;
|
|
|
}
|
|
|
return null;
|
|
|
@@ -407,6 +407,8 @@ let mbzm_obj={
|
|
|
newData.referenceRationID = referenceRationID;
|
|
|
newData.quantity = quantity;
|
|
|
newData.quantityEXP = gljUtil.isDef(data.coe) && data.coe != "0"?"MBGCL":quantity+"";
|
|
|
+ //这里还要生成根据清单生成含量,父清单如果是刚自动生成的,其工程量为0,含量也为0
|
|
|
+ newData.contain = projectObj.project.Ration.getContain(projectObj.project.mainTree.findNode(billsID),quantity);
|
|
|
let temRation = this.getDefaultRationCreateData(newData,data.code,libID,isFBFX);
|
|
|
return temRation;
|
|
|
},
|
|
|
@@ -436,7 +438,7 @@ let mbzm_obj={
|
|
|
}
|
|
|
return quantity;
|
|
|
},
|
|
|
- getExistRation:function (data,referenceRationID,type) {
|
|
|
+ getExistRation:function (data,referenceRationID,type,updateRations) {
|
|
|
let temRation = null;
|
|
|
//先检查要更新的定额是否已经存在
|
|
|
let rations =_.filter(projectObj.project.Ration.datas,{'referenceRationID':referenceRationID,'code':data.code});
|
|
|
@@ -470,6 +472,8 @@ let mbzm_obj={
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //如果没有执行到break,则说明这条定额是要被删除的
|
|
|
+ updateRations.delete.push({projectID:r.projectID,ID:r.ID});
|
|
|
}
|
|
|
return temRation;
|
|
|
},
|
|
|
@@ -523,12 +527,13 @@ let mbzm_obj={
|
|
|
let t_times = parseInt(rnode.data.unit);
|
|
|
t_times = isNaN(t_times)?1:t_times;//工程量要乘以定额单位的倍数
|
|
|
rnode.data.quantity = scMathUtil.roundForObj(t_quantity/t_times,getDecimal('ration.quantity'));
|
|
|
- if(rnode.parent.data.quantity&&rnode.parent.data.quantity!=0&&rnode.parent.data.quantity!=""){
|
|
|
+ rnode.data.contain = projectObj.project.Ration.getContain(rnode.parent,rnode.data.quantity);
|
|
|
+ /* if(rnode.parent.data.quantity&&rnode.parent.data.quantity!=0&&rnode.parent.data.quantity!=""){
|
|
|
var billQuantity = scMathUtil.roundForObj(rnode.parent.data.quantity,getDecimal("quantity",node.parent));
|
|
|
rnode.data.contain = scMathUtil.roundForObj(rnode.data.quantity/billQuantity,getDecimal("process"));
|
|
|
}else {
|
|
|
rnode.data.contain=0;
|
|
|
- }
|
|
|
+ }*/
|
|
|
rnode.change = true;
|
|
|
rationNodes.push(rnode)
|
|
|
}
|