public ResultVO sellStock(int paramInt, String paramString1, String paramString2) { ResultVO localResultVO = new ResultVO(); localResultVO.setResult(-1L); WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO localStockPO = localWareHouseStockDAO.getStockPOByIDAndLocked(paramString2); if (localStockPO == null) { localResultVO.addErrorInfo(-1100L, new Object[] {paramString2}); return localResultVO; } if (localStockPO.getStockStatus() != 1) { localResultVO.addErrorInfo(-1101L, new Object[] {paramString2}); return localResultVO; } List localList = localWareHouseStockDAO.getStockOperation(localStockPO.getStockID()); if (localList.size() > 0) { String localObject1 = ""; Iterator localObject2 = localList.iterator(); while (((Iterator) localObject2).hasNext()) { StockOperationPO localStockOperationPO = (StockOperationPO) ((Iterator) localObject2).next(); if (((String) localObject1).length() == 0) { localObject1 = StockOperation.getName(localStockOperationPO.getOperationID()); } else { localObject1 = (String) localObject1 + "、" + StockOperation.getName(localStockOperationPO.getOperationID()); } } localResultVO.addErrorInfo(-1102L, new Object[] {localObject1, localStockPO.getStockID()}); return localResultVO; } Object localObject1 = new StockOperationPO(); ((StockOperationPO) localObject1).setStockID(localStockPO.getStockID()); ((StockOperationPO) localObject1).setOperationID(StockOperation.SELL.getOperation()); localWareHouseStockDAO.insertStockOperation((StockOperationPO) localObject1); Object localObject2 = new PledgeStockPO(); ((PledgeStockPO) localObject2).setStockID(localStockPO.getStockID()); ((PledgeStockPO) localObject2).setModuleid(paramInt); ((PledgeStockPO) localObject2).setOrderID(paramString1); ((PledgeStockPO) localObject2).setStatus(0L); localWareHouseStockDAO.insertPledgeStock((PledgeStockPO) localObject2); localWareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, localStockPO.getOwnerFirm() + "卖仓单,参与交易的委托号:" + paramString1 + ";参与交易的仓单号:" + localStockPO.getStockID() + ";", 1); localResultVO.setResult(1L); return localResultVO; }
public void withdrawSellStock(int paramInt, String paramString) { WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); List localList = localWareHouseStockDAO.getPledgeStockList( " and moduleid=" + paramInt + " and orderID='" + paramString + "' and status=0 for update "); if ((localList == null) || (localList.size() <= 0)) { return; } PledgeStockPO localPledgeStockPO = (PledgeStockPO) localList.get(0); localWareHouseStockDAO.realesePledgeStock(paramInt, paramString); localWareHouseStockDAO.deleteStockOperation( localPledgeStockPO.getStockID(), StockOperation.SELL); }
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; }