|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
主要修改文件@version $Id: CalloutInOut.java,v 1.14 2006/01/28 01:28:28 jjanke Exp $中的一个方法。代码如下,如果大家有更好的方法,请告诉我阿。
- public String qty (Properties ctx, int WindowNo, MTab mTab, MField mField, Object value)
- {
- String text="";//我在这里加了一个变量,用来返回提示信息给操作员。
- if (isCalloutActive() || value == null)
- return text;//原来是return "";
- setCalloutActive(true);
- int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, "M_Product_ID");
- // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID);
- BigDecimal MovementQty, QtyEntered;
-
- // No Product
- if (M_Product_ID == 0)
- {
- QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
- mTab.setValue("MovementQty", QtyEntered);
- }
- // UOM Changed - convert from Entered -> Product
- else if (mField.getColumnName().equals("C_UOM_ID"))
- {
- int C_UOM_To_ID = ((Integer)value).intValue();
- QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
- MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
- C_UOM_To_ID, QtyEntered);
- if (MovementQty == null)
- MovementQty = QtyEntered;
- boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
- log.fine("UOM=" + C_UOM_To_ID
- + ", QtyEntered=" + QtyEntered
- + " -> " + conversion
- + " MovementQty=" + MovementQty);
- Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
- mTab.setValue("MovementQty", MovementQty);
- }
- // No UOM defined
- else if (Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID") == 0)
- {
- QtyEntered = (BigDecimal)mTab.getValue("QtyEntered");
- mTab.setValue("MovementQty", QtyEntered);
- }
- // QtyEntered changed - calculate MovementQty
- else if (mField.getColumnName().equals("QtyEntered"))
- {
-
- int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID");
- QtyEntered = (BigDecimal)value;
- //如果变更数值超过5%,则无效
- Integer C_OrderLine_ID = Env.getContextAsInt(ctx, WindowNo, "C_OrderLine_ID");
- // Get Order Details
- MOrderLine ol = new MOrderLine (ctx, C_OrderLine_ID.intValue(), null);
- if (ol.get_ID() != 0)
- {
- BigDecimal MovementQtyo = ol.getQtyOrdered().subtract(ol.getQtyDelivered());
- if (QtyEntered.floatValue()/MovementQtyo.floatValue()>1.05)
- {
- QtyEntered =MovementQtyo;
- mTab.setValue("QtyEntered", MovementQtyo);
- text="收货数量超过5%...........";
- }
- else QtyEntered = (BigDecimal)value;
-
- }
- //如果变更数值超过5%,则无效
- MovementQty = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
- C_UOM_To_ID, QtyEntered);
- if (MovementQty == null)
- MovementQty = QtyEntered;
-
- boolean conversion = QtyEntered.compareTo(MovementQty) != 0;
- log.fine("UOM=" + C_UOM_To_ID
- + ", QtyEntered=" + QtyEntered
- + " -> " + conversion
- + " MovementQty=" + MovementQty);
- Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
-
- mTab.setValue("MovementQty", MovementQty);
- }
- // MovementQty changed - calculate QtyEntered
- else if (mField.getColumnName().equals("MovementQty"))
- {
- int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, "C_UOM_ID");
- MovementQty = (BigDecimal)value;
- QtyEntered = MUOMConversion.convertProductTo (ctx, M_Product_ID,
- C_UOM_To_ID, MovementQty);
- if (QtyEntered == null)
- QtyEntered = MovementQty;
- boolean conversion = MovementQty.compareTo(QtyEntered) != 0;
- log.fine("UOM=" + C_UOM_To_ID
- + ", MovementQty=" + MovementQty
- + " -> " + conversion
- + " QtyEntered=" + QtyEntered);
- Env.setContext(ctx, WindowNo, "UOMConversion", conversion ? "Y" : "N");
- mTab.setValue("QtyEntered", QtyEntered);
- }
- //
- setCalloutActive(false);
- return text;//原来是return ""
- } // qty
复制代码 |
|