Beispiel #1
0
  /**
   * Cancel part accessory sale
   *
   * @param request HttpServletRequest
   * @param form ActionForm form data
   * @return Stri Return to forward page resultMessage Succeed to cancel Part accessory sale index
   *     save page
   */
  public String saleDetailCancel(HttpServletRequest request, ActionForm form) {
    String forward = "resultMessage";
    int tag = -1;
    try {
      String saleNo = request.getParameter("saleNo");
      String chkId = request.getParameter("chkId").trim();
      String flag = request.getParameter("flag");
      String salesType = request.getParameter("salesType");
      HttpSession session = request.getSession();
      Long userId = (Long) session.getAttribute("userId");
      Long orgCode = (Long) session.getAttribute("orgCode");

      tag = popupSaleInfoBo.cancelSaleDetail(saleNo, chkId, flag, userId);

      if (orgCode.intValue() == 421) {
        request.setAttribute("templetName", "1");
      } else {
        request.setAttribute("templetName", "0");
      }

      request.setAttribute("tempData", saleNo);
      request.setAttribute("tag", tag + "");
      if ("R".equals(salesType)) {
        request.setAttribute("businessFlag", "cancelSaleSuccess");
      } else {
        request.setAttribute("businessFlag", "cancelPreSaleSuccess");
      }

    } catch (Exception err) {
      err.printStackTrace();
    }

    return forward;
  }
Beispiel #2
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;
  }
Beispiel #3
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();
    }
  }
Beispiel #4
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;
  }