huangxingxing 2 лет назад
Родитель
Сommit
ad03bef502

+ 1 - 0
definitionsrc/returncode/returncode-business.properties

@@ -92,3 +92,4 @@ EB4000014 = \u5207\u7247List\u6E32\u67D3\u53C2\u6570\u5B58\u5728\u9519\u8BEF\uFF
 EB4000015 = \u8BF7\u4E0A\u4F20\u6587\u4EF6\uFF01
 EB4000016 = stream\u6E32\u67D3\u53C2\u6570\u5B58\u5728\u9519\u8BEF\uFF01
 EB4000017 = \u672A\u6210\u529F\u751F\u5B58\u7ED3\u679C\u6587\u4EF6\uFF01
+EB4000018 = \u52A8\u753B\u5FC5\u987B\u9009\u62E9\u7C7B\u578B\uFF01

+ 1 - 0
definitionsrc/returncode/returncode-business_zh_CN.properties

@@ -92,3 +92,4 @@ EB4000014 = \u5207\u7247List\u6E32\u67D3\u53C2\u6570\u5B58\u5728\u9519\u8BEF\uFF
 EB4000015 = \u8BF7\u4E0A\u4F20\u6587\u4EF6\uFF01
 EB4000016 = stream\u6E32\u67D3\u53C2\u6570\u5B58\u5728\u9519\u8BEF\uFF01
 EB4000017 = \u672A\u6210\u529F\u751F\u5B58\u7ED3\u679C\u6587\u4EF6\uFF01
+EB4000018 = \u52A8\u753B\u5FC5\u987B\u9009\u62E9\u7C7B\u578B\uFF01

+ 13 - 0
generated/com/miniframe/generate/comm/system/A_AFT001.java

@@ -308,4 +308,17 @@ public class A_AFT001 extends BaseMapModel implements Serializable {
 	public String getZ() {
 		return this.z;
 	}
+	String animationType;//动画渲染类型
+	/**
+	 *动画渲染类型
+	 */
+	public void setAnimationType(String animationType) {
+		this.animationType=animationType;
+	}
+	/**
+	 *动画渲染类型
+	 */
+	public String getAnimationType() {
+		return this.animationType;
+	}
 }

+ 13 - 0
generated/validateform/a_aft001Form.xml

@@ -290,6 +290,19 @@
       <var-value>2048</var-value>
     </var>
 </field>
+<field property="animationType" depends="minlength,maxlength">
+    <arg0 key="a_aft001.animationType"/>
+    <arg1 name="minlength" key="${var:minlength}"/>
+    <var>
+      <var-name>minlength</var-name>
+      <var-value>1</var-value>
+    </var>
+    <arg1 name="maxlength" key="${var:maxlength}"/>
+    <var>
+      <var-name>maxlength</var-name>
+      <var-value>2048</var-value>
+    </var>
+</field>
 </form>
 </formset>
 </form-validation>

+ 1 - 0
generated/validator/resources_a_aft001Form_validator.properties

@@ -21,4 +21,5 @@ a_aft001.index = \u5207\u7247\u6DFB\u52A0\u5220\u9664ID
 a_aft001.x = x
 a_aft001.y = y
 a_aft001.z = z
+a_aft001.animationType = \u52A8\u753B\u6E32\u67D3\u7C7B\u578B
 a_aft001Form = true

+ 1 - 0
generated/validator/resources_a_aft001Form_validator_zh_CN.properties

@@ -21,4 +21,5 @@ a_aft001.index = \u5207\u7247\u6DFB\u52A0\u5220\u9664ID
 a_aft001.x = x
 a_aft001.y = y
 a_aft001.z = z
+a_aft001.animationType = \u52A8\u753B\u6E32\u67D3\u7C7B\u578B
 a_aft001Form = true

+ 136 - 1
src/main/java/com/miniframe/bisiness/system/AFT001Service.java

@@ -20,10 +20,12 @@ import com.miniframe.generate.business.system.model.AFT001BaseModel;
 import com.miniframe.model.system.*;
 import com.miniframe.model.system.dao.*;
 import com.miniframe.service.mq.CaeMQ;
+import com.miniframe.solverconfig.fem.FEMPath;
 import com.miniframe.solverconfig.hcfd.HcfdPath;
 import com.miniframe.spring.mq.MFMqUtils;
 import com.miniframe.tools.XIFileUtils;
 import com.miniframe.tools.XiJsonUtil;
+import org.json.JSONArray;
 import org.json.JSONObject;
 
 /**
@@ -303,11 +305,144 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 				throw new BusinessException("EB4000014");
 			}
 
+		}else if(action.equals("animation")){
+			JSONObject obj = new JSONObject();
+			animationTypePara(scalarName, level, range0, range1, obj);
+			if(solver.getSolverModel().equals("HCFDLab")) {
+				animationHcfdFile(proId, obj);
+			}else if(solver.getSolverModel().equals("FEMLab(结构力学)")){
+				animationFemFile(proId, obj);
+			}
+			msg.setParamJson(obj.toString());
 		}
-
 		MFMqUtils.get(CaeMQ.class).sendCaein(XiJsonUtil.objectToJson(msg));
 
 	}
+	/**
+	 * FEM 动画文件获取
+	 * @param proId
+	 * @param obj
+	 * @throws BusinessException
+	 */
+	private void animationFemFile(String proId, JSONObject obj) throws BusinessException {
+		String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+ proId;
+		String exePath = jobPath+ MFConstant.separator+"fem";
+		String exeOutPath = exePath+ MFConstant.separator+"data_out";
+		JSONArray jsonArray = new JSONArray();
+		List<Integer> steps = FEMPath.femTeps(proId);
+		for (Integer st:steps) {
+			List<File> fileList = FEMPath.getStepFiles(proId,st.toString());
+			String fileName="";
+			for (int i = 0; i < fileList.size(); i++) {
+				if(i==fileList.size()-1){
+					fileName +=fileList.get(i).getName();
+				}else {
+					fileName +=fileList.get(i).getName()+",";
+				}
+			}
+			JSONObject obj2 = new JSONObject();
+			obj2.put("step",st);
+			obj2.put("fileName",fileName);
+			jsonArray.put(obj2);
+		}
+		obj.put("filePath", exeOutPath);
+		obj.put("fileType", "ascii");
+		obj.put("fileName", jsonArray);
+	}
+
+	/**
+	 * 根据渲染类型 设置参数
+	 * @param scalarName
+	 * @param level
+	 * @param range0
+	 * @param range1
+	 * @param obj
+	 * @throws BusinessException
+	 */
+	private void animationTypePara(String scalarName, String level, String range0, String range1, JSONObject obj) throws BusinessException {
+		String  animationType = getA_aft001().getAnimationType();
+		if(StringUtil.isNullOrEmpty(animationType)){
+			throw new BusinessException("4000018");
+		}else if(animationType.equals("ContourDisplay")){
+			obj.put("level", level);
+			obj.put("range", range0 +","+ range1);
+			obj.put("scalarName", scalarName);
+		}else if(animationType.equals("LineDisplay")){
+			obj.put("level", level);
+			obj.put("range", range0 +","+ range1);
+			obj.put("scalarName", scalarName);
+		}else if(animationType.equals("VectorDisplay")){
+			if(this.getA_aft001().getScaleFactor()==null
+					||"".equals(this.getA_aft001().getScaleFactor())||
+					this.getA_aft001().getDataU()==null
+					||"".equals(this.getA_aft001().getDataU())||
+					this.getA_aft001().getDataV()==null
+					||"".equals(this.getA_aft001().getDataV())||
+					this.getA_aft001().getDataW()==null
+					||"".equals(this.getA_aft001().getDataW())
+			){
+				throw new BusinessException("EB4000013");
+			}
+			obj.put("scaleFactor",this.getA_aft001().getScaleFactor());
+			obj.put("dataU",this.getA_aft001().getDataU());
+			obj.put("dataV",this.getA_aft001().getDataV());
+			obj.put("dataW",this.getA_aft001().getDataW());
+		}else if(animationType.equals("SolidSurfaceDisplay")){
+			String r =this.getA_aft001().getR();
+			String g =this.getA_aft001().getG();
+			String b =this.getA_aft001().getB();
+			String transparency=this.getA_aft001().getTransparency();
+			String showHideState=this.getA_aft001().getShowHideState();
+			if(r==null || "".equals(r)
+					||g==null || "".equals(g)
+					||b==null || "".equals(b)
+					||transparency==null || "".equals(transparency)
+					||showHideState==null || "".equals(showHideState)
+
+			){
+
+				throw new BusinessException("EB4000013");
+			}
+			obj.put("r",r);
+			obj.put("g",g);
+			obj.put("b",b);
+			obj.put("transparency",transparency);
+			obj.put("showHideState","1".equals(showHideState)?true:false);
+		}
+	}
+
+	/**
+	 * Hcfd 动画文件获取
+	 * @param proId
+	 * @param obj
+	 * @throws BusinessException
+	 */
+	private void animationHcfdFile(String proId, JSONObject obj) throws BusinessException {
+		String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+ proId;
+		String exePath = jobPath+ MFConstant.separator+"hcfd";
+		String testPath = exePath+ MFConstant.separator+"test";
+		String exeOutPath = testPath+ MFConstant.separator+"data_out";
+		JSONArray jsonArray = new JSONArray();
+		List<Integer> steps =HcfdPath.hcfdTeps(proId);
+		for (Integer st:steps) {
+			List<File> fileList = HcfdPath.getStepFiles(proId, getA_aft001().getIsVolume(), st.toString());
+			String fileName="";
+			for (int i = 0; i < fileList.size(); i++) {
+				if(i==fileList.size()-1){
+					fileName +=fileList.get(i).getName();
+				}else {
+					fileName +=fileList.get(i).getName()+",";
+				}
+			}
+			JSONObject obj2 = new JSONObject();
+			obj2.put("step",st);
+			obj2.put("fileName",fileName);
+			jsonArray.put(obj2);
+		}
+		obj.put("filePath", exeOutPath);
+		obj.put("fileType", "ascii");
+		obj.put("fileNames", jsonArray);
+	}
 
 	/**
 	 * 基础系统,“后处理消息发送”业务前处理

+ 49 - 0
src/main/java/com/miniframe/solverconfig/fem/FEMPath.java

@@ -1,6 +1,7 @@
 package com.miniframe.solverconfig.fem;
 
 import com.miniframe.constant.MFConstant;
+import com.miniframe.core.exception.BusinessException;
 import com.miniframe.core.ext.UtilTools;
 import com.miniframe.model.system.AdiModeling;
 import com.miniframe.model.system.AdiSolverConfig;
@@ -15,12 +16,60 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * 对执行所需要的文件进行文件夹规整已满足求解
  */
 public class FEMPath {
 
+    /**
+     *
+     * @param pid
+     * @param step  步数
+     * @return
+     */
+    public static List<File> getStepFiles(String pid , String step) throws BusinessException {
+        String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+pid;
+        String exePath = jobPath+ MFConstant.separator+"fem";
+        String exeOutPath = exePath+ MFConstant.separator+"data_out";
+        File exeOutDir = new File(exeOutPath);
+        if(!exeOutDir.exists()){
+            throw  new BusinessException("EB4000017");
+        }
+        List<File> fileList =new ArrayList<>();
+        File[] files =exeOutDir.listFiles();
+        for (File sonFile: files) {
+            if(sonFile.getName().indexOf("dynamicResponse-transient"+step+".vtk")>-1){
+                fileList.add(sonFile);
+            }
+        }
+        return  fileList;
+    }
+
+    public static List<Integer> femTeps(String pid) throws  BusinessException{
+        String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+pid;
+        String exePath = jobPath+ MFConstant.separator+"fem";
+        String exeOutPath = exePath+ MFConstant.separator+"data_out";
+        File exeOutDir = new File(exeOutPath);
+        if(!exeOutDir.exists()){
+            throw  new BusinessException("EB4000017");
+        }
+        List<Integer> steps = new ArrayList<>();
+        File[] files =exeOutDir.listFiles();
+        for (File sonFile: files) {
+            if(!"dynamicResponse-transient.vtk".equals(sonFile.getName())
+                    &&sonFile.getName().indexOf("dynamicResponse-transient")>-1){
+                String stip=sonFile.getName().replace("dynamicResponse-transient","").replace(".vtk","");
+                steps.add(Integer.valueOf(stip));
+            }
+        }
+        Collections.sort(steps);
+        return steps;
+    }
+
     public static  void femCreatePath(AdiModeling modeling,
                                       AdiSolverConfig config,
                                       AdiSolverJob job ) throws IOException {

+ 2 - 1
系统设计/数据定义/返 回 码/business(业务系统).csv

@@ -104,4 +104,5 @@
 
 4000015,EB4000015,请上传文件!
 4000016,EB4000016,stream 渲染参数存在错误!
-4000017,EB4000017,未成功生存结果文件!
+4000017,EB4000017,未成功生存结果文件!
+4000018,EB4000018,动画必须选择类型!

+ 2 - 1
系统设计/通信设计/通讯报文/system(系统服务)/报文体/AFT001_A(后处理消息操作消息发送).csv

@@ -21,4 +21,5 @@
 20,index,切片添加删除ID,string,,,,1,1024,,,,,,
 21,x,x,string,,,,1,2048,,,,,,
 22,y,y,string,,,,1,2048,,,,,,
-23,z,z,string,,,,1,2048,,,,,,
+23,z,z,string,,,,1,2048,,,,,,
+24,animationType,动画渲染类型,string,,,,1,2048,,,,,,