示例#1
0
 public void updateCreditNoteWfStatus(String billId, String status, Long userId)
     throws ComException, Exception {
   CreditNoteForm fm = new CreditNoteForm();
   CreditNoteMain fmmain = new CreditNoteMain();
   fmmain.setId(new Long(billId));
   fm.setCnm(fmmain);
   CreditNoteBo cnBo = (CreditNoteBo) SpringContextUtil.getBean("cnBo");
   CreditNoteMain cnm = cnBo.queryCreditNoteMain(fm);
   if (null != cnm) {
     List<Object> updateList = new ArrayList<Object>();
     Date currentDate = Operate.toUtilDate();
     cnm.setStatus(status);
     cnm.setUpdateBy(userId);
     cnm.setUpdateDate(currentDate);
     updateList.add(cnm);
     Set<CreditNoteDetail> detailSets = cnm.getCreditNoteDetails();
     for (CreditNoteDetail detail : detailSets) {
       if (SysConstants.CN_FLAG_Y.equals(detail.getCnFlag())) {
         detail.setStatus(status);
         detail.setUpdateBy(userId);
         detail.setUpdateDate(currentDate);
         updateList.add(detail);
       }
     }
     CreditNoteMainTemp cnmt =
         (CreditNoteMainTemp)
             this.getDao()
                 .uniqueResult("from CreditNoteMainTemp cnmt where cnmt.id=?", cnm.getRefTid());
     if (null != cnmt) {
       if (SysConstants.CN_STATUS_APPROVAL.equals(status)) {
         cnmt.setStatus(status);
       } else { // 如果审批不通过,Credit Note Temp主表置为关闭状态
         cnmt.setStatus(SysConstants.CN_TEMP_STATUS_CLOSED);
       }
       cnmt.setUpdateBy(cnm.getUpdateBy());
       cnmt.setUpdateDate(currentDate);
       updateList.add(cnmt);
     }
     this.getBatchDao().saveOrUpdateBatch(updateList);
   }
 }
示例#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
  /**
   * Method of submiting controled part applicaiton
   *
   * @param ralpf Controled part application
   * @param approveRoles Approve role list
   * @return 1:Successful,-1:Unsuccessful
   */
  public int pageSave(RepairApplicationPRForm ralpf, UserForm uf) {
    int returnFlag = -1;
    AllDefaultDaoImp daoImp = (AllDefaultDaoImp) SpringContextUtil.getBean("dao");
    String stType =
        ((CommonSearch) SpringContextUtil.getBean("commonSearch"))
            .findStTypeByOrgCode(ralpf.getOrganizationCode());
    WorkFlowConfigRole wfcr = null;
    try {

      ralpf.setWorkflowId(Long.valueOf(workFlowService.getBusinessId()));
      /* *******************************************************************/
      /*@Added/Modified by        : Deepak
      /*@Date                     : 14/10/2012
      /*@Reason                   : Part request application workflow
      /**********************************************************************/
      MultiEntity multiEntity = (MultiEntity) SpringContextUtil.getBean("multiEntity");
      String[] roleConfig = null;
      if (!multiEntity.getCountryCode().equalsIgnoreCase("IN")) {
        roleConfig =
            workFlowInit.getAllRole(BPEProcessConstants.PARTREQUEST, stType); // need to change
        ralpf.setAllApproveRoles(roleConfig[0]);
        logger.info("if ===from getallrole pagesave method==Deepak==" + roleConfig[0]);
      } else {
        if (ralpf.getWarrantyType().equals("O") && ralpf.getPartFeeType().equals("N")) {
          wfcr = daoImp.findByTempNameAndStep(BPEProcessConstants.PARTREQUEST, "STEP2", stType);
          logger.info("if part wfcr.getConfigRole()" + wfcr.getConfigRole());
          ralpf.setAllApproveRoles(wfcr.getConfigRole());

        } else {
          wfcr = daoImp.findByTempNameAndStep(BPEProcessConstants.PARTREQUEST, "STEP1", stType);
          //                  System.out.println("else part
          // wfcr.getConfigRole()"+wfcr.getConfigRole());
          ralpf.setAllApproveRoles(wfcr.getConfigRole());
          logger.info("else ===from getallrole pagesave method==Deepak==" + wfcr.getConfigRole());
        }
      }
      logger.info("===Pagesave method of Repair applicationPRBo.java file ");
      /** ******************************************************************* */
      returnFlag = this.getDao().insert(ralpf) ? 1 : -1;

      String tmplateId = "13";

      Map businessMap = new HashMap();
      businessMap.put("businessCode", ralpf.getServiceSheetNo());
      businessMap.put("varStType", stType);
      businessMap.put("varOrganizationCode", String.valueOf(ralpf.getOrganizationCode()));
      Map params =
          workFlowInit.initapplyMap(businessMap, uf, ralpf.getWorkflowId().toString(), tmplateId);
      NewsisUser nu = new NewsisUser();

      nu.setUserId(String.valueOf(uf.getId()));
      nu.setUserName(uf.getUserName());

      //			/***/
      WBIDBOperateBo wbido = new WBIDBOperateBo();
      String[] strs = ralpf.getAllApproveRoles().split(",");
      Long[] longs = new Long[strs.length + 2];
      longs[0] = null;
      longs[1] = null;
      for (int i = 0; i < strs.length; i++) {
        longs[i + 2] = new Long(strs[i]);
      }
      wbido.insertStartInfo(
          ralpf.getWorkflowId(),
          "P",
          ralpf.getApplyMan(),
          ralpf.getRepairNo(),
          ralpf.getServiceSheetNo(),
          new Long(strs[0]),
          longs);

      //			    System.out.println("写入到RepairUnRepairStatusInfoForm-----");
      List batchInsertList = new ArrayList();
      RepairUnRepairStatusInfoForm rursif = new RepairUnRepairStatusInfoForm();
      rursif.setRepairNo(ralpf.getRepairNo());
      rursif.setUnRepairStatus("E"); // Waiting for internal approve
      rursif.setDbBeginDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
      rursif.setOrganizationCode(ralpf.getOrganizationCode().toString());
      rursif.setUnrepairGenType("A");
      rursif.setWorkFlowNo(ralpf.getWorkflowId().toString());
      rursif.setCreateBy(ralpf.getCreateBy());
      rursif.setCreateDate(Operate.toUtilDate());
      batchInsertList.add(rursif);

      returnFlag = this.getBatchDao().insertBatch(batchInsertList) ? 1 : -1;
      //			///启动BPE申请工作流
      ProcessInfo pinfo = workFlowService.doStartProcess(params, nu);

    } catch (Exception e) {
      e.printStackTrace();
    }
    return returnFlag;
  }
示例#4
0
  /**
   * HUB defective part packing
   *
   * @param doPackPartReturnMappingForm DoPackPartReturnMappingForm
   * @param bpIds String bpId and version
   * @param userId Long User Id
   * @param doNo String Packing No
   * @return int 1:Successful,-1:Unsuccessful
   */
  public int hubReturnPartPack(
      String idList, Long userId, BrokenPartsHubForm form, String doNo, String doCode)
      throws VersionException {
    int tag = -1;
    boolean flag = false;
    ArrayList alData = new ArrayList();
    AllDefaultDaoImp adi = new AllDefaultDaoImp();
    try {

      Long doTarget =
          this.findReturnAddressByLocCode(form.getReturnLocation(), form.getOrganizationCode());
      //			System.out.println("doTarget"+doTarget);

      String versionId = Operate.toVersionData(idList);
      List tempList =
          this.listVersion(
              "from BrokenPartsHubForm as saf where (saf.hubId,saf.version) in (" + versionId + ")",
              idList.split(",").length);
      Iterator it = tempList.iterator();
      while (it.hasNext()) {
        BrokenPartsHubForm bph = (BrokenPartsHubForm) it.next();
        // 把要包装的数据添加到DoList表中

        DoListForm df = new DoListForm();

        df.setDoNo(doNo); // Do号

        df.setBpId(bph.getHubId()); // BrokenPartsHubForm 的hubId
        df.setSkuCode(bph.getPartCode());
        df.setRepairN(bph.getRepairNo());
        df.setSkuDesc(bph.getPartDesc()); // 零件描述
        df.setPackDate(Operate.toSqlDate()); // 打包时间
        df.setSkuType(bph.getPartTypeCode()); // 零件类型
        df.setReturnType("C");
        df.setOrganizationCode(bph.getOrganizationCode()); // 发货单位

        df.setSkuNum(bph.getBpNum()); // 零件数量
        df.setSnNo(bph.getSnNo()); // sn号
        df.setDoCode(doCode); // 箱号	
        df.setDoType("R"); // 包装类型
        df.setDoTarget(doTarget); // 创建人
        df.setCreateBy(userId);
        df.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-15  add time zone

        // 修改BrokenPartsHub表中的数据,将其"返还状态"改为"已包装"

        bph.setUpdateBy(userId);
        bph.setUpdateDate(Operate.toUtilDate());
        bph.setReturnStatus("D");
        bph.setDoCode(doCode);
        bph.setDoNo(doNo);

        Object[] objdf = {df, "i"};
        Object[] objbform = {bph, "u"};

        alData.add(objdf);
        alData.add(objbform);
      }
      flag = adi.allDMLBatch(alData);
      tag = flag == true ? 1 : -1;
    } catch (VersionException ve) {
      throw ve;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return tag;
  }
示例#5
0
  /**
   * Part accessory sale index save
   *
   * @param request HttpServletRequest
   * @param form form data
   * @return String Return to forward page resultMessage Succeed to save page of part accessory sale
   */
  public String sellPrepareSalesList(HttpServletRequest request, ActionForm form) {
    // String forward="sellRegisterList";
    String forward = "resultMessage";
    int tag = -1;

    try {
      SellRegisterForm srf = (SellRegisterForm) form;
      HttpSession session = request.getSession();
      Long userId = (Long) session.getAttribute("userId");
      Long orgCode = (Long) session.getAttribute("orgCode");
      String orgCode2 = request.getParameter("stationCode");
      if (orgCode2 != null && Operate.isPositiveInteger(orgCode2)) {
        orgCode = new Long(orgCode2);
        srf.setOrgName(
            ((CommonSearch) SpringContextUtil.getBean("commonSearch"))
                .findOrgNameByOrgCode(orgCode));
      }

      // 接收表单提交数据

      String[] skuCode1 = request.getParameterValues("skuCode1"); // SKU编号
      String[] skuQuanty1 = request.getParameterValues("skuQuanty1");
      // 数量
      String[] bkbs = request.getParameterValues("bkbs"); // 订购选项
      String[] marks = request.getParameterValues("marks"); // 备注
      String[] stdCost1 = request.getParameterValues("stdCost1"); // 建议价格
      String[] count1 = request.getParameterValues("count1"); // 实际价格
      String[] partDesc1 = request.getParameterValues("partDesc1");
      // SKU描述-英
      String[] partName1 = request.getParameterValues("partName1");
      // SKU描述-中
      String[] stdCost0 = request.getParameterValues("stdCost0"); // 建议单价
      String[] wcNo = request.getParameterValues("wcNo"); // 保卡号
      String[] sn1 = request.getParameterValues("sn1"); // SN号
      String[] lot1 = request.getParameterValues("lot1"); // LOT号
      String[] discount1 = request.getParameterValues("discount1");
      String[] totalTax = request.getParameterValues("totalTax");
      String taxBuffer[] = request.getParameterValues("taxBuffer");
      String totoalDiscount = request.getParameter("totalDiscount");
      // 销售来源
      String fromSales =
          request.getParameter("fromSales") == null ? "0" : request.getParameter("fromSales");
      //			PopupSaleInfoBo sibo = new PopupSaleInfoBo();
      // 销售信息表 TD_SALES_INFO
      TdCustomerInfoForm tdCustomer = customerInfoBo.findByID(srf.getCustomerId());
      SalesInfoForm sif = new SalesInfoForm();
      String saleNo = FormNumberBuilder.getNewSaleOrderNumber(orgCode.toString());
      // 销售单编号
      sif.setSaleNo(saleNo);
      sif.setCustomerId(srf.getCustomerId());
      sif.setCustomerName(srf.getCustomerN());
      sif.setPhone(srf.getCustomerTele());
      sif.setFormCreaDate(Operate.toUtilDate());
      sif.setTotalPrice(srf.getTotalPrice());
      sif.setSalesBy(userId);
      sif.setSaleStatus("N"); // 未确认预销售
      sif.setStationCode(orgCode);
      sif.setFromSales(new Long(fromSales));
      sif.setContractNo(srf.getContractNo());
      sif.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-16  add time zone
      srf.setSaleNo(saleNo);
      srf.setSaleDate(sif.getFormCreaDate());
      srf.setSuggestPrice(srf.getTotalPrice());
      sif.setTotalDiscount(totoalDiscount);
      // 生成预销售单是的创建人 add by hanxn
      sif.setCreateBy(userId);
      if (tdCustomer != null) {
        sif.setMobile(tdCustomer.getMobile());
      }
      ArrayList psfList = new ArrayList();

      // 销售/预定明细 TD_SALES_DETAIL
      if (skuCode1 != null && skuCode1.length > 0)
        for (int i = 0; i < skuCode1.length; i++) {
          Integer partNum =
              Operate.isPositiveInteger(skuQuanty1[i]) ? new Integer(skuQuanty1[i]) : null;
          Double perCost = Operate.isNumeric(stdCost0[i]) ? new Double(stdCost0[i]) : null;
          Double perPrice = Operate.isNumeric(count1[i]) ? new Double(count1[i]) : null;

          PartSaleForm psf = new PartSaleForm();
          psf.setSaleNo(saleNo);
          psf.setPartCode(skuCode1[i]);
          psf.setPartStatus("P"); // 等待分配
          psf.setPartNum(partNum);
          psf.setPerCost(perCost);
          psf.setPerPrice(perPrice);
          psf.setRemark(marks[i]);
          psf.setCreateBy(userId);
          psf.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-16  add time zone
          psf.setIsBackToBack(bkbs[i]);
          psf.setWarrantyCardNo(wcNo[i]);
          psf.setSnNo(sn1[i]);
          psf.setLotNo(lot1[i]);
          psf.setDiscount(discount1[i]);

          // 存储税begin
          String taxString = taxBuffer[i];

          if (null != taxString && !"".equals(taxString)) {
            String[] taxCount = taxString.split(SPLITER2_STR);
            if (null != taxCount && taxCount.length > 0) {
              for (int c = 0; c < taxCount.length; c++) {
                String[] taxDetial = taxCount[c].split(SPLITER1_STR);
                TdPartSalesTaxDetail sd = new TdPartSalesTaxDetail();
                sd.setSoId(new Long(1));
                sd.setTaxCode(taxDetial[0] == null ? "" : taxDetial[0]);
                sd.setTaxRate(taxDetial[2] == null ? null : new Double(taxDetial[2]));
                sd.setConvertedTaxRate(taxDetial[4] == null ? null : new Double(taxDetial[4]));
                sd.setTaxAmt(taxDetial[3] == null ? null : new Double(taxDetial[3]));
                sd.setDeletFlag(0);
                sd.setCreatedDate(Operate.getCurrentDate());
                sd.setCreateBy(0L);
                sd.setSaleNo(saleNo);
                psf.getTaxDetails().add(sd);
              }
            }
          }

          psfList.add(psf);
          // 存储税 end

          sif.getSalesDetails().add(psf);
        }
      tag = popupSaleInfoBo.add(sif);

      /*
      ArrayList tempList=new ArrayList();\
      if(tag==1){
      	ArrayList saleList=new ArrayList(sif.getSalesDetails());
      	//System.out.println("--------------saleList="+saleList.size());
      	for(int i=0;i<saleList.size();i++){
      		PartSaleForm psf2=(PartSaleForm)saleList.get(i);

      		String temp[]=new String[9];
      		temp[0]=psf2.getSoId().toString();
      		temp[1]=skuCode1[i];
      		temp[2]=partDesc1[i];
      		temp[3]=partName1[i];
      		temp[4]=wcNo[i];
      		temp[5]=sn1[i];
      		temp[6]=lot1[i];
      		temp[7]=skuQuanty1[i];
      		temp[8]=stdCost1[i];

      		tempList.add(temp);
      	}

      	request.setAttribute("tempList",tempList);
      	request.setAttribute("sellRegisterForm",srf);
      }
      request.setAttribute("flag","Y");
      */

      request.setAttribute("templetName", fromSales);
      request.setAttribute("tempData", sif.getSaleNo());

      request.setAttribute("tag", tag + "");
      request.setAttribute("businessFlag", "sellPrepareList");

    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }
示例#6
0
  /**
   * Part accessory sale index save
   *
   * @param request HttpServletRequest
   * @param form ActionForm form data
   * @return String Return to forward page resultMessage Succeed to save page of part accessory sale
   */
  public String sellRegisterSalesList(HttpServletRequest request, ActionForm form) {
    // String forward="sellRegisterList";
    String forward = "resultMessage";
    int tag = -1;

    try {
      HttpSession session = request.getSession();
      Long userId = (Long) session.getAttribute("userId");
      Long orgCode = (Long) session.getAttribute("orgCode");

      // 接收表单提交数据
      SellRegisterForm srf = (SellRegisterForm) form;
      String[] skuCode1 = request.getParameterValues("skuCode1"); // SKU编号
      String[] skuQuanty1 = request.getParameterValues("skuQuanty1");
      // 数量
      String[] bkbs = request.getParameterValues("bkbs"); // 订购选项
      String[] marks = request.getParameterValues("marks"); // 备注
      String[] stdCost1 = request.getParameterValues("stdCost1"); // 建议价格
      String[] count1 = request.getParameterValues("count1"); // 实际价格
      String[] discount1 = request.getParameterValues("discount1");
      // Discount
      String[] partDesc1 = request.getParameterValues("partDesc1");
      // SKU描述-英
      String[] partName1 = request.getParameterValues("partName1");
      // SKU描述-中
      String[] stdCost0 = request.getParameterValues("stdCost0"); // 建议单价 价格逻辑后的价格
      String[] stdCost = request.getParameterValues("stdCost"); // 成本单价

      String[] wcNo = request.getParameterValues("wcNo"); // 保卡号
      String[] sn1 = request.getParameterValues("sn1"); // SN号
      String[] lot1 = request.getParameterValues("lot1"); // LOT号

      String[] totalTax = request.getParameterValues("totalTax");
      String totalPrice = request.getParameter("totalPrice");

      String taxBuffer[] = request.getParameterValues("taxBuffer");

      String totoalDiscount = request.getParameter("totalDiscount");

      //			System.out.println("totoalDiscount -=-=-=-=-=-=-=-"+totoalDiscount);
      ArrayList partSalesTaxList = new ArrayList();
      // add by sr 后台计算实际价格总和
      // String[] partSn=request.getParameterValues("partSnNo1");//零件序列号
      //			double total=0;
      //			if(count1!=null&&count1.length>0)
      //			for(int j=0;j<count1.length;j++){
      //				//Double d=Double.valueOf(count1[j]);
      //
      //				BigDecimal b1 = new BigDecimal(count1[j]);//update by sr 防止double运算精度问题
      //				BigDecimal b2 = new BigDecimal(Double.toString(total));
      //				BigDecimal b3 = new BigDecimal(totalTax[j]);
      //				total=b1.add(b2).doubleValue();
      //
      //
      //				//total+=d.doubleValue();
      //			}

      // add by sr end

      PopupSaleInfoBo sibo = new PopupSaleInfoBo();
      // 销售信息表 TD_SALES_INFO
      SalesInfoForm sif = new SalesInfoForm();
      String saleNo = FormNumberBuilder.getNewSaleOrderNumber(orgCode.toString());

      TdCustomerInfoForm tdCustomer = customerInfoBo.findByID(srf.getCustomerId());
      sif.setSaleNo(saleNo);
      sif.setCustomerId(srf.getCustomerId());
      sif.setCustomerName(srf.getCustomerN());
      sif.setPhone(srf.getCustomerTele());
      sif.setFormCreaDate(Operate.toUtilDate());
      sif.setTotalPrice(new Double(totalPrice)); // update by sr
      sif.setSalesBy(userId);
      sif.setSaleStatus("P");
      sif.setStationCode(orgCode);
      sif.setFromSales(new Long(0));
      sif.setContractNo(srf.getContractNo());
      sif.setPartNum(srf.getQuantityAll());
      sif.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-16  add time zone
      if (tdCustomer != null) {
        sif.setMobile(tdCustomer.getMobile()); // 用户的电话号码
      }
      // 生成预销售单是的创建人 add by hanxn
      sif.setCreateBy(userId);

      srf.setSaleNo(saleNo);
      srf.setSaleDate(sif.getFormCreaDate());

      srf.setTotalDiscount(totoalDiscount);

      sif.setTotalDiscount(totoalDiscount);
      //			System.out.println("totoaldiscount-=-=-=-=-=-=-=-=-=-=-=-222222"+sif.getTotalDiscount());
      ArrayList dataList = new ArrayList();
      ArrayList psfList = new ArrayList();

      // 销售/预售明细 TD_SALES_DETAIL
      if (skuCode1 != null && skuCode1.length > 0)
        for (int i = 0; i < skuCode1.length; i++) {
          Integer partNum =
              Operate.isPositiveInteger(skuQuanty1[i]) ? new Integer(skuQuanty1[i]) : null;
          Double perCost =
              Operate.isNumeric(stdCost0[i]) ? new Double(stdCost0[i]) : null; // 价格逻辑后的单价
          Double perPrice =
              Operate.isNumeric(count1[i]) ? new Double(count1[i]) : null; // 调用价格逻辑后算出的这个零件价格*数量总和
          Double standCost = Operate.isNumeric(stdCost[i]) ? new Double(stdCost[i]) : null; // 零件基价

          PartSaleForm psf = new PartSaleForm();
          psf.setSaleNo(saleNo);
          psf.setPartCode(skuCode1[i]);
          psf.setPartStatus("P");
          psf.setPartNum(partNum);
          psf.setPerCost(perCost);
          psf.setPerPrice(perPrice);
          psf.setRemark(marks[i]);
          psf.setCreateBy(userId);
          psf.setIsBackToBack(bkbs[i]);
          psf.setWarrantyCardNo(wcNo[i]);
          psf.setSnNo(sn1[i]);
          psf.setLotNo(lot1[i]);
          psf.setAppPartCode(skuCode1[i]); // 保存第一次申请的零件号 add by sr
          psf.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-16  add time zone
          psf.setDiscount(discount1[i]);

          String taxString = taxBuffer[i];

          if (null != taxString && !"".equals(taxString)) {
            String[] taxCount = taxString.split(SPLITER2_STR);
            if (null != taxCount && taxCount.length > 0) {
              for (int c = 0; c < taxCount.length; c++) {
                String[] taxDetial = taxCount[c].split(SPLITER1_STR);
                TdPartSalesTaxDetail sd = new TdPartSalesTaxDetail();
                sd.setSoId(new Long(1));
                sd.setTaxCode(taxDetial[0] == null ? "" : taxDetial[0]);
                sd.setTaxRate(taxDetial[2] == null ? null : new Double(taxDetial[2]));
                sd.setConvertedTaxRate(taxDetial[4] == null ? null : new Double(taxDetial[4]));
                sd.setTaxAmt(taxDetial[3] == null ? null : new Double(taxDetial[3]));
                sd.setDeletFlag(0);
                sd.setCreatedDate(Operate.getCurrentDate());
                sd.setCreateBy(0L);
                sd.setSaleNo(saleNo);
                psf.getTaxDetails().add(sd);
              }
            }
          }

          psfList.add(psf);

          // 零件申请表 TD_PARTS_REQUEST
          PartsRequestForm prf = new PartsRequestForm();
          prf.setFormId(saleNo); // 销售单号
          if ("Y".equals(bkbs[i])) {
            prf.setReqType("T"); // 申请类型(Back To Back)
          } else if ("Q".equals(bkbs[i])) {
            prf.setReqType("Q"); // 申请类型(特殊)
          } else {
            prf.setReqType("S"); // 申请类型(普通)
          }
          prf.setReqStat("P"); // 零件申请状态
          prf.setPartsCode(skuCode1[i]); // 零件编号
          prf.setReqNum(partNum); // 零件数量
          prf.setPerCost(standCost); // 成本  (stand cost)
          prf.setOrganizationCode(orgCode); // 维修站代码
          prf.setReqDate(sif.getFormCreaDate()); // 申请日期
          prf.setRequestBy(userId); // 申请人
          prf.setPartType(
              ((CommonSearch) SpringContextUtil.getBean("commonSearch")).getPartType(skuCode1[i]));
          // SKU类型
          prf.setCreateBy(userId);
          prf.setRemark(marks[i]);
          prf.setRequestPartCode(skuCode1[i]); // add by sr 2009-03-31 保存原始申请零件
          prf.setCreateDate(Operate.toUtilDate()); // added by jackyu 2011-03-21  add time zone
          dataList.add(prf);
        }
      // 先插入request表
      tag = popupSaleInfoBo.sellRegisterAdd(dataList);
      if (tag == 1) {
        // 将requestId存入PartsRequestForm
        for (int i = 0; i < psfList.size(); i++) {
          PartSaleForm psf2 = (PartSaleForm) psfList.get(i);
          PartsRequestForm prf2 = (PartsRequestForm) dataList.get(i);
          psf2.setRequestId(prf2.getId());
          sif.getSalesDetails().add(psf2);
        }
        // 再插入销售业务表
        tag = popupSaleInfoBo.add(sif);
        if (tag == 1) {
          // 调用分配逻辑 U-U货不可以出库
          popupSaleInfoBo.saleAllocate(saleNo);

          // CCC用户
          if (orgCode.intValue() == 421) {
            request.setAttribute("templetName", "1");
          } else {
            request.setAttribute("templetName", "0");
          }
          request.setAttribute("tempData", sif.getSaleNo());
        }
        request.setAttribute("tag", tag + "");
        request.setAttribute("businessFlag", "sellRegisterList");
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }