Example #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;
  }
Example #2
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;
  }