Exemplo n.º 1
0
 public TransferGoodsVO sellStockToDelivery(
     int paramInt, String paramString1, String paramString2, String paramString3) {
   TransferGoodsVO localTransferGoodsVO = new TransferGoodsVO();
   localTransferGoodsVO.setResult(-1L);
   WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO();
   List localList =
       localWareHouseStockDAO.getPledgeStockList(
           " and moduleid="
               + paramInt
               + " and orderID='"
               + paramString1
               + "' and status=0 for update ");
   PledgeStockPO localPledgeStockPO = null;
   if ((localList != null) && (localList.size() > 0)) {
     localPledgeStockPO = (PledgeStockPO) localList.get(0);
   }
   if (localPledgeStockPO == null) {
     localTransferGoodsVO.addErrorInfo(
         -1223L, new Object[] {Integer.valueOf(paramInt), paramString1});
     return localTransferGoodsVO;
   }
   StockPO localStockPO = localWareHouseStockDAO.getStockPOByID(localPledgeStockPO.getStockID());
   if (!localStockPO.getOwnerFirm().equals(paramString3)) {
     localTransferGoodsVO.addErrorInfo(-1222L);
     return localTransferGoodsVO;
   }
   localWareHouseStockDAO.realesePledgeStock(paramInt, paramString1);
   localWareHouseStockDAO.deleteStockOperation(
       localPledgeStockPO.getStockID(), StockOperation.SELL);
   localTransferGoodsVO =
       transferGoods(
           paramInt, paramString2, new String[] {localPledgeStockPO.getStockID()}, paramString3);
   if (localTransferGoodsVO.getResult() < 0L) {
     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
   }
   return localTransferGoodsVO;
 }
Exemplo n.º 2
0
 public TransferGoodsVO transferGoods(
     int paramInt, String paramString1, String[] paramArrayOfString, String paramString2) {
   TransferGoodsVO localTransferGoodsVO = new TransferGoodsVO();
   localTransferGoodsVO.setResult(-1L);
   WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO();
   ArrayList localArrayList = new ArrayList();
   Object localObject2;
   Object localObject3;
   Object localObject4;
   for (int i = 0; i < paramArrayOfString.length; i++) {
     StockPO localStockPO = localWareHouseStockDAO.getStockPOByIDAndLocked(paramArrayOfString[i]);
     if (localStockPO == null) {
       localTransferGoodsVO.addErrorInfo(-1100L, new Object[] {paramArrayOfString[i]});
       return localTransferGoodsVO;
     }
     if (!localStockPO.getOwnerFirm().equals(paramString2)) {
       localTransferGoodsVO.addErrorInfo(-1140L);
       return localTransferGoodsVO;
     }
     if (localStockPO.getStockStatus() == 0) {
       localTransferGoodsVO.addErrorInfo(-1133L, new Object[] {localStockPO.getStockID()});
       return localTransferGoodsVO;
     }
     if (localStockPO.getStockStatus() == 2) {
       localTransferGoodsVO.addErrorInfo(-1134L, new Object[] {localStockPO.getStockID()});
       return localTransferGoodsVO;
     }
     if (localStockPO.getStockStatus() != 1) {
       localTransferGoodsVO.addErrorInfo(-1136L, new Object[] {localStockPO.getStockID()});
       return localTransferGoodsVO;
     }
     List localObject1 = localWareHouseStockDAO.getStockOperation(paramArrayOfString[i]);
     if (((List) localObject1).size() > 0) {
       localObject2 = "";
       localObject3 = ((List) localObject1).iterator();
       while (((Iterator) localObject3).hasNext()) {
         localObject4 = (StockOperationPO) ((Iterator) localObject3).next();
         if (((String) localObject2).length() == 0) {
           localObject2 =
               StockOperation.getName(((StockOperationPO) localObject4).getOperationID());
         } else {
           localObject2 =
               (String) localObject2
                   + "、"
                   + StockOperation.getName(((StockOperationPO) localObject4).getOperationID());
         }
       }
       localTransferGoodsVO.addErrorInfo(
           -1135L, new Object[] {localObject2, localStockPO.getStockID()});
       return localTransferGoodsVO;
     }
     localArrayList.add(localStockPO);
   }
   double d = 0.0D;
   Object localObject1 = localArrayList.iterator();
   while (((Iterator) localObject1).hasNext()) {
     localObject2 = (StockPO) ((Iterator) localObject1).next();
     localObject3 = new StockOperationPO();
     ((StockOperationPO) localObject3).setStockID(((StockPO) localObject2).getStockID());
     ((StockOperationPO) localObject3).setOperationID(StockOperation.DELIVERY.getOperation());
     localWareHouseStockDAO.insertStockOperation((StockOperationPO) localObject3);
     localObject4 = new TradeStockPO();
     ((TradeStockPO) localObject4).setStockID(((StockPO) localObject2).getStockID());
     ((TradeStockPO) localObject4).setModuleid(paramInt);
     ((TradeStockPO) localObject4).setTradeNO(paramString1);
     ((TradeStockPO) localObject4).setStatus(0L);
     localWareHouseStockDAO.insertTradeStock((TradeStockPO) localObject4);
     localWareHouseStockDAO.addGlobalLog(
         "系统",
         Server.getInstance().getIp(),
         1301,
         ((StockPO) localObject2).getOwnerFirm()
             + "将仓单用于交收,参与交易的模块号:"
             + paramInt
             + "合同号:"
             + paramString1
             + ";参与交易的仓单号:"
             + ((StockPO) localObject2).getStockID()
             + ";",
         1);
     d += ((StockPO) localObject2).getQuantity();
   }
   localTransferGoodsVO.setTradeNO(paramString1);
   localTransferGoodsVO.setQuantity(d);
   localTransferGoodsVO.setResult(1L);
   return localTransferGoodsVO;
 }