import { Common } from 'pc-component-v3';

/**
 * 工具类自动生成的API，请勿做任何修改，请勿做任何修改，请勿做任何修改（重要的事情说3遍）
 * 工具作者: 杨志杰
 * 项目事件地址Resource 
 */
export default {

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 领料页面添加收货地址 
	 */
	addReceivingAddress: function(projectItemId, toClient, toAddress, toContractUser, toContractPhone, defaultAddress){
		var requestUrl = "projectItemAddressResource/addReceivingAddress";
		var paramCount = 0;
		if(projectItemId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('projectItemId=' + projectItemId);
			paramCount ++;
		}
		if(toClient != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('toClient=' + toClient);
			paramCount ++;
		}
		if(toAddress != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('toAddress=' + toAddress);
			paramCount ++;
		}
		if(toContractUser != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('toContractUser=' + toContractUser);
			paramCount ++;
		}
		if(toContractPhone != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('toContractPhone=' + toContractPhone);
			paramCount ++;
		}
		if(defaultAddress != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('defaultAddress=' + defaultAddress);
			paramCount ++;
		}


		return new Promise((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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 添加发货信息 
	 */
	addShipingAddress: function(projectItemId, fromClient, fromAddress, fromContractUser, fromContractPhone, defaultAddress){
		var requestUrl = "projectItemAddressResource/addShipingAddress";
		var paramCount = 0;
		if(projectItemId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('projectItemId=' + projectItemId);
			paramCount ++;
		}
		if(fromClient != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('fromClient=' + fromClient);
			paramCount ++;
		}
		if(fromAddress != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('fromAddress=' + fromAddress);
			paramCount ++;
		}
		if(fromContractUser != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('fromContractUser=' + fromContractUser);
			paramCount ++;
		}
		if(fromContractPhone != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('fromContractPhone=' + fromContractPhone);
			paramCount ++;
		}
		if(defaultAddress != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('defaultAddress=' + defaultAddress);
			paramCount ++;
		}


		return new Promise((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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 删除项目事件发货信息 
	 */
	deleteByIdAndFRAddress: function(id){
		var requestUrl = "projectItemAddressResource/deleteByIdAndFRAddress";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 删除项目事件收货信息 
	 */
	deleteByIdAndTOAddress: function(id){
		var requestUrl = "projectItemAddressResource/deleteByIdAndTOAddress";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 领料查询发货地址信息 
	 */
	listByClientIdAndFR: function(projectItemAddressDto1){
		var requestUrl = "projectItemAddressResource/listByClientIdAndFR";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 领料查询收货地址信息 
	 */
	listByClientIdAndTO: function(projectItemAddressDto1){
		var requestUrl = "projectItemAddressResource/listByClientIdAndTO";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 修改项目事件发货货地址信息 
	 */
	updataByIdAndFRAddress: function(dataDto){
		var requestUrl = "projectItemAddressResource/updataByIdAndFRAddress";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 修改项目事件收货地址信息 
	 */
	updataByIdAndTOAddress: function(dataDto){
		var requestUrl = "projectItemAddressResource/updataByIdAndTOAddress";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 修改发货地址默认地址 
	 */
	updateByFRAddress: function(projectItemId, id){
		var requestUrl = "projectItemAddressResource/updateByFRAddress";
		var paramCount = 0;
		if(projectItemId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('projectItemId=' + projectItemId);
			paramCount ++;
		}
		if(id != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('id=' + id);
			paramCount ++;
		}


		return new Promise((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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 修改收货地址默认地址 
	 */
	updateByToAddress: function(projectItemId, id){
		var requestUrl = "projectItemAddressResource/updateByToAddress";
		var paramCount = 0;
		if(projectItemId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('projectItemId=' + projectItemId);
			paramCount ++;
		}
		if(id != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('id=' + id);
			paramCount ++;
		}


		return new Promise((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);
				}
			});
		});
	}
}
