/**
 * 工具类自动生成的API，请勿做任何修改，请勿做任何修改，请勿做任何修改（重要的事情说3遍）
 * 工具作者: 杨志杰
 *  
 */
var ProjectItemResource = {

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 物料页面添加项目 
	 */
	addNoAndNameByProject : function(name, no){
		var requestUrl = "ProjectItemResource/addNoAndNameByProject";
		var paramCount = 0;
		if(name != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('name=' + name);
			paramCount ++;
		}
		if(no != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('no=' + no);
			paramCount ++;
		}


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "post",
				contentType: "application/json",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询项目 
	 */
	getProjectItems : function(){
		var requestUrl = "ProjectItemResource/getProjectItems";


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 获取集团公司下面所有公司和分公司的资产分类 
	 */
	listRootSubProjectItems : function(){
		var requestUrl = "ProjectItemResource/listRootSubProjectItems";


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询所有项目 
	 */
	projectItem : function(){
		var requestUrl = "ProjectItemResource/projectItem";


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询公司所有仓库 
	 */
	queryAllProjectItems : function(){
		var requestUrl = "ProjectItemResource/all";


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				contentType: "application/json",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据条件查询公司项目事件 
	 */
	queryByCondition : function(name){
		var requestUrl = "ProjectItemResource/queryByCondition";
		var paramCount = 0;
		if(name != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('name=' + name);
			paramCount ++;
		}


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				contentType: "application/json",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 分页查询所有的工作令数据 
	 */
	queryProjectItemDto : function(param){
		var requestUrl = "ProjectItemResource/queryProjectItemDto";


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "post",
				contentType: "application/json",
				
				dataType: "json",
				data: JSON.stringify(param),
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
	querySubProjectItems : function(projectItemId){
		var requestUrl = "ProjectItemResource/querySubProjectItems";
		var paramCount = 0;
		if(projectItemId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('projectItemId=' + projectItemId);
			paramCount ++;
		}


		return new Promise(function(resolve, reject) {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	}
}
