上传文件至 'TML项目管理类型分类'
parent
4015750c8d
commit
85f469c006
@ -0,0 +1,197 @@
|
||||
import com.matrixone.apps.cpd.json.JSONObject;
|
||||
import com.matrixone.apps.domain.DomainObject;
|
||||
import com.matrixone.apps.domain.util.EnoviaResourceBundle;
|
||||
import com.matrixone.apps.domain.util.MqlUtil;
|
||||
import com.matrixone.apps.domain.util.PropertyUtil;
|
||||
import matrix.db.Context;
|
||||
import matrix.db.JPO;
|
||||
import matrix.util.StringList;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class TMLProjectSpace_mxJPO {
|
||||
public String getProjectCategory(Context context, String[] args) throws Exception {
|
||||
|
||||
StringBuffer htmlString = new StringBuffer();
|
||||
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
HashMap fieldMap = (HashMap) programMap.get("fieldMap");
|
||||
String attNameStr = (String) fieldMap.get("name");
|
||||
HashMap requestMap = (HashMap) programMap.get("requestMap");
|
||||
System.out.println("11111");
|
||||
System.out.println(requestMap);
|
||||
if (requestMap.containsKey("mode")) {
|
||||
htmlString.append("<script type=\"text/javascript\" src=\"../SxCentral/js/getProjectSpaceInfo.js\"></script>");
|
||||
htmlString.append("<script type=\"text/javascript\" src=\"../SxCentral/js/jquery.js\"></script>");
|
||||
|
||||
Map settings = (Map) fieldMap.get("settings");
|
||||
String AttributelinkSpecificType = (String) settings.get("AttributelinkSpecificType"); //SpecificType
|
||||
String attNameAdmin = (String) settings.get("Admin Type"); //attribute_ProjectCategory
|
||||
String attName = PropertyUtil.getSchemaProperty(context, attNameAdmin);
|
||||
htmlString.append("<select id='" + attNameStr + "' name='" + attNameStr + "' onchange=\"javascript=insertSpecificType(this,'" + AttributelinkSpecificType + "');\"><option value=''></option>");
|
||||
|
||||
String attRangeMql = "print att " + attName + " select range dump |";
|
||||
String resultAttRange = MqlUtil.mqlCommand(context, attRangeMql);
|
||||
|
||||
String newAttRange = resultAttRange.replaceAll("=", "");
|
||||
String[] arrRange = newAttRange.split("\\|");
|
||||
|
||||
for (int i = 0; i < arrRange.length; i++) {
|
||||
String proeprties = EnoviaResourceBundle.getProperty(context, "emxFrameworkStringResource", new Locale("zh_CN"), "emxFramework.Range." + attName + "." + arrRange[i].trim().replace(" ", "_"));
|
||||
htmlString.append("<option value='" + arrRange[i].trim() + "'>" +proeprties + "</option>");
|
||||
}
|
||||
htmlString.append("</select>");
|
||||
}
|
||||
System.out.println(htmlString);
|
||||
return htmlString.toString();
|
||||
}
|
||||
|
||||
public String getSpecificType(Context context, String[] args){
|
||||
String ProjectCategory = args[0];
|
||||
System.out.println("======>");
|
||||
System.out.println(ProjectCategory);
|
||||
|
||||
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
String ClassificationInfo = EnoviaResourceBundle.getProperty(context, "emxSxCentralStringResource", context.getLocale(), ProjectCategory);
|
||||
try {
|
||||
System.out.println("Test" + ClassificationInfo);
|
||||
String[] classification = ClassificationInfo.split(" ");
|
||||
|
||||
for(int i = 0; i < classification.length; i++){
|
||||
JSONObject json=new JSONObject();
|
||||
System.out.println(classification[i]);
|
||||
//emxSxCentral.Label.LogisticsSpecialist
|
||||
if(!classification[i].equals("NA")) {
|
||||
String SpecificType = EnoviaResourceBundle.getProperty(context, "emxSxCentralStringResource", context.getLocale(),
|
||||
"emxSxCentral.Label." + classification[i]);
|
||||
json.put("name",classification[i]);
|
||||
json.put("value", SpecificType);
|
||||
} else {
|
||||
json.put("name",classification[i]);
|
||||
json.put("value", classification[i]);
|
||||
}
|
||||
list.add(json);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(list.toString());
|
||||
return list.toString();
|
||||
}
|
||||
|
||||
public String getSpecificTypeJSONInfo(Context context, String[] args) throws Exception {
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
|
||||
Map fieldMap = (Map) programMap.get("fieldMap");
|
||||
HashMap requestMap = (HashMap)programMap.get("requestMap");
|
||||
|
||||
String attNameStr = (String) fieldMap.get("name");
|
||||
System.out.println("1111==>" + attNameStr);
|
||||
StringBuffer htmlString=new StringBuffer();
|
||||
|
||||
// if(!requestMap.containsKey("mode"))
|
||||
// {
|
||||
htmlString.append("<select id='"+attNameStr+"' name='"+attNameStr+"'><option value=''></option></select>");
|
||||
// }
|
||||
|
||||
return htmlString.toString();
|
||||
}
|
||||
|
||||
public String ProjectLevelInfo(Context context, String[] args) throws Exception {
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
|
||||
Map fieldMap = (Map) programMap.get("fieldMap");
|
||||
HashMap requestMap = (HashMap)programMap.get("requestMap");
|
||||
|
||||
String attNameStr = (String) fieldMap.get("name");
|
||||
System.out.println("1111==>" + attNameStr);
|
||||
StringBuffer htmlString=new StringBuffer();
|
||||
|
||||
// if(!requestMap.containsKey("mode"))
|
||||
// {
|
||||
htmlString.append("<select id='"+attNameStr+"' name='"+attNameStr+"'><option value=''></option></select>");
|
||||
// }
|
||||
|
||||
return htmlString.toString();
|
||||
}
|
||||
|
||||
public void updateProjectCategory(Context context, String[] args) throws Exception {
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
|
||||
Map paramMap = (Map) programMap.get("paramMap");
|
||||
Map fieldMap = (Map) programMap.get("fieldMap");
|
||||
Map settings = (Map) fieldMap.get("settings");
|
||||
|
||||
String attNameStr = (String) settings.get("Admin Type");
|
||||
String attName = PropertyUtil.getSchemaProperty(context,attNameStr);
|
||||
String NewValue = (String) paramMap.get("New Value");
|
||||
System.out.println("NewValue ==> " + NewValue);
|
||||
String objectId = (String) paramMap.get("objectId");
|
||||
|
||||
DomainObject domainObject = new DomainObject(objectId);
|
||||
domainObject.setAttributeValue(context, "ProjectCategory", NewValue);
|
||||
}
|
||||
|
||||
public void updateSpecificType(Context context, String[] args) throws Exception {
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
|
||||
Map paramMap = (Map) programMap.get("paramMap");
|
||||
Map fieldMap = (Map) programMap.get("fieldMap");
|
||||
Map settings = (Map) fieldMap.get("settings");
|
||||
|
||||
String attNameStr = (String) settings.get("Admin Type");
|
||||
String attName = PropertyUtil.getSchemaProperty(context,attNameStr);
|
||||
String NewValue = (String) paramMap.get("New Value");
|
||||
String objectId = (String) paramMap.get("objectId");
|
||||
System.out.println(objectId);
|
||||
|
||||
DomainObject domainObject = new DomainObject(objectId);
|
||||
domainObject.setAttributeValue(context, "SpecificType", NewValue);
|
||||
}
|
||||
|
||||
public void updateProjectLevel(Context context, String[] args) throws Exception {
|
||||
HashMap programMap = (HashMap) JPO.unpackArgs(args);
|
||||
|
||||
Map paramMap = (Map) programMap.get("paramMap");
|
||||
Map fieldMap = (Map) programMap.get("fieldMap");
|
||||
Map settings = (Map) fieldMap.get("settings");
|
||||
|
||||
String attNameStr = (String) settings.get("Admin Type");
|
||||
String attName = PropertyUtil.getSchemaProperty(context,attNameStr);
|
||||
String NewValue = (String) paramMap.get("New Value");
|
||||
String objectId = (String) paramMap.get("objectId");
|
||||
System.out.println(objectId);
|
||||
|
||||
DomainObject domainObject = new DomainObject(objectId);
|
||||
domainObject.setAttributeValue(context, "ProjectLevel", NewValue);
|
||||
}
|
||||
|
||||
|
||||
public StringList getProjectSpecificClassification(Context context, String[] args) throws Exception {
|
||||
HashMap hashMap=(HashMap) JPO.unpackArgs(args);
|
||||
List list=(List) hashMap.get("objectList");
|
||||
System.out.println("========");
|
||||
System.out.println(list);
|
||||
StringList stringList = new StringList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Map itemMap = (Map) list.get(i);
|
||||
String itemId = (String) itemMap.get("id");
|
||||
|
||||
String getAttrInfo = "print bus " + itemId + " select attribute[ProjectCategory].value attribute[SpecificType].value dump |";
|
||||
String attrInfo = MqlUtil.mqlCommand(context, getAttrInfo);
|
||||
System.out.println(attrInfo);
|
||||
if(attrInfo.length() <= 1){
|
||||
stringList.add("NAN");
|
||||
} else {
|
||||
String[] projectSpaceAttr = attrInfo.split("\\|");
|
||||
String SpecificType1 = EnoviaResourceBundle.getProperty(context, "emxFrameworkStringResource", context.getLocale(),
|
||||
"emxFramework.Range.ProjectCategory." + projectSpaceAttr[0]);
|
||||
String SpecificType2 = EnoviaResourceBundle.getProperty(context, "emxSxCentralStringResource", context.getLocale(),
|
||||
"emxSxCentral.Label." + projectSpaceAttr[1]);
|
||||
stringList.add(SpecificType1 + "-" + SpecificType2);
|
||||
}
|
||||
}
|
||||
return stringList;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue