Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clpjb.maximo76.00
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟宏辉
clpjb.maximo76.00
Commits
c635af82
Commit
c635af82
authored
Jul 25, 2022
by
zhh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新水调接口
parent
c330128a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1168 additions
and
2 deletions
+1168
-2
src/Test.java
src/Test.java
+20
-1
src/com/tohi/webclient/beans/pjoobservation/CustPjobehaviornoDataBean.java
...lient/beans/pjoobservation/CustPjobehaviornoDataBean.java
+1
-1
src/com/tohi/webclient/beans/rlrelaymanage/CustrRlreDataBean.java
...tohi/webclient/beans/rlrelaymanage/CustrRlreDataBean.java
+2
-0
src/fcg/app/workorder/CustWO.java
src/fcg/app/workorder/CustWO.java
+477
-0
src/psdi/app/common/purchasing/FldPurLineType.java
src/psdi/app/common/purchasing/FldPurLineType.java
+462
-0
src/tohi/app/crontask/MD5Utils.java
src/tohi/app/crontask/MD5Utils.java
+62
-0
src/tohi/app/crontask/RunCronTask.java
src/tohi/app/crontask/RunCronTask.java
+144
-0
No files found.
src/Test.java
View file @
c635af82
...
@@ -14,6 +14,25 @@ public class Test {
...
@@ -14,6 +14,25 @@ public class Test {
// c.add(Calendar.DAY_OF_MONTH, 1); //输出一天后的日期
// c.add(Calendar.DAY_OF_MONTH, 1); //输出一天后的日期
// System.out.println(sdf.format(c.getTime()));;
// System.out.println(sdf.format(c.getTime()));;
//DAY_OF_WEEK
//DAY_OF_WEEK
System
.
out
.
println
(
c
.
get
(
Calendar
.
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);
}
}
}
}
src/com/tohi/webclient/beans/pjoobservation/CustPjobehaviornoDataBean.java
View file @
c635af82
...
@@ -38,7 +38,7 @@ public class CustPjobehaviornoDataBean extends MultiselectDataBean{
...
@@ -38,7 +38,7 @@ public class CustPjobehaviornoDataBean extends MultiselectDataBean{
if
(
tempMbo
.
isSelected
()
&&
tempMbo
.
getString
(
"WONUM"
).
equalsIgnoreCase
(
""
))
{
if
(
tempMbo
.
isSelected
()
&&
tempMbo
.
getString
(
"WONUM"
).
equalsIgnoreCase
(
""
))
{
MboRemote
wo
=
woSet
.
add
(
11L
);
MboRemote
wo
=
woSet
.
add
(
11L
);
wo
.
setValue
(
"DESCRIPTION"
,
tempMbo
.
getString
(
"ELABORATE"
),
11L
);
wo
.
setValue
(
"DESCRIPTION"
,
tempMbo
.
getString
(
"ELABORATE"
),
11L
);
wo
.
setValue
(
"WORKTYPE"
,
"
EHS
"
,
11L
);
//
wo
.
setValue
(
"WORKTYPE"
,
"
HSE
"
,
11L
);
//
wo
.
setValue
(
"CUSTFZR"
,
tempMbo
.
getString
(
"PROPOSER"
),
11L
);
wo
.
setValue
(
"CUSTFZR"
,
tempMbo
.
getString
(
"PROPOSER"
),
11L
);
woSet
.
save
(
11L
);
woSet
.
save
(
11L
);
map
.
put
(
tempMbo
.
getLong
(
"pjobehaviorid"
),
wo
.
getString
(
"WONUM"
));
map
.
put
(
tempMbo
.
getLong
(
"pjobehaviorid"
),
wo
.
getString
(
"WONUM"
));
...
...
src/com/tohi/webclient/beans/rlrelaymanage/CustrRlreDataBean.java
View file @
c635af82
...
@@ -78,6 +78,8 @@ public class CustrRlreDataBean extends MultiselectDataBean {
...
@@ -78,6 +78,8 @@ public class CustrRlreDataBean extends MultiselectDataBean {
tempMbo
.
getString
(
"DEVICENAME"
),
11L
);
tempMbo
.
getString
(
"DEVICENAME"
),
11L
);
RLRELAYMANAGEmbo
.
setValue
(
"BREMARK"
,
RLRELAYMANAGEmbo
.
setValue
(
"BREMARK"
,
groupMbo
.
getString
(
"BREMARK"
),
11L
);
groupMbo
.
getString
(
"BREMARK"
),
11L
);
RLRELAYMANAGEmbo
.
setValue
(
"TYPE"
,
groupMbo
.
getString
(
"PLAN"
),
11L
);
if
(
tempMbo
.
getString
(
"SIGNOUT"
).
equalsIgnoreCase
(
"Y"
))
{
// 退出
if
(
tempMbo
.
getString
(
"SIGNOUT"
).
equalsIgnoreCase
(
"Y"
))
{
// 退出
// proteplatelineMbo.setValue("SIGNOUT", 1,11L); //将压板表
// proteplatelineMbo.setValue("SIGNOUT", 1,11L); //将压板表
...
...
src/fcg/app/workorder/CustWO.java
0 → 100644
View file @
c635af82
package
fcg
.
app
.
workorder
;
import
java.io.PrintStream
;
import
java.rmi.RemoteException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
com.tohi.app.wo.CustWORemote
;
import
psdi.app.financial.FinancialServiceRemote
;
import
psdi.app.workorder.WO
;
import
psdi.mbo.MboRemote
;
import
psdi.mbo.MboSet
;
import
psdi.mbo.MboSetRemote
;
import
psdi.server.AppService
;
import
psdi.server.MXServer
;
import
psdi.util.MXApplicationException
;
import
psdi.util.MXException
;
import
psdi.util.MXSession
;
public
class
CustWO
extends
WO
implements
CustWORemote
{
private
static
final
long
serialVersionUID
=
1L
;
public
CustWO
(
MboSet
ms
)
throws
MXException
,
RemoteException
{
super
(
ms
);
}
public
void
init
()
throws
MXException
{
super
.
init
();
}
public
void
add
()
throws
MXException
,
RemoteException
{
super
.
add
();
if
(
getString
(
"GLACCOUNT"
).
equalsIgnoreCase
(
""
))
{
setValue
(
"GLACCOUNT"
,
"9999-#-#"
,
2L
);
}
}
public
void
modify
()
throws
MXException
,
RemoteException
{
super
.
modify
();
}
public
void
canDelete
()
throws
MXException
,
RemoteException
{
super
.
canDelete
();
}
public
void
delete
()
throws
MXException
,
RemoteException
{
super
.
delete
();
}
//重写更改状态方法
public
void
changeStatus
(
String
status
,
Date
date
,
String
memo
,
long
accessModifier
)
throws
MXException
,
RemoteException
{
String
num
=
getString
(
"ORIGRECORDID"
);
//获取缺陷单号
System
.
out
.
println
(
"changestatus--------"
+
num
);
MboSetRemote
srSet
=
MXServer
.
getMXServer
().
getMboSet
(
"SR"
,
this
.
getUserInfo
());
srSet
.
setWhere
(
"TICKETID = '"
+
num
+
"'"
);
System
.
out
.
println
(
"changestatus--------111"
+
getString
(
"WORKTYPE"
));
if
(!
srSet
.
isEmpty
()
&&
!
getString
(
"WORKTYPE"
).
equalsIgnoreCase
(
"LL"
)&&!
getString
(
"WORKTYPE"
).
equalsIgnoreCase
(
"MOC"
))
{
System
.
out
.
println
(
"进入if--------"
+
srSet
.
getMbo
(
0
).
getString
(
"DESCRIPTION"
));
if
((!
"APPR"
.
equalsIgnoreCase
(
status
)
||
!
"WAPPR"
.
equalsIgnoreCase
(
status
)
)&&!
getString
(
"DESCRIPTION"
).
equals
(
srSet
.
getMbo
(
0
).
getString
(
"DESCRIPTION"
)))
{
System
.
out
.
println
(
"changestatus--------222"
+
getString
(
"DESCRIPTION"
));
throw
new
MXApplicationException
(
"工单"
,
"工单描述与故障单不一致,无法将"
+
status
+
"状态修改为APPR状态"
);
}
}
System
.
out
.
println
(
"更改状态-"
);
super
.
changeStatus
(
status
,
date
,
memo
,
accessModifier
,
false
);
}
public
void
save
()
throws
MXException
,
RemoteException
{
super
.
save
();
setValue
(
"GLACCOUNT"
,
"9999-#-#"
,
2L
);
if
(
getString
(
"status"
).
equalsIgnoreCase
(
"COMP"
))
{
String
FCG_ACTSTARTTIME
=
getString
(
"FCG_ACTSTARTTIME"
);
String
FCG_ACTFINISHTIME
=
getString
(
"FCG_ACTFINISHTIME"
);
if
((
FCG_ACTSTARTTIME
.
equals
(
""
))
||
(
FCG_ACTFINISHTIME
.
equals
(
""
)))
{
throw
new
MXApplicationException
(
"工单"
,
"警告 工单实际开工时间、实际结束时间必填!"
);
}
}
System
.
out
.
println
(
"判断应用程序"
);
System
.
out
.
println
(
"================"
+
getString
(
"WORKTYPE"
).
startsWith
(
"MG"
));
if
((
getString
(
"status"
).
equalsIgnoreCase
(
"COMP"
))
&&
(
getString
(
"WORKTYPE"
).
startsWith
(
"MG"
))
&&
(
getMboSet
(
"WORKLOG"
).
isEmpty
()))
{
throw
new
MXApplicationException
(
"MG工单"
,
"警告 工作日志必填!"
);
}
if
((
getString
(
"status"
).
equalsIgnoreCase
(
"COMP"
))
&&
(
isNull
(
"FCG_PROJECTID"
))
&&
(
getString
(
"WORKTYPE"
).
startsWith
(
"MG"
)))
{
throw
new
MXApplicationException
(
"MG工单"
,
"警告 项目编号必填!"
);
}
if
((
getThisMboSet
().
getApp
()
!=
null
)
&&
(
getThisMboSet
().
getApp
().
equals
(
"LLD"
))
&&
(
(
getString
(
"FCG_ELECTGROUP"
).
equals
(
""
))
||
(
getString
(
"FCG_KKS2_1"
).
equals
(
""
))
||
(
getString
(
"FCG_KKS2_2"
).
equals
(
""
))
||
(
getString
(
"FCG_KKS2_3"
).
equals
(
""
))
||
(
getString
(
"location"
).
equals
(
""
))))
{
throw
new
MXApplicationException
(
"领料单"
,
"警告 领料单必须由工单创建!"
);
}
if
((
getString
(
"origrecordclass"
).
equalsIgnoreCase
(
"SR"
))
&&
(
isNew
()))
{
MboRemote
ticket
=
getMboSet
(
"$TICKET"
,
"TICKET"
,
"ticketid="
+
getString
(
"origrecordid"
)).
getMbo
(
0
);
if
(
ticket
!=
null
)
{
if
(!
ticket
.
isNull
(
"custlldw"
))
{
setValue
(
"custlldw"
,
ticket
.
getString
(
"custlldw"
),
3L
);
}
if
(!
ticket
.
isNull
(
"fcg_speciality"
))
{
setValue
(
"fcg_speciality"
,
ticket
.
getString
(
"fcg_speciality"
),
3L
);
}
if
(!
ticket
.
isNull
(
"failurecode"
))
{
setValue
(
"failurecode"
,
ticket
.
getString
(
"failurecode"
),
3L
);
}
if
(!
ticket
.
isNull
(
"problemcode"
))
{
setValue
(
"problemcode"
,
ticket
.
getString
(
"problemcode"
),
3L
);
}
if
(!
ticket
.
isNull
(
"glaccount"
))
{
setValue
(
"glaccount"
,
ticket
.
getString
(
"glaccount"
),
3L
);
}
if
(!
ticket
.
isNull
(
"reportedpriority"
))
{
setValue
(
"wopriority"
,
ticket
.
getInt
(
"reportedpriority"
),
3L
);
}
if
(!
ticket
.
isNull
(
"targetstart"
))
{
setValue
(
"targstartdate"
,
ticket
.
getDate
(
"targetstart"
),
3L
);
}
if
(!
ticket
.
isNull
(
"FCG_ELECTGROUP"
))
{
setValue
(
"FCG_ELECTGROUP"
,
ticket
.
getString
(
"FCG_ELECTGROUP"
),
3L
);
}
if
(
ticket
.
getString
(
"FCG_ELECTGROUP"
).
equalsIgnoreCase
(
"MG"
))
{
setValue
(
"WORKTYPE"
,
"MGTCM"
,
3L
);
}
else
{
setValue
(
"WORKTYPE"
,
"CM"
,
3L
);
}
}
}
if
(
getString
(
"status"
).
equalsIgnoreCase
(
"CAN"
))
{
String
memo
=
getMboSet
(
"wostatus"
).
getMbo
(
0
).
getString
(
"memo"
);
memo
=
"关联工单已被取消:"
+
memo
;
if
(!
getString
(
"origrecordid"
).
equalsIgnoreCase
(
""
))
{
MboSetRemote
woSet
=
getMboSet
(
"$wo"
,
"WORKORDER"
,
"status<>'CAN' and wonum<>'"
+
getString
(
"wonum"
)
+
"' and origrecordid="
+
getString
(
"origrecordid"
));
if
(
woSet
.
isEmpty
())
{
MboSetRemote
srSet
=
getMboSet
(
"$sr"
,
"TICKET"
,
"ticketid="
+
getString
(
"origrecordid"
));
if
((!
srSet
.
isEmpty
())
&&
(!
srSet
.
getMbo
(
0
).
getString
(
"status"
).
equalsIgnoreCase
(
"CANCEL"
))
&&
(!
srSet
.
getMbo
(
0
).
getString
(
"status"
).
equalsIgnoreCase
(
"CLOSED"
)))
{
MboSetRemote
sr_instance
=
getMboSet
(
"$srWf"
,
"WFINSTANCE"
,
"ownertable='SR' and ownerid="
+
srSet
.
getMbo
(
0
).
getInt
(
"ticketuid"
)
+
" and active = 1"
);
if
(!
sr_instance
.
isEmpty
())
{
throw
new
MXApplicationException
(
"工单"
,
"警告 您取消的工单,有关联缺陷单,并且还在审批流程中无法取消!"
);
}
MboSetRemote
tks
=
srSet
.
getMbo
(
0
).
getMboSet
(
"tkstatus"
);
tks
.
add
(
11L
);
tks
.
setValue
(
"status"
,
"CANCEL"
,
3L
);
tks
.
setValue
(
"changeby"
,
getUserName
(),
3L
);
tks
.
setValue
(
"changedate"
,
MXSession
.
getSession
().
getDate
(),
3L
);
tks
.
setValue
(
"memo"
,
memo
,
3L
);
srSet
.
getMbo
(
0
).
setValue
(
"status"
,
"CANCEL"
,
3L
);
srSet
.
getMbo
(
0
).
setValue
(
"historyflag"
,
"Y"
,
3L
);
}
}
}
}
}
public
void
appValidate
()
throws
MXException
,
RemoteException
{
super
.
appValidate
();
MboSetRemote
wpmaterialSet
=
getMboSet
(
"WPMATERIAL"
);
if
(!
wpmaterialSet
.
isEmpty
())
{
FinancialServiceRemote
financialThingy
=
(
FinancialServiceRemote
)((
AppService
)
getMboServer
())
.
getMXServer
().
lookup
(
"FINANCIAL"
);
String
orgID
=
getString
(
"orgid"
);
if
((
getString
(
"PARENT"
).
equalsIgnoreCase
(
""
))
&&
(!
financialThingy
.
validateFullGLAccount
(
getUserInfo
(),
getString
(
"glaccount"
),
orgID
)))
{
throw
new
MXApplicationException
(
"工单"
,
"警告 您填写了物资领用,但科目填写不完整,请工单页面填写"
);
}
}
if
(
getString
(
"worktype"
).
equals
(
"LL"
))
{
MboRemote
wpmaterial
=
null
;
for
(
int
n
=
0
;
(
wpmaterial
=
wpmaterialSet
.
getMbo
(
n
))
!=
null
;
n
++)
{
if
(!
wpmaterial
.
toBeDeleted
())
{
MboSetRemote
matuseSet
=
wpmaterial
.
getMboSet
(
"ISSUEMATUSETRANS"
);
if
(
matuseSet
.
isEmpty
())
{
String
requestnum
=
wpmaterial
.
getString
(
"requestnum"
);
String
siteid
=
wpmaterial
.
getString
(
"siteid"
);
Long
wpitemid
=
Long
.
valueOf
(
wpmaterial
.
getLong
(
"wpitemid"
));
if
((
""
.
equals
(
requestnum
))
||
(
"0"
.
equals
(
requestnum
)))
{
MboSetRemote
wpmSet
=
MXServer
.
getMXServer
().
getMboSet
(
"WPMATERIAL"
,
getUserInfo
());
wpmSet
.
setWhere
(
"wpitemid="
+
wpitemid
);
wpmSet
.
reset
();
if
(!
wpmSet
.
isEmpty
())
{
requestnum
=
wpmSet
.
getMbo
(
0
).
getString
(
"requestnum"
);
}
wpmSet
.
close
();
}
MboSetRemote
invSet
=
MXServer
.
getMXServer
().
getMboSet
(
"INVRESERVE"
,
getUserInfo
());
invSet
.
setWhere
(
"requestnum='"
+
requestnum
+
"' and siteid='"
+
siteid
+
"' and restype='HARD'"
);
invSet
.
reset
();
double
invrerveQty
=
invSet
.
sum
(
"reservedqty"
);
if
(
wpmaterial
.
getDouble
(
"itemqty"
)
>
wpmaterial
.
getDouble
(
"INVENTORY.AVBLBALANCE"
)
+
invrerveQty
)
{
invSet
.
close
();
throw
new
MXApplicationException
(
"领料单: "
,
wpmaterial
.
getString
(
"description"
)
+
" 库存余量不足!"
);
}
invSet
.
close
();
}
}
}
}
Date
oldmindate
=
new
Date
();
Date
oldmaxdate
=
new
Date
();
if
(
getString
(
"status"
).
equalsIgnoreCase
(
"CLOSE"
))
{
MboSetRemote
gzpwombosetremote
=
getMboSet
(
"FCG_WONUM_WORKSHEET"
);
if
(!
gzpwombosetremote
.
isEmpty
())
{
MboRemote
gzpwomboremote
=
null
;
int
i
=
0
;
while
((
gzpwomboremote
=
gzpwombosetremote
.
getMbo
(
i
++))
!=
null
)
{
String
gzpzt
=
gzpwomboremote
.
getString
(
"STATUS"
);
if
((!
gzpzt
.
equalsIgnoreCase
(
"CANCEL"
))
&&
(!
gzpzt
.
equalsIgnoreCase
(
"DELETED"
)))
{
String
s
=
"警告 编号为"
+
gzpwomboremote
.
getString
(
"WSCOMBNUM"
)
+
"的工作票状态为'"
+
gzpzt
+
"',请先处理工作票!"
;
throw
new
MXApplicationException
(
"工作票"
,
s
);
}
if
(
i
==
0
)
{
oldmindate
=
gzpwomboremote
.
getDate
(
"ACCEPTEDDATE"
);
oldmaxdate
=
gzpwomboremote
.
getDate
(
"EVACUATEDDATE"
);
}
Date
mindate
=
gzpwomboremote
.
getDate
(
"ACCEPTEDDATE"
);
Date
maxdate
=
gzpwomboremote
.
getDate
(
"EVACUATEDDATE"
);
if
((
oldmindate
!=
null
)
&&
(
oldmaxdate
!=
null
)
&&
(
mindate
!=
null
)
&&
(
maxdate
!=
null
))
{
if
(
mindate
.
before
(
oldmindate
))
{
oldmindate
=
mindate
;
oldmaxdate
=
maxdate
;
}
if
(
maxdate
.
after
(
oldmaxdate
))
{
oldmaxdate
=
maxdate
;
}
}
}
if
(
oldmindate
!=
null
)
{
setValue
(
"FCG_ACTSTARTTIME"
,
oldmindate
,
3L
);
}
if
(
oldmaxdate
!=
null
)
{
setValue
(
"FCG_ACTFINISHTIME"
,
oldmaxdate
,
3L
);
}
}
}
if
(
getString
(
"STATUS"
).
equalsIgnoreCase
(
"CLOSE"
))
{
MboSetRemote
wochildset
=
getMboSet
(
"ALLCHILDWO"
);
MboRemote
wochildmboremote
=
null
;
int
i
=
0
;
while
((
wochildmboremote
=
wochildset
.
getMbo
(
i
++))
!=
null
)
{
if
((!
wochildmboremote
.
getString
(
"WO.STATUS"
).
equalsIgnoreCase
(
"CLOSE"
))
&&
(!
wochildmboremote
.
getString
(
"WO.STATUS"
).
equalsIgnoreCase
(
"CAN"
))
&&
(!
wochildmboremote
.
getBoolean
(
"wo.istask"
)))
{
String
msgbox
=
"错误: 子工单:‘"
+
wochildmboremote
.
getString
(
"wonum"
)
+
"’没有关闭,请先关闭子工单"
;
throw
new
MXApplicationException
(
"workorder"
,
msgbox
);
}
}
if
(
getString
(
"WORKTYPE"
).
startsWith
(
"MG"
))
{
if
(
isNull
(
"FCG_PROJECTID"
))
{
throw
new
MXApplicationException
(
""
,
"MG工单提示:\t 请填写项目编码后,再关闭工单"
);
}
if
(
getMboSet
(
"CUSTOMWOWORKLOG"
).
isEmpty
())
{
throw
new
MXApplicationException
(
""
,
"MG工单提示:\t 请填写工作日志后,再关闭工单"
);
}
}
}
MatusetransProject
(
getMboSet
(
"MATUSETRANS"
));
}
private
void
MatusetransProject
(
MboSetRemote
servrecSet
)
throws
MXException
,
RemoteException
,
MXApplicationException
{
MboRemote
servrec
=
null
;
if
(
servrecSet
.
isEmpty
())
{
return
;
}
if
(!
servrecSet
.
toBeSaved
())
{
return
;
}
HashMap
<
String
,
Double
>
servhashMap
=
new
HashMap
();
HashMap
<
String
,
String
>
pohashMap
=
new
HashMap
();
for
(
int
i
=
0
;
(
servrec
=
servrecSet
.
getMbo
(
i
))
!=
null
;
i
++)
{
System
.
out
.
println
(
i
+
"===i==="
+
servrecSet
.
getName
()
+
" "
+
servrec
.
toBeAdded
());
if
((
servrecSet
.
getName
().
equalsIgnoreCase
(
"MATUSETRANS"
))
&&
(
servrec
.
toBeAdded
())
&&
(
"ITEM"
.
equalsIgnoreCase
(
servrec
.
getString
(
"LINETYPE"
))))
{
if
(!
servrec
.
isNull
(
"WORKORDER.FCG_taskid.fcg_projectid"
)){
String
pid
=
servrec
.
getString
(
"WORKORDER.FCG_taskid.fcg_projectid"
);
servrec
.
setValue
(
"fcg_projectid"
,
pid
,
2L
);
String
sql
=
"finexpenseid =(select finexpenseid from finexpense where PROJECTID='"
+
pid
+
"') and getdate()>=startdate and getdate() <= enddate "
;
MboSetRemote
finSetp
=
MXServer
.
getMXServer
().
getMboSet
(
"finexpenseline"
,
getUserInfo
());
finSetp
.
setWhere
(
sql
);
finSetp
.
setOrderBy
(
"startdate desc"
);
finSetp
.
reset
();
if
(
finSetp
.
isEmpty
())
{
finSetp
.
close
();
}
else
{
MboRemote
fincntrl
=
finSetp
.
getMbo
(
0
);
String
fincntrlid
=
String
.
valueOf
(
fincntrl
.
getLong
(
"finexpenselineid"
));
servrec
.
setValue
(
"fcg_taskid"
,
fincntrlid
,
2L
);
finSetp
.
close
();
}
String
wonum
=
servrec
.
getString
(
"wonum"
);
if
(!
servhashMap
.
containsKey
(
wonum
))
servhashMap
.
put
(
wonum
,
servrec
.
getDouble
(
"linecost"
));
else
servhashMap
.
put
(
wonum
,
servhashMap
.
get
(
wonum
)
+
servrec
.
getDouble
(
"linecost"
));
System
.
out
.
println
(
wonum
+
"===servhashMap==="
+
servhashMap
.
get
(
wonum
));
if
(!
pohashMap
.
containsKey
(
wonum
))
pohashMap
.
put
(
wonum
,
servrec
.
getString
(
"WORKORDER.FCG_taskid.fcg_projectid"
));
System
.
out
.
println
(
wonum
+
"===pohashMap==="
+
pohashMap
.
get
(
wonum
));
}
}
}
Iterator
iterator1
=
pohashMap
.
keySet
().
iterator
();
HashMap
<
String
,
String
>
projectHashMap
=
new
HashMap
();
String
errorMSG
=
""
;
while
(
iterator1
.
hasNext
())
{
String
key
=
(
String
)
iterator1
.
next
();
String
projectid
=
(
String
)
pohashMap
.
get
(
key
);
if
((!
""
.
equals
(
projectid
))
&&
(!
projectHashMap
.
containsKey
(
projectid
)))
{
projectHashMap
.
put
(
projectid
,
projectid
);
String
sql
=
"finexpenseid =(select finexpenseid from finexpense where PROJECTID='"
+
projectid
+
"') and getdate()>=startdate and getdate() <= enddate "
;
MboSetRemote
finSet
=
MXServer
.
getMXServer
().
getMboSet
(
"finexpenseline"
,
getUserInfo
());
finSet
.
setWhere
(
sql
);
finSet
.
setOrderBy
(
"startdate desc"
);
finSet
.
reset
();
if
(
finSet
.
isEmpty
())
{
finSet
.
close
();
}
else
{
MboRemote
fincntrl
=
finSet
.
getMbo
(
0
);
String
fincntrlid
=
fincntrl
.
getString
(
"finexpenselineid"
);
Iterator
iterator2
=
servhashMap
.
keySet
().
iterator
();
double
toalcost
=
0.0
D
;
while
(
iterator2
.
hasNext
())
{
String
key2
=
(
String
)
iterator2
.
next
();
if
(((
String
)
pohashMap
.
get
(
key2
)).
equals
(
projectid
))
{
toalcost
+=
((
Double
)
servhashMap
.
get
(
key2
)).
doubleValue
();
}
}
System
.
out
.
println
(
"===toalcost==="
+
toalcost
);
double
netcost
=
fincntrl
.
getDouble
(
"budgetcost"
)
+
fincntrl
.
getDouble
(
"altercost"
)
-
fincntrl
.
getDouble
(
"PROJECTCOST"
);
System
.
out
.
println
(
"netcost:"
+
netcost
);
if
(
netcost
<
toalcost
)
{
finSet
.
close
();
errorMSG
=
errorMSG
+
"\n 工单号:"
+
key
+
" 超预算,费用预算编码:"
+
projectid
+
",预算行ID:"
+
fincntrlid
+
"\n 超预算金额:"
+
(
netcost
-
toalcost
);
}
else
{
finSet
.
close
();
}
}
}
}
//未超出预算,需要进行累计
if
(
""
.
equals
(
errorMSG
))
{
System
.
out
.
println
(
"===errorMSG==="
+
errorMSG
);
Iterator
iterator3
=
pohashMap
.
keySet
().
iterator
();
while
(
iterator3
.
hasNext
())
{
String
key
=
(
String
)
iterator3
.
next
();
String
projectid
=
pohashMap
.
get
(
key
);
System
.
out
.
println
(
"===key==="
+
key
);
System
.
out
.
println
(
"===projectid==="
+
projectid
);
if
(!
""
.
equals
(
projectid
)
&&
projectHashMap
.
containsKey
(
projectid
))
{
String
sql
=
"finexpenseid =(select finexpenseid from finexpense where PROJECTID='"
+
projectid
+
"') and getdate()>=startdate and getdate() <= enddate "
;
MboSetRemote
finSet
=
MXServer
.
getMXServer
().
getMboSet
(
"finexpenseline"
,
getUserInfo
());
finSet
.
setWhere
(
sql
);
finSet
.
setOrderBy
(
"startdate desc"
);
finSet
.
reset
();
if
(
finSet
.
isEmpty
())
{
finSet
.
close
();
}
else
{
MboRemote
fincntrl
=
finSet
.
getMbo
(
0
);
Iterator
iterator2
=
servhashMap
.
keySet
().
iterator
();
double
toalcost
=
0
;
while
(
iterator2
.
hasNext
())
{
String
key2
=
(
String
)
iterator2
.
next
();
if
(
pohashMap
.
get
(
key2
).
equals
(
projectid
))
toalcost
+=
servhashMap
.
get
(
key2
);
}
System
.
out
.
println
(
"===fincntrlID==="
+
fincntrl
.
getString
(
"finexpenselineid"
));
fincntrl
.
setValue
(
"PROJECTCOST"
,
fincntrl
.
getDouble
(
"PROJECTCOST"
)
+
toalcost
);
fincntrl
.
setValue
(
"netcost"
,
fincntrl
.
getDouble
(
"budgetcost"
)
+
fincntrl
.
getDouble
(
"altercost"
)
-
fincntrl
.
getDouble
(
"PROJECTCOST"
));
finSet
.
save
();
finSet
.
close
();
}
}
}
}
else
throw
new
MXApplicationException
(
"\n*************警告!警告!警告!**************"
,
errorMSG
);
}
public
void
setAllRelatedMboReadonly
(
String
relationName
)
throws
MXException
,
RemoteException
{
MboSetRemote
relatedSet
=
getMboSet
(
relationName
);
relatedSet
.
setFlag
(
7L
,
true
);
}
//
// public void setAttrFromWoGen(MboRemote mboremote)
// throws RemoteException, MXException
// {
// super.setAttrFromWoGen(mboremote);
// setValue("FCG_ELECTGROUP", mboremote.getString("FCG_ELECTGROUP"), 2L);
// setValue("WS_REQUIRE", mboremote.getString("WS_REQUIRE"), 2L);
// setValue("FCG_SPECIALITY", mboremote.getString("FCG_SPECIALITY"), 2L);
// setValue("custlldw", mboremote.getString("custlldw"), 2L);
// }
}
src/psdi/app/common/purchasing/FldPurLineType.java
0 → 100644
View file @
c635af82
package
psdi
.
app
.
common
.
purchasing
;
import
java.rmi.RemoteException
;
import
java.sql.Connection
;
import
psdi.app.common.FldCommonLineType
;
import
psdi.app.company.CompanySetRemote
;
import
psdi.app.po.POLineRemote
;
import
psdi.app.po.PORemote
;
import
psdi.app.pr.PRLineRemote
;
import
psdi.app.pr.PRRemote
;
import
psdi.app.rfq.RFQLineRemote
;
import
psdi.app.rfq.RFQRemote
;
import
psdi.mbo.AutoKey
;
import
psdi.mbo.MaximoDD
;
import
psdi.mbo.Mbo
;
import
psdi.mbo.MboRemote
;
import
psdi.mbo.MboServerInterface
;
import
psdi.mbo.MboSetInfo
;
import
psdi.mbo.MboSetRemote
;
import
psdi.mbo.MboValue
;
import
psdi.mbo.MboValueInfo
;
import
psdi.mbo.Translate
;
import
psdi.security.ConnectionKey
;
import
psdi.security.ProfileRemote
;
import
psdi.security.UserInfo
;
import
psdi.server.BulletinBoardServiceRemote
;
import
psdi.server.MXServer
;
import
psdi.server.MaxVarServiceRemote
;
import
psdi.util.MXApplicationException
;
import
psdi.util.MXException
;
import
psdi.util.MaxType
;
public
class
FldPurLineType
extends
FldCommonLineType
{
public
FldPurLineType
(
MboValue
mbv
)
throws
MXException
,
RemoteException
{
super
(
mbv
);
}
public
void
validate
()
throws
MXException
,
RemoteException
{
super
.
validate
();
if
(
getMboValue
().
isNull
())
{
return
;
}
MboRemote
purchasingLineRemote
=
getMboValue
().
getMbo
();
boolean
allowSPOrder
=
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
getMaxVar
().
getBoolean
(
"ALLOWSPORDER"
,
((
Mbo
)
purchasingLineRemote
).
getProfile
().
getInsertOrg
());
if
(!
allowSPOrder
)
{
String
maxLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
purchasingLineRemote
.
getString
(
"linetype"
));
if
(
maxLineType
.
equalsIgnoreCase
(
"SPORDER"
))
throw
new
MXApplicationException
(
"common"
,
"NotValidLineType"
);
}
}
public
void
action
()
throws
MXException
,
RemoteException
{
if
(
getMboValue
().
isNull
())
{
return
;
}
MboRemote
purchasingLineRemote
=
getMboValue
().
getMbo
();
String
previousLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
getMboValue
().
getPreviousValue
().
asString
());
String
maxLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
purchasingLineRemote
.
getString
(
"linetype"
));
if
(
maxLineType
.
equalsIgnoreCase
(
previousLineType
))
{
return
;
}
clearFields
();
((
Mbo
)
purchasingLineRemote
).
setAppDefaultValue
();
if
((
purchasingLineRemote
.
toBeAdded
())
&&
(
previousLineType
==
null
))
{
((
Mbo
)
purchasingLineRemote
).
setDefaultValue
();
maxLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
purchasingLineRemote
.
getString
(
"linetype"
));
}
if
((
maxLineType
.
equalsIgnoreCase
(
"ITEM"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"TOOL"
)))
{
setEditibilityAndValues
();
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
128L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"description"
,
128L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"classstructureid"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.HIERARCHYPATH"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.description_class"
,
7L
,
true
);
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
if
(
purchasingLineRemote
.
getBoolean
(
"issue"
))
{
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
512L
,
true
);
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
}
else
{
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
}
MboRemote
owner
=
purchasingLineRemote
.
getOwner
();
String
[]
internalReadOnly
=
{
"issue"
,
"wonum"
,
"location"
,
"assetnum"
};
if
((!(
purchasingLineRemote
instanceof
RFQLineRemote
))
&&
(
owner
.
getBoolean
(
"internal"
)))
purchasingLineRemote
.
setFieldFlag
(
internalReadOnly
,
7L
,
true
);
else
{
purchasingLineRemote
.
setFieldFlag
(
internalReadOnly
,
7L
,
false
);
}
}
else
if
((
maxLineType
.
equalsIgnoreCase
(
"SERVICE"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"STDSERVICE"
)))
{
if
(
maxLineType
.
equalsIgnoreCase
(
"SERVICE"
))
{
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
128L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"description"
,
128L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"classstructureid"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.HIERARCHYPATH"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.description_class"
,
7L
,
false
);
}
else
if
(
maxLineType
.
equalsIgnoreCase
(
"STDSERVICE"
))
{
purchasingLineRemote
.
setFieldFlag
(
"prorateservice"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
128L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"description"
,
128L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"classstructureid"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.HIERARCHYPATH"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.description_class"
,
7L
,
true
);
}
purchasingLineRemote
.
setFieldFlag
(
"conversion"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"manufacturer"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"modelnum"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"receiptreqd"
,
7L
,
false
);
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
boolean
serviceReceiptDefault
=
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
getMaxVar
().
getBoolean
(
"SERVRECEIPTDEFAULT"
,
((
Mbo
)
purchasingLineRemote
).
getProfile
().
getInsertOrg
());
purchasingLineRemote
.
setValue
(
"receiptreqd"
,
serviceReceiptDefault
,
2L
);
if
(
purchasingLineRemote
.
isNull
(
"wonum"
))
{
purchasingLineRemote
.
setFieldFlag
(
"chargestore"
,
7L
,
false
);
}
else
{
MboRemote
workorder
=
getMboValue
().
getMbo
().
getMboSet
(
"$wo"
,
"WORKORDER"
,
"wonum = :wonum"
).
getMbo
(
0
);
if
(!
workorder
.
getBoolean
(
"chargestore"
))
{
purchasingLineRemote
.
setFieldFlag
(
"chargestore"
,
7L
,
false
);
}
}
}
else
if
(
maxLineType
.
equalsIgnoreCase
(
"MATERIAL"
))
{
setEditibilityAndValues
();
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
128L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"description"
,
128L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
7L
,
true
);
purchasingLineRemote
.
setFieldFlag
(
"classstructureid"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.HIERARCHYPATH"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.description_class"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
512L
,
true
);
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
}
else
if
(
maxLineType
.
equalsIgnoreCase
(
"SPORDER"
))
{
setEditibilityAndValues
();
purchasingLineRemote
.
setFieldFlag
(
"itemnum"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"description"
,
128L
,
false
);
if
(
purchasingLineRemote
.
getBoolean
(
"issue"
))
{
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
512L
,
true
);
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
}
else
{
purchasingLineRemote
.
setFieldFlag
(
"issue"
,
7L
,
false
);
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
}
purchasingLineRemote
.
setFieldFlag
(
"classstructureid"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.HIERARCHYPATH"
,
7L
,
false
);
purchasingLineRemote
.
setFieldFlag
(
"CLASSSTRUCTURE.description_class"
,
7L
,
false
);
if
(!
MXServer
.
getBulletinBoard
().
isPosted
(
"po.SKIPSPORDERAUTOKEY"
,
purchasingLineRemote
.
getUserInfo
()))
setAutoItemKey
();
purchasingLineRemote
.
setValue
(
"category"
,
getTranslator
().
toExternalDefaultValue
(
"CATEGORY"
,
"SP"
,
purchasingLineRemote
),
11L
);
}
}
private
void
clearFields
()
throws
MXException
,
RemoteException
{
MboRemote
purchasingLineRemote
=
getMboValue
().
getMbo
();
MboRemote
owner
=
purchasingLineRemote
.
getOwner
();
String
maxLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
purchasingLineRemote
.
getString
(
"linetype"
));
if
(!(
purchasingLineRemote
instanceof
RFQLineRemote
))
{
if
(
owner
.
isNull
(
"contractrefnum"
))
{
purchasingLineRemote
.
setValueNull
(
"contractrefnum"
,
2L
);
}
else
if
((
maxLineType
.
equalsIgnoreCase
(
"SERVICE"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"MATERIAL"
)))
{
purchasingLineRemote
.
setValueNull
(
"contractrefnum"
,
2L
);
}
else
if
(
purchasingLineRemote
.
isNull
(
"contractrefnum"
))
{
purchasingLineRemote
.
setValue
(
"contractrefnum"
,
owner
.
getString
(
"contractrefnum"
),
11L
);
if
(!
owner
.
isNull
(
"contractrefid"
))
purchasingLineRemote
.
setValue
(
"contractrefid"
,
owner
.
getLong
(
"contractrefid"
),
11L
);
purchasingLineRemote
.
setValue
(
"contractrefrev"
,
owner
.
getString
(
"contractrefrev"
),
11L
);
}
purchasingLineRemote
.
setValueNull
(
"catalogcode"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"glcreditacct"
,
11L
);
purchasingLineRemote
.
setValue
(
"linecost1"
,
0.0
D
,
11L
);
purchasingLineRemote
.
setValue
(
"linecost2"
,
0.0
D
,
11L
);
purchasingLineRemote
.
setValue
(
"loadedcost"
,
0.0
D
,
11L
);
purchasingLineRemote
.
setValue
(
"loadedcost1"
,
0.0
D
,
11L
);
purchasingLineRemote
.
setValue
(
"taxexempt"
,
false
,
11L
);
if
((
purchasingLineRemote
instanceof
POLineRemote
))
{
purchasingLineRemote
.
setValueNull
(
"receipttolerance"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"receipttolqty"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"receipttolamt"
,
11L
);
if
(
owner
.
getString
(
"vendeliverydate"
)
==
""
)
{
purchasingLineRemote
.
setValueNull
(
"vendeliverydate"
,
11L
);
}
}
else
{
purchasingLineRemote
.
setValueNull
(
"vendeliverydate"
,
11L
);
}
}
purchasingLineRemote
.
setValueNull
(
"category"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"description"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"description_longdescription"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"itemnum"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"classstructureid"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"commoditygroup"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"commodity"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"manufacturer"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"modelnum"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"mrlinenum"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"mrnum"
,
11L
);
purchasingLineRemote
.
setValue
(
"orderqty"
,
1.0
D
,
11L
);
purchasingLineRemote
.
setValueNull
(
"orderunit"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"remark"
,
11L
);
String
previousLineType
=
getTranslator
().
toInternalString
(
"LINETYPE"
,
getMboValue
().
getPreviousValue
().
asString
());
if
(!(
purchasingLineRemote
instanceof
PRLineRemote
))
{
purchasingLineRemote
.
setValueNull
(
"supervisor"
,
11L
);
}
purchasingLineRemote
.
setValue
(
"unitcost"
,
0.0
D
,
11L
);
purchasingLineRemote
.
setValue
(
"linecost"
,
0.0
D
,
2L
);
purchasingLineRemote
.
setValueNull
(
"vendorpackcode"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"vendorpackquantity"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"vendorwarehouse"
,
11L
);
boolean
changeLineType
=
previousLineType
!=
null
;
if
(
changeLineType
)
{
if
(!
purchasingLineRemote
.
isNull
(
"storeloc"
))
{
boolean
fromItemType
=
(
previousLineType
.
equalsIgnoreCase
(
"ITEM"
))
||
(
previousLineType
.
equalsIgnoreCase
(
"TOOL"
));
boolean
toDirectIssueType
=
(
maxLineType
.
equalsIgnoreCase
(
"SERVICE"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"STDSERVICE"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"MATERIAL"
));
if
((
fromItemType
)
&&
(
toDirectIssueType
))
{
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
purchasingLineRemote
.
setValueNull
(
"storeloc"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"gldebitacct"
,
11L
);
}
}
else
{
boolean
fromDirectIssueType
=
(
previousLineType
.
equalsIgnoreCase
(
"SERVICE"
))
||
(
previousLineType
.
equalsIgnoreCase
(
"STDSERVICE"
))
||
(
previousLineType
.
equalsIgnoreCase
(
"MATERIAL"
));
boolean
toItemType
=
(
maxLineType
.
equalsIgnoreCase
(
"ITEM"
))
||
(
maxLineType
.
equalsIgnoreCase
(
"TOOL"
));
if
((
fromDirectIssueType
)
&&
(
toItemType
))
{
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
((
Mbo
)
purchasingLineRemote
).
setDefaultValue
();
if
((!
purchasingLineRemote
.
isNull
(
"refwo"
))
||
(!
purchasingLineRemote
.
isNull
(
"assetnum"
))
||
(!
purchasingLineRemote
.
isNull
(
"location"
)))
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
else
if
((!
purchasingLineRemote
.
isNull
(
"gldebitacct"
))
&&
(
purchasingLineRemote
.
isNull
(
"storeloc"
)))
{
purchasingLineRemote
.
setValue
(
"issue"
,
true
,
2L
);
}
}
}
}
else
{
purchasingLineRemote
.
setValueNull
(
"refwo"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"wonum"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"taskid"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"assetnum"
,
11L
);
purchasingLineRemote
.
setValueNull
(
"location"
,
11L
);
if
(
purchasingLineRemote
.
isNull
(
"storeloc"
))
{
purchasingLineRemote
.
setValueNull
(
"gldebitacct"
,
11L
);
}
purchasingLineRemote
.
setValue
(
"issue"
,
false
,
2L
);
}
if
(
purchasingLineRemote
.
isNull
(
"wonum"
))
{
purchasingLineRemote
.
setFieldFlag
(
"chargestore"
,
7L
,
true
);
}
purchasingLineRemote
.
setValue
(
"chargestore"
,
false
,
11L
);
purchasingLineRemote
.
setValue
(
"prorateservice"
,
false
,
11L
);
purchasingLineRemote
.
setValue
(
"receiptreqd"
,
false
,
11L
);
if
((
owner
instanceof
RFQRemote
))
{
return
;
}
CompanySetRemote
companySetRemote
=
null
;
MboSetRemote
costSet
=
null
;
if
((
owner
instanceof
PRRemote
))
{
companySetRemote
=
(
CompanySetRemote
)
owner
.
getMboSet
(
"COMPANIES"
);
costSet
=
purchasingLineRemote
.
getMboSet
(
"PRCOST"
);
}
if
((
owner
instanceof
PORemote
))
{
companySetRemote
=
(
CompanySetRemote
)
owner
.
getMboSet
(
"VENDOR"
);
costSet
=
purchasingLineRemote
.
getMboSet
(
"POCOST"
);
}
MboRemote
companyRemote
=
companySetRemote
.
getMbo
(
0
);
if
(
companyRemote
!=
null
)
{
purchasingLineRemote
.
setValue
(
"glcreditacct"
,
companyRemote
.
getString
(
"rbniacc"
),
11L
);
((
PurchasingLineMbo
)
purchasingLineRemote
).
getDefaultTaxCodes
(
null
,
null
);
}
if
((
purchasingLineRemote
.
toBeAdded
())
&&
(
previousLineType
==
null
)
&&
(
purchasingLineRemote
.
isNull
(
"storeloc"
)))
{
for
(
int
i
=
0
;
;
i
++)
{
MboRemote
costMbo
=
costSet
.
getMbo
(
i
);
if
(
costMbo
==
null
)
break
;
costMbo
.
setValueNull
(
"gldebitacct"
,
11L
);
costMbo
.
setValue
(
"linecost"
,
0
,
2L
);
}
}
}
private
void
setEditibilityAndValues
()
throws
MXException
,
RemoteException
{
MboRemote
mboRemote
=
getMboValue
().
getMbo
();
String
[]
setReadOnly
=
{
"prorateservice"
,
"receiptreqd"
};
String
[]
setEditable
=
{
"conversion"
,
"manufacturer"
,
"modelnum"
};
mboRemote
.
setFieldFlag
(
setReadOnly
,
7L
,
true
);
mboRemote
.
setFieldFlag
(
setEditable
,
7L
,
false
);
mboRemote
.
setValue
(
"receiptreqd"
,
true
,
2L
);
mboRemote
.
setValue
(
"inspectionrequired"
,
false
,
2L
);
MboRemote
owner
=
mboRemote
.
getOwner
();
if
((((
owner
instanceof
PRRemote
))
||
((
owner
instanceof
PORemote
)))
&&
(
owner
.
getBoolean
(
"inspectionrequired"
)))
mboRemote
.
setValue
(
"inspectionrequired"
,
true
,
2L
);
}
public
MboSetRemote
getList
()
throws
MXException
,
RemoteException
{
MboRemote
purchasingLineRemote
=
getMboValue
().
getMbo
();
MboRemote
owner
=
purchasingLineRemote
.
getOwner
();
boolean
allowSPOrder
=
false
;
String
sqlWhere
=
" and maxvalue in ('MATERIAL', 'ITEM', 'SERVICE', 'STDSERVICE', 'TOOL') "
;
MboSetRemote
valueListSet
=
super
.
getList
();
if
(
purchasingLineRemote
.
isZombie
())
{
allowSPOrder
=
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
getMaxVar
().
getBoolean
(
"ALLOWSPORDER"
,
((
Mbo
)
purchasingLineRemote
).
getProfile
().
getInsertOrg
());
if
(
allowSPOrder
)
sqlWhere
=
" and maxvalue in ('MATERIAL', 'ITEM', 'SERVICE', 'STDSERVICE', 'TOOL', 'SPORDER')"
;
String
relationWhere
=
valueListSet
.
getRelationship
();
valueListSet
.
setRelationship
(
relationWhere
+
sqlWhere
);
valueListSet
.
setOrderBy
(
"maxvalue"
);
return
valueListSet
;
}
allowSPOrder
=
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
getMaxVar
().
getBoolean
(
"ALLOWSPORDER"
,
purchasingLineRemote
.
getString
(
"orgid"
));
if
((
owner
!=
null
)
&&
(
owner
.
isBasedOn
(
"PO"
))
&&
(
getTranslator
().
toInternalString
(
"POTYPE"
,
owner
.
getString
(
"potype"
)).
equalsIgnoreCase
(
"CONSIGNMENT"
)))
{
sqlWhere
=
" and maxvalue in ('ITEM')"
;
}
else
if
(
purchasingLineRemote
.
toBeAdded
())
{
if
((!(
owner
instanceof
RFQRemote
))
&&
(
owner
.
getBoolean
(
"internal"
)))
{
sqlWhere
=
" and maxvalue in ('ITEM', 'TOOL')"
;
}
else
if
(
allowSPOrder
)
{
sqlWhere
=
" and maxvalue in ('MATERIAL', 'ITEM', 'SERVICE', 'STDSERVICE', 'TOOL', 'SPORDER')"
;
}
}
else
{
valueListSet
.
setOrderBy
(
"maxvalue"
);
return
valueListSet
;
}
String
relationWhere
=
valueListSet
.
getRelationship
();
valueListSet
.
setRelationship
(
relationWhere
+
sqlWhere
);
valueListSet
.
setOrderBy
(
"maxvalue"
);
return
valueListSet
;
}
private
void
setAutoItemKey
()
throws
MXException
,
RemoteException
{
MboRemote
purchasingLineRemote
=
getMboValue
().
getMbo
();
MboSetInfo
ti
=
MXServer
.
getMXServer
().
getMaximoDD
().
getMboSetInfo
(
"item"
);
MboValueInfo
di
=
ti
.
getMboValueInfo
(
"itemnum"
);
ConnectionKey
conKey
=
null
;
try
{
UserInfo
ui
=
purchasingLineRemote
.
getUserInfo
();
conKey
=
new
ConnectionKey
(
ui
);
Connection
con
=
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
getDBConnection
(
conKey
);
AutoKey
ak
=
new
AutoKey
(
con
,
di
,
ui
,
purchasingLineRemote
,
ti
);
if
(
purchasingLineRemote
.
getString
(
"itemnum"
).
equals
(
""
))
{
purchasingLineRemote
.
setValue
(
"itemnum"
,
ak
.
nextValue
(),
11L
);
purchasingLineRemote
.
setValue
(
"itemsetid"
,
purchasingLineRemote
.
getInsertItemSetId
(),
11L
);
}
}
finally
{
((
Mbo
)
purchasingLineRemote
).
getMboServer
().
freeDBConnection
(
conKey
);
}
}
}
\ No newline at end of file
src/tohi/app/crontask/MD5Utils.java
0 → 100644
View file @
c635af82
package
tohi
.
app
.
crontask
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
org.apache.commons.lang.StringUtils
;
/**
* MD5加密算法工具类
* @author bbo
*
*/
public
class
MD5Utils
{
/*
* 为了提高安全性,我们又额外加了一串随机字符串
*/
// private static final String USER_PWD_ENCP_PREFIX = "LDHDSFHWRERHESLM";
/**
* 用户密码加密
* @param beforeEncp
* @return
*/
public
static
String
encode
(
final
String
beforeEncp
){
if
(
StringUtils
.
isBlank
(
beforeEncp
)){
return
beforeEncp
;
}
return
encryptMD5
(
beforeEncp
);
}
/**
* md5加密
* @param strInput
* @return
*/
private
static
String
encryptMD5
(
final
String
strInput
)
{
StringBuffer
buf
=
null
;
try
{
// 拿到一个MD5转换器(如果想要SHA1参数换成”SHA1”)
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
// 输入的字符串转换成字节数组
md
.
update
(
strInput
.
getBytes
());
// 转换并返回结果,也是字节数组,包含16个元素
byte
b
[]
=
md
.
digest
();
// new一个StringBuffer,这个就是用来组成结果字符串的(解释一下:一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方))
buf
=
new
StringBuffer
(
b
.
length
*
2
);
//遍历
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
{
if
(((
int
)
b
[
i
]
&
0xff
)
<
0x10
)
{
//(int) b[i] & 0xff 转换成无符号整型
buf
.
append
(
"0"
);
}
//Long.toHexString( 无符号长整数的十六进制字符串表示
buf
.
append
(
Long
.
toHexString
((
int
)
b
[
i
]
&
0xff
));
}
}
catch
(
NoSuchAlgorithmException
ex
)
{
ex
.
printStackTrace
();
}
return
buf
==
null
?
null
:
buf
.
toString
();
//返回加密后 的结果
}
}
\ No newline at end of file
src/tohi/app/crontask/RunCronTask.java
0 → 100644
View file @
c635af82
package
tohi
.
app
.
crontask
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.PrintWriter
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.text.SimpleDateFormat
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
psdi.mbo.MboRemote
;
import
psdi.mbo.MboSetRemote
;
import
psdi.server.MXServer
;
import
psdi.server.SimpleCronTask
;
/**
* 定期任务安排生成定期任务
*
*/
public
class
RunCronTask
extends
SimpleCronTask
{
public
static
void
interfaceUtil
(
String
path
,
String
data
)
throws
IOException
{
try
{
URL
url
=
new
URL
(
path
);
//打开和url之间的连接
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
PrintWriter
out
=
null
;
//请求方式
conn
.
setRequestMethod
(
"GET"
);
conn
.
setReadTimeout
(
500000
);
conn
.
setConnectTimeout
(
500000
);
// //设置通用的请求属性
//Content-Type: application/x-www-form-urlencoded
conn
.
setRequestProperty
(
"Content-Type"
,
"application/x-www-form-urlencoded/charset=UTF-8"
);
InputStream
is
=
conn
.
getInputStream
();
//构造一个字符流缓存
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
String
str
=
""
;
String
strInfo
=
""
;
while
((
str
=
br
.
readLine
())
!=
null
)
{
strInfo
+=
str
;
}
// //关闭流
is
.
close
();
conn
.
disconnect
();
System
.
out
.
println
(
"完整结束"
);
//写入数据库中
JSONArray
jsarr
=
JSONArray
.
fromObject
(
strInfo
);
System
.
out
.
println
(
jsarr
.
toString
());
List
<
Resultitfa
>
list
=
new
ArrayList
<
Resultitfa
>();
for
(
int
i
=
0
;
i
<
jsarr
.
size
();
i
++)
{
JSONObject
obj
=(
JSONObject
)
jsarr
.
get
(
i
);
Resultitfa
r
=
new
Resultitfa
();
r
.
Id
=
obj
.
getString
(
"id"
);
r
.
time
=
obj
.
getString
(
"time"
);
r
.
value
=
obj
.
getDouble
(
"value"
);
list
.
add
(
r
);
}
MXServer
mx
=
MXServer
.
getMXServer
();
MboSetRemote
mboSet
=
mx
.
getMboSet
(
"WATERPORT"
,
mx
.
getSystemUserInfo
());
//获取系统表
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
nowDate
=
sdf
.
format
(
mx
.
getDate
());
//写入数据库
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Resultitfa
r
=
list
.
get
(
i
);
MboRemote
mbo
=
mboSet
.
addAtEnd
();
mbo
.
setValue
(
"id"
,
r
.
Id
);
if
(
r
.
Id
.
equalsIgnoreCase
(
"H9760"
))
{
mbo
.
setValue
(
"DESCRIPTION"
,
"时段出库流量"
);
}
if
(
r
.
Id
.
equalsIgnoreCase
(
"R1183"
))
{
mbo
.
setValue
(
"DESCRIPTION"
,
"实时坝下水位"
);
}
if
(
r
.
Id
.
equalsIgnoreCase
(
"H9620"
))
{
mbo
.
setValue
(
"DESCRIPTION"
,
"时段入库流量"
);
}
if
(
r
.
Id
.
equalsIgnoreCase
(
"R1283"
))
{
mbo
.
setValue
(
"DESCRIPTION"
,
"实时厂址水位"
);
}
if
(
r
.
Id
.
equalsIgnoreCase
(
"R1083"
))
{
mbo
.
setValue
(
"DESCRIPTION"
,
"实时坝上水位"
);
}
mbo
.
setValue
(
"time"
,
r
.
time
);
mbo
.
setValue
(
"value"
,
r
.
value
);
mbo
.
setValue
(
"memo"
,
nowDate
+
" 同步该记录!!!"
);
mboSet
.
save
();
}
mboSet
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
cronAction
()
{
try
{
Date
date
=
new
Date
();
System
.
out
.
println
(
date
.
getTime
());
String
info
=
"sduser"
+
date
.
getTime
()+
"sduser@2022"
;
// String info="sduser1656897995866sduser@2022";
String
s
=
MD5Utils
.
encode
(
info
);
String
url
=
"http://172.17.7.235:56022/getdata/all?Username=sduser&time="
+
date
.
getTime
()+
"&signature="
+
s
;
System
.
out
.
println
(
url
);
interfaceUtil
(
url
,
""
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
{
try
{
Date
date
=
new
Date
();
System
.
out
.
println
(
date
.
getTime
());
String
info
=
"sduser"
+
date
.
getTime
()+
"sduser@2022"
;
// String info="sduser1656897995866sduser@2022";
String
s
=
MD5Utils
.
encode
(
info
);
String
url
=
"http://172.17.7.235:56022/getdata/all?Username=sduser&time="
+
date
.
getTime
()+
"&signature="
+
s
;
System
.
out
.
println
(
url
);
interfaceUtil
(
url
,
""
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
static
class
Resultitfa
{
String
Id
;
String
time
;
Double
value
;
@Override
public
String
toString
()
{
return
"Resultitfa [Id="
+
Id
+
", time="
+
time
+
", value="
+
value
+
"]"
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment