import request from "@/utils/httpRequest";
import { PUBLIC_MODULES_PATH as prefix } from "../AppPath";

export default class WareHouseService {
	list(params) {
		return request({
			url: prefix + "/material/management/wareHouse/list",
			method: "get",
			params: params,
		});
	}
	reimbursementList(params) {
		return request({
			url: prefix + "/material/management/wareHouse/reimbursementList",
			method: "get",
			params: params,
		});
	}
	wareHouseList(param) {
		return request({
			url: prefix + "/material/management/wareHouse/wareHouseList",
			method: "get",
			params: param,
		});
	}
	wareHouseHistoryList(param) {
		return request({
			url: prefix + "/material/management/wareHouse/wareHouseHistoryList",
			method: "get",
			params: param,
		});
	}
	collectHistoryList(param) {
		return request({
			url: prefix + "/material/management/wareHouse/collectHistoryList",
			method: "get",
			params: param,
		});
	}
	wareHouseSummaryList(param) {
		return request({
			url: prefix + "/material/management/wareHouse/wareHouseSummaryList",
			method: "get",
			params: param,
		});
	}
	wareHouseSummaryList2(param) {
		return request({
			url: prefix + "/material/management/wareHouse/wareHouseSummaryList2",
			method: "get",
			params: param,
		});
	}
	save(param) {
		return request({
			url: prefix + "/material/management/wareHouse/save",
			method: "post",
			data: param,
		});
	}
	findById(id, status) {
		return request({
			url: prefix + "/material/management/wareHouse/findById",
			method: "get",
			params: { id: id, status: status },
		});
	}
	remove(id) {
		return request({
			url: prefix + "/material/management/wareHouse/remove",
			method: "get",
			params: { id: id },
		});
	}
	findRequestId(purchaseNo) {
		return request({
			url: prefix + "/material/management/wareHouse/findRequestId",
			method: "get",
			params: { purchaseNo: purchaseNo },
		});
	}
	updateStatusById(data) {
		return request({
			url: prefix + "/material/management/wareHouse/updateStatusById",
			method: "post",
			data: data,
		});
	}
	backSourceData(id) {
		return request({
			url: prefix + "/material/management/wareHouse/backSourceData",
			method: "get",
			params: { id: id },
		});
	}
	findHiById(id) {
		return request({
			url: prefix + "/material/management/wareHouse/findHiById",
			method: "get",
			params: { id: id },
		});
	}
	findHiByHiId(id) {
		return request({
			url: prefix + "/material/management/wareHouse/findHiByHiId",
			method: "get",
			params: { id: id },
		});
	}
	findLastHiByid(id) {
		return request({
			url: prefix + "/material/management/wareHouse/findLastHiByid",
			method: "get",
			params: { id: id },
		});
	}
	updateWarnFlagByTradeNameAndType(tradeName, wareHouseType) {
		return request({
			url: prefix + `/material/management/wareHouse/updateWarnFlagByTradeNameAndType`,
			method: "post",
			data: { tradeName: tradeName, wareHouseType: wareHouseType },
		});
	}
	updateWarnNumByTradeNameAndType(tradeName, wareHouseType, warnNum) {
		return request({
			url: prefix + `/material/management/wareHouse/updateWarnNumByTradeNameAndType`,
			method: "post",
			data: {
				tradeName: tradeName,
				wareHouseType: wareHouseType,
				warnNum: warnNum,
			},
		});
	}
	saveTradeName(oldTradeName, tradeName, type) {
		return request({
			url: prefix + `/material/management/wareHouse/saveTradeName`,
			method: "post",
			data: {
				oldTradeName: oldTradeName,
				tradeName: tradeName,
				wareHouseType: type,
			},
		});
	}
	findTradeByTypeId(typeId) {
		return request({
			url: prefix + "/material/management/wareHouse/findTradeByTypeId",
			method: "get",
			params: { typeId: typeId },
		});
	}
}
