Workflow 人機簽核分流

Short Code:[SYSTEM]

Workflow 除了員工進行審核,確認. 許多結點(Node)也會配合自動化設備自動執待.等待系統完成工作後.自動推動Workflow.為了避免人員誤觸系統確認結點. 在結點名字定義一組 Short Code [SYSTEM], 人員簽核畫面會自動過濾, 避免誤觸.

	private String getWhereActivities() {
		final String where =
			"a.Processed='N' AND a.WFState='OS' "
			+ " AND (EXISTS (select * from AD_WF_Node wfn where "
					+ " a.AD_WF_Node_ID = wfn.AD_WF_Node_ID "
					+ " and  not ( substring(wfn.name,1,8) = '[SYSTEM]' and wfn.action = 'Z' ) ) )"
			
			+ " AND ("
			//	Owner of Activity
			+ " a.AD_User_ID=?"	//	#1
			//	Invoker (if no invoker = all)
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))"	//	#2
			//  Responsible User
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND r.AD_User_ID=?)"		//	#3
			//	Responsible Role
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)"
			+ " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType='R' AND ur.AD_User_ID=? AND ur.isActive = 'Y')"	//	#4
			///* Manual Responsible */ 
			+ " OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r "
			+ " WHERE a.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=? AND r.isActive = 'Y')" 
			+ ") AND a.AD_Client_ID=?";	//	#5
		return where;
	}
Leave a comment

MySQL Quickly set up in 4 step

MySQL Script

#Create Database
CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
#Create New User
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
#Set Permission
GRANT ALL PRIVILEGES ON mydatabase. * TO 'newuser'@'localhost';
#Refresh Privileges
FLUSH PRIVILEGES;
Leave a comment

iDempiere with Jasper Report

ERP自動帶入 Procedure 四個重要內建參數

AD_PINSTANCE_ID   (Integer)
AD_Table_ID (Integer)
RECORD_ID (Integer)
CURRENT_LANG  (Integer)

其它參數

在 Procedure 傳入 Range 參數時,第二個參數會變成 參數_TO
但是在 Jasperreport. Range用法有很大的不同,第一個參數會變 參數1 第二個參數會變參數2
舉例:

以傳入DateAcct為例

Procedure: DateAcct 和 DateAcct_TO

Jasperreport: DateAcct1 和 DateAcct2

Leave a comment

Raspberry Pi 使用DDNS應用

  1. 至Gandi申請APIKEY
  2. 將下述程式碼存成bash script 並設定排程即可
#!/bin/sh
ip=$(/sbin/ifconfig ppp0 | grep 'inet' | cut -d: -f2 | awk '{ print $2}')
APIKEY="你Gandi的API KEY"
DOMAIN="你的domain"
HOST="你要更新的主機名稱,不含domain"
echo "pppoe IP: $ip"
lastip=$(cat /home/pi/lastip)
if [ -z $lastip ]
then
   lastip="0.0.0.0"
fi

if [ "$ip" != "$lastip" ]
then
curl -X PUT -H "Content-Type: application/json"\
     -H "X-Api-Key:$APIKEY"\
     -d '{"rrset_name":"'$HOST'",
        "rrset_type":"A",
	"rrset_ttl":300,
	"rrset_values": ["'$ip'"]}'\
	https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records/$HOST/A
	echo "\n"
    
     echo $ip > /home/pi/lastip	
else
     echo "no change"

fi

Leave a comment