Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
  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;
  }
Exemplo n.º 3
0
  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;
  }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }