- // 合并 List 中的相同数据行
- // Source : tmpOrderEntryListBeanList
- // Target : resultOrderEntryListBeanList
- // ------------------------------------------------------------------
-
- // (1)将结果赋给 Result Livon 2010-5-18 三
- // 整理列表,以便查询库存。
- private List<OrderEntryListBean> setOrderEntryList(List<OrderEntryListBean> orderEntryListBeanList){
-
- // (1)将结果赋给 Result Livon 2010-5-18 三
- //List<OrderEntryListBean> resultList = orderEntryListBeanList;
- ArrayList<OrderEntryListBean> list = new ArrayList<OrderEntryListBean>(orderEntryListBeanList);
- ArrayList<OrderEntryListBean> resultList = (ArrayList<OrderEntryListBean>) list.clone();
-
-
- int rdcID_i, rdcID_j ;
- int itemID_i, itemID_j ;
- double itemAmount_i, itemAmount_j = 0;
-
- // (2)从最后一行向上循环,直到第2条(如果存在的话)
- for(int i = resultList.size() - 1; i > 0; i--){
-
- rdcID_i = Integer.valueOf(resultList.get(i).getRdcId());
- itemID_i = Integer.valueOf(resultList.get(i).getItemId());
- itemAmount_i = Double.valueOf(resultList.get(i).getAmount());
-
- // (3)从第一条,向下,直到外循环的倒数第2条。
- for(int j = 0; j < i ; j++){
-
- rdcID_j = Integer.valueOf(resultList.get(j).getRdcId());
- itemID_j = Integer.valueOf(resultList.get(j).getItemId());
- itemAmount_j = Double.valueOf(resultList.get(j).getAmount());
-
- if(rdcID_i == rdcID_j && itemID_i == itemID_j ){
- resultList.get(j).setAmount( String.valueOf(itemAmount_i + itemAmount_j));
- resultList.remove(i);
- break;
- }
- }
-
- }
- return resultList;
-
- }