|
@@ -117,7 +117,7 @@ let mbzm_obj={
|
|
|
},
|
|
|
updatePosition:function (recode) {
|
|
|
let selection = this.sheet.getSelections()[0];
|
|
|
- let selectedItem =(this.datas[selection.row]);
|
|
|
+ let selectedItem =this.datas[selection.row];
|
|
|
let updateField = $("#createLocation").val()==this.locateMap.INMEASURE?"billID":"fxID";
|
|
|
if(selectedItem[updateField] == recode.ID) return;
|
|
|
selectedItem[updateField] = recode.ID;
|
|
@@ -132,7 +132,7 @@ let mbzm_obj={
|
|
|
if(this.datas.length <= 0) return;
|
|
|
for(let d of this.datas){
|
|
|
if(gljUtil.isDef(d.quantity)&& parseFloat(d.quantity)>0){
|
|
|
- if(this.positionChecking(createLocation,d) == false){
|
|
|
+ if(this.positionChecking(createLocation,d) == false){//清单位置检查
|
|
|
alert(`请选择${d.code}生成的清单位置`);
|
|
|
return;
|
|
|
}
|
|
@@ -149,15 +149,37 @@ let mbzm_obj={
|
|
|
console.log(data);
|
|
|
$.bootstrapLoading.start();
|
|
|
CommonAjax.post('/ration/applyTemplate',data,function (result) {
|
|
|
- $.bootstrapLoading.end();
|
|
|
let refreshNodes = projectObj.project.updateNodesCache(result.updateDatas);//更新要update的前端缓存,并返回要刷新的树节点
|
|
|
+ let nodeDatas = {ration:{add:[]}, bills:{add:[]}};
|
|
|
+ if(result.rationResult){
|
|
|
+ for(let rr of result.rationResult){
|
|
|
+ nodeDatas.ration.add.push(rr.ration);//定额datas数据的push在addNodes里面做
|
|
|
+ projectObj.project.Ration.addSubListOfRation(rr);//添加定额子项缓存
|
|
|
+ }
|
|
|
+ }
|
|
|
//对于新插入的清单:
|
|
|
if(result.billsResult.length > 0){
|
|
|
-
|
|
|
+ nodeDatas.bills.add = result.billsResult;
|
|
|
}
|
|
|
- //对于新插入的定额
|
|
|
-
|
|
|
+ let calRations = ProjectController.addNewNodes(nodeDatas);
|
|
|
+ if(refreshNodes.length > 0){
|
|
|
+ for(let r of refreshNodes){
|
|
|
+ if(r.sourceType == ModuleNames.ration){
|
|
|
+ calRations.push(r);
|
|
|
+ if(r.data.quantityEXP =="MBGCL" ) projectObj.project.quantity_detail.cleanQuantityDetail(r,true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projectObj.mainController.refreshTreeNode(refreshNodes, false);
|
|
|
+ }
|
|
|
+ projectObj.project.projectGLJ.loadData(function () {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ cbTools.refreshFormulaNodes();
|
|
|
+ //更新计算程序模板,并进行重新计算
|
|
|
+ projectObj.project.calcProgram.calcNodesAndSave(calRations,function () {
|
|
|
+ installationFeeObj.calcInstallationFee();
|
|
|
+ });
|
|
|
|
|
|
+ });
|
|
|
console.log(result);
|
|
|
})
|
|
|
|
|
@@ -171,7 +193,7 @@ let mbzm_obj={
|
|
|
}else if(_.isEmpty(data.billsLocation)){
|
|
|
validate = false
|
|
|
}
|
|
|
- }else {
|
|
|
+ }else if(type == mbzm_obj.locateMap.INFBFX){
|
|
|
if(_.isEmpty(data.fxID)) {
|
|
|
validate = false;
|
|
|
}else {
|
|
@@ -189,6 +211,7 @@ let mbzm_obj={
|
|
|
let ration = this.getExistRation(data,referenceRationID,type);
|
|
|
if(ration) {//如果存在,则比较清耗量、工程量表达式是否一致
|
|
|
let tem = this.getRationData(ration,data,quantity);//取更新信息
|
|
|
+
|
|
|
if(tem){//如果不一致,则需要更新
|
|
|
rations.update.push(tem);
|
|
|
}
|
|
@@ -204,30 +227,14 @@ let mbzm_obj={
|
|
|
}else {
|
|
|
this.createNewRationInFBFX(data,mainRation,quantity,rations,bills);
|
|
|
}
|
|
|
-
|
|
|
- /*[
|
|
|
- {
|
|
|
- type:'ration',
|
|
|
- data:{
|
|
|
- projectID:1605,
|
|
|
- ID:"7b962fb0-1131-11e8-b3da-af725dadd7ae",
|
|
|
- name:'testRation'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- type:'bills',
|
|
|
- data:{
|
|
|
- projectID:1605,
|
|
|
- ID:"af9f0081-1127-11e8-99a8-2fc02230b6e7",
|
|
|
- name:'安全文明施工专项费用123'
|
|
|
- }
|
|
|
- }
|
|
|
- ]*/
|
|
|
},
|
|
|
getRationData:function (ration,data,quantity) {
|
|
|
let tem = {};
|
|
|
if (ration.quantity + "" != quantity) tem.quantity = quantity;
|
|
|
- if (gljUtil.isDef(data.coe) && data.coe != "0") tem.quantityEXP = "MBGCL";
|
|
|
+ if (gljUtil.isDef(data.coe) && data.coe != "0"&&ration.quantityEXP != "MBGCL") {
|
|
|
+ tem.isFromDetail = 0;
|
|
|
+ tem.quantityEXP = "MBGCL";
|
|
|
+ }
|
|
|
if(!_.isEmpty(tem)) {
|
|
|
tem.projectID = ration.projectID;
|
|
|
tem.ID = ration.ID;
|
|
@@ -243,7 +250,7 @@ let mbzm_obj={
|
|
|
if(rations.create.length > 0){
|
|
|
serialNo = rations.create[rations.create.length -1].newData.serialNo + 1
|
|
|
}
|
|
|
- let n_ration = this.createNewRationData(data,newID,mainRation.data.referenceRationID,mainRation.data.billsItemID,serialNo,quantity,mainRation.data.libID);
|
|
|
+ let n_ration = this.createNewRationData(data,newID,mainRation.data.ID,mainRation.data.billsItemID,serialNo,quantity,mainRation.data.libID);
|
|
|
rations.create.push(n_ration);
|
|
|
//处理其它兄弟节点的序号
|
|
|
let br = projectObj.project.Ration.getBillsSortRation();
|
|
@@ -287,6 +294,7 @@ let mbzm_obj={
|
|
|
ParentID:parentNode.data.ID,
|
|
|
NextSiblingID:-1,
|
|
|
code:projectObj.project.Bills.newFormatCode(data.billsLocation),
|
|
|
+ type:billType.BILL,
|
|
|
billsLibId:projectInfoObj.projectInfo.engineeringInfo.bill_lib[0].id,//projectInfoObj.projectInfo.engineeringInfo.billsGuidance_lib
|
|
|
billsLocation : data.billsLocation//这个是用来在后端查找清单信息
|
|
|
};
|
|
@@ -385,7 +393,6 @@ let mbzm_obj={
|
|
|
}
|
|
|
return data.quantity
|
|
|
},
|
|
|
-
|
|
|
getExistRation:function (data,referenceRationID,type) {
|
|
|
let temRation = null;
|
|
|
//先检查要更新的定额是否已经存在
|
|
@@ -421,8 +428,35 @@ let mbzm_obj={
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return temRation;
|
|
|
+ },
|
|
|
+ hasReferenceRation:function (node) {
|
|
|
+ if(node.sourceType == ModuleNames.ration){
|
|
|
+ let template = projectObj.project.ration_template.getTemplateByRationID(node.data.ID);
|
|
|
+ if(template){
|
|
|
+ let ration = _.find(projectObj.project.Ration.datas,{'referenceRationID':node.data.ID});
|
|
|
+ if(ration) return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ deleteReferenceRation:function (mainNodes,updateNodes) {
|
|
|
+ let refNode = [];
|
|
|
+ for(let m of mainNodes){
|
|
|
+ if(this.hasReferenceRation(m)){
|
|
|
+ let rations = _.filter(projectObj.project.Ration.datas,{'referenceRationID':m.data.ID});
|
|
|
+ for(let r of rations){
|
|
|
+ let temNode = projectObj.project.mainTree.getNodeByID(r.ID);
|
|
|
+ if(temNode && updateNodes.indexOf(temNode) == -1){//能找到该节点,并且节点不在已经删除的列表中
|
|
|
+ refNode.push(temNode);
|
|
|
+ updateNodes.push(temNode);
|
|
|
+ projectObj.mainController.tree.getAllSubNode(temNode,updateNodes)//添加显示到造价书页面的主材、设备节点
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return refNode;
|
|
|
}
|
|
|
};
|
|
|
|