using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Security.Claims;
|
using System.Threading.Tasks;
|
using Microsoft.AspNetCore.Authorization;
|
using Newtonsoft.Json;
|
using Utility;
|
using Utility.Tools;
|
using WMS.IBLL.ILogServer;
|
using WMS.IBLL.ISysServer;
|
using WMS.Entity.SysEntity;
|
using SqlSugar;
|
using Model.ModelDto.SysDto;
|
using Model.ModelVm;
|
using Model.ModelVm.SysVm;
|
using System.Reflection.Metadata.Ecma335;
|
using System.Security.Cryptography;
|
using Model.ModelDto;
|
using Model.ModelDto.LogDto;
|
|
namespace Wms_09.Controllers
|
{
|
[Route("api/[controller]/[action]")]
|
[ApiController]
|
[Authorize]
|
public class SysController : ControllerBase
|
{
|
private readonly IWareHouseServer _wareHouseSvc; //仓库
|
private readonly IStorageAreaServer _areaSvc; //区域
|
private readonly IStorageRoadwayServer _roadwaySvc; //巷道
|
private readonly IStorageLocatServer _locatSvc; //储位
|
|
private readonly IPalletsServer _palletSvc; //条码
|
private readonly IPalletTrackServer _palletTrackSvc; //托盘
|
|
private readonly IDictionaryServer _dic; //数据字典
|
private readonly IMenuServer _menuSvc; //菜单
|
private readonly IOperationSysServer _operation; //操作日志
|
private readonly IExceptionServer _table; //异常处理
|
private readonly IHeaderSettingsServer _headerSet;//表头设置
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="wareHouseSvc">仓库</param>
|
/// <param name="areaSvc">区域</param>
|
/// <param name="roadwaySvc">巷道</param>
|
/// <param name="locatSvc">储位</param>
|
/// <param name="palletSvc">条码</param>
|
/// <param name="palletTrackSvc">托盘</param>
|
/// <param name="menuSvc">菜单</param>
|
/// <param name="dic">数据字典</param>
|
/// <param name="operation">操作日志</param>
|
/// <param name="table">异常处理</param>
|
public SysController(IWareHouseServer wareHouseSvc, IStorageAreaServer areaSvc, IStorageRoadwayServer roadwaySvc, IStorageLocatServer locatSvc, IPalletsServer palletSvc, IPalletTrackServer palletTrackSvc, IMenuServer menuSvc, IDictionaryServer dic, IOperationSysServer operation, IExceptionServer table, IHeaderSettingsServer headerSet)
|
{
|
_wareHouseSvc = wareHouseSvc; //仓库
|
_areaSvc = areaSvc; //区域
|
_roadwaySvc = roadwaySvc; //巷道
|
_locatSvc = locatSvc; //储位
|
|
_palletSvc = palletSvc; //条码
|
_palletTrackSvc = palletTrackSvc; //托盘
|
_menuSvc = menuSvc; //菜单
|
_dic = dic; //数据字典
|
_operation = operation; //操作日志
|
_table = table; //异常处理
|
|
_headerSet = headerSet;//表头设置
|
}
|
|
#region 菜单管理
|
|
/// <summary>
|
/// 获取菜单信息列表
|
/// </summary>
|
/// <param name="MenuName">菜单名称</param>
|
/// <param name="pMenuNo">父级菜单号</param>
|
/// <param name="MenuNo">菜单号</param>
|
/// <param name="level">层级</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level)
|
{
|
//查询菜单信息列表
|
List<FunctionMenuVm> menulist = _menuSvc.GetMenuList(MenuName, pMenuNo, MenuNo, level);
|
return Ok(new
|
{
|
data = menulist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
/// <summary>
|
/// 根据层级获取菜单列表(分配权限用到)
|
/// </summary>
|
/// <param name="level"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetMenuListForRight(string level)
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(UserId))
|
{
|
throw new Exception("未获取到用户信息");
|
}
|
|
//查询菜单信息列表
|
List<FunctionMenuVm> menulist = _menuSvc.GetMenuListForRight(level, UserId);
|
return Ok(new
|
{
|
data = menulist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取模块菜单
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetParentMenuList()
|
{
|
//查询菜单信息列表
|
List<SysFunctionMenu> menulist = _menuSvc.GetParentMenuList();
|
return Ok(new
|
{
|
data = menulist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 根据父级菜单号获取菜单信息
|
/// </summary>
|
/// <param name="MenuNo">菜单号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetMenuByParentNo(string MenuNo)
|
{
|
List<FunctionMenuVm> menulist = _menuSvc.GetMenuByParentNo(MenuNo);
|
return Ok(new
|
{
|
data = menulist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 根据id获取菜单信息列表
|
/// </summary>
|
/// <param name="id">菜单id</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetMenuListById(int id)
|
{
|
SysFunctionMenu menu = _menuSvc.GetMenuListById(id);
|
return Ok(new
|
{
|
data = menu,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 新增菜单信息
|
/// </summary>
|
/// <param name="menudto">菜单DTO模型</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public async Task<IActionResult> AddMenu(FunctionMenuDto menudto)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//创建人
|
menudto.CreateUser = uid;
|
int i = await _menuSvc.InsertMenu(menudto);
|
//判断是否新增成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "新增失败"
|
});
|
}
|
else if (i == 3)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 3,
|
msg = "菜单号必须唯一"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "菜单管理", menudto.MenuNo, "添加", "添加菜单信息 菜单编号:" + menudto.MenuNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "新增成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
return Ok(new { data = "", code = 3, msg = "新增菜单信息异常:"+ ex.Message });
|
}
|
|
}
|
|
/// <summary>
|
/// 删除菜单信息
|
/// 单删
|
/// </summary>
|
/// <param name="Id">菜单Id</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpGet]
|
public async Task<IActionResult> DelMenu(int Id)
|
{
|
//捕获异常
|
try
|
{
|
SysFunctionMenu menu = _menuSvc.GetMenuListById(Id);
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//创建人
|
menu.CreateUser = uid;
|
int i = await _menuSvc.DeleteMenu(menu);
|
//判断是否删除成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "删除失败"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "菜单管理", menu.MenuNo, "删除", "删除菜单信息 菜单号:" + menu.MenuNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "删除成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("删除菜单信息异常", ex);
|
}
|
|
}
|
|
/// <summary>
|
/// 编辑菜单信息
|
/// </summary>
|
/// <param name="menuvm">菜单视图模型</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public async Task<IActionResult> UpdateMenu(FunctionMenuVm menuvm)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//更改人
|
menuvm.UpdateUser = uid;
|
|
int i = await _menuSvc.UpdateMenu(menuvm);
|
//判断是否编辑成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "编辑失败"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "菜单管理", menuvm.MenuNo, "修改", "修改菜单信息 菜单编号:" + menuvm.MenuNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "编辑成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
return Ok(new { data = "", code = 3, msg = "编辑菜单信息异常:" + ex.Message });
|
}
|
|
}
|
|
#endregion
|
|
#region 数据字典
|
|
#region csc
|
|
/// <summary>
|
/// 获取字典信息
|
/// </summary>
|
/// <param name="parentNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetDictionaryByParentNo(string parentNo)
|
{
|
try
|
{
|
var bolls = _dic.GetDictionaryByParentNo(parentNo);
|
|
return Ok(new { code = 0, msg = "字典信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
#endregion
|
|
#region yyk
|
|
/// <summary>
|
/// 获取字典信息列表
|
/// </summary>
|
/// <param name="DictName">字典名称</param>
|
/// <param name="DictNo">父级字典号</param>
|
/// <param name="Level">层级</param>
|
/// <param name="IsEdit">允许编辑</param>
|
/// <param name="IsAdd">允许新增</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetDicList(string DictName, string DictNo, string Level, string IsEdit, string IsAdd = "")
|
{
|
List<DictionaryDto> diclist = _dic.GetDicList(DictName, DictNo, Level, IsEdit, IsAdd);
|
return Ok(new
|
{
|
data = diclist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取父级字典号(根据层级根目录)
|
/// </summary>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetDicParentListByLevel()
|
{
|
List<SysDictionary> diclist = _dic.GetDicParentListByLevel();
|
return Ok(new
|
{
|
data = diclist,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 根据id查询字典信息
|
/// </summary>
|
/// <param name="id">字典id</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetDicById(int id)
|
{
|
SysDictionary dic = _dic.GetDicById(id);
|
return Ok(new
|
{
|
data = dic,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 新增字典信息
|
/// </summary>
|
/// <param name="dicdto">数据字典dto</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public async Task<IActionResult> AddDic(DictionaryDto dicdto)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//创建人
|
dicdto.CreateUser = uid;
|
//新增
|
int i = await _dic.AddDic(dicdto);
|
//判断是否新增成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "失败"
|
});
|
}
|
else if (i == 3)
|
{
|
await _operation.InsertOperation("系统设置", "数据字典", dicdto.DictNo, "添加", "添加字典信息 字典号:" + dicdto.DictNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 3,
|
msg = "字典号必须唯一"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "数据字典", dicdto.DictNo, "添加", "添加字典信息 字典号:" + dicdto.DictNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("新增字典异常", ex);
|
}
|
}
|
|
/// <summary>
|
/// 删除字典信息
|
/// </summary>
|
/// <param name="id">字典id</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpGet]
|
public async Task<IActionResult> DelDic(int id)
|
{
|
//捕获异常
|
try
|
{
|
SysDictionary dic = _dic.GetDicById(id);
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//更改人
|
dic.UpdateUser = uid;
|
//删除
|
int i = await _dic.DelDic(dic);
|
//判断是否删除成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "失败"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "数据字典", dic.DictNo, "删除", "删除字典信息 字典号:" + dic.DictNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("删除字典异常", ex);
|
}
|
}
|
|
/// <summary>
|
/// 编辑字典信息
|
/// </summary>
|
/// <param name="dicdto">字典dto</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public async Task<IActionResult> ExitDic(DictionaryDto dicdto)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//更改人
|
dicdto.UpdateUser = uid;
|
//编辑
|
int i = await _dic.ExitDic(dicdto);
|
//判断是否编辑成功
|
if (i == 0)
|
{
|
return Ok(new
|
{
|
data = i,
|
code = 1,
|
msg = "失败"
|
});
|
}
|
else
|
{
|
await _operation.InsertOperation("系统设置", "数据字典", dicdto.DictNo, "修改", "修改字典信息 字典号:" + dicdto.DictNo, uid);
|
return Ok(new
|
{
|
data = i,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("编辑字典异常", ex);
|
}
|
}
|
|
#endregion
|
|
#endregion
|
|
#region 仓库管理
|
/// <summary>
|
/// 获取仓库信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetWarehouseList(GetWareHouseVm model)
|
{
|
try
|
{
|
var bolls = _wareHouseSvc.GetWarehouseList(model.WareHouseNo, model.WareHouseName, model.Type, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "仓库信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 获取单条仓库信息
|
/// </summary>
|
/// <param name="model">ID</param>
|
/// <returns></returns>
|
[HttpPost]
|
public async Task<IActionResult> GetWarehouse(IdVm model)
|
{
|
try
|
{
|
var bolls = await _wareHouseSvc.GetWarehouse(model.Id);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
|
/// <summary>
|
/// 修改仓库信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public async Task<IActionResult> EditWarehouse(EditWareHouseVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = await _wareHouseSvc.EditWareHouse(model.Id, model.WareHouseNo, model.WareHouseName, model.Type, model.Temp, model.Row, model.Col, model.Layer, int.Parse(userId));
|
if (bolls)
|
{
|
await _operation.InsertOperation("仓库设置", "仓库管理", model.WareHouseNo, "修改", "修改仓库信息 仓库号:" + model.WareHouseNo, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
|
}
|
/// <summary>
|
/// 获取仓库信息(前端下拉框可用)
|
/// </summary>
|
/// <returns></returns>
|
[HttpGet]
|
public async Task<IActionResult> GetWarehouseDic()
|
{
|
try
|
{
|
var bolls = await _wareHouseSvc.GetWareHouseDic();
|
|
return Ok(new { code = 0, msg = "仓库信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
#endregion
|
|
#region 区域管理
|
/// <summary>
|
/// 获取区域信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageAreaList(GetAreaVm model)
|
{
|
try
|
{
|
var bolls = _areaSvc.GetStorageAreaList(model.AreaName, model.WareHouseNo, model.Status, model.Type, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "区域信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取单条区域信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageArea(IdVm model)
|
{
|
try
|
{
|
var bolls = _areaSvc.GetStorageArea(model.Id);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取区域信息(根据仓库号)
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageAreaByHouseNo(string wareHouseNo)
|
{
|
try
|
{
|
var bolls = _areaSvc.GetStorageAreaByHouseNo(wareHouseNo);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 修改区域信息
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditStorageArea(EditAreaVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _areaSvc.EditStorageArea(model.Id, model.AreaName, model.Priority, model.Type, model.Temperature, int.Parse(userId));
|
if (bolls)
|
{
|
SysStorageArea area = _areaSvc.GetStorageArea(model.Id);
|
_operation.InsertOperation("仓库设置", "区域管理", area.AreaNo, "修改", "修改区域信息 区域号:" + area.AreaNo, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
|
}
|
/// <summary>
|
/// 修改区域状态
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditStorageAreaStatus(EditAreaStatusVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _areaSvc.EditStorageAreaStatus(model.Id, model.Status, int.Parse(userId));
|
if (bolls)
|
{
|
SysStorageArea area = _areaSvc.GetStorageArea(model.Id);
|
string msg = "区域状态 区域号:" + area.AreaNo;
|
_operation.InsertOperation("仓库设置", "区域管理", area.AreaNo, "修改", model.Status == "0" ? "启用" + msg : "停用" + msg, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑状态成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑状态失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = "请联系管理员/" + e.Message });
|
}
|
|
}
|
#endregion
|
|
#region 巷道管理
|
/// <summary>
|
/// 获取巷道信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageRoadwayList(GetRoadwayVm model)
|
{
|
try
|
{
|
var bolls = _roadwaySvc.GetStorageRoadwayList(model.WareHouseNo, model.RoadwayName, model.Status, model.Type, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "巷道信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取单条巷道信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageRoadway(IdVm model)
|
{
|
try
|
{
|
var bolls = _roadwaySvc.GetStorageRoadway(model.Id);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取巷道信息(根据仓库号)
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageRoadwayByHouseNo(string wareHouseNo)
|
{
|
try
|
{
|
var bolls = _roadwaySvc.GetStorageRoadwayByHouseNo(wareHouseNo);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 修改巷道信息
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditStorageRoadway(EditRoadwayVm model)
|
{
|
if (ModelState.IsValid)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _roadwaySvc.EditStorageRoadway(model.Id, model.RoadwayName, model.Priority, model.Type, model.Temp, int.Parse(userId));
|
if (bolls)
|
{
|
SysStorageRoadway storage = _roadwaySvc.GetStorageRoadway(model.Id);
|
_operation.InsertOperation("仓库设置", "巷道管理", storage.RoadwayNo, "修改", "修改巷道信息 巷道号:" + storage.RoadwayNo, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
else //数据格式错误
|
{
|
return Ok(new { code = 1, msg = "数据格式错误" });
|
}
|
}
|
/// <summary>
|
/// 修改巷道状态
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditStorageRoadwayStatus(EditRoadwayStatusVm model)
|
{
|
if (ModelState.IsValid)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _roadwaySvc.EditStorageRoadwayStatus(model.Id, model.Status, int.Parse(userId));
|
if (bolls)
|
{
|
SysStorageRoadway storage = _roadwaySvc.GetStorageRoadway(model.Id);
|
string msg = "巷道状态 巷道号:" + storage.RoadwayNo;
|
_operation.InsertOperation("仓库设置", "巷道管理", storage.RoadwayNo, "修改", model.Status == "0" ? "启用" + msg : "停用" + msg, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑状态成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑状态失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
else //数据格式错误
|
{
|
return Ok(new { code = 1, msg = "数据格式错误" });
|
}
|
}
|
#endregion
|
|
#region 储位管理
|
/// <summary>
|
/// 获取储位信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageLocatList(GetLocateVm model)
|
{
|
try
|
{
|
var bolls = _locatSvc.GetStorageLocatList(model.HouseNo, model.RoadwayNo, model.AreaNo,
|
model.Status, model.Flag, model.Locat, model.Row, model.Col, model.Layer, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "储位信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取单条储位信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetStorageLocat(IdVm model)
|
{
|
try
|
{
|
var bolls = _locatSvc.GetStorageLocat(model.Id);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, ErrorMsg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 添加储位信息
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[AllowAnonymous]
|
[HttpPost]
|
public async Task<IActionResult> AddStorageLocat(AddLocateVm model)
|
{
|
if (ModelState.IsValid)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 400, ErrorMsg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 400, ErrorMsg = "为获取到当前操作人信息" });
|
}
|
var bolls = await _locatSvc.AddStorageLocat(model.HouseNo, model.RoadwayNo, model.AreaNo, model.Row, model.Col, model.Layer, model.Depth, Convert.ToInt32(userId));
|
if (bolls > 0)
|
{
|
await _operation.InsertOperation("仓库设置", "储位管理", model.RoadwayNo, "添加", "添加储位信息 储位号:" + model.RoadwayNo, Convert.ToInt32(userId));
|
return Ok(new { code = 200, ErrorMsg = "添加成功", data = bolls });
|
}
|
else
|
{
|
return Ok(new { code = 400, ErrorMsg = "添加失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 400, ErrorMsg = "请联系管理员/" + e.Message });
|
}
|
}
|
else //数据格式错误
|
{
|
return Ok(new { code = 400, ErrorMsg = "数据格式错误" });
|
}
|
}
|
/// <summary>
|
/// 修改储位信息
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult EditStorageLocat(EditLocateVm model)
|
{
|
if (ModelState.IsValid)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _locatSvc.EditStorageLocat(model, int.Parse(userId));
|
if (bolls)
|
{
|
SysStorageLocat storage = _locatSvc.GetStorageLocat(model.Id);
|
_operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "修改", "修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId));
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
else //数据格式错误
|
{
|
return Ok(new { code = 1, msg = "数据格式错误" });
|
}
|
}
|
/// <summary>
|
/// 修改储位状态标识信息集合
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[AllowAnonymous]
|
[HttpPost]
|
public IActionResult EditStorageLocatList(EditLocateListVm model)
|
{
|
if (ModelState.IsValid)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = _locatSvc.EditStorageLocatList(model, 1);//int.Parse(userId)
|
if (bolls)
|
{
|
SysStorageLocat storage = _locatSvc.GetStorageLocat(model.Id[0]);
|
string msg = "储位状态 储位号:" + storage.RoadwayNo;
|
if (model.Id.Count > 1)
|
{
|
foreach (var item in model.Id)
|
{
|
storage = _locatSvc.GetStorageLocat(item);
|
_operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "批量编辑", "批量修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId));
|
}
|
}
|
else
|
{
|
_operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "修改", "修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId));
|
}
|
|
return Ok(new { code = 0, msg = "编辑成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "编辑失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
else //数据格式错误
|
{
|
return Ok(new { code = 1, msg = "数据格式错误" });
|
}
|
}
|
#endregion
|
|
#region 托盘条码管理
|
/// <summary>
|
/// 查询托盘条码信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetPalletsList(GetPalletVm model)
|
{
|
try
|
{
|
var bolls = _palletSvc.GetPalletsList(model.PalletNo, model.Status, model.Page, model.Limit, out int count);
|
|
return Ok(new { code = 0, count, msg = "托盘条码信息", data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 查询托盘条码 日志信息跟踪时间线
|
/// </summary>
|
/// <param name="palletNo">托盘码</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetPalletTrackList(string palletNo)
|
{
|
try
|
{
|
var bolls = _palletTrackSvc.GetPalletTrackByPallNoList(palletNo);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, ErrorMsg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 添加托盘信息
|
/// </summary>
|
/// <param name="model">模型</param>
|
/// <returns></returns>
|
[HttpPost]
|
public async Task<IActionResult> AddPallets(AddPalletVm model)
|
{
|
try
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var bolls = await _palletSvc.AddPallets(model.GroupCount, int.Parse(userId));
|
if (bolls)
|
{
|
return Ok(new { code = 0, msg = "添加成功", data = "" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = "添加失败", data = "" });
|
}
|
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取托盘条码信息
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetPalletsNo(GetImgBarVm model)
|
{
|
try
|
{
|
var bolls = _palletSvc.GetPalletsNo(model.PalletNo);
|
|
return Ok(new { code = 0, data = bolls });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, ErrorMsg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 获取条形码
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetImgBar(GetImgBarVm model)
|
{
|
try
|
{
|
|
List<string> list = new List<string>();
|
var stockCode = _palletSvc.GetPalletsNo("");
|
if (stockCode != model.PalletNo)
|
{
|
throw new Exception("当前显示的条码不是最新条码,请重新添加");
|
}
|
string str = model.PalletNo.Substring(3, 5);
|
string remove = model.PalletNo.Substring(0, 3);
|
int sibelius = Convert.ToInt16(str);
|
for (int i = 0; i < model.GroupCount; i++)
|
{
|
if (i != 0)
|
{
|
sibelius += 1;
|
}
|
|
string code = remove + Convert.ToString(sibelius).PadLeft(5, '0');
|
for (int j = 0; j < model.SameCount; j++)
|
{
|
var re = BarcodeHelper.GetCodeBarBase64(code, 80, 50);
|
list.Add(re);
|
}
|
}
|
return Ok(new { code = 0, data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
/// <summary>
|
/// 补打条形码
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetImgBarReprint(GetImgBarVm model)
|
{
|
try
|
{
|
List<string> list = new List<string>();
|
for (int i = 0; i < model.GroupCount; i++)
|
{
|
for (int j = 0; j < model.SameCount; j++)
|
{
|
var re = BarcodeHelper.GetCodeBarBase64(model.PalletNo, 80, 50);
|
list.Add(re);
|
}
|
}
|
return Ok(new { code = 0, data = list });
|
}
|
catch (Exception e)
|
{
|
return Ok(new { code = 1, msg = e.Message });
|
}
|
}
|
#endregion
|
|
#region 异常处理
|
|
/// <summary>
|
/// 获取异常处理信息列表
|
/// </summary>
|
/// <param name="exceptionNo">异常号</param>
|
/// <param name="palletNo">托盘号</param>
|
/// <param name="excLocatNo">异常储位</param>
|
/// <param name="orderNo">关联单号</param>
|
/// <param name="taskNo">关联任务号</param>
|
/// <param name="type">异常类型</param>
|
/// <param name="status">状态</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetTableList(string exceptionNo, string palletNo, string excLocatNo, string orderNo, string taskNo, string type, string status)
|
{
|
List<ExceptionDto> tabledto = _table.GetTableList(exceptionNo, palletNo, excLocatNo, orderNo, taskNo, type, status);
|
return Ok(new
|
{
|
data = tabledto,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 根据id获取异常信息
|
/// </summary>
|
/// <param name="id">异常id</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetTableById(int id)
|
{
|
SysException table = _table.GetTableById(id);
|
return Ok(new
|
{
|
data = table,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
|
/// <summary>
|
/// 处理异常状态-空取异常
|
/// </summary>
|
/// <param name="tabledto">异常处理dto</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public IActionResult EditStatus(ExceptionDto tabledto)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//更改人
|
tabledto.UpdateUser = uid;
|
string strMesage = _table.EditStatus(tabledto);
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "处理成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("处理状态异常", ex);
|
}
|
}
|
/// <summary>
|
/// 处理异常状态-满入异常
|
/// </summary>
|
/// <param name="tabledto">异常处理dto</param>
|
/// <returns></returns>
|
/// <exception cref="Exception">捕获异常</exception>
|
[HttpPost]
|
public IActionResult EditStatus2(ExceptionDto tabledto)
|
{
|
//捕获异常
|
try
|
{
|
//获取当前操作用户id
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
int uid = Convert.ToInt32(userId);
|
//更改人
|
tabledto.UpdateUser = uid;
|
string strMesage = _table.EditStatus2(tabledto);
|
if (strMesage == "")
|
{
|
return Ok(new { code = 0, msg = "处理成功" });
|
}
|
else
|
{
|
return Ok(new { code = 1, msg = strMesage });
|
}
|
}
|
catch (Exception ex)
|
{
|
//抛出异常
|
throw new Exception("处理状态异常", ex);
|
}
|
}
|
#endregion
|
|
#region 储位图例
|
|
/// <summary>
|
/// 根据仓库 排
|
/// </summary>
|
/// <param name="wareHouseNo">仓库</param>
|
/// <param name="roadway">巷道号</param>
|
/// <param name="row">排</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageLocatLists(string wareHouseNo, string roadway,string row)
|
{
|
//获取储位信息
|
List<SysStorageLocat> storagelist = _locatSvc.GetStorageLocatLists(wareHouseNo, roadway, row);
|
|
//获取最大层级
|
int maxLayer = _locatSvc.GetMaxLayer(wareHouseNo, roadway, row);
|
|
//获取最大列数
|
int maxColumn = _locatSvc.GetColumn(wareHouseNo, roadway, row);
|
|
return Ok(new
|
{
|
data = storagelist,
|
code = 0,
|
maxlayer = maxLayer,
|
maxcolumn = maxColumn,
|
msg = ""
|
});
|
}
|
|
/// <summary>
|
/// 获取储位深度
|
/// </summary>
|
/// <param name="wareHouseNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetDepth(string wareHouseNo)
|
{
|
List<string> depth = _locatSvc.GetDepth(wareHouseNo);
|
return Ok(new
|
{
|
data = depth,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取该仓库排数
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageLocatRow(string wareHouseNo)
|
{
|
List<int> maxrow = _locatSvc.GetStorageLocatRow(wareHouseNo);
|
return Ok(new
|
{
|
data = maxrow,
|
code = 0,
|
msg = "成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取库位占比(圆
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageProportion(string wareHouseNo)
|
{
|
List<GetLocateVm> getLocateVms = _locatSvc.GetStorageProportion(wareHouseNo);
|
return Ok(new
|
{
|
data = getLocateVms,
|
code = 0,
|
msg = "获取库位占比数成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取库位占比(柱
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <param name="roadwayNo">巷道号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetStorageProportion1(string wareHouseNo, string roadwayNo)
|
{
|
List<GetLocateVm> getLocateVms = _locatSvc.GetStorageProportion1(wareHouseNo,roadwayNo);
|
return Ok(new
|
{
|
data = getLocateVms,
|
code = 0,
|
msg = "获取库位占比数成功"
|
});
|
}
|
|
/// <summary>
|
/// 获取仓库巷道
|
/// </summary>
|
/// <param name="wareHouseNo">仓库号</param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetRoadwayList(string wareHouseNo)
|
{
|
List<RoadwayDto> roadway = _locatSvc.GetRoadwayList(wareHouseNo);
|
return Ok(new
|
{
|
data = roadway,
|
code = 0,
|
msg = "获取仓库巷道成功"
|
});
|
}
|
|
/// <summary>
|
/// 根据储位地址获取储位上的托盘和物品信息
|
/// </summary>
|
/// <param name="locatNo"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public IActionResult GetLocateInfo(string locatNo)
|
{
|
try
|
{
|
//获取储位信息
|
LocateInfoVm model = _locatSvc.GetLocateInfo(locatNo);
|
|
return Ok(new
|
{
|
data = model,
|
code = 0,
|
msg = ""
|
});
|
}
|
catch (Exception e)
|
{
|
return Ok(new
|
{
|
data = "",
|
code = 1,
|
msg = e.Message
|
});
|
}
|
}
|
|
#endregion
|
|
|
|
#region 数据表格表头自定义(通用方法)
|
/// <summary>
|
/// 获取用户自定义表头
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetTableColsByUserId(HeaderSetVm model)
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
model.UserId = int.Parse(userId);
|
string cols = _headerSet.GetTableColsByUserId(model);
|
return Ok(new
|
{
|
data = cols,
|
code = 0,
|
msg = "获取自定义表头成功"
|
});
|
}
|
/// <summary>
|
/// 获取系统表头
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetTableColsSys(HeaderSetVm model)
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
model.UserId = int.Parse(userId);
|
var obj = _headerSet.GetTableColsSys(model);
|
return Ok(new
|
{
|
data = obj,
|
code = 0,
|
msg = "获取表头成功"
|
});
|
}
|
/// <summary>
|
/// 保存自定义表头
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult SaveClosUser(HeaderSetVm model)
|
{
|
//获取当前登录的用户ID
|
var claimsIdentity = this.User.Identity as ClaimsIdentity;
|
if (claimsIdentity == null)
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
|
if (string.IsNullOrWhiteSpace(userId))
|
{
|
return Ok(new { code = 1, msg = "为获取到当前操作人信息" });
|
}
|
model.UserId = int.Parse(userId);
|
string saveResult = _headerSet.SaveClosUser(model);
|
if (!string.IsNullOrEmpty(saveResult))
|
{
|
return Ok(new { data = saveResult, code = 0, msg = "自定义列成功" });
|
}
|
else
|
{
|
return Ok(new { data = "", code = 1, msg = "自定义列失败" });
|
}
|
}
|
|
#endregion
|
}
|
}
|