|  | @@ -485,6 +485,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          JSONArray warehouseJSON = JSONArray.parseArray(warehousebillsitems);
 | 
	
		
			
				|  |  |          List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
 | 
	
		
			
				|  |  |          for (TWarehousebillsitems item : warehousebillsitemsList) {
 | 
	
		
			
				|  |  | +            // 查询库容量  是否可入库
 | 
	
		
			
				|  |  | +            int m=calculation(tWarehouseBills.getfWarehouseid(),item.getfGrossweight());
 | 
	
		
			
				|  |  | +            if(m == 0){
 | 
	
		
			
				|  |  | +                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                return AjaxResult.error("更新库存总账失败-->入库毛重大于库容");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              item.setfBillingway(tWarehouseBills.getfBillingway());
 | 
	
		
			
				|  |  |              item.setfChargedate(tWarehouseBills.getfChargedate());
 | 
	
		
			
				|  |  |              TWhgenleg tWhgenle = queryTWhgenleg(tWarehouseBills, item);
 | 
	
	
		
			
				|  | @@ -1048,4 +1054,55 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     *   库容-结余毛重
 | 
	
		
			
				|  |  | +     * @param fTotalgross
 | 
	
		
			
				|  |  | +     * @param fGrossweightblc
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public static BigDecimal  calculation1(String  fTotalgross, String fGrossweightblc){
 | 
	
		
			
				|  |  | +        BigDecimal num1 = new BigDecimal(fTotalgross);
 | 
	
		
			
				|  |  | +        BigDecimal num2 = new BigDecimal(fGrossweightblc);
 | 
	
		
			
				|  |  | +        BigDecimal result = num1.subtract(num2);
 | 
	
		
			
				|  |  | +        return result.setScale(2,BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     *   判断  是否允许 入库
 | 
	
		
			
				|  |  | +     * @param fId
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public  int  calculation (Long fId,BigDecimal fGrossweight){
 | 
	
		
			
				|  |  | +        // 仓库库容
 | 
	
		
			
				|  |  | +        TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(fId);
 | 
	
		
			
				|  |  | +        // 总账使用
 | 
	
		
			
				|  |  | +        List<Map<String, Object>> whouseList= tWhgenlegMapper.selectWareHouseListWhouse(fId);
 | 
	
		
			
				|  |  | +        if(whouseList!=null && whouseList.size()>0){
 | 
	
		
			
				|  |  | +            String  fTotalgross = null;
 | 
	
		
			
				|  |  | +            String fGrossweightblc = null;
 | 
	
		
			
				|  |  | +            for (Map<String, Object> m : whouseList){
 | 
	
		
			
				|  |  | +                for (String k : m.keySet()){
 | 
	
		
			
				|  |  | +                    // 获取毛重库容
 | 
	
		
			
				|  |  | +                    if(k.equals("fTotalgross")){
 | 
	
		
			
				|  |  | +                        fTotalgross= m.get(k).toString();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if(k.equals("fGrossweightD")){
 | 
	
		
			
				|  |  | +                        fGrossweightblc=  m.get(k).toString();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            BigDecimal result = calculation1(fTotalgross,fGrossweightblc);
 | 
	
		
			
				|  |  | +            if(result.compareTo(fGrossweight) == -1){
 | 
	
		
			
				|  |  | +                return 0;// 结余库容小于入库数
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                return 1;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            if(tWarehouse.getfTotalgross().compareTo(fGrossweight) == -1){
 | 
	
		
			
				|  |  | +                return 0;// 库容小于入库数
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                return 1;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |