示例#1
0
  // 作废EDI临时信息主表
  public void deleteStatusCtTmD(Long dno) throws Exception {
    List<CtTmD> tmdlist = this.ctTmDDao.findBy("DNo", dno + "");

    if (null == dno) {
      throw new ServiceException("配送单号为空!");
    }

    if (null != tmdlist && tmdlist.size() > 0) {
      CtTmD tmd = tmdlist.get(0);
      tmd.setStatus(0l); // 0表示需要删除
      this.ctTmDDao.save(tmd);
    } else {
      CtTmD tmd = new CtTmD();
      OprFaxIn faxIn = this.oprFaxInService.get(dno);
      if (!this.edi_distributionMode.equals(faxIn.getDistributionMode())) {
        throw new ServiceException("配送单号为 " + dno + "的货物不是中转的货物!");
      }
      try {
        tmd.setCtId(Long.valueOf(this.customerService.get(faxIn.getGoWhereId()).getEdiUserId()));
      } catch (Exception e) {
        throw new ServiceException("获取EDI编码获取失败!");
      }

      tmd.setDNo(faxIn.getDno() + "");
      tmd.setStopflag("0");
      tmd.setGoodStatus("1");
      tmd.setOkFlag("0");
      tmd.setSignFlag("0");
      tmd.setExceptionFlag("1"); // 1为否,0为是
      tmd.setIsvaluables("0");
      tmd.setCtName(faxIn.getGowhere());
      tmd.setCubage(faxIn.getBulk());
      tmd.setCustomerServiceName(faxIn.getCustomerService());
      tmd.setDnAmt(faxIn.getConsigneeFee());
      tmd.setDnAmtChange(0d);
      tmd.setEndpayAmt(faxIn.getPaymentCollection());
      tmd.setFlyTime(faxIn.getFlightTime());
      tmd.setGoods(faxIn.getGoods());
      tmd.setPiece(faxIn.getPiece());
      tmd.setReceAdd(faxIn.getAddr());
      tmd.setReceCorp("");
      tmd.setReceMan(faxIn.getConsignee());
      tmd.setReceTel(faxIn.getConsigneeTel());
      tmd.setShfNo(faxIn.getFlightNo());
      tmd.setSustbillNo(faxIn.getSubNo());
      tmd.setTakeMode(faxIn.getTakeMode().trim());
      tmd.setTraAmt(faxIn.getTraFee());
      tmd.setTraCost(faxIn.getTraFeeRate());
      tmd.setWeight(faxIn.getCusWeight());
      tmd.setYdNo(faxIn.getFlightMainNo());
      tmd.setSignType(faxIn.getReceiptType()); // 签单类型
      tmd.setDeptName(faxIn.getInDepartId() == 457l ? "广州" : "深圳");
      tmd.setIsSp(faxIn.getSonderzug() == null ? "0" : faxIn.getSonderzug() + ""); // 是否专车
      tmd.setIsurgent(
          faxIn.getUrgentService() == null ? "0" : faxIn.getUrgentService() + ""); // 是否加急
      tmd.setStatus(0l); // STATUS 1:正常,0:保存时,需要删除的判断依据

      this.save(tmd);
    }
  }
  public List<? extends PrintBean> setPrintBeanList(
      BillLadingList mainbill, Map<String, String> map) {
    List<PrintBean> list = new ArrayList<PrintBean>();

    String dno = map.get("dno");
    String changeNo = map.get("changeNo");

    if (null == map.get("changeNos") || "".equals(map.get("changeNos").trim())) {
      mainbill.setMsg("请传更改明细单号过来!");
      return list;
    }
    if (null == changeNo || "".equals(changeNo)) {
      mainbill.setMsg("请传更改单号过来!");
      return list;
    }
    if (null == dno || "".equals(dno)) {
      mainbill.setMsg("请传配送单号过来!");
      return list;
    }
    String changeNos[] = map.get("changeNos").split(",");
    OprChangeMain changeMain = this.oprFaxChangeDao.get(Long.valueOf(changeNo));
    if (null == changeMain) {
      mainbill.setMsg("更改单号有误,没有找到该更改单号!");
      return list;
    }
    OprFaxIn fax = this.oprFaxInDao.get(changeMain.getDno());
    if (null == fax) {
      mainbill.setMsg("没有找到对应的传真记录!");
      return list;
    }
    OprChangeDetail detail = null;
    OprFaxChangeBean bean = null;
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm ss");
    SimpleDateFormat sdfPrint = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 打印格式
    User user = WebRalasafe.getCurrentUser(ServletActionContext.getRequest());
    Iterator<OprChangeDetail> itr = changeMain.getOprChangeDetail().iterator();
    while (itr.hasNext()) {
      detail = itr.next();
      boolean bool = false;
      for (int i = 0; i < changeNos.length; i++) {

        if (detail.getId().equals(Long.valueOf(changeNos[i]))) {
          bool = true;
          break;
        }
      }
      if (!bool) {
        continue;
      }

      bean = new OprFaxChangeBean();
      bean.setChangeContent(
          "原 "
              + detail.getChangeFieldZh()
              + " 为:"
              + detail.getChangePre()
              + "   现改为:"
              + detail.getChangePost());
      try {
        bean.setChangeDate(sdf.format(changeMain.getCreateTime()));
      } catch (Exception e) {
        mainbill.setMsg("更改申请主表创建时间有误!");
        logger.debug("更改申请主表创建时间有误!");
      }
      bean.setChangeDepart(changeMain.getDepartName() == null ? "" : changeMain.getDepartName());
      bean.setChangeName(changeMain.getCreateName() == null ? "" : changeMain.getCreateName());
      bean.setChangeNo(changeNo);
      bean.setChangeTitle("配送中心更改通知单"); // 设置标题
      bean.setConsignee(fax.getConsignee() == null ? "" : fax.getConsignee());
      bean.setCusName(fax.getCpName() == null ? "" : fax.getCpName());
      bean.setDistributionMode(fax.getDistributionMode() == null ? "" : fax.getDistributionMode());
      bean.setDno(fax.getDno() + "");
      bean.setFlightMainNo(fax.getFlightMainNo() == null ? "" : fax.getFlightMainNo());
      bean.setSubNo(fax.getSubNo() == null ? "" : fax.getSubNo());
      bean.setGoWhere(fax.getRealGoWhere() == null ? "" : fax.getRealGoWhere());
      bean.setPayWay(fax.getWhoCash() == null ? "" : fax.getWhoCash());
      bean.setPiece(fax.getPiece() == null ? "0" : fax.getPiece() + "");
      bean.setTakeMode(fax.getTakeMode() == null ? "" : fax.getTakeMode());
      bean.setWeight(fax.getCqWeight() == null ? "0" : fax.getCqWeight() + ""); // 重量
      bean.setWeightFee(fax.getCusWeight() == null ? "" : fax.getCusWeight() + ""); // 计费重量
      bean.setXbwlImagePath(this.print_fax_change_img); // 设置图片路径

      bean.setPrintId("");
      bean.setPrintName(user.get("name") + "");
      bean.setPrintNum(1l);
      bean.setPrintTime(sdfPrint.format(new Date())); // 打印时间
      bean.setSourceNo(changeNo);

      list.add(bean);
    }
    return list;
  }