| 
					
				 | 
			
			
				@@ -137,4 +137,33 @@ const doComplete = async function(projectCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     BaseUtil.closePool(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-doComplete(process.argv[3]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// doComplete(process.argv[3]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 更新所有工程量清单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const updateProjectSpread = async function (project) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const projectSpread = await querySql('Select * From zh_project_spread WHERE pid = ?', [project.id]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (const spread of projectSpread) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!spread.gcl_stage_set) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const gcl_stage_set = JSON.parse(spread.gcl_stage_set); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const tz_calc = gcl_stage_set.find(x => { return x.key === 'tz_calc'}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!tz_calc) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tz_calc.pos_valid = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        await querySql(`UPDATE zh_project_spread SET gcl_stage_set = ? WHERE id = ?`, [JSON.stringify(gcl_stage_set), spread.id]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const doComplete2 = async function (projectCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const whereSql = projectCode ? ` WHERE code = "${projectCode}"` : ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const project = await querySql(`Select * From zh_project ${whereSql}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (const p of project) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            console.log(`Update Project ${p.code}(${p.id}):`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await updateProjectSpread(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } catch (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log(err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    BaseUtil.closePool(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+doComplete2(process.argv[3]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 |