示例#1
0
  /**
   * Hub packing list
   *
   * @param doNo String Packing ID
   * @param orgCode Long ASC code
   * @return ArrayList Packing Info and part Info
   */
  public ArrayList hubReturnPartPrint(String doNo, Long orgCode) {
    ArrayList alDate = new ArrayList();
    CommonSearch cs = ((CommonSearch) SpringContextUtil.getBean("commonSearch"));
    String location = "";
    try {
      if (doNo != null && !doNo.equals("")) {
        List tempList = new ArrayList();
        tempList =
            this.getDao()
                .list("from DoListForm df where df.doNo='" + doNo.trim() + "' and rownum=1");

        List brokenList =
            (ArrayList)
                this.getDao()
                    .list(
                        " select rf.returnCode,rf.serviceSheetNo,rf.modelCode,rf.serialNo,rf.partCode,rf.snNo,rf.partDesc,rf.bpNum,rf.irisCodeName,rf.irisCodeDesc,rf.returnLocation from BrokenPartsHubForm rf where rf.hubId in(select df.bpId from DoListForm df where df.returnType='C' and df.doNo='"
                            + doNo.trim()
                            + "')");
        Iterator bt = brokenList.iterator();
        while (bt.hasNext()) {
          String[] data = new String[10];
          Object[] obj = (Object[]) bt.next();
          data[0] = obj[0] == null ? "" : obj[0].toString();
          data[1] = obj[1] == null ? "" : obj[1].toString();
          data[2] = obj[2] == null ? "" : obj[2].toString();
          data[3] = obj[3] == null ? "" : obj[3].toString();
          data[4] = obj[4] == null ? "" : obj[4].toString();
          data[5] = obj[5] == null ? "" : obj[5].toString();
          data[6] = obj[6] == null ? "" : obj[6].toString();
          data[7] = obj[7] == null ? "" : obj[7].toString();
          data[8] = obj[8] == null ? "" : obj[8].toString();
          data[9] = obj[9] == null ? "" : obj[9].toString();
          location = obj[10].toString();
          alDate.add(data);
        }
        DoListForm doListForm = (DoListForm) tempList.get(0);
        String temp[] = new String[5];
        temp[0] = cs.findOrgNameByOrgCode(orgCode);
        temp[1] = doListForm.getDoCode() == null ? "" : doListForm.getDoCode();
        temp[2] = cs.findOrgNameByOrgCode(doListForm.getDoTarget());
        temp[3] = Operate.toSqlDate().toString();
        temp[4] = location;
        alDate.add(0, temp);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return alDate;
  }
示例#2
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;
  }
示例#3
0
文件: ASCQABo.java 项目: a4m/newsisAP
  /**
   * Query Q&A<br>
   * Query all questions or query by asker. Questions include answered questions and not answered,
   * show not answered by default
   *
   * @param balanceQAForm BalanceQAForm Q&A form,include query conditions input by user
   * @return ArrayList Return query results
   */
  public ArrayList list(BalanceQAForm balanceQAForm) {
    List dataList = new ArrayList();
    ArrayList alData = new ArrayList();

    String answer = balanceQAForm.getAnswerTag();

    if (answer == null || answer.equals("")) {
      answer = "N";
      balanceQAForm.setAnswerTag(answer);
    } else if (answer.equals("00")) {
      balanceQAForm.setAnswerTag("");
    }

    ASCQAQuery uq = new ASCQAQuery(balanceQAForm);

    int count = 0;
    try {
      dataList = uq.doListQuery(balanceQAForm.getFromPage(), balanceQAForm.getToPage());
      count = uq.doCountQuery();

      BalanceQAForm uf = new BalanceQAForm();
      RoleForm rf = null;

      // System.out.println("dataList.size is : "+dataList.size());
      for (int i = 0; i < dataList.size(); i++) {
        String[] data = new String[12];
        uf = (BalanceQAForm) dataList.get(i);
        // System.out.println("uf.answerTag is :"+uf.getAnswerTag());
        data[0] = uf.getServiceSheetNo() == null ? "" : uf.getServiceSheetNo();
        data[1] = uf.getModelCode() == null ? "" : uf.getModelCode();
        data[2] = uf.getSerialNo() == null ? "" : uf.getSerialNo();
        data[3] = uf.getWarrantyCardNo() == null ? "" : uf.getWarrantyCardNo();
        data[4] = uf.getInvoiceNo() == null ? "" : uf.getInvoiceNo();
        data[5] = CommonSearch.getSystemName("QUESTION_ER", uf.getQuestionRoleBy().toString());
        data[6] = uf.getQuestionContent() == null ? "" : uf.getQuestionContent();
        data[7] = uf.getQuestionId() == null ? "" : uf.getQuestionId().toString();
        data[8] = uf.getQuestionRoleBy() == null ? "" : uf.getQuestionRoleBy().toString();
        data[9] = CommonSearch.getSystemName("QUESTION_ER", uf.getQuestionTarget().toString());
        data[10] = uf.getCreateDate() == null ? "" : uf.getCreateDate().toString();
        data[11] =
            CommonSearch.getSystemName(
                "QUESTION_ER", uf.getCopyRoleBy() == null ? "" : uf.getCopyRoleBy().toString());
        /*Iterator it = uf.getQuestContent().iterator();
        while (it.hasNext()) {
        	data[0] = uf.getServiceSheetNo()==null?"":uf.getServiceSheetNo();
        	data[1] = uf.getModelCode()==null?"":uf.getModelCode();
        	data[2] = uf.getSerialNo()==null?"":uf.getSerialNo();
        	data[3] = uf.getWarrantyCardNo()==null?"":uf.getWarrantyCardNo();
        	data[4] = uf.getInvoiceNo()==null?"":uf.getInvoiceNo();
        	//if(uf.getQuestionRoleBy()!=null){
        		TdQuestForm element =(TdQuestForm) it.next();
        		RoleBo rb=new RoleBo();

        	  // if(element.getFormType().equals("B")){
        		rf=rb.find(element.getQuestionRoleBy().toString());
        		data[5] = rf.getRoleName()==null?"":rf.getRoleName();
        	 // modified by xt	System.out.println("roleName questionRoleById====="+element.getQuestionRoleBy());
        		data[6] = element.getQuestionContent()==null?"":element.getQuestionContent();
        		//}
        	//}
        	data[7] = element.getQuestionId()==null?"":element.getQuestionId().toString();
        	//data[8] =uf.getQuestionRoleBy()==null?"":uf.getQuestionRoleBy().toString();
        	alData.add(data);
        	}	*/
        alData.add(data);
      }

      // System.out.println("answer type is :"+answer);
      alData.add(0, count + "");

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
    }
    return alData;
  }
示例#4
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();
    }
  }
示例#5
0
 /**
  * @param userId 审批人
  * @param wfid 流程id
  * @param comment
  * @param orgCodeRR
  * @param string
  * @param tkiid
  * @param approveAgree
  * @return
  * @throws Exception
  */
 @SuppressWarnings("rawtypes")
 public ProcessInfo approveCreditNote(
     Long userId,
     String wfid,
     String processId,
     String comment,
     Long orgCode,
     boolean approveAgree) {
   ProcessInfo pf = null;
   Map<String, Object> businessMap = new HashMap<String, Object>();
   businessMap.put("businessCode", wfid); // throw new Exception();
   businessMap.put("varorganizationCode", orgCode.toString());
   String stType =
       ((CommonSearch) SpringContextUtil.getBean("commonSearch")).findStTypeByOrgCode(orgCode);
   businessMap.put("varStType", stType);
   WorkFlowDao workFlowDao = (WorkFlowDao) BeanUtil.getBean("workFlowDao");
   try {
     WorkFlowNextRoles wfnr =
         workFlowDao.findWorkFlowNextRolesByProcessId(Integer.parseInt(processId));
     WBIDBOperateBo wbidbbo = new WBIDBOperateBo();
     TdWorkFlowForm wff = wbidbbo.getWorkFlowFormByWorkflowNoAndSheetType(processId, "D");
     String currentRole = "";
     if (null != wfnr) {
       log.info("CreditNote->审批----ROLES:" + wfnr.getProcessNextRoles());
       if (wfnr.getProcessNextRoles().indexOf(",") != -1) {
         String[] configRoles = wfnr.getProcessNextRoles().split(",");
         currentRole = configRoles[0];
       } else {
         currentRole = wfnr.getProcessNextRoles();
       }
     }
     TdWorkFlowInfoForm wfif = new TdWorkFlowInfoForm();
     // 审批单据号码
     wfif.setWorkflowNo(wff.getWorkflowNo());
     wfif.setSheetType("D"); // 审批单据类型
     wfif.setApproveUser(userId); // 审批人
     wfif.setRoleCode(wff.getNextRole());
     // 审批时角色
     wfif.setApproveDate(Operate.getCurrentDate());
     // 审批日期
     wfif.setWorkFlowStatus("R"); // 流程状态为等待审批
     if (approveAgree) {
       wff.setCurrentStatus(cn.com.sony.npc.common.SysConstants.NPC_WORKFLOW_STATUS_O);
       wfif.setApproveResult("Y"); // 审批同意
       wff.setApproveResult("Y");
     } else {
       wfif.setApproveResult("N"); // 审批不同意
       wff.setApproveResult("N");
     }
     wfif.setApproveNote(comment); // 审批内容
     wfif.setCreateBy(Long.valueOf(userId));
     if (!"".equals(currentRole)) {
       wff.setNextRole(Long.valueOf(currentRole)); // 设置下一个审批角色
     } else {
       wff.setNextRole(null); // 设置下一个审批角色
     }
     wff.setUpdateDate(Operate.getCurrentDate());
     wfif.setWff(wff);
     if (!wbidbbo.isClosedAlready(new Long(processId))) {
       wbidbbo.insert(wfif);
       // 工作流参数(MAP)准备工作
       Map params = workFlowInit.initApproveMap(businessMap, approveAgree + "", wfid, comment);
       // 启动BPE工作流
       IWorkFlowService workFlowService = (IWorkFlowService) BeanUtil.getBean("workFlowService");
       MockUser user = new MockUser();
       user.setUserId(userId + "");
       user.setUserName(CommonSearch.getInstance().findUserNameByUserId(userId));
       user.setCurrentRole(currentRole);
       pf = workFlowService.doApproveProcess(params, user);
       // 工作流审批结束TODO
       log.info("CreditNote->当前审批结束,下个审批节点是:" + pf.getNextStateId());
       log.info("CreditNote->............流程审批结束.............");
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return pf;
 }
示例#6
0
  /**
   * Part accessory sale index save
   *
   * @param request HttpServletRequest
   * @param form ActionForm form data
   * @param mapping ActionMapping
   * @param response HttpServletResponse
   */
  public void validate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    try {
      MultiEntity multiEntity = (MultiEntity) SpringContextUtil.getBean("multiEntity");
      HttpSession session = request.getSession();
      PrintWriter writer = response.getWriter();
      response.setContentType("text/xml");
      response.setHeader("Cache-Control", "no-cache");
      writer.println("<xml>");

      Long orgCode = (Long) session.getAttribute("orgCode");
      Boolean isSSC = (Boolean) session.getAttribute("isSSC");
      String stType = (String) session.getAttribute("stType");
      String pcType =
          ((CommonSearch) SpringContextUtil.getBean("commonSearch")).findPcTypeByOrgCode(orgCode);
      String partCode = request.getParameter("skuCode");
      String customerId = request.getParameter("customerId");
      int quantity = new Integer(request.getParameter("quantity")).intValue();
      // 得到 part info
      PartInfoForm partInfoForm = partInfoBo.find(partCode);
      PartsPriceLogic priceLogic = new PartsPriceLogic();
      //
      if (partInfoForm != null) {

        String clientType = "";
        Double partStdCost = null;
        FactorMarkUp priceGroupRelation = null;
        boolean hasPriceGroupFee = true;
        if (customerId != null && !customerId.equals("") && NumberUtils.isDigits(customerId)) {
          // 得到customer group id
          Long cusGrpid =
              ((CommonSearch) SpringContextUtil.getBean("commonSearch")).getCustomGrpId(customerId);
          if (cusGrpid != null) {
            clientType = cusGrpid.toString();
            priceGroupRelation =
                priceGroupBo.findGroupRelation(Long.parseLong(customerId), orgCode);
            TdCustomerInfoForm cus =
                (TdCustomerInfoForm)
                    priceGroupBo
                        .getDao()
                        .findById(TdCustomerInfoForm.class, Long.parseLong(customerId));
            if (priceGroupRelation == null) {
              priceLogic = new PartsPriceLogic();
            } else {
              priceLogic =
                  new PartsPriceLogic(priceGroupRelation.getPriceGroupId(), cus.getForSsc());
            }
            partStdCost = priceLogic.getPartPrice(partCode, "SS", orgCode, pcType, clientType);
            String enableMU6 =
                CommonSearch.getSystemCode("ENABLE_MU6", "MU6", multiEntity.getCountryCode());
            if ("P".equals(stType)
                && isSSC
                && (null != enableMU6 && "Y".equals(enableMU6.toUpperCase()))) {
              if (null != priceGroupRelation) {
                hasPriceGroupFee = partStdCost != 0d;
              } else {
                hasPriceGroupFee = false;
              }
            }
          }
        }

        boolean flag = partInfoBo.isCanUsePart(partCode, "S");

        /** *****新的计价逻辑****** */
        CommonSearch cs = ((CommonSearch) SpringContextUtil.getBean("commonSearch"));
        ArrayList<PartsSalesInfo> partList = new ArrayList<PartsSalesInfo>();
        SearchOptionListSetting extOptionList = null;

        String productSubCategory = partInfoForm.getProduct_Subcategory();
        String cityCode = cs.getCityCode(orgCode);
        String stateCode = cs.getStateCode(orgCode);
        String unitCode = cs.findUnitCodeByOrgCode(orgCode);
        String ascLevel = cs.getAscLevelByOrgCode(orgCode);
        RepairBasicInfo repairBasicInfo =
            new RepairBasicInfo(
                null,
                stateCode,
                cityCode,
                "",
                productSubCategory,
                "",
                "",
                orgCode,
                new Long(customerId),
                unitCode,
                ascLevel,
                "");
        repairBasicInfo.setOrgType(pcType);
        repairBasicInfo.setClientType(clientType);
        repairBasicInfo.setAbandonFlag(true);

        PartsSalesInfo partsSalesInfo = new PartsSalesInfo();
        partsSalesInfo.setPartCode(partInfoForm.getPartCode());
        partsSalesInfo.setChargableFlag("N");
        partsSalesInfo.setQuantity(quantity);

        partList.add(partsSalesInfo);

        PartFeeInterface partFeeInterface =
            (PartFeeInterface)
                SpringContextUtil.getBean("partFeeInterface" + multiEntity.getCountryCode());
        partFeeInterface.initSales(repairBasicInfo);
        PartFeeListBean partFeeListBean = partFeeInterface.getSalesPartFee(extOptionList, partList);
        ArrayList<PartFeeBean> partFeeBeanList = partFeeListBean.listFee();
        PartFeeBean partFeeBean = partFeeBeanList.get(0);

        PartTaxListBean partTaxListBean = partFeeBean.getTaxList();

        ArrayList<PartTaxBean> partTaxBeanList = partTaxListBean.listTax();

        writer.println("<partFlag>true</partFlag>");
        writer.println(
            "<partName>" + EscapeUnescape.escape(partInfoForm.getPartName()) + "</partName>");
        writer.println(
            "<partDesc>" + EscapeUnescape.escape(partInfoForm.getPartDesc()) + "</partDesc>");
        writer.println(
            "<partPrice>" + Operate.DoubleTransfer(partFeeBean.getPartPrice()) + "</partPrice>");
        //				System.out.println("<partPrice>" + Operate.DoubleTransfer(partFeeBean.getPartPrice())
        // + "</partPrice>");
        writer.println(
            "<stdCost>" + Operate.DoubleTransfer(partInfoForm.getStdCost()) + "</stdCost>");
        writer.println("<isHasSn>" + partInfoForm.getIsHasSn() + "</isHasSn>");
        writer.println("<isCanUsePart>" + flag + "</isCanUsePart>");
        writer.println("<perCost>" + Operate.DoubleTransfer(partStdCost) + "</perCost>");
        //				System.out.println("<perCost>"+Operate.DoubleTransfer(partStdCost)+"</perCost>");
        StringBuffer taxBuffer = new StringBuffer();
        int count = 0;
        Double totalTax = 0.0;
        for (PartTaxBean partTaxBean : partTaxBeanList) {

          writer.println("<taxRow id=\"" + count + "\">");
          writer.println(
              "<taxCode>" + EscapeUnescape.escape(partTaxBean.getTaxCode()) + "</taxCode>");
          writer.println(
              "<taxName>"
                  + EscapeUnescape.escape(popupSaleInfoBo.findTaxName(partTaxBean.getTaxCode()))
                  + "</taxName>");
          writer.println(
              "<taxRate>"
                  + EscapeUnescape.escape(
                      String.valueOf(Operate.formatPrice(partTaxBean.getTaxRate() * 100)))
                  + "</taxRate>");
          writer.println(
              "<taxAmt>"
                  + EscapeUnescape.escape(Operate.DoubleTransfer(partTaxBean.getTaxAmt()))
                  + "</taxAmt>");
          writer.println(
              "<convertedTaxRate>"
                  + EscapeUnescape.escape(
                      String.valueOf(Operate.formatPrice(partTaxBean.getActualTaxRate() * 100)))
                  + "</convertedTaxRate>");
          writer.println(
              "<taxType>" + EscapeUnescape.escape(partTaxBean.getTaxType()) + "</taxType>");
          writer.println("</taxRow>");
          Double tax = partTaxBean.getTaxAmt();
          String taxType = partTaxBean.getTaxType();
          totalTax = PriceLogicCommonHelper.calculateTaxByTaxType(totalTax, tax, taxType);

          String taxString =
              partTaxBean.getTaxCode()
                  + SPLITER1_STR
                  + popupSaleInfoBo.findTaxName(partTaxBean.getTaxCode())
                  + SPLITER1_STR
                  + partTaxBean.getTaxRate()
                  + SPLITER1_STR
                  + Operate.DoubleTransfer(partTaxBean.getTaxAmt())
                  + SPLITER1_STR
                  + partTaxBean.getActualTaxRate();

          taxBuffer.append(taxString);
          taxBuffer.append(SPLITER2_STR);
          count += 1;
        }
        writer.println(
            "<totalTax>" + EscapeUnescape.escape(Operate.DoubleTransfer(totalTax)) + "</totalTax>");
        writer.println(
            "<taxBuffer>" + EscapeUnescape.escape(taxBuffer.toString()) + "</taxBuffer>");
        writer.println("<hasPriceGroup>" + hasPriceGroupFee + "</hasPriceGroup>");
      } else {
        writer.println("<partFlag>false</partFlag>");
      }

      writer.println("</xml>");
      writer.flush();
      writer.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }