webservices.factory('vatOutputInvoiceManageService', ['$http', 'apiConfig', function ($http, apiConfig) {
    'use strict';
    return {
        //手工更新数据
        manualUpdateSFData: function () {
            return $http.get('/outputInvoiceImported/manualUpdateSFData', apiConfig.create());
        },

        //Reassign VRL
        reassignCase: function (reassignReason) {
            return $http.post('/outputInvoiceImported/reassignCase', reassignReason , apiConfig.create());
        },

        //获取已导入数据
        getOutputImportedList: function (queryParm) {
            return $http.post('/outputInvoiceImported/getImportedData', queryParm, apiConfig.create());
        },

        // 获取编辑的outputInvoiceEdited
        getOutputInvoiceEditedList: function (model) {
            return $http.post('/outputInvoiceEdited/getOutputInvoiceEditedList', model, apiConfig.create());
        },

        // 存入到发票表中
        addOutputInvoicePrinted: function (model, loadingBar) {

            var ignoreLoadingBar = true;
            // 默认不显示转圈圈,如果加载LoadBar,则显示
            if (loadingBar) {
                ignoreLoadingBar = false;
            }

            var config = { ignoreLoadingBar: ignoreLoadingBar };
            return $http.post('/outputInvoiceEdited/addOutputInvoicePrinted', model, apiConfig.create(config));
        },

        // 发票编辑保存
        updateOutputInvoiceEdit: function (model) {
            return $http.post('/outputInvoiceEdited/updateOutputInvoiceEdit', model, apiConfig.create());
        },

        // 获取已打印GD-BD发票
        getIssuedInvoiceGdList: function (queryParm) {
            return $http.post('/outputInvoicePrinted/getIssuedInvoiceGdList', queryParm, apiConfig.create());
        },

        // 获取修改待打印发票理由
        getAllOutputInvoiceUpdateReasonList: function () {
            return $http.get('/outputInvoiceEdited/getAllOutputInvoiceUpdateReasonList', apiConfig.create());
        },

        //获取已打印的BD-USER发票列表
        getIssuedVehicleBdList: function (queryParm) {
            return $http.post('/outputInvoicePrinted/getIssuedVehicleBdList', queryParm, apiConfig.create());
        },

        //根据vin获取来自sf的BD信息
        getOutputInvoiceImportedByVin: function (vin) {
            return $http.get('/outputInvoiceImported/getOutputInvoiceImportedByVin/' + vin, apiConfig.create());
        },
        //special vat invoice list
        getSpecailGBInvoiceList: function (dto) {
            return $http.post('/outputInvoiceGBIssued/getGBInvoiceList', dto, apiConfig.create());
        },
        //special vat invoice detail
        getGBInvoiceDetail: function (id) {
            return $http.get('/outputInvoiceGBIssued/getGBDetail/' + id, apiConfig.create());
        },
        //GD-BD invoice cancel
        cancelGDInvoice: function (list) {
            return $http.post('/outputInvoiceGBIssued/gdInvoiceCancel', list, apiConfig.create());
        },
        //GD-BD red letter
        gdRedLetter: function (detailID) {
            return $http.post('/outputInvoiceGBIssued/gdRedletter?detailID=' + detailID, {}, apiConfig.create());
        },
        //GD-BD multiple red letter
        gdMultipleRedLetter: function (detailIDs) {
            return $http.post('/outputInvoiceGBIssued/gdMultipleRedletter' ,detailIDs, apiConfig.create());
        },
        //更新GD-BD Status
        updateInvoiceGdBdStatus: function (id, status) {
            return $http.post('/outputInvoicePrinted/updateInvoiceGdBdStatus/' + id + '/' + status, {}, apiConfig.create());
        },

        //更新GD-BD的车辆 Status
        updateInvoiceVichelGdBdStatus: function (id, status) {
            return $http.post('/outputInvoicePrinted/updateInvoiceVichelGdBdStatus/' + id + '/' + status, {}, apiConfig.create());
        },

        pendingForApprovalGdBdInvoice: function(vin){
            return $http.post('/outputInvoicePrinted/pendingForApprovalGdBdInvoice/' + vin, {}, apiConfig.create());
        },

        //保存折扣率
        saveMarkupRatio: function (data) {
            return $http.post('/outputInvoiceGBIssued/saveMarkupRatio', data, apiConfig.create());
        },

        // 保存限额
        saveInvoiceQuota: function (data) {
            return $http.post('/outputInvoiceGBIssued/invoiceQuota', angular.toJson(data), apiConfig.create());
        },

        // 手动调价
        manualAdjustPrice: function (model) {
            return $http.post('/outputInvoiceImported/manualAdjustPrice', model, apiConfig.create());
        },

        getAmountCheckManualInputReason: function () {
            return $http.get('/outputInvoicePrinted/amountCheckManualInputReason', apiConfig.create());
        },

        // 挂起列表
        holdRecordList: function (list) {
            return $http.post('/outputInvoiceImported/holdRecordList', list, apiConfig.create());
        },

        // 进入待开票状态
        triggerIssuanceList: function (list) {
            return $http.post('/outputInvoiceImported/triggerIssuanceList', list, apiConfig.create());
        },

        //获取折扣率
        getMarkupRatio: function () {
            return $http.get('/outputInvoiceGBIssued/getMarkupRatio', apiConfig.create());
        },

        // 获取限额
        getInvoiceQuota: function () {
            return $http.get('/outputInvoiceGBIssued/invoiceQuota', apiConfig.create());
        },

        //取消已打印的(BD-User)发票
        cancelInvoice: function (id,reprint) {
            return $http.post('/outputInvoicePrinted/cancelInvoice/' + id+'/'+reprint, {}, apiConfig.create());
        },

        //红冲已打印的(BD-User)发票
        redLetterInvoice: function (id) {
            return $http.post('/outputInvoicePrinted/redLetterInvoice/' + id, {}, apiConfig.create());
        },

        //添加手工修改发票历史记录
        addOutputInvoiceEditHistory: function (data) {
            return $http.post('/outputInvoiceEdited/addOutputInvoiceEditHistory', data, apiConfig.create());
        },

        //获取手工修改发票历史记录
        getOutputInvoiceEditHistory: function (invoiceId) {
            return $http.get('/outputInvoiceEdited/getOutputInvoiceEditHistory/' + invoiceId, apiConfig.create());
        },

        //保存手工导入数据历史记录
        saveSyncHistory: function (data) {
            return $http.post('/outputInvoiceImported/saveSyncHistory', data, apiConfig.create());
        },

        //获取手工导入数据历史记录
        getSyncHistory: function () {
            return $http.get('/outputInvoiceImported/getSyncHistory', apiConfig.create());
        },

        //获取Model Mapping设置
        getModelMappingConfig: function () {
            return $http.get('/outputInvoiceImported/modelMappingConfig', apiConfig.create());
        },

        addModelMappingConfig: function (model) {
            return $http.post('/outputInvoiceImported/modelMappingConfig', model, apiConfig.create());
        },

        updateModelMappingConfig: function (model) {
            return $http.put('/outputInvoiceImported/modelMappingConfig', model, apiConfig.create());
        },

        deleteModelMappingConfig: function (id) {
            return $http.delete('/outputInvoiceImported/modelMappingConfig?id=' + id, apiConfig.create());
        },

        getModelSeries: function () {
            return $http.get('/outputInvoiceImported/modelSeries', apiConfig.create());
        },

        getCabinConfiguration: function () {
            return $http.get('/outputInvoiceImported/cabinConfiguration', apiConfig.create());
        },

        // 打印GD发票
        printGDInvoice: function (model) {
            return $http.post('/outputInvoicePrinted/printGDInvoice', model, apiConfig.create());
        },

        getGdInvoiceInventory: function () {
            return $http.get('/outputInvoicePrinted/gdInvoiceInventory', apiConfig.create());
        },

        getBdInvoiceInventory: function (id) {
            return $http.get('/outputInvoiceEdited/bdInvoiceInventory?id=' + id, apiConfig.create());
        },

        getCheckShipmentList: function (vinList) {
            return $http.post('/outputInvoicePrinted/checkShipmentList', vinList, apiConfig.create());
        },

        // 计算价格
        computeBDPrice: function (model) {
            var config = { ignoreLoadingBar: true };
            return $http.post('/outputInvoiceEdited/computeBDPrice', model, apiConfig.create(config));
        },

        // 解挂
        unHoldRecordByList:function(model){
            return $http.post('/outputInvoiceImported/unHoldRecordByList', model, apiConfig.create());
        },

        // 取消BD发票打印
        cancelBDEditList:function(model){
            return $http.post('/outputInvoiceEdited/cancelBDEditList', model, apiConfig.create());
        },

        //添加BD-User 红冲原因
        addBdUserRedLetterReason: function (data) {
            return $http.post('/outputInvoicePrinted/addBdUserRedLetterReason', data, apiConfig.create());
        },

        //删除BdUserRedLetter Evidence File
        deleteEvidenceFile: function (evidencesList) {
            return $http.post('/outputInvoicePrinted/deleteEvidences', evidencesList, apiConfig.create());
        },

        //下载Evidence File
        downloadEvidenceFile: function (queryDto) {
            return $http.post('/outputInvoicePrinted/downLoadEvidence', queryDto, apiConfig.create())
        }
        ,
        // 查询shipment列表
        getImportShipmentList:function(model){
            return $http.post('/outputInvoiceImportShipment/getImportShipmentList', model, apiConfig.create());
        },
        // 查询日志
        getOutputInvoiceImportShipmentSyncHistory:function(){
            return $http.get('/outputInvoiceImportShipment/getOutputInvoiceImportShipmentSyncHistory', apiConfig.create());
        },

        sendEmail: function (vin,id) {
            return $http.post('/outputInvoicePrinted/sendEmail/' + vin + '/' + id, {}, apiConfig.create())
        },

        receiveEmail: function () {
            return $http.get('/outputInvoicePrinted/receiveEmail', apiConfig.create())
        },
        getGDDetailByVin: function (dto) {
            return $http.post('/outputInvoiceGBIssued/gdDetailViewByVin',dto, apiConfig.create());
        },
        getVehicleModelNameList: function(){
            return $http.get('/outputInvoicePrinted/getVehicleModelNameList', apiConfig.create());
        },
        getTaxControlDiskList:function(model,loadingBar){
            var ignoreLoadingBar = true;
            // 默认不显示转圈圈,如果加载LoadBar,则显示
            if (loadingBar) {
                ignoreLoadingBar = false;
            }

            var config = { ignoreLoadingBar: ignoreLoadingBar };
            return $http.post('/taxControlDisk/getTaxControlDiskList',model, apiConfig.create(config));
        },
        testIsActive:function(model,loadingBar){
            var ignoreLoadingBar = true;
            // 默认不显示转圈圈,如果加载LoadBar,则显示
            if (loadingBar) {
                ignoreLoadingBar = false;
            }

            var config = { ignoreLoadingBar: ignoreLoadingBar };
            return $http.post('/taxControlDisk/testIsActive',model, apiConfig.create(config));
        }, getBDDetailGroupByVIN: function (dto) {
            return $http.post('/outputInvoicePrinted/getBDDetailGroupByVIN', dto, apiConfig.create());
        },
        updateTaxControlDisk:function(model){
            return $http.post('/taxControlDisk/updateTaxControlDisk',model, apiConfig.create());
        }

    };
}]);