|
@@ -109,6 +109,7 @@ const shareListModel = mongoose.model('share_list');
|
|
const shareLibModel = mongoose.model('share_libs');
|
|
const shareLibModel = mongoose.model('share_libs');
|
|
let welcomeModel = mongoose.model("welcome_setting");
|
|
let welcomeModel = mongoose.model("welcome_setting");
|
|
let equipmentPurchaseModel = mongoose.model('equipment_purchase');
|
|
let equipmentPurchaseModel = mongoose.model('equipment_purchase');
|
|
|
|
+const gaterFeeModel = mongoose.model('gather_calc_programs');
|
|
|
|
|
|
|
|
|
|
let scMathUtil = require('../../../public/scMathUtil').getUtil();
|
|
let scMathUtil = require('../../../public/scMathUtil').getUtil();
|
|
@@ -705,6 +706,9 @@ async function copyProject(userID, compilationID,data,newProjectID = null, delay
|
|
|
|
|
|
copyTasks.push(copyEquipment(newProjectID,originalID));
|
|
copyTasks.push(copyEquipment(newProjectID,originalID));
|
|
|
|
|
|
|
|
+ // 复制费用汇总
|
|
|
|
+ copyTasks.push(copyGatherFee(newProjectID, originalID));
|
|
|
|
+
|
|
await Promise.all(copyTasks);
|
|
await Promise.all(copyTasks);
|
|
// 最后再处理项目数据
|
|
// 最后再处理项目数据
|
|
// 可能会有最后再在外层方法插入项目数据的需求,如拷贝例题,暂时先不在这里插入项目数据
|
|
// 可能会有最后再在外层方法插入项目数据的需求,如拷贝例题,暂时先不在这里插入项目数据
|
|
@@ -833,6 +837,17 @@ async function copyEquipment(newProjectID,oldProjectID){//复制设备购置费
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 复制费用汇总
|
|
|
|
+async function copyGatherFee(newProjectID, oldProjectID) {
|
|
|
|
+ let result = null;
|
|
|
|
+ const gatherItem = await gaterFeeModel.findOne({ projectID: oldProjectID }, '-_id').lean();
|
|
|
|
+ if (gatherItem) {
|
|
|
|
+ gatherItem.projectID = newProjectID;
|
|
|
|
+ result = await gaterFeeModel.create(gatherItem);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+
|
|
async function commonCopy(newProjectID,oldID,newID,model) { //对于只需更新ID和projectID的文件的复制
|
|
async function commonCopy(newProjectID,oldID,newID,model) { //对于只需更新ID和projectID的文件的复制
|
|
let result = null;
|
|
let result = null;
|
|
let file = await model.findOne({"ID": oldID}, '-_id');
|
|
let file = await model.findOne({"ID": oldID}, '-_id');
|
|
@@ -2542,6 +2557,7 @@ async function exportTenderData(data){
|
|
result.bidList = await bidListModel.find({projectID:data.projectID}, '-_id').lean();
|
|
result.bidList = await bidListModel.find({projectID:data.projectID}, '-_id').lean();
|
|
result.contractorList = await contractorListModel.find({projectID:data.projectID}, '-_id').lean();
|
|
result.contractorList = await contractorListModel.find({projectID:data.projectID}, '-_id').lean();
|
|
result.equipments = await equipmentPurchaseModel.findOne({projectID:data.projectID},'-_id').lean();
|
|
result.equipments = await equipmentPurchaseModel.findOne({projectID:data.projectID},'-_id').lean();
|
|
|
|
+ result.gatherFees = await gaterFeeModel.findOne({projectID:data.projectID},'-_id').lean();
|
|
|
|
|
|
return cipher.aesEncrypt(JSON.stringify(result));
|
|
return cipher.aesEncrypt(JSON.stringify(result));
|
|
}
|
|
}
|
|
@@ -2786,9 +2802,9 @@ async function importProjects(data,req,updateData) {
|
|
let [constructionProjectID,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap] = await handleMainProjectDatas(mainData,updateData,req.session.sessionUser.id);
|
|
let [constructionProjectID,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap] = await handleMainProjectDatas(mainData,updateData,req.session.sessionUser.id);
|
|
result.constructionProjectID = constructionProjectID;
|
|
result.constructionProjectID = constructionProjectID;
|
|
if(datas.length > 1 ){
|
|
if(datas.length > 1 ){
|
|
- let newProjectSettings=[],bills=[],rations=[],installationFees=[],projectGLJs=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[],newCalcProgramsFiles=[],newLabourCoes=[],newEquipments = [];
|
|
|
|
|
|
+ let newProjectSettings=[],bills=[],rations=[],installationFees=[],projectGLJs=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[],newCalcProgramsFiles=[],newLabourCoes=[],newEquipments = [],newGatherFees = [];
|
|
for(let i = 1;i<datas.length;i++){
|
|
for(let i = 1;i<datas.length;i++){
|
|
- let [tnewProjectSetting,tbills,trations,tinstallationFees,tprojectGLJs,trationGLJs,trationCoes,tquantityDetails,trationInstallations,trationTemplates,tevaluateList,tbidList,tcontractorList,tnewCalcProgramsFile,tnewLabourCoe,tnewEquipments] = await handleEachProject(datas[i],projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap)
|
|
|
|
|
|
+ let [tnewProjectSetting,tbills,trations,tinstallationFees,tprojectGLJs,trationGLJs,trationCoes,tquantityDetails,trationInstallations,trationTemplates,tevaluateList,tbidList,tcontractorList,tnewCalcProgramsFile,tnewLabourCoe,tnewEquipments, tnewGatherFees] = await handleEachProject(datas[i],projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap)
|
|
if(tnewProjectSetting) newProjectSettings.push(tnewProjectSetting);
|
|
if(tnewProjectSetting) newProjectSettings.push(tnewProjectSetting);
|
|
if(tbills.length > 0) bills = bills.concat(tbills);
|
|
if(tbills.length > 0) bills = bills.concat(tbills);
|
|
if(trations.length > 0) rations = rations.concat(trations);
|
|
if(trations.length > 0) rations = rations.concat(trations);
|
|
@@ -2804,7 +2820,8 @@ async function importProjects(data,req,updateData) {
|
|
if(tcontractorList.length > 0) contractorList = contractorList.concat(tcontractorList);
|
|
if(tcontractorList.length > 0) contractorList = contractorList.concat(tcontractorList);
|
|
if(tnewCalcProgramsFile) newCalcProgramsFiles.push(tnewCalcProgramsFile);
|
|
if(tnewCalcProgramsFile) newCalcProgramsFiles.push(tnewCalcProgramsFile);
|
|
if(tnewLabourCoe) newLabourCoes.push(tnewLabourCoe);
|
|
if(tnewLabourCoe) newLabourCoes.push(tnewLabourCoe);
|
|
- if(tnewEquipments) newEquipments.push(tnewEquipments);
|
|
|
|
|
|
+ if(tnewEquipments) newEquipments.push(tnewEquipments);
|
|
|
|
+ if(tnewGatherFees) newGatherFees.push(tnewGatherFees);
|
|
}
|
|
}
|
|
|
|
|
|
if(newProjectSettings.length > 0) await insertMany(newProjectSettings,projectSettingModel)
|
|
if(newProjectSettings.length > 0) await insertMany(newProjectSettings,projectSettingModel)
|
|
@@ -2823,6 +2840,7 @@ async function importProjects(data,req,updateData) {
|
|
if(newCalcProgramsFiles.length > 0) await insertMany(newCalcProgramsFiles,calcProgramsModel);
|
|
if(newCalcProgramsFiles.length > 0) await insertMany(newCalcProgramsFiles,calcProgramsModel);
|
|
if(newLabourCoes.length > 0) await insertMany(newLabourCoes,labourCoesModel);
|
|
if(newLabourCoes.length > 0) await insertMany(newLabourCoes,labourCoesModel);
|
|
if(newEquipments.length > 0) await insertMany(newEquipments,equipmentPurchaseModel);
|
|
if(newEquipments.length > 0) await insertMany(newEquipments,equipmentPurchaseModel);
|
|
|
|
+ if(newGatherFees.length > 0) await insertMany(newGatherFees,gaterFeeModel);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2836,7 +2854,7 @@ async function importProjects(data,req,updateData) {
|
|
|
|
|
|
async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap){
|
|
async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgramFileIDMap){
|
|
let bills = [],rations = [],projectGLJs = [],installationFees=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[];
|
|
let bills = [],rations = [],projectGLJs = [],installationFees=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[];
|
|
- let newProjectSetting =null,newCalcProgramsFile = null,newLabourCoe = null,newEquipments = null;
|
|
|
|
|
|
+ let newProjectSetting =null,newCalcProgramsFile = null,newLabourCoe = null,newEquipments = null, newGatherFees = null;
|
|
let billsIDMap = {},projectGLJIDMap={},rationIDMap = {};
|
|
let billsIDMap = {},projectGLJIDMap={},rationIDMap = {};
|
|
let newProjectID = projectIDMap[data.projectID];
|
|
let newProjectID = projectIDMap[data.projectID];
|
|
//生成安装增加费设置
|
|
//生成安装增加费设置
|
|
@@ -2924,9 +2942,15 @@ async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgra
|
|
delete newEquipments._id;
|
|
delete newEquipments._id;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (data.gatherFees) {
|
|
|
|
+ data.gatherFees.projectID = newProjectID;
|
|
|
|
+ newGatherFees = data.gatherFees;
|
|
|
|
+ delete newGatherFees._id;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- return [newProjectSetting,bills,rations,installationFees,projectGLJs,rationGLJs,rationCoes,quantityDetails,rationInstallations,rationTemplates,evaluateList,bidList,contractorList,newCalcProgramsFile,newLabourCoe,newEquipments]
|
|
|
|
|
|
+ return [newProjectSetting,bills,rations,installationFees,projectGLJs,rationGLJs,rationCoes,quantityDetails,rationInstallations,rationTemplates,evaluateList,bidList,contractorList,newCalcProgramsFile,newLabourCoe,newEquipments,newGatherFees]
|
|
|
|
|
|
}
|
|
}
|
|
function setMaterialList(datas,newProjectID,projectGLJIDMap){
|
|
function setMaterialList(datas,newProjectID,projectGLJIDMap){
|