api.js 18.5 KB
import {getAction, deleteAction, putAction, postAction, httpAction} from '@/api/manage'
import Vue from 'vue'
import {UI_CACHE_DB_DICT_DATA} from "@/store/mutation-types"

//角色管理
const addRole = (params) => postAction("/sys/role/add", params);
const editRole = (params) => putAction("/sys/role/edit", params);
const checkRoleCode = (params) => getAction("/sys/role/checkRoleCode", params);
const queryall = (params) => getAction("/sys/role/queryall", params);

//用户管理
const addUser = (params) => postAction("/sys/user/add", params);
const editUser = (params) => putAction("/sys/user/edit", params);
const queryUserRole = (params) => getAction("/sys/user/queryUserRole", params);
const getUserList = (params) => getAction("/sys/user/list", params);
const frozenBatch = (params) => putAction("/sys/user/frozenBatch", params);
//验证用户是否存在
const checkOnlyUser = (params) => getAction("/sys/user/checkOnlyUser", params);
//改变密码
const changePassword = (params) => putAction("/sys/user/changePassword", params);
//系统激活API
const systemActivation = (params) => postAction("/sys/systemActivation", params);

//权限管理
const addPermission = (params) => postAction("/sys/permission/add", params);
const editPermission = (params) => putAction("/sys/permission/edit", params);
const getPermissionList = (params) => getAction("/sys/permission/list", params);
const getSystemMenuList = (params) => getAction("/sys/permission/getSystemMenuList", params);
const getSystemSubmenu = (params) => getAction("/sys/permission/getSystemSubmenu", params);
const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params)
const queryTreeList = (params) => getAction("/sys/permission/queryTreeList", params);
const queryTreeListForRole = (params) => getAction("/sys/role/queryTreeList", params);
const queryListAsync = (params) => getAction("/sys/permission/queryListAsync", params);
const queryRolePermission = (params) => getAction("/sys/permission/queryRolePermission", params);
const saveRolePermission = (params) => postAction("/sys/permission/saveRolePermission", params);
const queryPermissionsByUser = () => getAction("/sys/permission/getUserPermissionByToken");
const loadAllRoleIds = (params) => getAction("/sys/permission/loadAllRoleIds", params);
const getPermissionRuleList = (params) => getAction("/sys/permission/getPermRuleListByPermId", params);
const queryPermissionRule = (params) => getAction("/sys/permission/queryPermissionRule", params);

// 部门管理
const queryDepartTreeList = (params) => getAction("/sys/sysDepart/queryTreeList", params);
const queryDepartTreeSync = (params) => getAction("/sys/sysDepart/queryDepartTreeSync", params);
const queryIdTree = (params) => getAction("/sys/sysDepart/queryIdTree", params);
const queryParentName = (params) => getAction("/sys/sysDepart/queryParentName", params);
const searchByKeywords = (params) => getAction("/sys/sysDepart/searchBy", params);
const deleteByDepartId = (params) => deleteAction("/sys/sysDepart/delete", params);


//二级部门管理
const queryDepartPermission = (params) => getAction("/sys/permission/queryDepartPermission", params);
const saveDepartPermission = (params) => postAction("/sys/permission/saveDepartPermission", params);
const queryTreeListForDeptRole = (params) => getAction("/sys/sysDepartPermission/queryTreeListForDeptRole", params);
const queryDeptRolePermission = (params) => getAction("/sys/sysDepartPermission/queryDeptRolePermission", params);
const saveDeptRolePermission = (params) => postAction("/sys/sysDepartPermission/saveDeptRolePermission", params);
const queryMyDepartTreeList = (params) => getAction("/sys/sysDepart/queryMyDeptTreeList", params);

//日志管理
const deleteLog = (params) => deleteAction("/sys/log/delete", params);
const deleteLogList = (params) => deleteAction("/sys/log/deleteBatch", params);
//获得所有接口日志名称
const getApiNameList = (params) => deleteAction("/monitor/apiLog/getApiNameList", params);

//数据字典
const addDict = (params) => postAction("/sys/dict/add", params);
const editDict = (params) => putAction("/sys/dict/edit", params);
const treeList = (params) => getAction("/sys/dict/treeList", params);
const addDictItem = (params) => postAction("/sys/dictItem/add", params);
const editDictItem = (params) => putAction("/sys/dictItem/edit", params);

//字典标签专用(通过code获取字典数组)
export const ajaxGetDictItems = (code, params) => getAction(`/sys/dict/getDictItems/${code}`, params);

//从缓存中获取字典配置
function getDictItemsFromCache(dictCode) {
  if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) {
    let dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode];
    //console.log("-----------getDictItemsFromCache----------dictCode="+dictCode+"---- dictItems=",dictItems)
    return dictItems;
  }
}

//系统通告
const doReleaseData = (params) => getAction("/sys/annountCement/doReleaseData", params);
const doReovkeData = (params) => getAction("/sys/annountCement/doReovkeData", params);
//获取系统访问量
const getLoginfo = (params) => getAction("/sys/loginfo", params);
const getVisitInfo = (params) => getAction("/sys/visitInfo", params);

// 根据部门主键查询用户信息
const queryUserByDepId = (params) => getAction("/sys/user/queryUserByDepId", params);

// 重复校验
const duplicateCheck = (params) => getAction("/sys/duplicate/check", params);
// 加载分类字典
const loadCategoryData = (params) => getAction("/sys/category/loadAllData", params);
const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', params)
//加载我的通告信息
const getUserNoticeInfo = (params) => getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend", params);
const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}`

//根据用户编码,获取仓库信息
export const getWarehouseByUserCode = (params) => postAction('/sys/getWarehouseByUserCode', params);
//获取库区列表
export const getZoneList = (params) => getAction('/config/zone/getZoneList', params);
//获取容器类型列表
export const getContainerTypeList = (params) => getAction('/config/containerType/getContainerTypeList', params);
//获取库位类型列表
export const getLocationTypeList = (params) => getAction('/config/locationType/getLocationTypeList', params);
//获取库位类高度列表
export const getLocationHighList = (params) => postAction('/config/locationHigh/getLocationHighList', params);
//获取货主列表
export const getCompanyList = (params) => getAction('/config/company/getCompanyList', params);
//获取盘点类型列表
export const getCountTypeList = (params) => getAction('/config/cycleCountPreference/getCountTypeList', params);
//获取承运商列表
export const getCarrierList = (params) => getAction('/config/carrier/getCarrierList', params);
//获取客户列表
export const getCustomerList = (params) => getAction('/config/customer/getCustomerList', params);
//获取供应商列表
export const getSupplierList = (params) => getAction('/config/supplier/getSupplierList', params);
//获取入库类型列表
export const getReceiptTypeList = (params) => getAction('/config/receiptType/getReceiptTypeList', params);
//获取出库类型列表
export const getShipmentTypeList = (params) => getAction('/config/shipmentType/getShipmentTypeList', params);
//根据物料编码查询物料信息
export const searchMaterialByCode = (params) => postAction('/config/material/searchMaterialByCode', params);
//根据入库单头ID查询入库单详情
export const listReceiveByReceiptId = (params) => postAction('/receipt/receiveHeader/listReceiveByReceiptId', params);
//创建入库任务
export const createReceiptTask = (params) => postAction('/receipt/receiptContainerHeader/createReceiptTask', params);
//批量创建入库任务
export const createReceiptBatchTask = (params) => postAction('/receipt/receiptContainerHeader/createReceiptBatchTask', params);
//完成WMS任务
export const completeTaskByWMS = (params) => postAction('/task/taskHeader/completeTaskByWMS', params);
//下发任务给WCS
export const execute = (params) => postAction('/task/taskHeader/execute', params);
//取消任务
export const cancelTask = (params) => postAction('/task/taskHeader/cancelTask?ids=' + params, params);

//盘点任务创建
export const createCycleCountDetailByInventory = (params) => postAction('/cycleCountDetail/cycleCountDetail/createCycleCountDetailByInventory', params);

//切换任务
export const switchTask = (params) => postAction('/task/taskHeader/switchTask?ids=' + params, params);
//自动配盘
export const autoCombination = (params) => postAction('/shipment/shipmentCombination/autoCombination', params);
//自动出库
export const autoShipment = (params) => postAction('/shipment/shipmentHeader/autoShipment', params);
//创建出库任务
export const createShipmentTask = (params) => postAction('/shipment/shipmentCombination/createShipmentTask', params);
//批量创建出库任务
export const createShipmentBatchTask = (params) => postAction('/shipment/shipmentCombination/createShipmentBatchTask', params);
//选择出库分拣口
export const selectSortingPort = (params) => postAction('/shipment/shipmentCombination/selectSortingPort', params);
//选择入库分拣口
export const selectSupplePort = (params) => postAction('/receipt/receiptContainerHeader/selectSupplePort', params);
//选择盘点分拣口
export const inventoryPort = (params) => postAction('/cycleCountDetail/cycleCountDetail/inventoryPort', params);
//创建空托盘入库任务
export const createEmptyIn = (params) => postAction('/task/taskHeader/createEmptyIn', params);
//创建空托盘出库任务
export const createEmptyOut = (params) => postAction('/task/taskHeader/createEmptyOut', params);
//选择出库整出口
export const selectOutPort = (params) => postAction('/task/taskHeader/selectOutPort', params);
//选择出库分拣口
export const selectPickPort = (params) => postAction('/task/taskHeader/selectPickPort', params);
//创建移库任务
export const createTransferTask = (params) => postAction('/task/taskHeader/createTransferTask', params);
//创建出库查看任务
export const createCheckOutTask = (params) => postAction('/task/taskHeader/createCheckOutTask', params);
//选择站台
export const selectPort = (params) => postAction('/task/taskHeader/selectPort', params);
//创建跨站任务
export const createOverStationTask = (params) => postAction('/task/taskHeader/createOverStationTask', params);
//盘点任务创建
export const stockTakeTask = (params, headerId, code) => postAction('/cycleCountDetail/cycleCountDetail/stockTakeTask?ids=' + params + '&headerId=' + headerId + '&code=' + code, code);
//盘盈添加
export const increaseInInventoryGain = (params) => postAction('/cycleCountDetail/cycleCountDetail/increaseInInventoryGain', params);
//盘点任务生成
export const createCycleCoutTaskByDetailId = (params, toPort) => postAction('/cycleCountDetail/cycleCountDetail/createCycleCoutTaskByDetailId?cycleId=' + params + '&toPort=' + toPort, params);
//盘点确定实盘数量
export const confirmGapQty = (params) => postAction('/cycleCountDetail/cycleCountDetail/confirmGapQty', params);
//创建空托盘组入库任务
export const createManyEmptyIn = (params) => postAction('/task/taskHeader/createManyEmptyIn', params);
//创建空托盘组出库任务
export const createManyEmptyOut = (params) => postAction('/task/taskHeader/createManyEmptyOut', params);
//获取容器打印数据
export const getPrintContainer = (params) => postAction('/config/container/getPrintContent?ids=' + params, params);
//获取库位打印数据
export const getPrintLocation = (params) => postAction('/config/location/getPrintContent?ids=' + params, params);
//获取物料打印数据
export const getMaterialLocation = (params) => postAction('/config/material/getPrintContent?ids=' + params, params);
//获取物料类别列表
export const getMaterialTypeList = (params) => getAction('/config/materialType/getMaterialTypeList', params);
//根据出库单头ID查询出库单详情
export const listShipmentByShipmentDetailId = (params) => postAction('/shipment/shipmentCombination/listShipmentByShipmentDetailId', params);
//根据出库单详情选取库存
export const getInventoryFromShipmentDetail = (params) => postAction('/shipment/shipmentCombination/getInventoryFromShipmentDetail', params);
//配盘
export const combination = (params) => postAction('/shipment/shipmentCombination/combination', params);
//回传入库单
export const backErpReceipt = (params) => postAction('/receipt/receiptHeader/backErpReceipt', params);
//回传出库单
export const backErpShipment = (params) => postAction('/shipment/shipmentHeader/backErpShipment', params);
//合并出库单
export const mergeShipment = (params) => postAction('/shipment/shipmentHeader/mergeShipment', params);
//首页取值
export const deliveringAmount = (params) => postAction("/sys/home/deliveringAmount", params);
export const inventoryUtilization = (params) => postAction("/sys/home/inventoryUtilization", params);
export const inventoryStatus = (params) => postAction("/sys/home/inventoryStatus", params);
export const inventoryOverview = (params) => postAction("/sys/home/inventoryOverview", params);
export const getCommonData = (params) => postAction("/sys/home/getCommonData", params);
//执行AGV任务
export const executeAgv = (params) => postAction('/task/agvTask/execute?ids=' + params, params);
//完成AGV任务
export const completeAgv = (params) => postAction('/task/agvTask/complete?ids=' + params, params);
//取消AGV任务
export const cancelAgv = (params) => postAction('/task/agvTask/cancel?ids=' + params, params);
//修复空出数据
export const handleEmptyOut = (params) => postAction('/task/taskHeader/handleEmptyOut?id=' + params, params);
//修复取货错数据
export const handlePickupError = (params) => postAction('/task/taskHeader/handlePickupError?id=' + params, params);
//修复重入数据
export const handleDoubleIn = (params) => postAction('/task/taskHeader/handleDoubleIn?id=' + params, params);
//查询用户角色
export const queryWarehouse = (params) => getAction("/config/sysUserWarehouse/queryWarehouse", params);
//查询所有仓库
export const getAllWarehouseList = (params) => getAction("/config/warehouse/getAllWarehouseList", params);
//查询所有库区
export const getAllZoneList = (params) => getAction("/config/zone/getAllZoneList", params);

//入库单提交审核
export const createReceiptAuditFlow = (params) => getAction("/audit/audit/createReceiptAuditFlow", params);
//入库单审核
export const auditReceipt = (params) => getAction("/audit/audit/auditReceipt", params);
//查询审核流程进度
export const searchAuditFlow = (params) => getAction("/audit/audit/searchAuditFlow", params);

//出库单提交审核
export const createShipmentAuditFlow = (params) => getAction("/audit/audit/createShipmentAuditFlow", params);
//出库单审核
export const auditShipment = (params) => getAction("/audit/audit/auditShipment", params);

//查询是否开启审核流程
export const getDocumentAduitFlow = (params) => getAction("/config/parameterConfiguration/getDocumentAduitFlow", params);
//快速入库
export const quickReceipt = (params) => postAction("/task/taskHeader/quickReceipt", params);
//快速出库,批量快速出整托
export const shipmentInventoryHeader = (params) => postAction('/inventory/inventoryHeader/shipmentInventoryHeader', params);
//快速出库,批量快速出库存详情
export const shipmentInventoryDetail = (params) => postAction('/inventory/inventoryHeader/shipmentInventoryDetail', params);
//呼叫入库托盘
export const callReceiptBox = (params) => postAction('/receipt/receiptHeader/callbox', params);
//批量呼叫入库托盘
export const batchCallReceiptBox = (params) => postAction('/receipt/receiptHeader/batchCallBox', params);
//呼叫出库托盘
export const callShipmentBox = (params) => postAction('/shipment/shipmentHeader/callbox', params);
//根据收货ID查询收货单
export const listReceiveByReceiveId = (params) => postAction('/receipt/receiveHeader/listReceiveByReceiveId', params);
//收货
export const receive = (params) => postAction('/receipt/receiveHeader/receive', params);
//全部收货
export const receiveHeader = (params) => postAction('/receipt/receiveHeader/receiveHeader?id=' + params, params);
//越库
export const crossDocking = (params) => postAction('/receipt/receiptHeader/crossDocking?id=' + params, params);
//收货详情转质检
export const receiveDetailToQuality = (params) => postAction('/receipt/receiveHeader/receiveDetailToQuality?id=' + params, params);
//入库质检
export const qualityTesting = (params) => postAction('/receipt/qualityHeader/qualityTesting', params);
//全部转质检
export const receiveHeaderToQuality = (params) => postAction('/receipt/receiveHeader/receiveHeaderToQuality?id=' + params, params);
//生成库内质检任务
export const qualityInventoryDetail = (params) => postAction('/inventory/inventoryHeader/qualityInventoryDetail', params);
//质检登记
export const qualityRegister = (params) => postAction('/task/taskHeader/qualityRegister', params);
//创建出库任务,AGV去接
export const createShipmentTaskByAgv = (params) => postAction('/shipment/shipmentCombination/createShipmentTask', params);

// 中转HTTP请求
export const transitRESTful = {
  get: (url, parameter) => getAction(getTransitURL(url), parameter),
  post: (url, parameter) => postAction(getTransitURL(url), parameter),
  put: (url, parameter) => putAction(getTransitURL(url), parameter),
  http: (url, parameter) => httpAction(getTransitURL(url), parameter),
}

export {
  // imgView,
  // doMian,
  addRole,
  editRole,
  checkRoleCode,
  addUser,
  editUser,
  queryUserRole,
  getUserList,
  queryall,
  frozenBatch,
  checkOnlyUser,
  changePassword,
  systemActivation,
  getPermissionList,
  addPermission,
  editPermission,
  queryTreeList,
  queryListAsync,
  queryRolePermission,
  saveRolePermission,
  queryPermissionsByUser,
  loadAllRoleIds,
  getPermissionRuleList,
  queryPermissionRule,
  queryDepartTreeList,
  queryDepartTreeSync,
  queryIdTree,
  queryParentName,
  searchByKeywords,
  deleteByDepartId,
  deleteLog,
  deleteLogList,
  addDict,
  editDict,
  treeList,
  addDictItem,
  editDictItem,
  doReleaseData,
  doReovkeData,
  getLoginfo,
  getVisitInfo,
  queryUserByDepId,
  duplicateCheck,
  queryTreeListForRole,
  getSystemMenuList,
  getSystemSubmenu,
  getSystemSubmenuBatch,
  loadCategoryData,
  checkRuleByCode,
  queryDepartPermission,
  saveDepartPermission,
  queryTreeListForDeptRole,
  queryDeptRolePermission,
  saveDeptRolePermission,
  queryMyDepartTreeList,
  getUserNoticeInfo,
  getDictItemsFromCache,
  getApiNameList
}