Ejemplo n.º 1
0
  /**
   * RC add warranty claim fee
   *
   * @param request HttpServletRequest
   * @param form ActionForm
   * @return String Return results page
   */
  public String addBalanceFee(HttpServletRequest request, ActionForm form) {
    String forward = "resultMessage";
    ArrayList al = new ArrayList();
    int ftag = -1;
    int ptag = -1;
    try {

      /**
       * ******************************************************************** /*@Added/Modified by :
       * Veena /*@Date : 4/09/2012 /*@Reason : INC000000441294, CR 19 - Tax calculation by system
       * /*********************************************************************
       */
      String stateCode = null;
      String cityCode = null;
      String unitCode = null;
      Long organizationCode = null;
      String customerGroupId = null;
      ArrayList<String> feeTypeList = new ArrayList<String>();
      TreeMap<String, ServiceTaxListBean> serviceTaxMap = null;
      /** **********************Ends here********************************************* */
      Set balanceIdSet = new HashSet();
      HttpSession session = request.getSession();
      Long chargeStaffId = (Long) session.getAttribute("userId");
      String chks = (String) request.getParameter("chksBalanceId");
      BalanceFeeForm2 bf = (BalanceFeeForm2) form;
      String status = "";
      if ("bcApprove".equals(bf.getSheetType())) {
        status = "1";
      } else {
        status = "27";
      }
      //			System.out.println("sheetType---------------"+bf.getSheetType());
      //			System.out.println("status---------------"+status);
      //			BCBalanceApproveBo rbo=new BCBalanceApproveBo();
      List tempList = bcBalanceApproveBo.listVersion(chks);
      for (int i = 0; i < tempList.size(); i++) {
        BalanceFeeForm2 balanceFeeForm = (BalanceFeeForm2) tempList.get(i);
        balanceIdSet.add(balanceFeeForm.getBalanceId()); // 取不重复的balanceId
      }
      Iterator it = balanceIdSet.iterator();
      while (it.hasNext()) {
        BalanceFeeForm2 addFeeForm = new BalanceFeeForm2();
        Long tempBalanceId = (Long) it.next();
        addFeeForm.setBalanceId(tempBalanceId);
        addFeeForm.setBalanceFeeType(bf.getBalanceFeeType());
        addFeeForm.setBalanceSponsor(new Long(request.getParameter("hiddenFactoryInfo")));
        addFeeForm.setBalanceFee(bf.getBalanceFee());
        /**
         * ******************************************************************** /*@Added/Modified by
         * : Veena /*@Date : 4/09/2012 /*@Reason : INC000000441294, CR 19 - Tax calculation by
         * system /*********************************************************************
         */
        feeTypeList.add(bf.getBalanceFeeType());

        Long repairNo =
            Long.valueOf(bcBalanceApproveBo.findRepairNoByBalanceId(tempBalanceId.toString()));
        RepairServiceForm rsf = getRepairInfo(repairNo);
        organizationCode = rsf.getOrganizationCode();
        cityCode = cs.getCityCode(organizationCode);
        stateCode = cs.getStateCode(organizationCode);
        unitCode = cs.findUnitCodeByOrgCode(organizationCode);
        /* *******************************************************************/
        /*@Added/Modified by        : Manohar
        /*@Date                     : 17/04/2013
        /*@Reason                   : INC000000518392 - NeWSIS :: System issue :: Fee modification for jobs
        /**********************************************************************/

        if (null != rsf.getCustomerId() && rsf.getCustomerId().equals("")) {
          customerGroupId = cs.getCustomGrpId(rsf.getCustomerId().toString()).toString();
        }
        /* ************************ENDS HERE****************************************  */
        SearchOptionListSetting taxOptionList = new SearchOptionListSetting();

        taxOptionList.createServiceTaxDefaultInstance(
            stateCode, cityCode, unitCode, feeTypeList, customerGroupId);

        MultiEntity multiEntity = (MultiEntity) SpringContextUtil.getBean("multiEntity");
        String countryCode = multiEntity.getCountryCode();
        CommonSearchService commonSearchService =
            (CommonSearchService) SpringContextUtil.getBean("commonSearchService" + countryCode);

        serviceTaxMap = commonSearchService.getTaxList(taxOptionList);

        ServiceTaxListBean taxList =
            (serviceTaxMap == null) ? null : serviceTaxMap.get(bf.getBalanceFeeType());

        if (taxList != null) {
          taxList.calculate(bf.getBalanceFee());

          /* *******************************************************************/
          /*@Added/Modified by        : Sanjay
          /*@Date                     : 25/09/2012
          /*@Reason                   : INC000000456989 - IW Module Add fee Issue - Operation failed
          /**********************************************************************/

          if (null != taxList.getTotalTaxAmt().toString()) {
            addFeeForm.setTaxTotal(taxList.getTotalTaxAmt().toString());
          }
          /* ************************ENDS HERE********************************** */
        }

        addFeeForm.setBalanceFeeStatus(
            status); // 设置状��此页�结算�状�为BC暂�
        addFeeForm.setCreateBy(chargeStaffId);
        addFeeForm.setCreateDate(Operate.toUtilDate());
        addFeeForm.setIsSysGen("N"); // 代表是 BC手工添加的这笔费用
        addFeeForm.setRepairCode(
            bcBalanceApproveBo.findRepairCodeByBalanceId(tempBalanceId.toString())); // 方法代码
        if (bf.getBcRemark() != null && !"".equals(bf.getBcRemark())) {
          addFeeForm.setBcRemark("BC Manul Create:" + bf.getBcRemark());
        }
        ftag = bcBalanceApproveBo.add(addFeeForm);
        if (ftag == 1) {

          // 插入结算费用变化过程表
          SettlementFeeChangeProcdureForm sfcpf = new SettlementFeeChangeProcdureForm();
          sfcpf.setBalanceId(tempBalanceId);
          sfcpf.setBalanceFeeId(addFeeForm.getBalanceFeeId());
          sfcpf.setBalanceFee(bf.getBalanceFee());
          // wubin at 20100527 增加taxTotal
          Double tempTaxTotal =
              bf.getTaxTotal() == null || "".equals(bf.getTaxTotal().trim())
                  ? 0
                  : Double.parseDouble(bf.getTaxTotal());
          sfcpf.setTaxTotal(tempTaxTotal);
          sfcpf.setBalanceStatus(status);
          sfcpf.setChangeBy(chargeStaffId);
          sfcpf.setRemark(bf.getBcRemark());
          sfcpf.setCreateBy(chargeStaffId);
          sfcpf.setCreateDate(Operate.toUtilDate());
          ptag = bcBalanceApproveBo.add(sfcpf);
          if (ptag == -1) {
            bcBalanceApproveBo.delete(addFeeForm);
          }
        }
      }

      request.setAttribute("tag", ptag + "");
      if ("bcApprove".equals(bf.getSheetType())) {
        request.setAttribute("businessFlag", "RcApprove");
      } else {
        request.setAttribute("businessFlag", "BCWait");
      }
    } catch (VersionException ve) {
      forward = "versionErr";
    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }
Ejemplo n.º 2
0
  /**
   * Call method after controled part application approved
   *
   * @param ralpf Application details
   * @param approveFlag true:Approve passed,false:Approve failed
   */
  public void wbiBack(boolean approveFlag, RepairApplicationPRForm raprf, long userId) {
    try {
      RepairPartForm rpform =
          (RepairPartForm) this.getDao().findById(RepairPartForm.class, raprf.getPartsId());
      rpform.setPartRequestNo(raprf.getWorkflowId());
      this.getDao().update(rpform);
      // 将TD_UNREPAIR_STATUS置为完成
      try {
        List unRepairStatusForms =
            this.getDao()
                .list(
                    " from RepairUnRepairStatusInfoForm rursif where rursif.unRepairStatus='E' and rursif.repairNo="
                        + raprf.getRepairNo()
                        + " and rursif.workFlowNo="
                        + raprf.getWorkflowId());
        for (int i = 0; i < unRepairStatusForms.size(); i++) {
          RepairUnRepairStatusInfoForm rursif =
              (RepairUnRepairStatusInfoForm) unRepairStatusForms.get(i);
          rursif.setDbEndDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          rursif.setContinuanceDays(
              new Long(Operate.calculateDiffDays(rursif.getDbBeginDate(), rursif.getDbEndDate())));
          rursif.setContinuanceHours(
              new Long(Operate.calculateDiffHours(rursif.getDbBeginDate(), rursif.getDbEndDate())));

          rursif.setUpdateDate(
              new java.sql.Date(
                  ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime()));
          unRepairStatusForms.set(i, rursif);
        }
        this.getBatchDao().updateBatch(unRepairStatusForms);
      } catch (Exception e) {
        e.printStackTrace();
      }
      UserForm uf = (UserForm) this.getDao().findById(UserForm.class, userId);
      if (approveFlag) {

        // 取出此零件对应的维修单
        RepairServiceForm rsf =
            (RepairServiceForm)
                this.getDao().findById(RepairServiceForm.class, raprf.getRepairNo());
        // 取出此零件的基本信息

        // 根据PARTCODE查询RETURN PART 看是否RMA审批零件
        List returnPart =
            this.getDao()
                .list("from ReturnPartForm r where r.partCode='" + raprf.getPartCode() + "'");

        CommonSearch cs = ((CommonSearch) SpringContextUtil.getBean("commonSearch"));
        String pcType = cs.findPcTypeByOrgCode(rsf.getOrganizationCode());
        LimitPartApprove lpa = new LimitPartApprove();
        String[] approveRoles =
            lpa.getApproveRoles(
                "Y".equals(rpform.getPartFeeType()) ? "O" : "I",
                rsf.getManufacture(),
                rsf.getModelCode(),
                rpform.getPartCode(),
                pcType);

        if (!returnPart.isEmpty()) { // 如果符合RMA零件申请则自动启动RMA流程申请
          //			System.out.println("维修零件申请审批结束---系统自动启动RMA零件申请");
          RepairListBo rlb = new RepairListBo();
          RepairPartForm rpf = rlb.getRepairPartInfo(raprf.getPartsId());
          rpf.setRepairPartStatus("E");
          rpf.setRmaApply("Y");
          this.getDao().update(rpf);

          RepairApplicationRMAForm rmaForm = new RepairApplicationRMAForm();
          rmaForm.setRepairNo(rsf.getRepairNo());
          rmaForm.setServiceSheetNo(rsf.getServiceSheetNo());
          rmaForm.setModelCode(rsf.getModelCode());
          rmaForm.setSerialNo(rsf.getSerialNo());
          rmaForm.setPartsId(rpf.getPartsId());
          rmaForm.setPartCode(rpf.getPartCode());
          rmaForm.setOrganizationCode(rsf.getOrganizationCode());
          rmaForm.setModelName(rsf.getModelName());
          rmaForm.setCreateDate(
              ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          rmaForm.setCreateBy(rpf.getUpdateBy());
          rmaForm.setApplyMan(rpf.getUpdateBy());
          repairApplicationRMABo.startRMA(rmaForm, uf);
        } else if (approveRoles != null) { // 如果符合受控零件申请则自动启动受控流程申请
          //			System.out.println("维修零件申请审批结束---系统自动启动受控零件申请");
          RepairListBo rlb = new RepairListBo();
          RepairPartForm rpf = rlb.getRepairPartInfo(raprf.getPartsId());
          rpf.setRepairPartStatus("E");
          rpf.setLimitApply("Y"); // 如果是受控零件,先更改零件申请类型
          this.getDao().update(rpf); // 更新维修零件表
          RepairApplicationLPForm ralpf = new RepairApplicationLPForm();
          ralpf.setRepairNo(rsf.getRepairNo());
          ralpf.setServiceSheetNo(rsf.getServiceSheetNo());
          ralpf.setModelCode(rsf.getModelCode());
          ralpf.setModelName(rsf.getModelName());
          ralpf.setSerialNo(rsf.getSerialNo());
          ralpf.setPartsId(rpf.getPartsId());
          ralpf.setPartCode(rpf.getPartCode());
          ralpf.setOrganizationCode(rsf.getOrganizationCode());
          ralpf.setCreateDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          ralpf.setCreateBy(rpf.getUpdateBy());
          ralpf.setApplyMan(rpf.getUpdateBy());
          ralpf.setFactory(rsf.getManufacture());
          ralpf.setFee(rpf.getFee1());
          ralpf.setPartFeeType(rpf.getPartFeeType());

          repairApplicationLPBo.pageSave(ralpf, approveRoles, uf);
        } else {
          PartInfoForm pif =
              (PartInfoForm) this.getDao().findById(PartInfoForm.class, rpform.getPartCode());
          repairHandleBo.repairApproveAllocate(
              raprf.getWorkflowId(), raprf.getCreateBy(), rsf, rpform, pif);
        }
      } else {
        // 审批拒绝repair_part_info & partrequest update
        //			rpform.setRepairPartStatus("X");
        //			rpform.setCancelQty(new Long(1));
        //
        //	rpform.setUpdateDate(((MultiDate)SpringContextUtil.getBean("multiDate")).getMultiDate());
        //			this.getDao().update(rpform);
        repairHandleBo.processReject(rpform, raprf.getWorkflowId(), raprf.getCreateBy());
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }