|
@@ -133,8 +133,11 @@ async function replaceRations(userID,data) {
|
|
|
}
|
|
|
|
|
|
async function replaceRation(nodeInfo,stdRation,firstLibID,projectID,calQuantity) {
|
|
|
- if(stdRation){
|
|
|
- await deleRationSubRecode(projectID,nodeInfo.ID);
|
|
|
+ if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
|
|
|
+ await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
|
|
|
+ return await setEmptyRation(projectID,nodeInfo.ID);
|
|
|
+ }else if(stdRation){
|
|
|
+ await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
|
|
|
let newRation = await updateRation(stdRation,firstLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
|
|
|
return await addRationSubList(stdRation,newRation,nodeInfo.needInstall);
|
|
|
}else {
|
|
@@ -375,6 +378,40 @@ async function updateRation(std,firstLibID,rationID,billsItemID,projectID,calQu
|
|
|
return newRation;
|
|
|
}
|
|
|
|
|
|
+async function setEmptyRation(projectID,rationID){
|
|
|
+ let ration ={};
|
|
|
+ ration.code = "";
|
|
|
+ ration.name = "";
|
|
|
+ ration.caption = "";
|
|
|
+ ration.unit = "";
|
|
|
+ ration.libID = null;
|
|
|
+ ration.content = "";
|
|
|
+ ration.adjustState = '';
|
|
|
+ ration.isFromDetail=0;
|
|
|
+ ration.isSubcontract=false;
|
|
|
+ ration.fees=[];
|
|
|
+ ration.comments = "";
|
|
|
+ ration.ruleText = "";
|
|
|
+ ration.quantity="";
|
|
|
+ ration.contain="";
|
|
|
+ ration.quantityEXP="";
|
|
|
+ ration.from = 'std';
|
|
|
+ //定额前缀 none:0, complementary:1, borrow: 2
|
|
|
+ ration.prefix = '';
|
|
|
+ ration.rationAssList = [];
|
|
|
+ ration.marketUnitFee ="";
|
|
|
+ ration.marketTotalFee ="";
|
|
|
+ ration.maskName = "";
|
|
|
+ ration.targetTotalFee ='';
|
|
|
+ ration.targetUnitFee = "";
|
|
|
+ ration.deleteInfo = null;
|
|
|
+ ration.quantityCoe = {};
|
|
|
+ ration.rationQuantityCoe="";
|
|
|
+ ration.tenderQuantity = "";
|
|
|
+ let newRation = await ration_model.model.findOneAndUpdate({ID:rationID,projectID:projectID},{"$set":ration},{new: true});//;
|
|
|
+ return {ration:newRation,ration_gljs:[],ration_coes:[],ration_installs:[]};
|
|
|
+}
|
|
|
+
|
|
|
function createRationAss(std) {
|
|
|
let rationAssList = [];//生成辅助定额
|
|
|
if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){
|