public ResultVO stockOutUpdate(StockOutApplyBO stockOutApplyBO) { ResultVO result = new ResultVO(); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); OutStockPO outStock = new OutStockPO(); outStock.setIdnumber(stockOutApplyBO.getIdnumber()); outStock.setDeliveryPerson(stockOutApplyBO.getDeliveryPerson()); outStock.setKey(stockOutApplyBO.getKey()); outStock.setStatus(0); outStock.setStockID(stockOutApplyBO.getStockID()); outStock.setAddress(stockOutApplyBO.getAddress()); outStock.setPhone(stockOutApplyBO.getPhone()); outStock.setDeliveryStatus(Integer.valueOf(stockOutApplyBO.getDeliveryStatus())); wareHouseStockDAO.updateOutStock(outStock); result.setResult(1L); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "仓单出库申请信息修改,仓单号:" + stockOutApplyBO.getStockID(), 1); return result; }
public ResultVO frozenStocks(int paramInt, String[] paramArrayOfString) { ResultVO localResultVO = new ResultVO(); localResultVO.setResult(-1L); WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); ArrayList localArrayList = new ArrayList(); StockPO localStockPO; Object localObject1; Object localObject2; for (int i = 0; i < paramArrayOfString.length; i++) { localStockPO = localWareHouseStockDAO.getStockPOByIDAndLocked(paramArrayOfString[i]); if (localStockPO == null) { localResultVO.addErrorInfo(-1504L, new Object[] {paramArrayOfString[i]}); return localResultVO; } if (localStockPO.getStockStatus() != 1) { localResultVO.addErrorInfo(-1505L, new Object[] {localStockPO.getStockID()}); return localResultVO; } localObject1 = localWareHouseStockDAO.getStockOperation(paramArrayOfString[i]); if (((List) localObject1).size() > 0) { localObject2 = ""; Iterator localIterator2 = ((List) localObject1).iterator(); while (localIterator2.hasNext()) { StockOperationPO localStockOperationPO = (StockOperationPO) localIterator2.next(); if (((String) localObject2).length() == 0) { localObject2 = StockOperation.getName(localStockOperationPO.getOperationID()); } else { localObject2 = (String) localObject2 + "、" + StockOperation.getName(localStockOperationPO.getOperationID()); } } localResultVO.addErrorInfo(-1506L, new Object[] {localStockPO.getStockID(), localObject2}); return localResultVO; } localArrayList.add(localStockPO); } Iterator localIterator1 = localArrayList.iterator(); while (localIterator1.hasNext()) { localStockPO = (StockPO) localIterator1.next(); localObject1 = new StockOperationPO(); ((StockOperationPO) localObject1).setStockID(localStockPO.getStockID()); ((StockOperationPO) localObject1).setOperationID(StockOperation.FROZEN.getOperation()); localWareHouseStockDAO.insertStockOperation((StockOperationPO) localObject1); localObject2 = new FrozenStockPO(); ((FrozenStockPO) localObject2).setStockID(localStockPO.getStockID()); ((FrozenStockPO) localObject2).setModuleID(paramInt); ((FrozenStockPO) localObject2).setStatus(0); localWareHouseStockDAO.insertFrozenStockPO((FrozenStockPO) localObject2); localWareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "冻结仓单,系统模块号:" + paramInt + "仓单编号:" + localStockPO.getStockID() + ";", 1); } localResultVO.setResult(1L); return localResultVO; }
public ResultVO unFrozenStocks(int paramInt, String[] paramArrayOfString) { ResultVO localResultVO = new ResultVO(); localResultVO.setResult(-1L); WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); for (int i = 0; i < paramArrayOfString.length; i++) { List localList = localWareHouseStockDAO.getFrozenStockList( " and moduleid=" + paramInt + " and stockID='" + paramArrayOfString[i] + "' and status=0 for update "); if (localList.size() > 0) { localWareHouseStockDAO.deleteStockOperation(paramArrayOfString[i], StockOperation.FROZEN); localWareHouseStockDAO.realeseFrozenStockPO(paramArrayOfString[i]); localWareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "解冻仓单,系统模块号:" + paramInt + "仓单编号:" + paramArrayOfString[i] + ";", 1); } else { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); localResultVO.setResult(-2L); localResultVO.addErrorInfo( -1604L, new Object[] {Integer.valueOf(paramInt), paramArrayOfString[i]}); return localResultVO; } } localResultVO.setResult(1L); return localResultVO; }
public ResultVO logoutStock(String stockID) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1272L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 1) { resultVO.addErrorInfo(-1273L, new Object[] {stockPO.getStockStatusMeaning()}); return resultVO; } List<StockOperationPO> list = wareHouseStockDAO.getStockOperation(stockPO.getStockID()); if (list.size() > 0) { String operationStr = ""; for (StockOperationPO o : list) { if (operationStr.length() == 0) { operationStr = StockOperation.getName(o.getOperationID()); } else { operationStr = operationStr + "、" + StockOperation.getName(o.getOperationID()); } } resultVO.addErrorInfo(-1274L, new Object[] {operationStr, stockPO.getStockID()}); return resultVO; } wareHouseStockDAO.updateStockStatus(stockID, 0); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "注销仓单,仓单号:" + stockID, 1); resultVO.setResult(1L); return resultVO; }
public ResultVO endFinancing(long paramLong) { ResultVO localResultVO = new ResultVO(); localResultVO.setResult(-1L); WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); FinancingStockPO localFinancingStockPO = localWareHouseStockDAO.getFinancingStockPOBuIDAndLocked(paramLong); if (localFinancingStockPO == null) { localResultVO.addErrorInfo(-1222L, new Object[] {Long.valueOf(paramLong)}); return localResultVO; } if (localFinancingStockPO.getStatus().equals("N")) { localResultVO.addErrorInfo(-1223L, new Object[] {Long.valueOf(paramLong)}); return localResultVO; } localWareHouseStockDAO.disableFinancingStock(paramLong); localWareHouseStockDAO.deleteStockOperation( localFinancingStockPO.getStockID(), StockOperation.FINANCING); localWareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, localFinancingStockPO.getStockID() + "融资成功:" + ";融资仓单号:" + paramLong + ";", 1); localResultVO.setResult(1L); return localResultVO; }
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 ResultVO stockOut(String stockID, String userID, String userName, String password) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1292L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 0) { resultVO.addErrorInfo(-1293L, new Object[] {stockPO.getStockStatusMeaning()}); return resultVO; } wareHouseStockDAO.updateStockStatus(stockID, 2); Random random = new Random(); long t1 = 0x7FFFFFFF & System.currentTimeMillis(); long key = t1 << 32 | Math.abs(random.nextInt()); OutStockPO outStock = new OutStockPO(); outStock.setIdnumber(null); outStock.setDeliveryPerson(null); outStock.setKey(key + ""); outStock.setStatus(2); outStock.setStockID(stockPO.getStockID()); wareHouseStockDAO.addOutStock(outStock); resultVO.setResult(key); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "仓单直接出库,仓单号:" + stockID, 1); UnRegisterRequestVO request = new UnRegisterRequestVO(); request.setPwd(password); request.setQuantity(stockPO.getQuantity()); request.setStockID(stockPO.getRealStockCode()); request.setUserID(userID); request.setUserName(userName); ResponseVO response = this.wareHouseStockService.stockOut(request); if ((response == null) || (response.getResult() == null)) { throw new BillCoreException("调用仓库系统失败,仓库系统返回信息为空"); } if (response.getResult().getReturnCode() != 0L) { if ((response.getResult().getMessage() != null) && (response.getResult().getMessage().trim().length() > 0)) { throw new BillCoreException(response.getResult().getMessage()); } throw new BillCoreException("仓库系统处理失败"); } return resultVO; }
public FinancingApplyVO startFinancing(String paramString, long paramLong) { FinancingApplyVO localFinancingApplyVO = new FinancingApplyVO(); localFinancingApplyVO.setResult(-1L); WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO localStockPO = localWareHouseStockDAO.getStockPOByIDAndLocked(paramString); if (localStockPO == null) { localFinancingApplyVO.addErrorInfo(-1100L, new Object[] {paramString}); return localFinancingApplyVO; } if (localStockPO.getStockStatus() != 1) { localFinancingApplyVO.addErrorInfo(-1101L, new Object[] {paramString}); return localFinancingApplyVO; } 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()); } } localFinancingApplyVO.addErrorInfo( -1202L, new Object[] {localObject1, localStockPO.getStockID()}); return localFinancingApplyVO; } Object localObject1 = new StockOperationPO(); ((StockOperationPO) localObject1).setStockID(paramString); ((StockOperationPO) localObject1).setOperationID(StockOperation.FINANCING.getOperation()); localWareHouseStockDAO.insertStockOperation((StockOperationPO) localObject1); Object localObject2 = new FinancingStockPO(); ((FinancingStockPO) localObject2).setStockID(paramString); ((FinancingStockPO) localObject2).setFinancingstockID(paramLong); localWareHouseStockDAO.addFinancingStock((FinancingStockPO) localObject2); localWareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, paramString + "参与融资:" + ";融资仓单号:" + paramLong + ";", 1); localFinancingApplyVO.setResult(1L); localFinancingApplyVO.setFinancingStockID(paramLong); return localFinancingApplyVO; }
public ResultVO dismantleStock(String stockID, Double[] amountarr) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1252L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 0) { resultVO.addErrorInfo(-1253L, new Object[] {stockPO.getStockStatusMeaning()}); return resultVO; } double totalAmount = 0.0D; Double[] arrayOfDouble1; int j = (arrayOfDouble1 = amountarr).length; for (int i = 0; i < j; i++) { double amount = arrayOfDouble1[i].doubleValue(); totalAmount = Arith.add(totalAmount, amount); } if (totalAmount != stockPO.getQuantity()) { resultVO.addErrorInfo( -1254L, new Object[] {Double.valueOf(stockPO.getQuantity()), Double.valueOf(totalAmount)}); return resultVO; } StockOperationPO stockOperationPO = new StockOperationPO(); stockOperationPO.setStockID(stockPO.getStockID()); stockOperationPO.setOperationID(StockOperation.DISMANTLE.getOperation()); wareHouseStockDAO.insertStockOperation(stockOperationPO); Double[] arrayOfDouble2; int k = (arrayOfDouble2 = amountarr).length; for (j = 0; j < k; j++) { double amount = arrayOfDouble2[j].doubleValue(); DismantlePO DismantlePO = new DismantlePO(); DismantlePO.setStockID(stockID); DismantlePO.setAmount(amount); wareHouseStockDAO.insertDismantle(DismantlePO); } wareHouseStockDAO.updateStockStatus(stockID, 4); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "拆仓单,仓单号:" + stockID, 1); resultVO.setResult(1L); return resultVO; }
public ResultVO withdrowStockOutApply(String stockID) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1902L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 5) { resultVO.addErrorInfo( -1903L, new Object[] {stockPO.getStockID(), stockPO.getStockStatusMeaning()}); return resultVO; } OutStockPO outStock = wareHouseStockDAO.getUnAuditOutStockByStockID(stockID); if (outStock == null) { resultVO.addErrorInfo(-1904L, new Object[] {stockPO.getStockID()}); return resultVO; } wareHouseStockDAO.updateStockStatus(stockID, 0); wareHouseStockDAO.updateOutStockStatus(outStock.getOutStockID(), 1); resultVO.setResult(1L); return resultVO; }
public ResultVO stockOutApply(StockOutApplyBO stockOutApplyBO) { ResultVO result = new ResultVO(); result.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockOutApplyBO.getStockID()); if (stockPO == null) { result.addErrorInfo(-1703L, new Object[] {stockOutApplyBO.getStockID()}); return result; } if (stockPO.getStockStatus() != 0) { result.addErrorInfo( -1704L, new Object[] {stockPO.getStockID(), stockPO.getStockStatusMeaning()}); return result; } wareHouseStockDAO.updateStockStatus(stockPO.getStockID(), 5); Random random = new Random(); long t1 = 0x7FFFFFFF & System.currentTimeMillis(); long key = t1 << 32 | Math.abs(random.nextInt()); OutStockPO outStock = new OutStockPO(); outStock.setIdnumber(stockOutApplyBO.getIdnumber()); outStock.setDeliveryPerson(stockOutApplyBO.getDeliveryPerson()); outStock.setKey(key + ""); outStock.setStatus(0); outStock.setStockID(stockPO.getStockID()); outStock.setAddress(stockOutApplyBO.getAddress()); outStock.setPhone(stockOutApplyBO.getPhone()); outStock.setDeliveryStatus(Integer.valueOf(stockOutApplyBO.getDeliveryStatus())); wareHouseStockDAO.addOutStock(outStock); result.setResult(key); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "仓单出库申请,仓单号:" + stockPO.getStockID(), 1); return result; }
public ResultVO registerStock(String stockID) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1282L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 0) { resultVO.addErrorInfo(-1283L, new Object[] {stockPO.getStockStatusMeaning()}); return resultVO; } wareHouseStockDAO.updateStockStatus(stockID, 1); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "注册仓单,仓单号:" + stockID, 1); resultVO.setResult(1L); return resultVO; }
public ResultVO stockOutAudit(StockOutAuditBO stockOutAuditBO) { ResultVO result = new ResultVO(); result.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockOutAuditBO.getStockID()); if (stockPO == null) { result.addErrorInfo(-1803L, new Object[] {stockOutAuditBO.getStockID()}); return result; } if (stockPO.getStockStatus() != 5) { result.addErrorInfo( -1804L, new Object[] {stockPO.getStockID(), stockPO.getStockStatusMeaning()}); return result; } OutStockPO outStock = wareHouseStockDAO.getUnAuditOutStockByStockID(stockOutAuditBO.getStockID()); if (outStock == null) { result.addErrorInfo(-1808L, new Object[] {stockPO.getStockID()}); return result; } if (!stockOutAuditBO.getKey().equals(outStock.getKey())) { result.addErrorInfo(-1805L); return result; } if (!stockOutAuditBO.getDeliveryPerson().equals(outStock.getDeliveryPerson())) { result.addErrorInfo(-1806L); return result; } wareHouseStockDAO.updateStockStatus(stockPO.getStockID(), 2); wareHouseStockDAO.updateOutStockStatus(outStock.getOutStockID(), 2); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "仓单出库,仓单号:" + stockPO.getStockID(), 1); result.setResult(1L); return result; }
public List<String> getUnusedStocks(int moduleid, String firmID) { List<String> result = new ArrayList(); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); List<StockPO> stockList = wareHouseStockDAO.getUnusedStocksVOList(moduleid, firmID); if ((stockList == null) || (stockList.size() <= 0)) { return result; } for (StockPO stock : stockList) { result.add(stock.getStockID()); } return result; }
public AddStockResultVO addStock(StockPO stockPO, List<GoodsPropertyPO> propertyList) { AddStockResultVO resultVO = new AddStockResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); if ((propertyList == null) || (propertyList.size() == 0)) { resultVO.addErrorInfo(-1232L); return resultVO; } WarehousePO warehouse = wareHouseStockDAO.getWarehouse(stockPO.getWarehouseID()); if (warehouse == null) { resultVO.addErrorInfo(-1233L, new Object[] {stockPO.getWarehouseID()}); return resultVO; } if (warehouse.getStatus() != 0) { resultVO.addErrorInfo(-1234L, new Object[] {stockPO.getWarehouseID()}); return resultVO; } String stockID = wareHouseStockDAO.insertStock(stockPO) + ""; for (GoodsPropertyPO wGoodsPropertyPO : propertyList) { wGoodsPropertyPO.setStockID(stockID); } wareHouseStockDAO.insertGoodsProperty(propertyList); wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, stockPO.getOwnerFirm() + "录入仓单,仓单号:" + stockID, 1); resultVO.setResult(1L); resultVO.setStockID(stockID); return resultVO; }
public double delivery( int paramInt, String paramString1, String paramString2, String paramString3) { WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); List localList = localWareHouseStockDAO.getTradeStockList( " and moduleid=" + paramInt + " and tradeNO='" + paramString1 + "' and status=0 for update "); Iterator localIterator = localList.iterator(); while (localIterator.hasNext()) { TradeStockPO localTradeStockPO = (TradeStockPO) localIterator.next(); stockChg(new String[] {localTradeStockPO.getStockID()}, paramString2, paramString3); } return realeseGoods(paramInt, paramString1); }
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 StockQiantityResultVO getQuantityByStockIDs(List<String> stockIDs) { StockQiantityResultVO result = new StockQiantityResultVO(); result.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); double quantity = 0.0D; for (String stockID : stockIDs) { StockPO stockPO = wareHouseStockDAO.getStockPOByID(stockID); if (stockPO == null) { result.addErrorInfo(-1402L, new Object[] {stockID}); return result; } quantity += stockPO.getQuantity(); } result.setQuantity(quantity); result.setResult(1L); return result; }
public double realeseGoods(int paramInt, String paramString) { WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); List localList = localWareHouseStockDAO.getTradeStockList( " and moduleid=" + paramInt + " and tradeNO='" + paramString + "' and status=0 for update "); double d = 0.0D; Iterator localIterator = localList.iterator(); while (localIterator.hasNext()) { TradeStockPO localTradeStockPO = (TradeStockPO) localIterator.next(); localWareHouseStockDAO.deleteStockOperation( localTradeStockPO.getStockID(), StockOperation.DELIVERY); StockPO localStockPO = localWareHouseStockDAO.getStockPOByID(localTradeStockPO.getStockID()); d += localStockPO.getQuantity(); } localWareHouseStockDAO.realeseTradeStockByTN(paramInt, paramString); return d; }
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; }
public double realeseGoods(int paramInt, String paramString, String[] paramArrayOfString) { WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); double d = 0.0D; for (int i = 0; i < paramArrayOfString.length; i++) { List localList = localWareHouseStockDAO.getTradeStockList( " and moduleid=" + paramInt + " and tradeNO='" + paramString + "' and stockID='" + paramArrayOfString[i] + "' and status=0 for update "); if (localList.size() > 0) { localWareHouseStockDAO.deleteStockOperation(paramArrayOfString[i], StockOperation.DELIVERY); localWareHouseStockDAO.realeseTradeStockBySI(paramArrayOfString[i]); StockPO localStockPO = localWareHouseStockDAO.getStockPOByID(paramArrayOfString[i]); d += localStockPO.getQuantity(); } else { throw new BillCoreException("没有相应的交收仓单,仓单号:" + paramArrayOfString[i]); } } return d; }
public List<String> getUnusedStocks( long breedID, Map<String, String> propertys, String firmID, double quantity) { List<String> result = new ArrayList(); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); List<StockVO> stockList = wareHouseStockDAO.getUnusedStocksVOList(breedID, firmID, quantity); if ((stockList == null) || (stockList.size() <= 0)) { return result; } List<Map<String, Object>> propertyList = wareHouseStockDAO.getCategoryPropertyByBreedID(breedID); if ((propertyList != null) && (propertyList.size() > 0)) { for (Map<String, Object> map : propertyList) { if ((map.get("stockcheck") != null) && (map.get("stockcheck").equals("Y"))) { String propValue = (String) propertys.get(map.get("propertyname").toString()); List<StockVO> removeStock = new ArrayList(); for (StockVO stockVO : stockList) { List<GoodsPropertyPO> props = stockVO.getStockPropertys(); if ((props == null) || (props.size() <= 0)) { removeStock.add(stockVO); } else { String stockP = null; for (GoodsPropertyPO goodsPropertyPO : props) { if (map.get("propertyname").toString().equals(goodsPropertyPO.getPropertyName())) { stockP = goodsPropertyPO.getPropertyValue(); break; } } if (((propValue == null) && (stockP != null)) || ((propValue != null) && (stockP == null)) || ((propValue != null) && (stockP != null) && (!propValue.equals(stockP)))) { removeStock.add(stockVO); } } } for (StockVO stockVO : removeStock) { stockList.remove(stockVO); } } else if ((map.get("stockcheck") != null) && (map.get("stockcheck").equals("M"))) { String propValue = (String) propertys.get(map.get("propertyname").toString()); List<StockVO> removeStock = new ArrayList(); for (StockVO stockVO : stockList) { List<GoodsPropertyPO> props = stockVO.getStockPropertys(); if ((props == null) || (props.size() <= 0)) { removeStock.add(stockVO); } else { String stockP = null; for (GoodsPropertyPO goodsPropertyPO : props) { if (map.get("propertyname").toString().equals(goodsPropertyPO.getPropertyName())) { stockP = goodsPropertyPO.getPropertyValue(); break; } } if (((propValue == null) && (stockP != null)) || ((propValue != null) && (stockP == null)) || ((propValue != null) && (stockP != null) && (!("|" + propValue + "|").contains("|" + stockP + "|")))) { removeStock.add(stockVO); } } } for (StockVO stockVO : removeStock) { stockList.remove(stockVO); } } } } for (StockVO stockVO : stockList) { result.add(stockVO.getStock().getStockID()); } return result; }
public void stockChg(String[] paramArrayOfString, String paramString1, String paramString2) { WareHouseStockDAO localWareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); for (String str : paramArrayOfString) { localWareHouseStockDAO.stockChg(str, paramString1, paramString2); } }
public long getFinancingStockID() { return Server.getInstance().getWareHouseStockDAO().getFinancingStockID(); }
public ResultVO dismantleStock(String stockID, boolean result, Map<String, String> dismantleMap) { ResultVO resultVO = new ResultVO(); resultVO.setResult(-1L); WareHouseStockDAO wareHouseStockDAO = Server.getInstance().getWareHouseStockDAO(); StockPO stockPO = wareHouseStockDAO.getStockPOByIDAndLocked(stockID); if (stockPO == null) { resultVO.addErrorInfo(-1262L, new Object[] {stockID}); return resultVO; } if (stockPO.getStockStatus() != 4) { resultVO.addErrorInfo(-1263L, new Object[] {stockPO.getStockStatusMeaning()}); return resultVO; } List<DismantlePO> dismantlePOList = wareHouseStockDAO.getDismantleList( " and stockID='" + stockPO.getStockID() + "' and status=0 "); if ((dismantlePOList == null) || (dismantlePOList.size() == 0) || (!"0".equals(((DismantlePO) dismantlePOList.get(0)).getStatus()))) { resultVO.addErrorInfo(-1264L, new Object[] {stockID}); return resultVO; } wareHouseStockDAO.deleteStockOperation(stockPO.getStockID(), StockOperation.DISMANTLE); if (result) { wareHouseStockDAO.updateStockStatus(stockPO.getStockID(), 3); for (DismantlePO wDismantlePO : dismantlePOList) { StockPO newStockPO = new StockPO(); newStockPO.setBreedID(stockPO.getBreedID()); newStockPO.setOwnerFirm(stockPO.getOwnerFirm()); newStockPO.setQuantity(wDismantlePO.getAmount()); if ((dismantleMap == null) || (dismantleMap.get(wDismantlePO.getDismantleID()) == null)) { resultVO.addErrorInfo(-1265L, new Object[] {Long.valueOf(wDismantlePO.getDismantleID())}); throw new BillCoreException(resultVO.getErrorDetailInfo()); } newStockPO.setRealStockCode((String) dismantleMap.get(wDismantlePO.getDismantleID())); newStockPO.setStockStatus(0); newStockPO.setUnit(stockPO.getUnit()); newStockPO.setWarehouseID(stockPO.getWarehouseID()); String newStockID = wareHouseStockDAO.insertStock(newStockPO) + ""; List<GoodsPropertyPO> propertyList = wareHouseStockDAO.getGoodsProperty(stockID); List<GoodsPropertyPO> newPropertyList = new ArrayList(); for (GoodsPropertyPO wGoodsPropertyPO : propertyList) { GoodsPropertyPO newGoodsPropertyPO = new GoodsPropertyPO(); newGoodsPropertyPO.setPropertyName(wGoodsPropertyPO.getPropertyName()); newGoodsPropertyPO.setPropertyValue(wGoodsPropertyPO.getPropertyValue()); newGoodsPropertyPO.setStockID(newStockID); newGoodsPropertyPO.setPropertyTypeID(wGoodsPropertyPO.getPropertyTypeID()); newPropertyList.add(newGoodsPropertyPO); } wareHouseStockDAO.insertGoodsProperty(newPropertyList); wareHouseStockDAO.dismantleSucess( wDismantlePO.getDismantleID(), newStockID, (String) dismantleMap.get(wDismantlePO.getDismantleID())); } } else { for (DismantlePO wDismantlePO : dismantlePOList) { wareHouseStockDAO.dismantleFail(wDismantlePO.getDismantleID()); } wareHouseStockDAO.updateStockStatus(stockPO.getStockID(), 0); } wareHouseStockDAO.addGlobalLog( "系统", Server.getInstance().getIp(), 1301, "处理拆仓单,仓单号为:" + stockID + ";仓库处理结果:" + (result ? "拆仓单处理成功" : "拆仓单处理失败"), 1); resultVO.setResult(1L); return resultVO; }
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; }