import {
	main,
	dict,
	FileApi,
	baseApp,
	cblApiclient,
	zhcx,
	cbgm,
	baseServer,
	medicament,
} from "@/api";
import request from "@/utils/require";

//熏蒸备案列表
export function getList(data) {
	return request({
		url: `${main}/fumigation/selectFumigationPageList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "post",
		data: data,
	});
}

//熏蒸备案详情
export function getDetail(data) {
	return request({
		url: `${main}/fumigation/selectFumigationDetail`,
		method: "post",
		data: data,
	});
}

//熏蒸备案审核
export function confirmFumigation(data) {
	return request({
		// url: `${main}/fumigation/updateFumigation`,
		url: `${main}/fumigation/updateSign`,
		method: "post",
		data: data,
	});
}
//熏蒸备案-修改状态
export function updateFumigation(data) {
	return request({
		url: `${main}/fumigation/insertFumigation`,
		// url: `${main}/fumigation/updateStatus`,
		method: "post",
		data: data,
	});
}
//上传
export function findByIds(data) {
	return request({
		url: `${FileApi}/file/findByIds?ids=${data}`,
		method: "get",
	});
}

export function getDictionaryList(params) {
	return request({
		url: `${dict}/dataDictionary/findByGroupId/${params.groupId}`,
		method: "get",
		data: params,
	});
}

// 仓房基本情况
export function getWareList(param) {
	return request({
		url: `${baseApp}/warehouseListByKddm/${param.kddm}`,
		method: "post",
	});
}
//通风作业列表
export function tfListPageGet(data) {
	return request({
		url: `${zhcx}/collect/tf/page?pageNum=${data.pageNum}&pageSize=${
			data.pageSize
		}`,
		method: "POST",
		data: data,
	});
}
//通风作业详情
export function tfDetailGet(data) {
	return request({
		url: `${zhcx}/tfzy/info/${data.id}`,
		method: "get",
	});
}
//药剂信息维护列表
export function infoMaintainList(data) {
	if (data.status == "") {
		data.status = "-1";
	}
	return request({
		url: `${cblApiclient}/xunzheng/selectWeiHuList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂信息维护详情
export function infoMaintainDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectWeiHuDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂采购申请列表
export function purchaseRequestList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectShenPiList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂采购申请详情
export function purchaseRequestDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectShenPiDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂入库列表
export function inStoreList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectRuKuList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂入库详情
export function inStoreDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectRuKuDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂领用申请列表
export function useApplyList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectLyApplyList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂领用申请详情
export function useApplyDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectLLyApplyDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂领用登记列表
export function useRegisterList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectLyRegisterList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂领用登记详情
export function useRegisterDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectLyRegisterDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂归还列表
export function giveBackList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectGuiHuanList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂归还详情
export function giveBackDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectGuiHuanDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂销毁列表
export function destroyList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectXiaoHuiList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂销毁详情
export function destroyDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectXiaoHuiDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂台账列表
export function standingBookList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectTaiZhangList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
//药剂台账详情
export function standingBookDetail(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectTaiZhangDetail?id=${data.id}`,
		method: "get",
	});
}
//药剂台账详情列表
export function standingBookDetailList(data) {
	return request({
		url: `${cblApiclient}/xunzheng/selectTaiZhangDetailList?pageNum=${
			data.pageNum
		}&pageSize=${data.pageSize}`,
		method: "POST",
		data: data,
	});
}
// 药剂报表
export function pageStatement(data) {
	return request({
		url: `${cbgm}/yctech/xunzheng/pageStatement?pageNum=-1&pageSize=10`,
		method: "post",
		data,
	});
}
// 药剂报表详情
// http://172.16.0.16:9025
export function pageStatementDetail(data) {
	return request({
		url: `${medicament}/depot-storage/depot/business/statement/getList?endDate=${
			data.endDate
		}&orgId=${data.orgId}&startDate=${data.startDate}`,
		method: "get",
		data,
	});
}
// 字典接口
export function dictionary() {
	return request({
		url: `${medicament}/depot-basic/Enum/findEnumObj`,
		method: "get",
	});
}
/* 熏蒸方案审核  开始 */
// export function getDetailById(applyId){
//     return request({
//         url: `${cbgm}/yctech/fumigationapply/getDetailById?applyId=${applyId}`,
//         method: 'get',
//         data: {}
//     })
// }
/* 熏蒸方案审核  结束 */

///* 熏蒸方案接口start */
//熏蒸方案申请列表
export function getManageList(pageData) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getManageList?pageNum=${
			pageData.pageNum
		}&pageSize=${pageData.pageSize}`,
		method: "post",
		data: pageData,
	});
}
//根据仓号获取熏蒸记录
export function getByCreditCode(creditCode) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getStorageInfoByCreditCode?creditCode=${creditCode}`,
		method: "get",
		data: {},
	});
}
//获取熏蒸历史列表

export function getHistoryByStorageNo(pageData, storageId) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getHistoryByStorageNo?pageNum=${
			pageData.page
		}&pageSize=${pageData.size}&storageId=${storageId}`,
		method: "get",
		data: {},
	});
}
//获取虫害检测单号

export function getPestOrderList(data) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getPestOrderList`,
		method: "post",
		data: data,
	});
}
//根据检查单号获取虫害信息

export function getPestInfoByOrder(pestOrder) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getPestInfoByOrder?pestOrder=${pestOrder}`,
		method: "get",
		data: {},
	});
}
//获取药剂名称，药剂剂型

export function getDrugList() {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getDrugList`,
		method: "get",
		data: {},
	});
}
//熏蒸申请保存

export function getgationapplyadd(data) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/add`,
		method: "post",
		data: data,
	});
}
//熏蒸详情

export function getDetailById(applyId) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/getDetailById?applyId=${applyId}`,
		method: "get",
		data: {},
	});
}
//熏蒸修改

export function getupdateById(data) {
	return request({
		url: `${cbgm}/yctech/fumigationapply/updateById`,
		method: "post",
		data: data,
	});
}
/*  熏蒸方案接口end*/
//品种新接口
export function getPzOptions(data) {
	return request({
		url: `${dict}/dataDictionary/getDataGroup?groupId=PM001&pdictCode=22`,
		method: "get",
	});
}
export function sinkpointList(data = {}) {
	return request({
		url: `${baseServer}/sinkpointList`,
		method: "post",
		data: data,
	});
}
