实现MAXIMO7.5工作流任务箱任务颜色提示功能

Posted 10月 25th, 2011 by
Categories: maximo

XP 用代码来强制关机 或重启

Posted 02月 14th, 2011 by
Categories: 未分类

unction MyExitWindows(RebootParam: Longword): Boolean;
var
TTokenHd: THandle;
TTokenPvg: TTokenPrivileges;
cbtpPrevious: DWORD;
rTTokenPvg: TTokenPrivileges;
pcbtpPreviousRequired: DWORD;
tpResult: Boolean;
const
SE_SHUTDOWN_NAME = ’SeShutdownPrivilege’;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
tpResult := OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,
TTokenHd);
if tpResult then
begin
tpResult := LookupPrivilegeValue(nil,
SE_SHUTDOWN_NAME,
TTokenPvg.Privileges[0].Luid);
TTokenPvg.PrivilegeCount := 1;
TTokenPvg.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
cbtpPrevious := SizeOf(rTTokenPvg);
pcbtpPreviousRequired := 0;
if tpResult then
Windows.AdjustTokenPrivileges(TTokenHd,
False,
TTokenPvg,
cbtpPrevious,
rTTokenPvg,
pcbtpPreviousRequired);
end;
end;
Result := ExitWindowsEx(RebootParam, 0);
end;
关机
MyExitWindows(EWX_POWEROFF or EWX_FORCE);
重启
MyExitWindows(EWX_REBOOT or EWX_FORCE);

maximo 弹出确认对话框

Posted 05月 20th, 2010 by
Categories: maximo, 未分类

在客户开发过程中,有些客户经常提出,要在操作的时候,给他们一个一弹出式对话框来确认。

解决方法:

1.后台登录数据库中,为”MAXMESSAGES”添加一笔记录

Insert into  MAXMESSAGES

(MSGKEY, MSGGROUP, VALUE, TITLE, DISPLAYMETHOD, OPTIONS, MAXMESSAGESID, ROWSTAMP)

Values

(‘endcontinue’, ‘jspmessages’, ‘日志是否交班?‘, ‘日志管理系统‘, ‘MSGBOX’, 24, 1, ‘62099904′);

Insert into  MAXMESSAGES

(MSGKEY, MSGGROUP, VALUE, TITLE, DISPLAYMETHOD, OPTIONS, MAXMESSAGESID, ROWSTAMP)

Values

(‘endcontinue’, ‘jspmessages’, ‘日志是否交班?‘, ‘日志管理系统‘, ‘MSGBOX’, 24, 1, ‘62099904′);

说明:msgkey是你的消息标识

MSGGROUP是消息分组

系统通过 msgkey和msggroup来找到你定义 的消息

value:提示内容

title:提示标题(我在maximo 6.2.1设置,无作用)

DISPLAYMETHOD:(TEXT,STATUS,MSGBOX)

OPTIONS, 24:显示(是,否两个按钮)26:显示(确认,取消,否三个按钮)

其它无特别意义

在BEAN类中实现如下代码:

private boolean EndLogYesNoCheck() throws MXException {

WebClientEvent event = sessionContext.getCurrentEvent();

int msgRet = event.getMessageReturn();

if (msgRet < 0) {

throw new MXApplicationException(“jspmessages”, “endcontinue”);

} else if (msgRet == 8) {

return true;        } else if (msgRet == 16) {

reset();

resetRemote = true;

return false;

} else {

return false;

}

}

在需要显示对话框的事件中写如下:

if (EndLogYesNoCheck()) {

logRemote.EndLog();

this.save();

//对页面进行刷新

sessionContext.queueRefreshEvent();

}

return 1;

maximo 自动出入库

Posted 05月 13th, 2010 by
Categories: maximo

在实施MAXIMO中,有的公司因为某些原因,不想用标准《发放和转移》功能进行物资的出库操作,想在领料单中,自动通过流程确认后,就自动出库,发放数据与领用数据相符。

同样,在入库时,也不想通过标准《接收》模块进行物资的入库操作。

经过研究,可以对相关类进行客户化,即可达到这种效果

代码如下:

对WORLORDER客户化,使其有自动出库功能
private void AutoUse() throws MXException,RemoteException
{

MboSetRemote locationset=getMboSet(“$LOCATIONS”,”LOCATIONS”,”type=’STOREROOM’”);
MboRemote location=locationset.getMbo(0);
if (location!=null)
{
MboSetRemote matusetrans=location.getMboSet(“MATUSETRANSISSUE”);
MboSetRemote wpset=getMboSet(“WPMATERIAL”);
if (!wpset.isEmpty())
{
for (int i=0;i<wpset.count();i++)
{
MboRemote wpmbo=wpset.getMbo(i);
if (wpmbo!=null)
{
MboRemote matuseMbo=matusetrans.add();
matuseMbo.setValue(“ITEMNUM”, wpmbo.getString(“ITEMNUM”));
matuseMbo.setValue(“POSITIVEQUANTITY”, wpmbo.getDouble(“ITEMQTY”));
matuseMbo.setValue(“GLDEBITACCT”, “1000-4102-3501″);

}
}
}
}
}

//对PO客户化,使其有自动入库功能

private void matrec() throws MXException, RemoteException
{
String ownerSysId = getString(“ownersysid”);

MboSetRemote polineSet=this.getMboSet(“POLINE”);
for (int i=0; i<polineSet.count();i++)
{
MboRemote poline=polineSet.getMbo(i);//每行数据
if (poline!=null)
{
long linenum=poline.getLong(“polinenum”);//行号

double quantity=poline.getDouble(“orderqty”);//数量
//针对行,创建一个接收
MboRemote receipt = createReceipt(null, linenum, ownerSysId);
//接收数据赋值
receipt.setValue(“tobin”, “”, 2L);
receipt.setValue(“quantity”, quantity, 2L);

}
}

}

MAXIMO 序列维护

Posted 04月 1st, 2010 by
Categories: maximo

经常在导入导出MAXIMO的时候,遇到序列值不匹配的情况,每次都客户应用或测试的时候发现这个问题,搞得巨没面子,为此,写了如下脚本,解决此问题
declare
– Local variables here
i integer;
– Local variables here
cursor seq_cursor is(
select * from maxsequence   );
seq_cursor_row seq_cursor%rowtype;
imaxseq        number(10);
icurvalseq     number(10);
strsql         varchar2(200);
ic             number;
isExist        number(10);
begin
– Test statements here
open seq_cursor;
loop
fetch seq_cursor
into seq_cursor_row;
EXIT WHEN seq_cursor%NOTFOUND;
imaxseq := 0;
strSQL  := ’select count(*) from all_objects where object_name=:1 and object_type=”TABLE”’;
execute IMMEDIATE strSQL
into isExist
using seq_cursor_row.tbname;
dbms_output.put_line(isExist);
if (isExist = 1) then
strsql := ’select max(‘ || seq_cursor_row.name || ‘)  from ‘ ||
seq_cursor_row.tbname;
EXECUTE IMMEDIATE strsql
into imaxseq;

strsql := ’select ‘ || seq_cursor_row.sequencename ||
‘.nextval from dual’;

EXECUTE IMMEDIATE strsql
into icurvalseq;

ic := imaxseq – icurvalseq;
if ic <> -1 then
strSQL := ‘alter sequence ‘ || seq_cursor_row.sequencename ||
‘ increment by ‘ || ic || ‘ nocache’;
EXECUTE IMMEDIATE strsql;
strSQL := ’select ‘ || seq_cursor_row.sequencename ||
‘.nextval from dual’;
EXECUTE IMMEDIATE strsql
into ic;
strSQL := ‘alter sequence ‘ || seq_cursor_row.sequencename ||
‘ increment by 1 cache 20′;

EXECUTE IMMEDIATE strsql;
end if;
end if;

end loop;
close seq_cursor;
end;

清空任务表无效数据

Posted 04月 1st, 2010 by
Categories: maximo, 未分类

在maximo运行过程中,工作流任务数据越来越多,导致每次进入系统都比较慢,为了解决这个问题,特意做如下过程,清空无用数据!

create or replace procedure clearwstask is

tbname varchar2(100);

strSQL varchar2(1000);

recordcount number(10);

ideletecount number(10);

begin

select count(*) into recordcount from wfassignment where assignstatus=’INACTIVE’;

–备份表数据

tbname:=to_char(sysdate,’yymmdd’);

strsql:=’create table wfassignment_’||tbname||’ as select * from wfassignment where assignstatus=”INACTIVE”’;

EXECUTE IMMEDIATE strsql;

–删除数据

loop

if recordcount<2000 then

ideletecount:=recordcount;

recordcount:=0;

else

recordcount:=recordcount-2000;

ideletecount:=2000;

end if;

strSQL:=’begin delete from wfassignment where assignstatus=”INACTIVE” and rownum<’||ideletecount;

strSQL:=strSQL||’;commit; end;’;

EXECUTE IMMEDIATE strSQL;

exit when recordcount=0;

end loop;

–得建索引

strSQL:=’alter index WFASSIGN_NDX1 rebuild’;

EXECUTE IMMEDIATE strSQL;

strSQL:=’alter index WFASSIGN_NDX2 rebuild’;

EXECUTE IMMEDIATE strSQL;

strSQL:=’alter index WFASSIGN_NDX3 rebuild’;

EXECUTE IMMEDIATE strSQL;

strSQL:=’alter index WFASSIGN_NDX4 rebuild’;

EXECUTE IMMEDIATE strSQL;

end clearwstask;

解决ora-01110和ORA-01157 错误

Posted 10月 28th, 2009 by
Categories: oracle

某一天,学习过程中,发现oracle的undo表空间文件比较大,所以就学着去减小undo表空间文件大小,
第二天启动的时候,发现数据库不能启动了

 
sqlplus "/as sysdba"

SQL> shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size            1218992 bytes
Variable Size           96470608 bytes
Database Buffers      184549376 bytes
Redo Buffers            2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 – see DBWR trace file
ORA-01110: data file 2: ‘/opt/oracle/oradata/myora/undotbs01.dbf’;
发现错误,
查阅资料后
SQL> ALTER SYSTEM SET "_allow_resetlogs_corruption"=TRUE SCOPE=SPFILE;

System altered.

SQL> shoutdown immediate
;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size            1218992 bytes
Variable Size           96470608 bytes
Database Buffers      184549376 bytes
Redo Buffers            2973696 bytes
Database mounted.

SQL> alter database datafile ‘/opt/oracle/oradata/myora/undotbs01.dbf’ offline drop;

Database altered.
SQL> shoutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size            1218992 bytes
Variable Size           96470608 bytes
Database Buffers      184549376 bytes
Redo Buffers            2973696 bytes
Database mounted.
Database opened.

解决问题!

解决报表故障 afc\rptroot.bas

Posted 08月 24th, 2009 by
Categories: maximo

 Status No: 1 :
 基本错误: 118
 模块: afc\rptroot.bas
 行: 511
 
 未能创建文件 /rpt/CSTM_WSD2/reports/roi/.1.40049.6251967593_31.roi。

maximo的报表重装后,某些用户不能打印报表,为此,管理员登录系统后,选中rpt文件夹,将属性分配给相关用户即可!

connection to “:0.0″ refused by server 错误

Posted 05月 7th, 2009 by
Categories: Linux学习, oracle

今天在安装oracle11g的时候,系统报Xlib:connection to ":0.0" refused by server错误,

查资料后
xhost local:oracle non-network local connections being added to access control list
  解决!

解决ORA-01033: ORACLE initialization or shutdown in progress错误

Posted 05月 7th, 2009 by
Categories: oracle

由于我的机器上安装了N个oracle实例,一天,清理磁盘空间,不小心删除了一个数据库文件,当启动oracle中的个实例后,登录oracle数据库,系统报ORA-01033: ORACLE initialization or shutdown in progress这个错误

解决方案
 cmd
  sqlplus/nolog
  sql> connect system/asdjkl@oracle as sysdba
  sql>  alter database datafile ‘数据空间表文件’ offline drop;
 因为我oracle是采用NOARCHIVELOG模式,所以offiline 加drop,如果是ARCHIVELOG则不需drop

重启数据库,解决问题!