Ejemplo n.º 1
0
 @Override
 protected void handle(Context context, CheckinAskAmountChangeTask task) throws Throwable {
   UpdateSqlBuilder ub = new UpdateSqlBuilder(context);
   ub.setTable(ERPTableNames.Inventory.CheckinSheet.getTableName());
   ub.addExpression(
       "value", ub.DOUBLE, task.getAskAmount(), "askedAmount = t.askedAmount+@value");
   ub.addCondition("id", ub.guid, task.getId(), "t.RECID=@id");
   ub.addCondition("xxx", ub.STRING, "a", "t.amount-t.askedAmount>=@value");
   int count = ub.execute();
   if (0 == count) {
     throw new Exception("申请金额超出入库金额,请核对!");
   }
 }
Ejemplo n.º 2
0
 @Override
 protected void handle(Context context, ChangeCheckinRealAmount task) throws Throwable {
   UpdateSqlBuilder ub = new UpdateSqlBuilder(context);
   double amount = task.getAmount();
   if (amount < 0) {
     amount = DoubleUtil.sub(0, amount);
   }
   ub.setTable(ERPTableNames.Inventory.CheckinSheet.getTableName());
   ub.addExpression("value", ub.DOUBLE, amount, "paidAmount = t.paidAmount+@value");
   ub.addCondition("id", ub.guid, task.getId(), "t.RECID=@id");
   ub.addCondition("xxx", ub.STRING, "a", "t.amount-t.paidAmount>=@value");
   int count = ub.execute();
   if (0 == count) {
     throw new Exception("付款金额超出入库金额,请核对!");
   }
   CheckInBaseInfo info = context.find(CheckInBaseInfo.class, task.getId());
   if (info.getAmount() == info.getPaidAmount()) {
     context.dispatch(
         new CheckInSheetAmountBalanceCompleteEvent(info.getRelaBillsId(), info.getSheetType()));
   }
 }