|  | @@ -103,15 +103,17 @@ public class DistributionServiceImpl implements DistributionService {
 | 
		
	
		
			
			| 103 | 103 |          return Tools.moreThanZeroResultJSON(num);
 | 
		
	
		
			
			| 104 | 104 |      }
 | 
		
	
		
			
			| 105 | 105 |  
 | 
		
	
		
			
			| 106 |  | -public void lockAndInsertDetail(  List<Store> list,  Distribution distribution , String userId, String belongId){
 | 
		
	
		
			
			| 107 |  | -    for (int i = 0; i < list.size(); i++) {
 | 
		
	
		
			
			|  | 106 | +    public void lockAndInsertDetail(  List<Store> list,  Distribution distribution , String userId, String belongId){
 | 
		
	
		
			
			|  | 107 | +        // 重新获取ID,第一次配车的时候会出现没有ID的情况
 | 
		
	
		
			
			|  | 108 | +        Distribution distribution1 = distributionMapper.selectByTruckNo(distribution.getTruckNo(), belongId);
 | 
		
	
		
			
			|  | 109 | +        for (int i = 0; i < list.size(); i++) {
 | 
		
	
		
			
			| 108 | 110 |          Store store = storeMapper.selectByPrimaryKey(list.get(i).getId());
 | 
		
	
		
			
			| 109 |  | -        if (!store.getLockFlag().equals("1") && distribution.getId()!= null && !distribution.getId().equals("")){
 | 
		
	
		
			
			|  | 111 | +        if (!store.getLockFlag().equals("1") && distribution1.getId()!= null && !distribution1.getId().equals("")){
 | 
		
	
		
			
			| 110 | 112 |              list.get(i).setLockFlag("1");
 | 
		
	
		
			
			| 111 | 113 |              num += storeMapper.updateByPrimaryKey(list.get(i));
 | 
		
	
		
			
			| 112 |  | -            DistributionDetail detail = getDistributionDetail(distribution, list.get(i), userId, belongId);
 | 
		
	
		
			
			|  | 114 | +            DistributionDetail detail = getDistributionDetail(distribution1, list.get(i), userId, belongId);
 | 
		
	
		
			
			| 113 | 115 |              num += distributionDetailMapper.insert(detail);
 | 
		
	
		
			
			| 114 |  | -            DistributionRecord record  = getDistributionRecord(distribution, list.get(i), "1",userId, belongId);
 | 
		
	
		
			
			|  | 116 | +            DistributionRecord record  = getDistributionRecord(distribution1, list.get(i), "1",userId, belongId);
 | 
		
	
		
			
			| 115 | 117 |              num += distributionRecordMapper.insert(record);
 | 
		
	
		
			
			| 116 | 118 |          }
 | 
		
	
		
			
			| 117 | 119 |  
 |