EDII Callout Order Line And Validator
This commit is contained in:
parent
b03d0abcb4
commit
f45660397d
|
|
@ -4,3 +4,4 @@ syntax: glob
|
|||
andromeida.midsuit.project/bin/andromedia/midsuit/factory/*.rej
|
||||
andromeida.midsuit.project/src/andromedia/midsuit/factory/*.orig
|
||||
*.rej
|
||||
*.orig
|
||||
|
|
|
|||
|
|
@ -7,22 +7,24 @@ import org.compiere.model.CalloutEngine;
|
|||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.X_C_OrderLine;
|
||||
import org.compiere.util.DB;
|
||||
|
||||
public class EDI_CalloutOrderLine extends CalloutEngine implements IColumnCallout {
|
||||
|
||||
@Override
|
||||
public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
|
||||
if(mField.getColumnName().equals(X_C_OrderLine.COLUMNNAME_M_Product_ID))
|
||||
return C_Order_ID(ctx, WindowNo, mTab, mField, value, oldValue);
|
||||
return M_Product_ID(ctx, WindowNo, mTab, mField, value, oldValue);
|
||||
return null;
|
||||
}
|
||||
|
||||
public String C_Order_ID(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
|
||||
public String M_Product_ID(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
|
||||
if(value==null)
|
||||
return null;
|
||||
MOrder Order = new MOrder(ctx, (int) mTab.getValue(X_C_OrderLine.COLUMNNAME_C_Order_ID), null);
|
||||
|
||||
MProduct Product = new MProduct(ctx, (int)value, null);
|
||||
String retValue = Order.get_ValueAsString("NoAju1") + "/"
|
||||
+ Order.get_ValueAsString("NoAju2") + "/"
|
||||
+ Order.get_ValueAsString("NoAju3") + "/"
|
||||
|
|
@ -30,6 +32,18 @@ public class EDI_CalloutOrderLine extends CalloutEngine implements IColumnCallou
|
|||
|
||||
mTab.setValue("NoAju", retValue);
|
||||
|
||||
String sqlExec = "SELECT M_AttributeSetInstance_ID " +
|
||||
" FROM M_Storage S " +
|
||||
" WHERE M_Product_ID = ? AND " +
|
||||
" DateMaterialPolicy = (SELECT MIN(DateMaterialPolicy) FROM M_StorageOnHand SOH " +
|
||||
" WHERE SOH.QtyOnHand>0 AND M_AttributeSetInstance_ID > 0 AND M_Product_ID = S.M_Product_ID)";
|
||||
int M_AttributeSetInstance_ID = DB.getSQLValueEx(null, sqlExec, new Object[] { Product.getM_Product_ID() });
|
||||
if(M_AttributeSetInstance_ID>0)
|
||||
mTab.setValue(X_C_OrderLine.COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID);
|
||||
else
|
||||
mTab.setValue(X_C_OrderLine.COLUMNNAME_M_AttributeSetInstance_ID, 0);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import org.osgi.service.event.Event;
|
|||
public class EDI_OrderValidator {
|
||||
public static String executeEvent(Event e, PO po) {
|
||||
MOrder Order = (MOrder) po;
|
||||
if (Order.isSOTrx()) return "";
|
||||
if (e.getTopic().equals(IEventTopics.DOC_BEFORE_COMPLETE))
|
||||
return beforeComplete(Order);
|
||||
else if (e.getTopic().equals(IEventTopics.PO_BEFORE_CHANGE))
|
||||
|
|
|
|||
Loading…
Reference in New Issue