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

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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 删除登记数据 
	 */
	deleteRegistrationOrderLine: function(registrationOrderId){
		var requestUrl = "RegistrationOrderResource/deleteRegistrationOrderLine";
		var paramCount = 0;
		if(registrationOrderId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('registrationOrderId=' + registrationOrderId);
			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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询所有登记表 
	 */
	filterQueryRegistrationOrder: function(documentNo, stockOutPrepareDocumentNo, otherRecipientsOrderDocumentNo){
		var requestUrl = "RegistrationOrderResource/filterQueryRegistrationOrder";
		var paramCount = 0;
		if(documentNo != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('documentNo=' + documentNo);
			paramCount ++;
		}
		if(stockOutPrepareDocumentNo != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('stockOutPrepareDocumentNo=' + stockOutPrepareDocumentNo);
			paramCount ++;
		}
		if(otherRecipientsOrderDocumentNo != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('otherRecipientsOrderDocumentNo=' + otherRecipientsOrderDocumentNo);
			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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据登记主表id查询所有登记表明细 
	 */
	generateRegistrationOrderLine: function(id){
		var requestUrl = "RegistrationOrderResource/generateRegistrationOrderLine";
		var paramCount = 0;
		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);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 加载所有流程有关的登记明细列表 
	 */
	getElecEquipmentAllocationLineData: function(param){
		var requestUrl = "RegistrationOrderResource/getElecEquipmentAllocationLineData";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 加载所有和分配主表相关的明细列表 
	 */
	getElecEquipmentAllocationLineDto: function(param){
		var requestUrl = "RegistrationOrderResource/getElecEquipmentAllocationLineDto";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 加载所有电装 
	 */
	queryAllInfoByParam: function(param){
		var requestUrl = "RegistrationOrderResource/queryAllInfoByParam";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 *  
	 */
	queryDocumentData: function(){
		var requestUrl = "RegistrationOrderResource/queryDocumentData";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据短接单id查询短接明细 
	 */
	queryOtherRecipientsOrderLineDto: function(otherRecipientsOrderId){
		var requestUrl = "RegistrationOrderResource/queryOtherRecipientsOrderLineDto";
		var paramCount = 0;
		if(otherRecipientsOrderId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('otherRecipientsOrderId=' + otherRecipientsOrderId);
			paramCount ++;
		}


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询所有登记表 
	 */
	queryRegistrationOrder: function(param){
		var requestUrl = "RegistrationOrderResource/queryRegistrationOrder";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 查询所有登记主表的数据（点料） 
	 */
	queryRegistrationOrdersByUserId: function(param){
		var requestUrl = "RegistrationOrderResource/queryRegistrationOrdersByUserId";


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 根据领料单id查询领料明细 
	 */
	queryStockOutPrepareLineDto: function(stockOutPrepareId){
		var requestUrl = "RegistrationOrderResource/queryStockOutPrepareLineDto";
		var paramCount = 0;
		if(stockOutPrepareId != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('stockOutPrepareId=' + stockOutPrepareId);
			paramCount ++;
		}


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

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 保存登记数据 
	 */
	saveRegistrationOrder: function(registrationOrderDto){
		var requestUrl = "RegistrationOrderResource/saveRegistrationOrder";


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