Example #1
0
  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;
  }
Example #2
0
  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;
  }
Example #3
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;
  }
Example #4
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;
  }
Example #5
0
  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;
  }
Example #6
0
  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;
  }
Example #7
0
  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;
  }
Example #8
0
  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;
  }