"import org.compiere.model.MTable
import org.compiere.util.DB
import org.compiere.util.Msg
String sql = null;
enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
// A_WindowNo A_Tab A_Field A_Value A_OldValue A_Ctx BOMQty
if (A_Value!=null && A_OldValue!=A_Value){
Integer SK_BOM_ID= (Integer)A_Tab.getValue("SK_BOM_ID");
Integer SK_BOMLine_ID= (Integer)A_Tab.getValue("SK_BOMLine_ID");
BigDecimal BOMQty=(BigDecimal) A_Value;
BigDecimal OldBOMQty=(BigDecimal) A_OldValue;
if (BOMQty==null) BOMQty=new BigDecimal(0);
if (OldBOMQty==null) OldBOMQty=new BigDecimal(0);
sql = "SELECT SUM(BOMQty) FROM SK_BOMLine WHERE SK_BOM_ID=? AND SK_BOMLine_ID <> ? ";
BigDecimal sQty = DB.getSQLValueBD (null, sql, [SK_BOM_ID,SK_BOMLine_ID] );
BigDecimal tQty = sQty .add(BOMQty);
if ( tQty.compareTo(new BigDecimal(1) ) !=0 )
A_Tab.fireDataStatusEEvent("合計不等於一","合計:"+ tQty+"不等於一", false);
// A_Tab.setValue("Description", "目前總數:"+tQty ); // +" , "+BOMQty+" , "+OldBOMQty+" , "+SK_BOM_ID+" , "+SK_BOMLine_ID);
}
result="" "
沒有留言:
張貼留言