groovy:訂單帶出客戶單號
Callout
===================
import java.sql.Timestamp
import java.math.BigDecimal
import java.sql.PreparedStatement
import java.sql.ResultSet
import org.compiere.util.DB
import org.compiere.model.MUser
//@script:groovy:getQuotationForOrder
if (A_Value != null )
{
int id = ((Integer) A_Value).intValue();
String sql ="SELECT \"客戶單號\",\"匯率\" FROM \"訂單\" WHERE \"訂單_id\"=? ";
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
// 只作 1筆 while (rs.next()){
if (rs.next()) {
if (rs.getString("客戶單號") != null) A_Tab.setValue("客戶單號",rs. getString ("客戶單號"));
if (rs.getBigDecimal ("匯率") != null) A_Tab.setValue("匯率",rs.getBigDecimal ("匯率"));
}
rs.close();
pstmt.close();
}
result=""
沒有留言:
張貼留言