Esempio n. 1
0
 /**
  * 修改出库单 (non-Javadoc)
  *
  * @see
  *     com.wms3.bms.standard.business.outbound.IOutBoundBus#updateOutBound(com.wms3.bms.standard.entity.outbound.OutboundInvoiceHeader)
  */
 public String updateOutBound(OutboundInvoiceHeader invoice) throws Exception {
   String strMsg = "操作成功!";
   // 同步  收货单号
   synchronized (invoice.getOutstockid()) {
     if (invoice.getOutstatus().equals("0")) {
       outBoundDAO.updateOutBound(invoice);
     } else {
       strMsg =
           "出库单[" + invoice.getOutstockid() + "]状态(" + invoice.getOutstatus() + ")不为开单状态1!无法修改!";
     }
   }
   return strMsg;
 }
Esempio n. 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;
  }