import request from '../util/request.js';


// 可领料数据查询
export function findInventory(params) {
    params.warehouseId = localStorage.getItem('#warehouseId');
    return request({
        url: '/api/InventoryResource/findInventoryByCondition',
        method: 'post',
        data: params,
    });
}

// 生成领料车
export function createStockOutPrepareLine(params) {
    return request({
        url: '/api/PickingCarResource/generateCFPickCar',
        method: 'post',
        data: params,
    });
}

// 查询领料车数量
export function queryPickingCarNumber() {
    return request({
        url: '/api/PickingCarResource/queryPickingCarCount',
        method: 'get',
    });
}

// 查询领料车物料列表
export function queryCFPickCar(params) {
    params.warehouseId = localStorage.getItem('#warehouseId');
    return request({
        url: '/api/PickingCarResource/queryCFPickCar',
        method: 'post',
        data: params,
    });
}

// 将设备从领料车内删除
export function deleteCFPickCar(params) {
    return request({
        url: '/api/PickingCarResource/deleteCFPickCar',
        method: 'post',
        data: params,
    });
}

// 生成领料单
export function saveCFStockOutPrepare(params) {
    return request({
        url: '/api/StockOutPrepareResource/saveCFStockOutPrepare',
        method: 'post',
        data: params,
    });
}

// 查询常用领料
export function queryCommonUse(params) {
    params.warehouseId = localStorage.getItem('#warehouseId');
    return request({
        url: '/api/BorroweLogResource/queryCommonUse',
        method: 'post',
        data: params,
    });
}

// 闸机外侧查询领料明细
export function list(params) {
    params.warehouseId = localStorage.getItem('#warehouseId');
    return request({
        url: '/api/StockOutPrepareLineResource/queryCFStockOutPrepareLine',
        method: 'post',
        data: params,
    });
}

// 闸机外侧选择领料单明细生成出库单
export function createStockOut(params) {
    return request({
        url: '/api/StockOutResource/generateCFStockOut',
        method: 'post',
        data: params,
    });
}

// 闸机外侧选择物料明细生成领料单、领料明细、出库单
export function generatePickPaper(params) {
    return request({
        url: '/api/StockOutResource/generatePickPaper',
        method: 'post',
        data: params,
    });
}

// 闸机内侧人工领料出库验证工装设备是否一致
export function cfStockOut(params) {
    return request({
        url: '/api/StockOutResource/verificationCFStockOut',
        method: 'post',
        data: params,
    });
}


// 操作人员进入仓库拿取工装设备直接出库(申请领料)
export function leaveCFWarehouse(inventoryId) {
    return request({
        url: '/api/StockOutResource/leaveCFWarehouse?inventoryId=' + inventoryId,
        method: 'post',
    });
}

// 领料完成离开
export function cfStockOutLeave(params) {
    return request({
        url: '/api/StockOutResource/leaveCFStockOut',
        method: 'post',
        data: params,
    });
}

// 查看AGV RFID识别记录
export function getAgvRfidLogByTaskId() {
    const warehouseId = localStorage.getItem('#warehouseId');
    return request({
        url: '/api/AGVRfidRecordLogResource/queryLastAgvRfidLog?warehouseId=' + warehouseId,
        method: 'get',
    });
}
