Example #1
0
  /**
   * Query Hub packing
   *
   * @param doPackPartReturnMappingForm DoPackPartReturnMappingForm
   * @param orgCode Long ASC code
   * @return ArrayList Packing list
   */
  public ArrayList list(BrokenPartsHubForm form) {
    List dataList = new ArrayList();
    ArrayList alData = new ArrayList();
    ReturnPartHubQuery uq = new ReturnPartHubQuery(form); // 实例化queryBean
    int count = 0;
    try {
      dataList = uq.doListQuery(form.getFromPage(), form.getToPage()); // 查询坏件信息
      count = uq.doCountQuery();
      BrokenPartsHubForm uf = new BrokenPartsHubForm();
      for (int i = 0; i < dataList.size(); i++) {
        String[] data = new String[14];

        uf = (BrokenPartsHubForm) dataList.get(i);

        data[0] = uf.getReturnCode();
        data[1] = uf.getServiceSheetNo() == null ? "" : uf.getServiceSheetNo().toString(); // BO_ID
        data[2] = uf.getModelCode() == null ? "" : uf.getModelCode(); // 机型
        data[3] = uf.getSerialNo() == null ? "" : uf.getSerialNo(); // 机身号
        data[4] = uf.getPartCode() == null ? "" : uf.getPartCode(); // 零件编号
        data[5] = uf.getSnNo() == null ? "" : uf.getSnNo().toString(); // 零件序列号
        data[6] = uf.getPartName() == null ? "" : uf.getPartName(); // 零件中文描述
        data[7] = uf.getPartDesc() == null ? "" : uf.getPartDesc(); // 零件英文描述
        data[8] = uf.getBpNum() == null ? "" : uf.getBpNum().toString(); // 零件数量
        data[9] = uf.getReturnLocation() == null ? "" : uf.getReturnLocation(); // ReturnLocation
        data[10] =
            uf.getHubId().toString() + CommonSearch.split1 + uf.getVersion(); // 返回的BoId+版本号 						
        data[11] =
            uf.getReceiveDate() == null ? "" : Operate.formatYMDDate(uf.getReceiveDate()); // 回库日期
        alData.add(data);
      }
      alData.add(0, count + "");
    } catch (Exception e) {
      e.printStackTrace();
    } finally {

    }
    return alData;
  }
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;
  }