//对重名单位进行合并
bool CMainFrame::CombineMedicines(void){ //合并同名单位 for(int i=0; i<m_stock.size(); i++) { //for(int j=i+1; j<m_stock.size(); j++) for(vector<medicine_stock>::iterator iter_2=m_stock[i].medicine.begin(); iter_2 != m_stock[i].medicine.end(); iter_2++) { for(vector<medicine_stock>::iterator iter_3=iter_2+1; iter_3 != m_stock[i].medicine.end(); ) { //判断是否为重名 if(iter_3->medi_name == iter_2->medi_name) { iter_2->amount += iter_3->amount; iter_3 = m_stock[i].medicine.erase(iter_3); } else iter_3++; } } }return true;
}