//生成批次号
function genBatchNo(batchRuleCode,expDate){
	if(batchRuleCode == null){
		return null;
	}
	//获取完整的日期  
	var dateObj=new Date;  
	
	var year=dateObj.getFullYear();
	
	var month=dateObj.getMonth()+1;  
	month =(month<10 ? "0"+month:month);
	
	var day=dateObj.getDate();  
	day =(day<10 ? "0"+day:day);
	
	var currentDate = (year.toString() + month.toString() + day.toString());
	
	var batchNo = "";
	if(batchRuleCode == 'IWD'){//按入库日期
		batchNo = "IWD"+currentDate;
	}
	
	if(batchRuleCode == 'EXP'){//按到期日期
		if(expDate == null || expDate == '' ){
			batchNo = "IWD"+currentDate;
		} else {
			batchNo  = "EXP"+expDate;	
		}
	}
	
	if(batchRuleCode == 'CUS'){//货主自定义
		batchNo = "CUS"+currentDate;
	}
	
	if(batchRuleCode == 'WHE'){//仓库自定义
		batchNo = "WHE"+currentDate;
	}
	return batchNo;
}

//按生产日期加保质期天数得到过期日期
function getExpDate(dateStr,shelfLifeDays){
	if(dateStr == null || dateStr ==''){
		return null;
	}
	if(shelfLifeDays == null ){
		return null
	}
	
	var parseResult = parseDate8(dateStr)
	
	var dateObj = new Date();
	dateObj.setFullYear(parseResult.yearInt)
	dateObj.setMonth(parseResult.monthInt-1)
	dateObj.setDate(parseResult.dateInt)
	
	var shelfLifeDaysInt = parseInt(shelfLifeDays);
	

	console.log(dateObj)//可以输出对应的日期对象

	var t_s = dateObj.getTime();//转化为时间戳毫秒数
	dateObj.setTime(t_s +  1000 * 60 * 60 * 24 * shelfLifeDaysInt);//设置新时间比旧时间多天
	
	console.log(dateObj)//可以输出对应的日期对象 
	
	var year=dateObj.getFullYear();
	
	var month=dateObj.getMonth()+1;  
	month =(month<10 ? "0"+month:month);
	
	var day=dateObj.getDate();  
	day =(day<10 ? "0"+day:day);
	
	var currentDate = (year.toString() + month.toString() + day.toString());
	
	return currentDate;
}