|
@@ -108,6 +108,8 @@ const overHeightLibModel = mongoose.model('std_over_height_lib');
|
|
|
const shareListModel = mongoose.model('share_list');
|
|
|
const shareLibModel = mongoose.model('share_libs');
|
|
|
let welcomeModel = mongoose.model("welcome_setting");
|
|
|
+let equipmentPurchaseModel = mongoose.model('equipment_purchase');
|
|
|
+
|
|
|
|
|
|
let scMathUtil = require('../../../public/scMathUtil').getUtil();
|
|
|
let counter = require('../../../public/counter/counter');
|
|
@@ -699,6 +701,10 @@ async function copyProject(userID, compilationID,data,newProjectID = null, delay
|
|
|
if(originalProperty.unitPriceFile){
|
|
|
copyTasks.push(copyUnitPriceFile(newProjectID,originalProperty.rootProjectID,userID,originalProperty.unitPriceFile.id,unitPriceFileID,newUnitName));
|
|
|
}
|
|
|
+ //复制设备购置
|
|
|
+
|
|
|
+ copyTasks.push(copyEquipment(newProjectID,originalID));
|
|
|
+
|
|
|
await Promise.all(copyTasks);
|
|
|
// 最后再处理项目数据
|
|
|
// 可能会有最后再在外层方法插入项目数据的需求,如拷贝例题,暂时先不在这里插入项目数据
|
|
@@ -817,6 +823,16 @@ async function copyProjectGLJ(gljList) {
|
|
|
await insertMany(gljList,gljListModel);
|
|
|
}
|
|
|
|
|
|
+async function copyEquipment(newProjectID,oldProjectID){//复制设备购置费
|
|
|
+ let result = null;
|
|
|
+ const equipments = await equipmentPurchaseModel.findOne({projectID:oldProjectID}, '-_id').lean();
|
|
|
+ if(equipments){
|
|
|
+ equipments.projectID = newProjectID;
|
|
|
+ result = await equipmentPurchaseModel.create(equipments);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
async function commonCopy(newProjectID,oldID,newID,model) { //对于只需更新ID和projectID的文件的复制
|
|
|
let result = null;
|
|
|
let file = await model.findOne({"ID": oldID}, '-_id');
|