Commit 4f46d9fd authored by zhh's avatar zhh

zhh update

parent 8509ea2b
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Test {
public static void main(String[] args) {
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf1 =new SimpleDateFormat("yyyyMMdd");
Date date=new Date();
Calendar c=Calendar.getInstance();
c.setTime(date);
// c.add(Calendar.DAY_OF_MONTH, 1); //输出一天后的日期
// System.out.println(sdf.format(c.getTime()));;
//DAY_OF_WEEK
// System.out.println(c.get(Calendar.DAY_OF_WEEK));
Calendar calendar1 = Calendar.getInstance(); //当前时间
System.out.println(calendar1.get(Calendar.DAY_OF_WEEK));
calendar1.add(Calendar.DAY_OF_MONTH,10);
System.out.println(calendar1.getTime());
// int weekNowNum=calendar1.get(Calendar.DAY_OF_WEEK);//获取当前星期
// System.out.println(weekNowNum);
String s=new String("\u5df2");
System.out.println(s);
SimpleDateFormat sdf=new SimpleDateFormat("yyMMdd");
System.out.println(sdf.format(new Date()));
}
}
......@@ -38,7 +38,7 @@ public class Test3 {
System.out.println("原来"+pwd);
//String spwd = mx.decData("05D3E4AE66BD4C6D0A934D9896EB2187");
String spwd1 = mx.encData("clpjbdev");
String spwd = mx.decData("170DB79B4BEE2D9670C8C117EE7862D7");
String spwd = mx.decData("500C7C9864165AD6E8A35E1EFC5279C2");
// System.out.println("spwd:"+spwd);
System.out.println("加密"+spwd1);
// System.out.println("解密"+new String(spwd.getBytes("UTF-8")));
......
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.util.StringUtility;
public class Testjdbc {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Connection con = null;// 创建一个数据库连接
PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Statement
ResultSet result = null;// 创建一个结果集对象
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");//实例化oracle数据库驱动程序(建立中间件)
String url ="jdbc:sqlserver://;serverName=172.17.6.230;databaseName=maxdb;portNumber=1433;integratedSecurity=false;sendStringParametersAsUnicode=false;selectMethod=cursor;";//@localhost为服务器名,sjzwish为数据库实例名
con = DriverManager.getConnection(url, "maximo", "maximo");//连接数据库,a代表帐户,a代表密码
System.out.println("连接成功!");
String sql = " select LOCATIONMETER.metername, "
+ " METER.METERTYPE, LOCATIONMETER.normalvalue, "
+ " LOCATIONMETER.maxvalue , "
+ " LOCATIONMETER.minvalue, "
+ " MEASUREMENT.observation , "
+ " MEASUREMENT.measurementid , "
+ " MEASUREMENT.ifsynchronous , "
+ " MEASUREMENT.location , "
+ " MEASUREMENT.measurementvalue , "
+ " MEASUREMENT.pointnum , "
+ " MEASUREMENT.inspector , "
+ " MEASUREMENT.measuredate , MEASUREMENT.rtinspcnum , "
+ " MEASUREMENT.siteid , MEASUREMENT.orgid " + " from "
+ " LOCATIONMETER,METER,MEASUREMENT "
+ " where LOCATIONMETER.metername= METER.metername "
+ " and MEASUREMENT.metername= METER.metername "
+ " and IFSYNCHRONOUS=0 ";
pre = con.prepareStatement(sql);// 实例化预编译语句
result = pre.executeQuery();// 执行查询,注意括号中不需要再加参数
int count =0;
while (result.next()) {
String metername = result.getString("metername");
String metertype = result.getString("metertype");
String normalvalue = result.getString("normalvalue");
String maxvalue = result.getString("maxvalue");
String minvalue = result.getString("minvalue");
String observation = result.getString("observation");
Long measurementid = result.getLong("measurementid");
// 需要新增变量
String location = result.getString("location");
Double measurementvalue = result.getDouble("measurementvalue");
String inspector = result.getString("inspector");
Date measuredate = result.getDate("measuredate");
String rtinspcnum = result.getString("rtinspcnum");
String siteid = result.getString("siteid");
String orgid = result.getString("orgid");
boolean flag = false;
if (metertype.equalsIgnoreCase("CHARACTERISTIC")) { // 非数值类型
if (!StringUtility.isEmpty(normalvalue)) {
if (!normalvalue.equalsIgnoreCase(observation)) { // 如果是相同类型则正常
System.out.println(normalvalue+"---"+observation);
count++;
flag=true;
}
}
}
if (metertype.equalsIgnoreCase("GAUGE")) { // 数值类型
if (StringUtility.isEmpty(minvalue)
&& StringUtility.isEmpty(maxvalue)) {
continue;
}
if ( !StringUtility.isEmpty(minvalue)
&& !StringUtility.isEmpty(maxvalue)) {
if (measurementvalue < Double.parseDouble(minvalue)
|| measurementvalue > Double.parseDouble(maxvalue)) { // 生成记录
flag = true;
}
} else if (!StringUtility.isEmpty(minvalue)
&& StringUtility.isEmpty(maxvalue)) {
if (measurementvalue < Double.parseDouble(minvalue)) { // 生成记录
flag = true;
}
} else if (StringUtility.isEmpty(minvalue)
&& !StringUtility.isEmpty(maxvalue)) {
if (measurementvalue > Double.parseDouble(maxvalue)) { // 生成记录
flag = true;
}
}
if (flag) {
System.out.println(measurementid+"--zzz--"+minvalue+"---"+maxvalue +"---"+ measurementvalue);
count++;
}
}
}
System.out.println(count);
}
}
package clp.app.po;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.util.HashSet;
......@@ -11,7 +10,11 @@ import psdi.mbo.MboSetRemote;
import psdi.security.ProfileRemote;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXApplicationWarningException;
import psdi.util.MXApplicationYesNoCancelException;
import psdi.util.MXException;
import psdi.webclient.system.controller.MXApplicationLiteralWarningException;
public class CLPPO extends PO
implements CLPPORemote
......@@ -22,10 +25,17 @@ public class CLPPO extends PO
public CLPPO(MboSet paramMboSet) throws MXException, RemoteException {
super(paramMboSet);
}
@Override
public void appValidate() throws MXException, RemoteException {
super.appValidate();
}
public void init() throws MXException {
public void init() throws MXException {
super.init();
try {
String status = getString("status");
String[] as = { "DESCRIPTION" };
......@@ -50,7 +60,6 @@ public class CLPPO extends PO
POLINE.setFlag(7L, false);
}
} catch (RemoteException localRemoteException) {
}
}
......@@ -132,25 +141,4 @@ public class CLPPO extends PO
zero = zero + "0";
return zero;
}
@Override
public MboRemote revisePO(String arg0, boolean arg1) throws MXException,
RemoteException {
setValue("POTYPE","CHG",11L);
return super.revisePO(arg0, arg1);
}
@Override
public MboRemote revisePO() throws MXException, RemoteException {
setValue("POTYPE","CHG",11L);
return super.revisePO();
}
@Override
public MboRemote revisePO(String revDescription) throws MXException,
RemoteException {
System.out.println("޶po ----1");
setValue("POTYPE","CHG",11L);
return super.revisePO(revDescription);
}
}
\ No newline at end of file
package clp.app.po;
public interface CLPPORemote {
}
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package clp.app.rfq;
import java.io.PrintStream;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
import psdi.app.rfq.RFQ;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.security.ProfileRemote;
import psdi.util.MXException;
public class CLPRFQ extends RFQ implements CLPRFQRemote {
private static final long serialVersionUID = 1L;
public CLPRFQ(MboSet paramMboSet) throws MXException, RemoteException {
super(paramMboSet);
}
public void init() throws MXException {
super.init();
try {
System.out.println("初始化--");
if (this.getString("siteid").equals("CLP-YN-YE")) {
this.setFieldFlag("CUSTDEPT", 7L, true);
}
String status = this.getString("status");
String[] as = new String[]{"DESCRIPTION", "CUSTSQLY", "PRIORITY", "REQUIREDDATE", "CUSTGKBM", "CURRENCYCODE"};
String[] as1 = new String[]{"CUSTZBRQ"};//招标日期
if (this.isNew()) {
return;
}
if (this.getUserName().equalsIgnoreCase("yeadmin") || this.getUserName().equalsIgnoreCase("hjadmin")) {
return;
}
if (this.getString("ENTERBY").equalsIgnoreCase(this.getUserName()) && status.equals("INPRG")) {
return;
}
this.setFieldFlag(as, 7L, false);
MboSetRemote RFQLINE = this.getMboSet("RFQLINE");
RFQLINE.setFlag(7L, true);
MboSetRemote wfment = this.getMboSet("$wfassignment", "wfassignment", "ownerid='" + this.getInt("rfqid") + "' and assignstatus='ACTIVE' and assigncode='" + this.getUserInfo().getPersonId().toUpperCase() + "' and ownertable='" + this.getName().toUpperCase() + "'");
int i = wfment.count();
if (i > 0) {
this.setFieldFlag(as, 7L, false);
this.setFieldFlag("CUSTTJGYS", 7L, false);
this.setFieldFlag("CUSTTJYY", 7L, false);
RFQLINE.setFlag(7L, false);
}
String personId = getUserInfo().getPersonId();
MXServer mxServer = MXServer.getMXServer();
MboSetRemote personSet = mxServer.getMboSet("GROUPUSER", getUserInfo());
personSet.setWhere(" userid='" + personId + "'");
for (int j = 0; j < personSet.count(); j++) {
MboRemote team = personSet.getMbo(j);
if (team.getString("groupname").equalsIgnoreCase("CLPJB15")) {
System.out.println("进入了商务控制!!");
setFlag(7L, false);
return;
}
}
} catch (RemoteException var6) {
}
}
public void add() throws MXException, RemoteException {
super.add();
if (this.getString("siteid").equals("CLP-YN-YE")) {
this.setValue("CUSTDEPT", "CLPYE", 2L);
} else if (this.getString("siteid").equals("CLP-HY-BX")) {
this.setValue("CUSTDEPT", "CLPHY", 2L);
} else if (this.getString("siteid").equals("CLP-JB-JBZB")) {
this.setValue("CUSTDEPT", this.getString("ENTERBY.DEPARTMENT"), 11L);
}
}
public void save() throws MXException, RemoteException {
super.save();
}
public void createRFQLineFromPR(MboRemote paramMboRemote1, MboRemote paramMboRemote2) throws MXException, RemoteException {
super.createRFQLineFromPR(paramMboRemote1, paramMboRemote2);
this.getMboSet("RFQLINE").setValue("custdept", paramMboRemote2.getString("custdept"), 11L);
this.getMboSet("RFQLINE").setValue("unitcost", paramMboRemote2.getString("unitcost"), 11L);
this.getMboSet("RFQLINE").setValue("linecost", paramMboRemote2.getString("linecost"), 11L);
}
public void getCustCode(String prtype, String year) throws MXException, RemoteException {
int count = 1;
int tmpNum1 = 0;
String custcode = null;
String siteid = this.getProfile().getDefaultSite();
String code = "JB-TR-" + year + "-" + prtype + "-";
synchronized(this) {
MboSetRemote prSet = this.getMboSet("$rfq", "rfq", "custcode=(select custcode from rfq,(select '%'+max(SUBSTRING(custcode,14,3)) b from rfq where siteid='" + siteid + "')a where custcode like a.b)");
System.out.println("custcode=(select custcode from rfq,(select '%'+max(SUBSTRING(custcode,14,3)) b from rfq where siteid='" + siteid + "')a where custcode like a.b)");
if (prSet.count() == 1) {
MboRemote pr = prSet.getMbo(0);
tmpNum1 = Integer.parseInt(pr.getString("custcode").substring(14, 16));
count = tmpNum1 + 1;
custcode = this.getMatId(code, count);
this.setValue("custcode", custcode, 11L);
} else {
this.setValue("custcode", code + "001", 11L);
}
}
}
public class CLPRFQ extends RFQ
implements CLPRFQRemote
{
private static final long serialVersionUID = 1L;
public CLPRFQ(MboSet paramMboSet)
throws MXException, RemoteException
{
super(paramMboSet);
}
@Override
public void init() throws MXException {
super.init();
}
private String getMatId(String code, int count) {
String num = this.getCharacterCountStringValue(count, 3);
return code + num;
public void add()
throws MXException, RemoteException
{
super.add();
if (getString("siteid").equals("CLP-YN-YE"))
setValue("CUSTDEPT", "CLPYE", 2L);
else if (getString("siteid").equals("CLP-HY-BX"))
setValue("CUSTDEPT", "CLPHY", 2L);
else if (getString("siteid").equals("CLP-JB-JBZB"))
setValue("CUSTDEPT", getString("ENTERBY.DEPARTMENT"), 11L);
}
public void save()
throws MXException, RemoteException
{
super.save();
}
public void createRFQLineFromPR(MboRemote paramMboRemote1, MboRemote paramMboRemote2) throws MXException, RemoteException {
super.createRFQLineFromPR(paramMboRemote1, paramMboRemote2);
getMboSet("RFQLINE").setValue("custdept", paramMboRemote2.getString("custdept"), 11L);
getMboSet("RFQLINE").setValue("unitcost", paramMboRemote2.getString("unitcost"), 11L);
getMboSet("RFQLINE").setValue("linecost", paramMboRemote2.getString("linecost"), 11L);
}
public void getCustCode(String prtype, String year) throws MXException, RemoteException {
int count = 1;
int tmpNum1 = 0;
String custcode = null;
String siteid = getProfile().getDefaultSite();
String code = "JB-TR-" + year + "-" + prtype + "-";
synchronized (this) {
MboSetRemote prSet = getMboSet("$rfq", "rfq", "custcode=(select custcode from rfq,(select '%'+max(SUBSTRING(custcode,14,3)) b from rfq where siteid='" + siteid + "')a where custcode like a.b)");
System.out.println("custcode=(select custcode from rfq,(select '%'+max(SUBSTRING(custcode,14,3)) b from rfq where siteid='" + siteid + "')a where custcode like a.b)");
if (prSet.count() == 1) {
MboRemote pr = prSet.getMbo(0);
tmpNum1 = Integer.parseInt(pr.getString("custcode").substring(14, 16));
count = tmpNum1 + 1;
custcode = getMatId(code, count);
setValue("custcode", custcode, 11L);
} else {
setValue("custcode", code + "001", 11L);
}
}
}
private String getCharacterCountStringValue(int count, int maxDigit) {
int length = String.valueOf(count).length();
return this.getZeroString(maxDigit - length) + count;
}
private String getMatId(String code, int count)
{
String num = getCharacterCountStringValue(count, 3);
return code + num;
}
private String getZeroString(int num) {
String zero = "";
private String getCharacterCountStringValue(int count, int maxDigit) {
int length = String.valueOf(count).length();
return getZeroString(maxDigit - length) + count;
}
for(int i = 0; i < num; ++i) {
zero = zero + "0";
}
private String getZeroString(int num) {
String zero = "";
return zero;
for (int i = 0; i < num; i++) {
zero = zero + "0";
}
public void initFieldFlagsOnMbo(String attrName) throws MXException {
super.initFieldFlagsOnMbo(attrName);
try {
if (this.getString("siteid").equals("CLP-JB-JBZB") && this.getInternalStatus().equals("SENT") && this.getString("status").equals("WAPPR3")) {
this.setFieldFlag("custcode", 7L, false);
this.setFieldFlag("CUSTTYPE", 7L, false);
}
} catch (RemoteException var3) {
var3.printStackTrace();
}
return zero;
}
public void initFieldFlagsOnMbo(String attrName) throws MXException {
super.initFieldFlagsOnMbo(attrName);
try
{
if ((getString("siteid").equals("CLP-JB-JBZB")) && (getInternalStatus().equals("SENT")) && (getString("status").equals("WAPPR3"))) {
setFieldFlag("custcode", 7L, false);
setFieldFlag("CUSTTYPE", 7L, false);
}
} catch (RemoteException var3) {
var3.printStackTrace();
}
}
}
}
\ No newline at end of file
package clp.app.rfq;
import psdi.app.rfq.RFQRemote;
public abstract interface CLPRFQRemote extends RFQRemote
{
}
\ No newline at end of file
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package clp.app.rtinspection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import org.json.JSONException;
import org.json.JSONObject;
import psdi.common.action.ActionCustomClass;
import psdi.mbo.MboRemote;
import psdi.server.MXServer;
import psdi.util.MXException;
public class GenRtinspcTask implements ActionCustomClass {
public GenRtinspcTask() {
}
public void applyCustomAction(MboRemote rtInspc, Object[] aobj) throws MXException, RemoteException {
Properties properties = MXServer.getMXServer().getConfig();
String apikey = properties.getProperty("clp.maxadmin.apikey", "").trim();
String filepath = properties.getProperty("clp.rtinspc.storepath", "").trim();
String loadTaskURL = properties.getProperty("clp.rtinspc.loadTask.url", "").trim();
String rtinspcnum = rtInspc.getString("rtinspcnum");
String route = rtInspc.getString("route");
String siteid = rtInspc.getString("siteid");
String inspcTaskJson = this.getInspcTaskJson(apikey, loadTaskURL, rtinspcnum, route, siteid);
this.write2File(inspcTaskJson, filepath, rtinspcnum + "-" + siteid);
rtInspc.setValue("flag", true);
}
private String getInspcTaskJson(String apikey, String url, String rtinspcnum, String route, String siteid) throws MXException {
HttpURLConnection con = null;
try {
URL u = new URL(url);
con = (HttpURLConnection)u.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "*/*");
con.setRequestProperty("Accept-Charset", "UTF-8");
con.setRequestProperty("apikey", apikey);
Map<String, String> parameters = new HashMap();
parameters.put("oslc.select", "rel.activertinspc{rtinspcnum,description,status,route,rtinspectype,siteid},rel.rtinspcstops{rtinspcstopsid,rtinspcnum,location,description,siteid,flag,route_stop.files--files,route_stop.area--area}");
parameters.put("site.activertinspc.where", "rtinspcnum in [\"" + rtinspcnum + "\"]");
parameters.put("site.rtinspcstops.where", "rtinspcnum in [\"" + rtinspcnum + "\"]");
parameters.put("oslc.where", "siteid=\"" + siteid + "\"");
parameters.put("ignorecollectionref", "1");
parameters.put("lean", "1");
con.setDoOutput(true);
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(this.getParamsString(parameters));
out.flush();
out.close();
con.setConnectTimeout(5000);
con.setReadTimeout(5000);
int status = con.getResponseCode();
Reader streamReader = null;
if (status > 299) {
streamReader = new InputStreamReader(con.getErrorStream(), "UTF-8");
} else {
streamReader = new InputStreamReader(con.getInputStream(), "UTF-8");
}
BufferedReader br = new BufferedReader(streamReader);
StringBuilder sb = new StringBuilder();
String line;
while((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
con.disconnect();
try {
String var17 = (new JSONObject(sb.toString())).toString();
return var17;
} catch (JSONException var29) {
var29.printStackTrace();
}
} catch (MalformedURLException var30) {
var30.printStackTrace();
} catch (IOException var31) {
var31.printStackTrace();
} finally {
if (con != null) {
try {
con.disconnect();
} catch (Exception var28) {
var28.printStackTrace();
}
}
}
return null;
}
private void write2File(String rtinspcJson, String filePath, String filename) throws MXException, RemoteException {
String fileName = filePath + filename + ".json";
File dir = new File(filePath);
if (!dir.exists()) {
dir.mkdirs();
}
File checkFile = new File(fileName);
FileWriter writer = null;
try {
if (!checkFile.exists()) {
checkFile.createNewFile();
}
writer = new FileWriter(checkFile, false);
writer.append(rtinspcJson);
writer.flush();
} catch (IOException var17) {
var17.printStackTrace();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException var16) {
var16.printStackTrace();
}
}
}
}
private String getParamsString(Map<String, String> params) throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
Iterator var4 = params.entrySet().iterator();
while(var4.hasNext()) {
Entry<String, String> entry = (Entry)var4.next();
result.append(URLEncoder.encode((String)entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode((String)entry.getValue(), "UTF-8"));
result.append("&");
}
String resultString = result.toString();
return resultString.length() > 0 ? resultString.substring(0, resultString.length() - 1) : resultString;
}
}
package clp.app.rtinspection;
import java.rmi.RemoteException;
import java.util.HashSet;
import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValueInfo;
import psdi.security.UserInfo;
import psdi.server.MXServer;
import psdi.util.MXException;
import psdi.util.logging.MXLogger;
import psdi.util.logging.MXLoggerFactory;
public class RtInspection extends Mbo
implements RtInspectionRemote
{
private static HashSet skipFieldCopy = new HashSet();
private static boolean isHashSetLoaded = false;
private boolean isModified = false;
private final String APPLOGGER = "maximo.application.RTINSPECTION";
private MXLogger log;
public RtInspection(MboSet mboSet0)
throws RemoteException
{
super(mboSet0);
this.log = MXLoggerFactory.getLogger("maximo.application.RTINSPECTION");
}
public void add() throws MXException, RemoteException
{
super.add();
this.log.debug("RtInspection.add");
setValue("status", "草稿", 11L);
setValue("createdby", getUserInfo().getUserName(), 11L);
setValue("createdate", MXServer.getMXServer().getDate(), 11L);
setValue("statusdate", MXServer.getMXServer().getDate(), 11L);
}
public void init()
throws MXException
{
super.init();
this.log.debug("RtInspection.init");
try
{
String status = getString("status");
String[] as = { "DESCRIPTION", "MEMO", "RTINSPCDATE",
"RTINSPECTYPE", "ROUTE", "ENDTIME" };
String[] as2 = { "MEMO", "ENDTIME" };
if (isNew()) {
return;
}
if (getUserName().equalsIgnoreCase("maxadmin")) {
return;
}
if ((getString("CREATEDBY").equalsIgnoreCase(getUserName())) &&
(status.equals("草稿"))) {
return;
}
setFieldFlag(as, 7L, true);
MboSetRemote leadGrp = getMboSet("LEADGROUP");
leadGrp.setFlag(7L, true);
MboSetRemote rtInspcStops = getMboSet("RTINSPCSTOPS");
rtInspcStops.setFlag(7L, true);
MboSetRemote wfment = getMboSet("$wfassignment", "wfassignment",
"ownerid='" + getInt("ROUTINGINSPECTIONID") +
"' and assignstatus='ACTIVE' and assigncode='" +
getUserInfo().getPersonId().toUpperCase() +
"' and ownertable='" + getName().toUpperCase() +
"'");
int i = wfment.count();
if ((i > 0) && ("草稿".equals(status))) {
setFieldFlag(as, 7L, false);
leadGrp.setFlag(7L, false);
rtInspcStops.setFlag(7L, false);
}
if ((i > 0) && (("已核准".equals(status)) || ("验收不合格".equals(status))))
setFieldFlag(as2, 7L, false);
}
catch (RemoteException localRemoteException) {
}
}
public void copyStops() throws RemoteException, MXException {
MboSetRemote routesSet = getMboSet("routes");
if (routesSet.isEmpty()) {
return;
}
MboRemote route = routesSet.getMbo(0);
MboSetRemote rtInspcStops = getMboSet("RTINSPCSTOPS");
rtInspcStops.deleteAll(2L);
MboSetRemote routeStops = route.getMboSet("ROUTE_STOP");
MboRemote routeStop = null;
MboRemote rtInspecStop = null;
for (int i = 0; (routeStop = routeStops.getMbo(i)) != null; i++) {
rtInspecStop = rtInspcStops.add();
rtInspecStop.setValue("location", routeStop.getString("location"));
}
}
public void delete(long access) throws MXException, RemoteException
{
getMboSet("LEADGROUP").deleteAll(access);
getMboSet("RTINSPCSTOPS").deleteAll(access);
super.delete(access);
}
public MboRemote duplicate() throws MXException, RemoteException {
if (!isHashSetLoaded)
loadSkipFieldCopyHashSet();
MboRemote newTestRemote = copy();
return newTestRemote;
}
protected boolean skipCopyField(MboValueInfo mvi) throws MXException, RemoteException {
return skipFieldCopy.contains(mvi.getName());
}
private static void loadSkipFieldCopyHashSet() throws MXException, RemoteException {
isHashSetLoaded = true;
skipFieldCopy.add("ORGID");
skipFieldCopy.add("SITEID");
skipFieldCopy.add("CREATEDBY");
skipFieldCopy.add("CREATEDATE");
skipFieldCopy.add("STATUS");
skipFieldCopy.add("STATUSDATE");
skipFieldCopy.add("HISTORYFLAG");
skipFieldCopy.add("RTINSPCNUM");
skipFieldCopy.add("MEMO");
}
public void initRelationship(String relationName, MboSetRemote mboSet) throws RemoteException, MXException
{
if (getInt("HISTORYFLAG") == 1)
setFlag(7L, true);
}
}
\ No newline at end of file
package clp.app.rtinspection;
import java.rmi.RemoteException;
import psdi.common.action.ActionCustomClass;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
public class UpdateComprate
implements ActionCustomClass
{
public void applyCustomAction(MboRemote rtInspc, Object[] aobj)
throws MXException, RemoteException
{
MboSetRemote stopsSet = rtInspc.getMboSet("RTINSPCSTOPS");
if (!stopsSet.isEmpty()) {
int compRate = Math.round(rtInspc.getMboSet("RTINSPCSTOPS2").count() / stopsSet.count() * 100.0F);
rtInspc.setValue("compRate", compRate, 2L);
rtInspc.setValue("compRateStr2", rtInspc.getMboSet("RTINSPCSTOPS2").count() + "/" + stopsSet.count(), 2L);
}
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ public class CustSafetyadviceAppBean extends AppBean{
newWoMbo.setValue("DESCRIPTION", mbo.getString("DESCRIPTION"),11L);
newWoMbo.setValue("CUSTDEPT", mbo.getString("DEPARTMENT"),11L); //部门
newWoMbo.setValue("CUSTFZR", mbo.getString("PERSONLIABLE"),11L);//责任人
newWoMbo.setValue("WORKTYPE","HSE",11L);//工单类型
newWoMbo.setValue("WORKTYPE","SHE",11L);//工单类型
mbo.setValue("WONUM", newWoMbo.getString("WONUM"));
WORKORDERMboSet.save();
WORKORDERMboSet.close();
......
......@@ -22,7 +22,7 @@ public class CustPjobehaviornoDataBean extends MultiselectDataBean{
RemoteException {
DataBean appBean = app.getAppBean();
MboRemote groupMbo = appBean.getMbo();
MboSetRemote ms = super.getMboSetRemote();;
MboSetRemote ms = super.getMboSetRemote();
System.out.println(" behaviortype=2 and TREATMENTMETHOD = 2 and (wonum is NULL or wonum ='') and pjoobservationid ='"+groupMbo.getLong("PJOOBSERVATIONID")+"'");
ms.setWhere(" behaviortype=2 and TREATMENTMETHOD = 2 and (wonum is NULL or wonum ='') and pjoobservationid ='"+groupMbo.getLong("PJOOBSERVATIONID")+"'");
return ms;
......@@ -37,8 +37,13 @@ public class CustPjobehaviornoDataBean extends MultiselectDataBean{
MboRemote tempMbo=mboSet.getMbo(i);
if (tempMbo.isSelected() && tempMbo.getString("WONUM").equalsIgnoreCase("")) {
MboRemote wo=woSet.add(11L);
wo.setValue("BEHAVIORCATEGORY", tempMbo.getString("BEHAVIORCATEGORY"),11L);
wo.setValue("BEHAVIORCATEGORYLINID", tempMbo.getString("BEHAVIORCATEGORYLINID"),11L);
wo.setValue("TREATMENTMETHOD", tempMbo.getString("TREATMENTMETHOD"),11L);
wo.setValue("PJOREGION", tempMbo.getString("PJOREGION"),11L);
wo.setValue("SOURCE", tempMbo.getString("SOURCE"),11L);
wo.setValue("DESCRIPTION", tempMbo.getString("ELABORATE"),11L);
wo.setValue("WORKTYPE", "HSE",11L);//
wo.setValue("WORKTYPE", "SHE",11L);
wo.setValue("CUSTFZR", tempMbo.getString("PROPOSER"),11L);
woSet.save(11L);
map.put(tempMbo.getLong("pjobehaviorid"),wo.getString("WONUM"));
......
package com.tohi.webclient.beans.po;
import java.rmi.RemoteException;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXApplicationYesNoCancelException;
import psdi.util.MXException;
import psdi.webclient.beans.po.POAppBean;
public class CustPoAppBean extends POAppBean{
/**
// * 确认弹窗,在appbean内调用,不能在mbo内调用
// * @author juong
// * @throws MXException
// * @throws RemoteException
// * @return 当用户选择"是"时返回true;当用户选择"否"时返回false,
// */
public boolean confirm () throws RemoteException, MXException{
int userInput = MXApplicationYesNoCancelException.getUserInput("id",MXServer.getMXServer(), this.getMbo().getUserInfo());
System.out.println(userInput);
switch (userInput) {
case MXApplicationYesNoCancelException.NULL:{
Object params[] = {"确认要执行此操作吗?"};
throw new MXApplicationYesNoCancelException("id", "po", "showtotalcost", params);
}
case 2:{
break;
}
}
return false;
}
@Override
public int SAVE() throws MXException, RemoteException {
System.out.println("保存");
if (!this.getMbo().getMboSet("POline").isEmpty()) {
double d=this.getMbo().getDouble("PRLINE.PR.TOTALCOST");
double d1=this.getMbo().getDouble("TOTALCOST");
if (d==d1) { confirm (); }
}
return super.SAVE();
}
}
package com.tohi.webclient.beans.po;
import psdi.webclient.beans.po.POAppBean;
public class CustpoAppBean extends POAppBean{
}
package com.tohi.webclient.beans.rtinspnrecor;
import java.rmi.RemoteException;
import java.util.Vector;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
import psdi.webclient.system.beans.AppBean;
public class RtinspnrecorAppBean extends AppBean {
/**
* 异常巡检处理
* @param mbo
* @throws MXException
* @throws RemoteException
*/
public int CREATESR() throws MXException, RemoteException {
System.out.println("进入");
if ( this.app.getResultsBean().getSelection().size() <=0) {
throw new MXApplicationException("异常巡检处理", "请选择至少一条或多条记录!!!");
}
Vector<MboRemote> ver= this.app.getResultsBean().getSelection();
for (MboRemote m:ver) {
if (m.getString("PROCESSRESULT").equals("已处理") || m.getString("PROCESSRESULT").equals("无需处理")) {
throw new MXApplicationException("异常巡检处理", "已处理和无需处理的请勿勾选!!!!");
}
}
System.out.println(ver.size()+"-------");
MboSetRemote mboSet=MXServer.getMXServer().getMboSet("SR", MXServer.getMXServer().getSystemUserInfo());
for (MboRemote m:ver) {
System.out.println(m.getString("TICKETID"));
MboRemote RECORDmbo=mboSet.add(11L);
RECORDmbo.setValue("DESCRIPTION", m.getString("METER.DESCRIPTION")+"---"+m.getString("POINTNUM"),11L);//旧班组
m.setValue("ticketid", RECORDmbo.getString("TICKETID"),11L);
m.setValue("PROCESSRESULT","已处理" ,11L);
mboSet.save();
}
mboSet.close();
this.app.getResultsBean().save();
return 1;
}
public int CHANGENAPPR() throws MXException, RemoteException {
System.out.println("进入");
if ( this.app.getResultsBean().getSelection().size() <=0) {
throw new MXApplicationException("异常巡检处理", "请选择至少一条或多条记录!!!");
}
Vector<MboRemote> ver= this.app.getResultsBean().getSelection();
for (MboRemote m:ver) {
if (m.getString("PROCESSRESULT").equals("已处理") || m.getString("PROCESSRESULT").equals("无需处理")) {
throw new MXApplicationException("异常巡检处理", "已处理和无需处理的请勿勾选!!!!");
}
}
System.out.println(ver.size()+"-------");
for (MboRemote m:ver) {
m.setValue("PROCESSRESULT","无需处理" ,11L);
}
this.app.getResultsBean().save();
return 1;
}
public int CHANGEAPPR() throws MXException, RemoteException {
System.out.println("进入");
if ( this.app.getResultsBean().getSelection().size() <=0) {
throw new MXApplicationException("异常巡检处理", "请选择至少一条或多条记录!!!");
}
Vector<MboRemote> ver= this.app.getResultsBean().getSelection();
for (MboRemote m:ver) {
if (m.getString("PROCESSRESULT").equals("已处理") || m.getString("PROCESSRESULT").equals("无需处理")) {
throw new MXApplicationException("异常巡检处理", "已处理和无需处理的请勿勾选!!!!");
}
}
System.out.println(ver.size()+"-------");
for (MboRemote m:ver) {
m.setValue("PROCESSRESULT","已处理" ,11L);
}
this.app.getResultsBean().save();
return 1;
}
}
This diff is collapsed.
......@@ -41,7 +41,6 @@ public class ImgLib extends Mbo
getMboValue("imglibid").generateUniqueID();
if ("WORKORDER".equalsIgnoreCase(ownerMbo.getName()) || "SAFETYADVICE".equalsIgnoreCase(ownerMbo.getName())) {
MboSetRemote msr1 = ownerMbo.getMboSet("IMGLIB1");
MboSetRemote msr2 = ownerMbo.getMboSet("IMGLIB2");
if (!msr1.isEmpty()) {
......
......@@ -147,14 +147,22 @@ public class RecordImage extends BoundComponentInstance {
}
if ("WORKORDER".equalsIgnoreCase(mbo.getName()) || "SAFETYADVICE".equalsIgnoreCase(mbo.getName())) {
String udimageCount = this.getProperty("udimagecount");
if ("1".equals(udimageCount)) {
mimetype = mbo.getString("IMGLIB1.MIMETYPE");
} else if ("2".equals(udimageCount)) {
mimetype = mbo.getString("IMGLIB2.MIMETYPE");
} else {
mimetype = mbo.getString("IMGLIB1.MIMETYPE");
}
// String udimageCount = this.getProperty("udimagecount");
// if ("1".equals(udimageCount)) {
// mimetype = mbo.getString("IMGLIB1.MIMETYPE");
// } else if ("2".equals(udimageCount)) {
// mimetype = mbo.getString("IMGLIB2.MIMETYPE");
// } else {
// mimetype = mbo.getString("IMGLIB1.MIMETYPE");
// }
String reName =this.getId();
if(reName.indexOf("-")>=0){
reName = reName.split("-")[0];
}
System.out.println("reName:"+reName);
mimetype = mbo.getString(reName+".MIMETYPE");
} else {
mimetype = imagedb.getMbo().getString("IMGLIB.MIMETYPE");
}
......@@ -179,14 +187,21 @@ public class RecordImage extends BoundComponentInstance {
if (!imagedb.getMbo().isNull("IMGLIB.IMAGE")) {
MboRemote mbo = imagedb.getMbo();
if ("WORKORDER".equalsIgnoreCase(mbo.getName()) || "SAFETYADVICE".equalsIgnoreCase(mbo.getName())) {
udimageCount = this.getProperty("udimagecount");
if ("1".equals(udimageCount)) {
image = mbo.getBytes("IMGLIB1.IMAGE");
} else if ("2".equals(udimageCount)) {
image = mbo.getBytes("IMGLIB2.IMAGE");
} else {
image = mbo.getBytes("IMGLIB1.IMAGE");
}
// udimageCount = this.getProperty("udimagecount");
// if ("1".equals(udimageCount)) {
// image = mbo.getBytes("IMGLIB1.IMAGE");
// } else if ("2".equals(udimageCount)) {
// image = mbo.getBytes("IMGLIB2.IMAGE");
// } else {
// image = mbo.getBytes("IMGLIB1.IMAGE");
// }
String reName =this.getId();
if(reName.indexOf("-")>=0){
reName = reName.split("-")[0];
}
System.out.println("reName:"+reName);
image = mbo.getBytes(reName+".IMAGE");
} else {
image = imagedb.getMbo().getBytes("IMGLIB.IMAGE");
}
......@@ -222,14 +237,21 @@ public class RecordImage extends BoundComponentInstance {
String udimageCount;
if (!e.isNull("IMGLIB.IMAGE")) {
if ("WORKORDER".equalsIgnoreCase(e.getName()) || "SAFETYADVICE".equalsIgnoreCase(e.getName())) {
udimageCount = this.getProperty("udimagecount");
if ("1".equals(udimageCount)) {
image = e.getBytes("IMGLIB1.IMAGE");
} else if ("2".equals(udimageCount)) {
image = e.getBytes("IMGLIB2.IMAGE");
} else {
image = e.getBytes("IMGLIB1.IMAGE");
}
// udimageCount = this.getProperty("udimagecount");
// if ("1".equals(udimageCount)) {
// image = e.getBytes("IMGLIB1.IMAGE");
// } else if ("2".equals(udimageCount)) {
// image = e.getBytes("IMGLIB2.IMAGE");
// } else {
// image = e.getBytes("IMGLIB1.IMAGE");
// }
String reName =this.getId();
if(reName.indexOf("-")>=0){
reName = reName.split("-")[0];
}
System.out.println("reName:"+reName);
image = e.getBytes(reName+".IMAGE");
} else {
image = e.getBytes("IMGLIB.IMAGE");
}
......@@ -259,7 +281,7 @@ public class RecordImage extends BoundComponentInstance {
AppInstance app = clientSession.getCurrentApp();
DataBean imagedb = app.getDataBean(dataSrc);
MboRemote mbo = imagedb.getMbo();
if ("WORKORDER".equalsIgnoreCase(mbo.getName())) {
if ("WORKORDER".equalsIgnoreCase(mbo.getName()) || "SAFETYADVICE".equalsIgnoreCase(mbo.getName())) {
if (!"".equals(this.cachedImageSrc)) {
app.openURL(clientSession.getMaximoRequestContextURL() + this.cachedImageSrc + "?" + clientSession.getUISessionUrlParameter(), true);
}
......
package tohi.app.crontask;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import psdi.server.MXServer;
import psdi.server.SimpleCronTask;
public class RunSumIssueCount extends SimpleCronTask {
@Override
public void cronAction() {
Calendar nowDate=Calendar.getInstance();
Calendar oldDate=Calendar.getInstance(); //前一年
Calendar old1Date=Calendar.getInstance();//前两年
Calendar old2Date=Calendar.getInstance();//前三年
oldDate.add(Calendar.YEAR, -1);
old1Date.add(Calendar.YEAR, -2);
old2Date.add(Calendar.YEAR, -3);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s=sdf.format(nowDate.getTime());
String s1=sdf.format(oldDate.getTime());
String s2= sdf.format(old1Date.getTime());
String s3= sdf.format(old2Date.getTime());
Connection con = null;// 创建一个数据库连接
PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Statement
ResultSet result = null;// 创建一个结果集对象
PreparedStatement pre1 = null;
try {
con = MXServer.getMXServer().getDBManager().getSequenceConnection();
System.out.println("连接成功!");
String sql=" select itemnum,sum(quantity) count,1 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s1+"' group by itemnum UNION " +
" select itemnum,sum(quantity) count,2 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s2+"' group by itemnum UNION " +
" select itemnum,sum(quantity) count,3 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s3+"' group by itemnum ";
pre = con.prepareStatement(sql);// 实例化预编译语句
result=pre.executeQuery();// 执行查询,注意括号中不需要再加参数
while (result.next()) {
String itemnum= result.getString("itemnum");
Double count= result.getDouble("count");
Integer num= result.getInt("num");
String sql1="";
if (num==1) { //前一年
sql1="update matusetrans set ISSUE1YRAGO = "+count+" where itemnum='"+itemnum+"'";
}
if (num==2) {//前两年
sql1="update matusetrans set ISSUE2YRAGO = "+count+" where itemnum='"+itemnum+"'";
}
if (num==3) {//前三年
sql1="update matusetrans set ISSUE3YRAGO = "+count+" where itemnum='"+itemnum+"'";
}
pre1=con.prepareStatement(sql1);
pre1.execute();
}
System.out.println("库存近一二三年记录更新完成-----");
} catch (RemoteException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws ClassNotFoundException {
//获取执行sql语句的statement对象
Calendar nowDate=Calendar.getInstance();
Calendar oldDate=Calendar.getInstance(); //前一年
Calendar old1Date=Calendar.getInstance();//前两年
Calendar old2Date=Calendar.getInstance();//前三年
System.out.println(nowDate.getTime());
oldDate.add(Calendar.YEAR, -1);
old1Date.add(Calendar.YEAR, -2);
old2Date.add(Calendar.YEAR, -3);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s=sdf.format(nowDate.getTime());
String s1=sdf.format(oldDate.getTime());
String s2= sdf.format(old1Date.getTime());
String s3= sdf.format(old2Date.getTime());
Connection con = null;// 创建一个数据库连接
PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Statement
ResultSet result = null;// 创建一个结果集对象
PreparedStatement pre1 = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//获取与数据库连接的对象-Connetcion
con = DriverManager.getConnection("jdbc:sqlserver://;serverName=172.17.6.230;databaseName=maxdb;portNumber=1433;integratedSecurity=false;sendStringParametersAsUnicode=false;selectMethod=cursor;", "maximo", "maximo");
// con = MXServer.getMXServer().getDBManager().getSequenceConnection();
System.out.println("连接成功!");
String sql=" select itemnum,sum(quantity) count,1 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s1+"' group by itemnum UNION " +
" select itemnum,sum(quantity) count,2 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s2+"' group by itemnum UNION " +
" select itemnum,sum(quantity) count,3 num from matusetrans m " +
" where transdate < '"+s+"' and transdate >='"+s3+"' group by itemnum ";
pre = con.prepareStatement(sql);// 实例化预编译语句
result=pre.executeQuery();// 执行查询,注意括号中不需要再加参数
while (result.next()) {
String itemnum= result.getString("itemnum");
Double count= result.getDouble("count");
Integer num= result.getInt("num");
String sql1="";
if (num==1) { //前一年
sql1="update INVENTORY set ISSUE1YRAGO = "+-count+" where itemnum='"+itemnum+"'";
}
if (num==2) {//前两年
sql1="update INVENTORY set ISSUE2YRAGO = "+-count+" where itemnum='"+itemnum+"'";
}
if (num==3) {//前三年
sql1="update INVENTORY set ISSUE3YRAGO = "+-count+" where itemnum='"+itemnum+"'";
}
pre1=con.prepareStatement(sql1);
pre1.execute();
}
System.out.println("更新完成-----");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package tohi.app.crontask;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Date;
import org.springframework.util.StringUtils;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.server.SimpleCronTask;
import psdi.util.StringUtility;
/**
* 同步巡检异常结果
*
*/
public class SynTime_XJYCJG extends SimpleCronTask {
@Override
public void cronAction() {
Connection con = null;// 创建一个数据库连接
PreparedStatement pre = null;// 创建预编译语句对象,一般都是用这个而不用Statement
ResultSet result = null;// 创建一个结果集对象
PreparedStatement pre1 = null;
try {
con = MXServer.getMXServer().getDBManager().getSequenceConnection();// 获取连接
System.out.println("连接成功!");
String sql = " select MEASUREPOINT.metername, "
+ " METER.METERTYPE, " + " MEASUREPOINT.NORMALVALUE, "
+ " MEASUREPOINT.UPPERWARNING , "
+ " MEASUREPOINT.LOWERWARNING, "
+ " MEASUREMENT.observation , "
+ " MEASUREMENT.measurementid , "
+ " MEASUREMENT.ifsynchronous , "
+ " MEASUREMENT.location , "
+ " MEASUREMENT.measurementvalue , "
+ " MEASUREMENT.pointnum , "
+ " MEASUREMENT.inspector , "
+ " MEASUREMENT.measuredate , MEASUREMENT.rtinspcnum , "
+ " MEASUREMENT.siteid , MEASUREMENT.orgid " + " from "
+ " MEASUREPOINT,METER,MEASUREMENT "
+ " where MEASUREPOINT.metername= METER.metername "
+ " and MEASUREMENT.metername= METER.metername "
+ " and IFSYNCHRONOUS=0 ";
pre = con.prepareStatement(sql);// 实例化预编译语句
result = pre.executeQuery();// 执行查询,注意括号中不需要再加参数
while (result.next()) {
String metername = result.getString("metername");
String metertype = result.getString("metertype");
String normalvalue = result.getString("NORMALVALUE");
String maxvalue = result.getString("UPPERWARNING");
String minvalue = result.getString("LOWERWARNING");
String observation = result.getString("observation");
Long measurementid = result.getLong("measurementid");
// 需要新增变量
String location = result.getString("location");
Double measurementvalue = result.getDouble("measurementvalue");
String inspector = result.getString("inspector");
Date measuredate = result.getDate("measuredate");
String rtinspcnum = result.getString("rtinspcnum");
String siteid = result.getString("siteid");
String orgid = result.getString("orgid");
boolean flag = false;
if (metertype.equalsIgnoreCase("CHARACTERISTIC")) { // 非数值类型
if (!StringUtility.isEmpty(normalvalue)) {
if (!normalvalue.equalsIgnoreCase(observation)) { // 如果是相同类型则正常
flag = true;
}
}
}
if (metertype.equalsIgnoreCase("GAUGE")) { // 数值类型
if (StringUtility.isEmpty(minvalue)
&& StringUtility.isEmpty(maxvalue)) {
continue;
}
if ( !StringUtility.isEmpty(minvalue)
&& !StringUtility.isEmpty(maxvalue)) {
if (measurementvalue < Double.parseDouble(minvalue)
|| measurementvalue > Double
.parseDouble(maxvalue)) { // 生成记录
flag = true;
}
} else if (!StringUtility.isEmpty(minvalue)
&& StringUtility.isEmpty(maxvalue)) {
if (measurementvalue < Double.parseDouble(minvalue)) { // 生成记录
flag = true;
}
} else if (StringUtility.isEmpty(minvalue)
&& !StringUtility.isEmpty(maxvalue)) {
if (measurementvalue > Double.parseDouble(maxvalue)) { // 生成记录
flag = true;
}
}
}
if (flag) {
MboSetRemote mboSet = MXServer.getMXServer().getMboSet(
"RTINSPNRECOR",
MXServer.getMXServer().getSystemUserInfo());
MboRemote mbo = mboSet.add();
mbo.setValue("observation", observation, 11L);
mbo.setValue("metername", metername, 11L);
mbo.setValue("location", location, 11L);
mbo.setValue("measurementvalue", measurementvalue, 11L);
mbo.setValue("inspector", inspector, 11L);
mbo.setValue("measuredate", measuredate, 11L);
mbo.setValue("rtinspcnum", rtinspcnum, 11L);
mbo.setValue("siteid", siteid, 11L);
mbo.setValue("orgid", orgid, 11L);
mbo.setValue("PROCESSRESULT", "待处理", 11L);
mboSet.save();
mboSet.close();
MboSetRemote mboSet1 = MXServer.getMXServer().getMboSet(
"MEASUREMENT",
MXServer.getMXServer().getSystemUserInfo());
mboSet1.setWhere(" MEASUREMENTID="+ measurementid + " ");
mboSet1.getMbo(0).setValue("IFSYNCHRONOUS", "1");
mboSet1.save();
System.out.println(measurementid + "完成同步,修改状态");
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 逐一将上面的几个对象关闭,因为不关闭的话会影响性能、并且占用资源
// 注意关闭的顺序,最后使用的最先关闭
if (result != null)
result.close();
if (pre != null)
pre.close();
if (pre1 != null)
pre1.close();
if (con != null)
con.close();
System.out.println("数据库连接已关闭!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
package tohi.app.measurement;
import java.rmi.RemoteException;
import psdi.mbo.ALNDomain;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValue;
import psdi.util.MXException;
public class FldObservation extends ALNDomain
{
public FldObservation(MboValue mbv)
throws MXException
{
super(mbv);
String thisAttr = getMboValue().getAttributeName();
MboRemote mbo=this.mboValue.getMbo();
String DOMAINID="";
try {
DOMAINID= mbo.getString("METER.DOMAINID");
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
setRelationship("ALNDOMAIN", "domainid = '"+DOMAINID+"' and value = :" + thisAttr);
setErrorMessage("meter", "invalidForMeterDomain");
}
public MboSetRemote getList()
throws MXException, RemoteException
{
MboRemote mbo=this.mboValue.getMbo();
String DOMAINID="";
try {
DOMAINID= mbo.getString("METER.DOMAINID");
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
setListCriteria("(domainid = '"+DOMAINID+"')");
return super.getList();
}
}
\ No newline at end of file
......@@ -26,4 +26,5 @@ public class FloodpreventionMbo extends Mbo implements MboRemote{
e.printStackTrace();
}
}
}
package tohi.app.rlmainthing;
import java.rmi.RemoteException;
import psdi.mbo.MboRemote;
import psdi.mbo.MboValue;
import psdi.mbo.MboValueAdapter;
import psdi.util.MXException;
public class FldrlmainthingType extends MboValueAdapter{
public FldrlmainthingType() {
super();
}
public FldrlmainthingType(MboValue mbv) {
super(mbv);
}
@Override
public void initValue() throws MXException, RemoteException {
super.initValue();
MboRemote mbo=this.mboValue.getMbo();
if (this.mboValue.getString().equalsIgnoreCase("INSPECTION")) {
mbo.setFieldFlag("CONTENT1",this.HIDDEN, false);
System.out.println("in----1");
}else{
mbo.setFieldFlag("CONTENT1",this.HIDDEN, true);
System.out.println("in----2");}
}
@Override
public void action() throws MXException, RemoteException {
super.action();
MboRemote mbo=this.mboValue.getMbo();
if (this.mboValue.getString().equalsIgnoreCase("INSPECTION")) {
mbo.setFieldFlag("CONTENT1",this.HIDDEN, false);
System.out.println("in----1");
}else{
mbo.setFieldFlag("CONTENT1",this.HIDDEN, true);
System.out.println("in----2");}
}
}
......@@ -30,7 +30,7 @@ public class RlshiftsMbo extends Mbo implements MboRemote{
protected void save() throws MXException, RemoteException {
super.save();
if (toBeAdded()) {
String num=genKeyNum();
String num=genKeyNum();//202208
MboSetRemote mboSet=MXServer.getMXServer().getMboSet("RLSHIFTS",MXServer.getMXServer().getSystemUserInfo());
mboSet.setWhere("SHIFTNUM = '"+num+"'");
if (mboSet.count()!=0) {
......@@ -40,7 +40,7 @@ public class RlshiftsMbo extends Mbo implements MboRemote{
}
}
public String genKeyNum() throws RemoteException, MXException{
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMdd"); //202208
String num="";
if ( getString("MARKSIGN").equalsIgnoreCase("N")) { //如果是夜班
Date date=new Date();
......
package tohi.app.rtinspnrecor;
import java.rmi.RemoteException;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.mbo.MboValue;
import psdi.mbo.MboValueAdapter;
import psdi.util.MXException;
public class FldPerformance extends MboValueAdapter{
public FldPerformance() {
super();
}
public FldPerformance(MboValue mbv) {
super(mbv);
}
@Override
public void action() throws MXException, RemoteException {
super.action();
MboRemote mbo= this.mboValue.getMbo();
MboSetRemote mboSet=mbo.getThisMboSet();
boolean flag=false;
for (int i = 0; i < mboSet.count(); i++) {
MboRemote m=mboSet.getMbo(i);
if (m.getString("PERFORMANCE").equalsIgnoreCase("NO") && m.getString("CRUXMEASURES").equalsIgnoreCase("Y") ) {
flag=true;
break;
}
}
if (flag) {
System.out.println("");
mbo.getOwner().setValue("ISSIF", "1",11L);
}else{
System.out.println("");
mbo.getOwner().setValue("ISSIF", "0",11L);
}
}
}
package tohi.app.workflow;
/**
* 判断相关工单记录是否关闭
*/
import java.rmi.RemoteException;
import psdi.common.action.ActionCustomClass;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
public class CustIsCloseWorkAction implements ActionCustomClass {
public CustIsCloseWorkAction() {
super();
}
@Override
public void applyCustomAction(MboRemote mbo, Object[] arg1)
throws MXException, RemoteException {
MboSetRemote mboSet=mbo.getMboSet("EXISTSWORKINFO");
if (!mboSet.isEmpty()) {
throw new MXApplicationException("许可证", "产生相关的日常行为观察或巡查记录未全部关闭!!!!");
}
}
}
package tohi.app.workflow;
import java.rmi.RemoteException;
import psdi.common.action.ActionCustomClass;
......@@ -22,131 +24,167 @@ public class CustWorkSheetAction implements ActionCustomClass {
mbo.getUserInfo());
if (mbo.getString("PJOTYPE").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR" , 11L);// 观察地点
genTypeInfo("PJOTYPE", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE1").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE1", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE1", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE1", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE2").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE2", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE2", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE2", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE3").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE3", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE3", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE3", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE4").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE4", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE4", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE4", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE5").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE5", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE5", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE5", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE6").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE6", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE6", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE6", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE7").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE7", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE7", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE7", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE8").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE8", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE8", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE8", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE9").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE9", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE9", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE9", pjombo);
PJOOBSERVATIONSet.save();
}
if (mbo.getString("PJOTYPE10").equalsIgnoreCase("Y")) {
MboRemote pjombo = PJOOBSERVATIONSet.add(11L);
pjombo.setValue("PJOTYPE", "PJOTYPE10", 11L);
pjombo.setValue("PJOTYPE", "PJOTYPE10", 2L);
pjombo.setValue("WSNUM", mbo.getString("WSNUM"), 11L);
pjombo.setValue("JOBCONTENT", mbo.getString("WORKDESC"), 11L);// 工作内容
pjombo.setValue("WORKTASK", mbo.getString("EVACUATEDBY"), 11L);// 工作负责人
pjombo.setValue("PJOPLACE", mbo.getString("WORKPLACE"), 11L);// 观察地点
pjombo.setValue("STATUS", "WAPPR", 11L);// 观察地点
genTypeInfo("PJOTYPE10", pjombo);
PJOOBSERVATIONSet.save();
}
PJOOBSERVATIONSet.close();
}
}
public void genTypeInfo(String pjoType,MboRemote mbo) throws RemoteException, MXException{
MboSetRemote PJOOBSERVATIONLINSet=mbo.getMboSet("PJOOBSERVATIONLIN");
PJOOBSERVATIONLINSet.deleteAll(11L);
MboSetRemote pjoContentSet=MXServer.getMXServer().getMboSet("PJOCONTENT",mbo.getUserInfo());
pjoContentSet.setWhere("pjotype = '"+pjoType+"'");
for (int i = 0; i < pjoContentSet.count(); i++) {
MboRemote contentMbo=pjoContentSet.getMbo(i);
MboRemote PJOOBSERVATIONLIN=PJOOBSERVATIONLINSet.add(11L);
PJOOBSERVATIONLIN.setValue("PJOOBSERVATIONID", mbo.getLong("PJOOBSERVATIONID"),11L);//设定关系
PJOOBSERVATIONLIN.setValue("pjocontent", contentMbo.getString("pjocontent"),11L);//设定关系
PJOOBSERVATIONLIN.setValue("PJOTYPE", contentMbo.getString("PJOTYPE"),11L);//设定关系
PJOOBSERVATIONLIN.setValue("PJONUM", contentMbo.getString("PJONUM"),11L);//设定关系
pjoContentSet.save();
}
pjoContentSet.close();
System.out.println("保存完毕--");
}
}
package tohi.app.worksheet;
import java.rmi.RemoteException;
import psdi.mbo.MboRemote;
import psdi.mbo.MboValue;
import psdi.mbo.MboValueAdapter;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
public class FldworksheetPjotype extends MboValueAdapter{
public FldworksheetPjotype() {
super();
}
public FldworksheetPjotype(MboValue mbv) {
super(mbv);
}
@Override
public void init() throws MXException, RemoteException {
// TODO Auto-generated method stub
super.init();
MboRemote mbo=this.getMboValue().getMbo();
System.out.println(this.getMboValue().getString());
if (this.getMboValue().getAttributeName().equalsIgnoreCase("PJOTYPE11") ) {
if ( this.getMboValue().getString().equalsIgnoreCase("Y")) {
System.out.println("1111111");
for (int i = 0; i < 11; i++) {
if (i==0) {
mbo.setFieldFlag("PJOTYPE", 7L,true);
}else{
mbo.setFieldFlag("PJOTYPE"+i, 7L,true);
}
}
}
if ( this.getMboValue().getString().equalsIgnoreCase("N")) {
System.out.println("2222222");
for (int i = 0; i < 11; i++) {
if (i==0) {
mbo.setFieldFlag("PJOTYPE", 7L,false);
}else{
mbo.setFieldFlag("PJOTYPE"+i, 7L,false);
}
}
}
}else {
boolean flag=false;
for (int i = 0; i < 11; i++) {
if (i==0) {
if (mbo.getString("PJOTYPE").equalsIgnoreCase("Y")) {
flag=true;
break;
}
}else{
if (mbo.getString("PJOTYPE"+i).equalsIgnoreCase("Y")) {
flag=true;
break;
}
}
}
if (flag) {
mbo.setFieldFlag("PJOTYPE11", 7L,true);
}else{
mbo.setFieldFlag("PJOTYPE11", 7L,false);
}
}
}
@Override
public void action() throws MXException, RemoteException {
super.action();
String name=this.getMboValue().getAttributeName();
MboRemote mbo=this.getMboValue().getMbo();
if (!name.equalsIgnoreCase("PJOTYPE11") ) {
if (mbo.getString("PJOTYPE11").equalsIgnoreCase("Y")) {
throw new MXApplicationException("异常巡检处理", "不适用请勿勾选!!!");
}
}else{
boolean flag=false;
for (int i = 0; i < 11; i++) {
if (i==0) {
if (mbo.getString("PJOTYPE").equalsIgnoreCase("Y")) {
flag=true;
break;
}
}else{
if (mbo.getString("PJOTYPE"+i).equalsIgnoreCase("Y")) {
flag=true;
break;
}
}
}
if (flag) {
throw new MXApplicationException("异常巡检处理", "已勾选其他项,请勿勾选不适用!!!");
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment