示例#1
0
 /**
  * 增加出库单 (non-Javadoc)
  *
  * @see
  *     com.wms3.bms.standard.business.outbound.IOutBoundBus#addOutBound(com.wms3.bms.standard.entity.outbound.OutboundInvoiceHeader)
  */
 public String addOutBound(OutboundInvoiceHeader invoice) throws Exception {
   // 获得单据ID
   BaseSeqDaoImpl seqDao = new BaseSeqDaoImpl(outBoundDAO.getEntityDAO());
   BaseSeq seqEn = seqDao.getSeqByType("CKD");
   String strID =
       SeqTool.getNewID(
           seqEn.getSeqType(),
           seqEn.getSeqPrefix(),
           seqEn.getIcodelength(),
           outBoundDAO.getEntityDAO());
   invoice.setOutstockid(strID);
   // 增加出库单
   outBoundDAO.addOutBound(invoice);
   return strID;
 }
示例#2
0
  /**
   * 功能:作废出库单
   *
   * @param ids 出库单ID
   * @return
   * @throws Exception
   */
  public String cancelInvoices(String ids, String strUserCode) throws Exception {

    String strBackMsg = "Y";
    try {

      OutboundInvoiceHeader outboundinvoice = null;
      OutboundInvoiceDetail detail = null;
      List<OutboundInvoiceDetail> lsDetail;

      String[] outstockid = ids.split(",");
      for (int i = 0; i < outstockid.length; i++) {

        outboundinvoice = getOutBoundById(outstockid[i]); // 出库单据
        lsDetail = getOutBoundDetailsById(outstockid[i]); // 出库单据详细
        boolean statusflg = false;

        // 判断状态 0:开单;2-分配  7:发货确认 8:作废
        if (outboundinvoice.getOutstatus().equals("0")) {
          statusflg = false;

        } else if (outboundinvoice.getOutstatus().equals("2")) // 分配后可不可以作废,分配后作业都已作废
        {
          // 分配状态, 作业都已作废,是可以作废单据的。
          int iCount = jobDao.noCancelJob(outboundinvoice.getOutstockid(), null);
          if (iCount > 0) { // 不能作废
            statusflg = true;
          } else { // 可以作废
            statusflg = false;
          }
        } else {
          statusflg = true;
        }

        if (statusflg) {

          if (strBackMsg.equals("Y")) {
            strBackMsg = "不能作废非开单状态的单据!";

          } else {
            strBackMsg += "\r不能作废非开单状态的单据!";
          }
        } else {

          if (outboundinvoice.getSaleno() != null || outboundinvoice.getSaleno() != "") {
            List<SaleFormDetail> SaleFormDetaills = new ArrayList<SaleFormDetail>();
            List<OutboundInvoiceDetail> lsinvoiceD =
                getOutBoundDetailsById(outboundinvoice.getOutstockid());
            OutboundInvoiceDetail invoiceD = null;
            IOutboundSoBus soBus = new OutboundSoBusImpl(outBoundDAO.getEntityDAO());
            if (lsinvoiceD != null && lsinvoiceD.size() > 0) {
              for (int j = 0; j < lsinvoiceD.size(); j++) {
                invoiceD = lsinvoiceD.get(j);
                SaleFormDetail saD = soBus.getSoDeByDId(invoiceD.getSodetailid());
                saD.setM_iOutNum(saD.getM_iOutNum() - invoiceD.getInvoicenum());
                SaleFormDetaills.add(saD);
              }
            }
            outboundinvoice.setOutstatus("8");
            outBoundDAO.CancelInvoice(outboundinvoice, SaleFormDetaills);
          } else {
            outboundinvoice.setOutstatus("8");
            outBoundDAO.updateOutBound(outboundinvoice);
          }

          Logger.info("用户【" + strUserCode + "】在单据管理模块里作废了出库单据:" + outstockid[i]);
        }
      }
    } catch (Exception e) {

      e.printStackTrace();
      throw new Exception("作废出库单据时候出错:" + e.getMessage());
    }

    return strBackMsg;
  }