| | |
| | | { |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun013", {}, 'get', function (res) { |
| | | console.log(res.data.SetValue) |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | pageCnt = parseInt(res.data.SetValue); |
| | |
| | | function GetIsSetColW() |
| | | { |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun014", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | isSetColW=true; |
| | |
| | | $(".shenqingClass").hide(); //申请储位 |
| | | }); |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun012", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | $(function () { |
| | |
| | | |
| | | sendData(IP + "/Basis/GetDepartmentList?DepartmentName=" + DepartmentName + "&&DepartmentNo=" + DepartmentNo, {}, "get", function (res) { |
| | | console.log(res.data); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { |
| | | //成功 |
| | | var list = res.data; |
| | |
| | | Demo: field.Demo, |
| | | }; |
| | | sendData( IP + "/Basis/AddDepartment", param, "post", function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg( |
| | | res.msg, |
| | |
| | | msg: cusid, |
| | | }; |
| | | sendData( IP + "/Basis/DelDepartment?Id="+cusid+"",{},"get",function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg( |
| | | res.msg, |
| | |
| | | Demo: field.Demo, |
| | | }; |
| | | sendData( IP + "/Basis/ExitDepartment", param, "post", function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg("修改成功", |
| | | { |
| | |
| | | }; |
| | | sendData(IP + "/Basis/GetDepartmentById?Id="+param.id+"", {}, 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | //部门号编辑不显示 |
| | | if(res.data.DepartmentNo != "") |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/AddMate", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelMate?Id="+data.Id+"", {} , 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/ExitMate", param, 'post', |
| | | function(res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | |
| | | var sel1 = false; |
| | | //获取单位下拉菜单 UnitNo |
| | | synData(IP + "/Basis/GetUnitList", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#UnitNo").append('<option value =' + res.data[i].UnitNo + '>' + res.data[i].UnitName + '</option>'); |
| | |
| | | var sel2 = false; |
| | | //获取包装下拉菜单 PackagNo |
| | | synData(IP + "/Basis/GetPackagList", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#PackagNo").append('<option value =' + res.data[i].PackagNo + '>' + res.data[i].PackagName + '</option>'); |
| | |
| | | UserId: id, |
| | | }; |
| | | synData(IP + "/Basis/GetMateById?Id= " + getQueryString('id') + "", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | // console.log(res.data.CategoryNo) |
| | | //审批状态编辑显示 |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/GetPackagList", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/AddMate", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | |
| | | //获取单位下拉菜单 UnitNo |
| | | sendData(IP + "/Basis/GetUnitList",{},'get',function(res){ |
| | | if(res.code == 0) //成功 |
| | | if(res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) |
| | | { |
| | |
| | | |
| | | //获取包装下拉菜单 PackagNo |
| | | sendData(IP + "/Basis/GetPackagList",{},'get',function(res){ |
| | | if(res.code == 0) //成功 |
| | | if(res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) |
| | | { |
| | |
| | | UserId: id, |
| | | }; |
| | | sendData(IP + "/Basis/GetMateById?Id= " +getQueryString('id')+ "", {}, 'get', function(res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | //审批状态编辑显示 |
| | | if(res.data.AuditStatusNo != "") |
| | |
| | | GroupNo: GroupNo |
| | | }; |
| | | sendData(IP + "/Basis/GetFunSettingList?FunSetName="+FunSetName+"&&IsEnable="+IsEnable+"&&GroupNo="+GroupNo, {}, 'get', function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | var list = res.data; |
| | | $.extend(infoOptions, { |
| | |
| | | doing = false; |
| | | sendData(IP + "/basis/AddFunSettings", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelFunSettings?Id="+data.Id+"", {} , 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | |
| | | doing = false; |
| | | sendData(IP + "/basis/ExitFunSettings", param, 'post', |
| | | function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | |
| | | UserId: id, |
| | | }; |
| | | sendData(IP + "/basis/GetFunSettingById?Id= " +getQueryString('id')+ "", {}, 'get', function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | //页面赋值 |
| | | if(res.data.FunSetNo != "") |
| | |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | using SqlSugar; |
| | | using WMS.Entity.Context; |
| | | using Utility; |
| | | using Microsoft.AspNetCore.Identity; |
| | | using System.Data; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | |
| | | /// </summary> |
| | | private readonly IDepartmentRepository _department; |
| | | readonly IMapper _mapper; |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="server">部门仓储接口</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public DepartmentServer(IDepartmentRepository department, IMapper mapper) |
| | | public DepartmentServer(IDepartmentRepository department, IMapper mapper, UserManager userManager) |
| | | { |
| | | _department = department;//部门 |
| | | _mapper = mapper;//automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="DepartmentName">部门名称</param> |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | public List<DepartmentDto> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | { |
| | | List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | return departmentlist; |
| | | return await Db.Queryable<SysDepartment>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(DepartmentNo), a => a.DepartmentNo.Contains(DepartmentNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(DepartmentName), a => a.DepartmentName.Contains(DepartmentName)) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<DepartmentDto>((a, b) => new DepartmentDto() { CreateUserName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | public SysDepartment GetDepartmentById(int id) |
| | | public async Task<SysDepartment> GetDepartmentById(int id) |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(id); |
| | | return department; |
| | | return await Db.Queryable<SysDepartment>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据部门号获取部门信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetDepartmentByNo(string DepartmentNo) |
| | | public async Task<int> GetDepartmentByNo(string DepartmentNo) |
| | | { |
| | | List<SysDepartment> department = _department.GetDepartmentByNo(DepartmentNo); |
| | | return department.Count; |
| | | return await Db.Queryable<SysDepartment>().CountAsync(s => s.DepartmentNo == DepartmentNo && s.IsDel == "0"); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 新增部门信息 |
| | | /// </summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | //模型映射 |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | //判断部门号是否唯一 |
| | | int count = await GetDepartmentByNo(department.DepartmentNo); |
| | | if (count > 0) |
| | | { |
| | | //模型映射 |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | //判断部门号是否唯一 |
| | | int count = GetDepartmentByNo(department.DepartmentNo); |
| | | int i = 0; |
| | | if (count > 0) |
| | | { |
| | | i = 3; |
| | | } |
| | | else if (count == 0) |
| | | { |
| | | i = await _department.AddDepartment(department); |
| | | } |
| | | return i; |
| | | |
| | | throw Oops.Bah("部门号必须唯一"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("新增部门异常", ex); |
| | | } |
| | | department.CreateTime = DateTime.Now; |
| | | department.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(department).ExecuteCommandAsync(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelDepartment(SysDepartment department) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _department.DelDepartment(department); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除部门异常", ex); |
| | | } |
| | | return await Db.Updateable<SysDepartment>() |
| | | .Where(s => s.Id == department.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //模型映射 |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | //编辑 |
| | | int i = await _department.ExitDepartment(department); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("编辑部门异常", ex); |
| | | } |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | int count = await Db.Queryable<SysDepartment>().CountAsync(s => s.DepartmentNo == departmentdto.DepartmentNo && s.Id != departmentdto.Id && s.IsDel == "0"); |
| | | if (count > 0) |
| | | throw Oops.Bah("部门号必须唯一"); |
| | | department.UpdateUser = _userManager.UserId; |
| | | department.UpdateTime = DateTime.Now; |
| | | return await Db.Updateable(department) |
| | | .UpdateColumns(s => new { s.DepartmentNo, s.DepartmentName, s.Demo, s.UpdateUser, s.UpdateTime }) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | using Utility; |
| | | using Microsoft.AspNetCore.Identity; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | |
| | | /// </summary> |
| | | private readonly IFunSettingRepository _setting; |
| | | private readonly IMapper _mapper; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="setting">功能设定</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public FunSettingServer(IFunSettingRepository setting, IMapper mapper) : base(Db) |
| | | public FunSettingServer(IFunSettingRepository setting, IMapper mapper, UserManager userManager) : base(Db) |
| | | { |
| | | _setting = setting;//功能设定 |
| | | _mapper = mapper;//automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | |
| | |
| | | /// <param name="IsEnable">开启状态</param> |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | public List<FunSettingDto> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | { |
| | | |
| | | List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | return settinglist; |
| | | return await Db.Queryable<SysFunSetting>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(FunSetName), a => a.FunSetName.Contains(FunSetName)) |
| | | .WhereIF(!string.IsNullOrEmpty(GroupNo), a => a.GroupNo.Contains(GroupNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(IsEnable), a => a.IsEnable == IsEnable) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<FunSettingDto>((a, b) => new FunSettingDto() { CreateName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | public SysFunSetting GetFunSettingById(int id) |
| | | public async Task<SysFunSetting> GetFunSettingById(int id) |
| | | { |
| | | SysFunSetting settinglist = _setting.GetFunSettingById(id); |
| | | return settinglist; |
| | | return await Db.Queryable<SysFunSetting>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | public SysFunSetting GetFunSettingByNo(string funSetNo) |
| | | public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo) |
| | | { |
| | | try |
| | | { |
| | | var list = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == funSetNo); |
| | | return list; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw ex; |
| | | } |
| | | return await Db.Queryable<SysFunSetting>().FirstAsync(a => a.IsDel == "0" && a.FunSetNo == funSetNo); |
| | | } |
| | | |
| | | ///// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | //映射模型 |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | var setData = await Db.Queryable<SysFunSetting>().FirstAsync(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue); |
| | | if (setData != null) |
| | | { |
| | | //映射模型 |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | //判断功能编号是否唯一 |
| | | var set = GetFunSettingByNo(setting.FunSetNo); |
| | | int i = 0; |
| | | if (set != null) |
| | | { |
| | | i = 3; |
| | | } |
| | | else if (set == null) |
| | | { |
| | | var setData = Db.Queryable<SysFunSetting>() |
| | | .First(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue==settingdto.SetValue); |
| | | if (setData!=null) |
| | | { |
| | | throw new Exception("同组内设定值重复"); |
| | | } |
| | | //新增 |
| | | i = await _setting.AddFunSettings(setting); |
| | | } |
| | | return i; |
| | | throw Oops.Bah("同组内设定值重复"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | setting.CreateTime = DateTime.Now; |
| | | setting.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(setting).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelFunSettings(SysFunSetting funSetting) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _setting.DelFunSettings(funSetting); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除功能异常", ex); |
| | | } |
| | | return await Db.Updateable<SysFunSetting>() |
| | | .Where(s => s.Id == funSetting.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //映射模型 |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | |
| | | var setData = Db.Queryable<SysFunSetting>() |
| | | .First(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue && m.Id!=settingdto.Id); |
| | | if (setData != null) |
| | | { |
| | | throw new Exception("同组内设定值重复"); |
| | | } |
| | | //编辑 |
| | | int i = await _setting.ExitFunSettings(setting); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | var setData = await Db.Queryable<SysFunSetting>() |
| | | .FirstAsync(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue && m.Id != settingdto.Id); |
| | | if (setData != null) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | throw Oops.Bah("同组内设定值重复"); |
| | | } |
| | | setting.UpdateUser = _userManager.UserId; |
| | | setting.UpdateTime = DateTime.Now; |
| | | return await Db.Updateable(setting) |
| | | .UpdateColumns(s => new { s.FunSetName, s.SetValue, s.FunText, s.IsEnable, s.Ord, s.GroupNo, s.UpdateUser, s.UpdateTime }) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using AutoMapper; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using Utility; |
| | | using WMS.DAL; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.SysEntity; |
| | |
| | | public IMaterialsRepository _mate { get; set; } |
| | | private readonly IMapper _mapper; |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="mate">物料编码</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public MaterialsServer(IMaterialsRepository mate, IMapper mapper) : base(Db) |
| | | public MaterialsServer(IMaterialsRepository mate, IMapper mapper, UserManager userManager) : base(Db) |
| | | { |
| | | _mate = mate; //物料编码 |
| | | _mapper = mapper; //automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | #region wms |
| | | |
| | | //public List<MaterialsDto> GetMaterialsList(string skuNo, string skuName, string type, string isInspect, int page, int limit, out int count) |
| | | //{ |
| | | // try |
| | | // { |
| | | // Expression<Func<SysMaterials, bool>> item = Expressionable.Create<SysMaterials>() |
| | | // .AndIF(!string.IsNullOrWhiteSpace(skuNo), it => it.SkuNo.Contains(skuNo.Trim())) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(skuName), it => it.SkuName.Contains(skuName.Trim())) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(isInspect), it => it.IsInspect == isInspect) |
| | | // .ToExpression();//注意 这一句 不能少 |
| | | |
| | | // var data = _mate.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | // .Includes(x => x.TypeInfo) |
| | | // .Includes(x => x.EnvironmentInfo) |
| | | // .Includes(x => x.UnitInfo) |
| | | // .Includes(x => x.PackagInfo) |
| | | // .Includes(x => x.CreateUserInfo) |
| | | // .Includes(x => x.UpdateUserInfo) |
| | | // .ToList(); |
| | | // count = counts; |
| | | |
| | | // return data.Select(m => new MaterialsDto() |
| | | // { |
| | | // Id = m.Id, |
| | | // SkuNo = m.SkuNo, |
| | | // SkuName = m.SkuName, |
| | | // Standard = m.Standard, |
| | | // AuditStatusNo = m.AuditStatusNo, |
| | | // Type = m.Type, |
| | | // TypeName = m.TypeInfo == null ? "" : m.TypeInfo.DictName, |
| | | // IsControlled = m.IsControlled, |
| | | // IsInspect = m.IsInspect, |
| | | // Origin = m.Origin, |
| | | // UnitNo = m.UnitNo, |
| | | // UnitName = m.UnitInfo == null ? "" : m.UnitInfo.UnitName, |
| | | // PackagNo = m.PackagNo, |
| | | // PackagName = m.PackagInfo == null ? "" : m.PackagInfo.PackagName, |
| | | // Environment = m.Environment, |
| | | // EnvironmentName = m.EnvironmentInfo == null ? "" : m.EnvironmentInfo.DictName, |
| | | // Weight = m.Weight, |
| | | // Warranty = m.Warranty, |
| | | // Price = m.Price, |
| | | // Demo = m.Demo, |
| | | |
| | | // CreateUserName = m.CreateUserInfo == null ? "" : m.CreateUserInfo.UserName, |
| | | // UpdateUserName = m.UpdateUserInfo == null ? "" : m.UpdateUserInfo.UserName, |
| | | // CreateTime = m.CreateTime, |
| | | // UpdateTime = m.UpdateTime |
| | | // }).ToList(); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // throw new Exception(e.Message); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取物料信息列表 |
| | |
| | | /// <param name="environment">存储环境</param> |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | public List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | public Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | { |
| | | List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | return matedto; |
| | | return Db.Queryable<SysMaterials>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuNo.Contains(skuName)) |
| | | .WhereIF(!string.IsNullOrEmpty(auditStatusNo), a => a.AuditStatusNo == auditStatusNo) |
| | | .WhereIF(!string.IsNullOrEmpty(type), a => a.Type == type) |
| | | .WhereIF(!string.IsNullOrEmpty(isControlled), a => a.IsControlled == isControlled) |
| | | .WhereIF(!string.IsNullOrEmpty(isInspect), a => a.IsInspect == isInspect) |
| | | .WhereIF(!string.IsNullOrEmpty(environment), a => a.Environment == environment) |
| | | .WhereIF(!string.IsNullOrEmpty(categoryNo), a => a.CategoryNo == categoryNo) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<MaterialsDto>((a, b) => new MaterialsDto() { CreateUserName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | public SysMaterials GetMateById(int id) |
| | | public async Task<SysMaterials> GetMateById(int id) |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | return mate; |
| | | return await Db.Queryable<SysMaterials>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="SkuNo">物料编号</param> |
| | | /// <returns></returns> |
| | | public int GetMateByNo(string SkuNo) |
| | | public async Task<int> GetMateByNo(string SkuNo) |
| | | { |
| | | List<SysMaterials> mate = _mate.GetMateByNo(SkuNo); |
| | | return mate.Count; |
| | | return await Db.Queryable<SysMaterials>().CountAsync(s => s.SkuNo == SkuNo && s.IsDel == "0"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | int count = GetMateByNo(matedto.SkuNo); |
| | | |
| | | if (count > 0) |
| | | { |
| | | throw new Exception("系统中已存在该物料"); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | { |
| | | throw new Exception("包装信息不能为空"); |
| | | } |
| | | |
| | | |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | mate.AuditStatusNo = "9"; //审核状态 |
| | | mate.Type = mate.Type; //类型 |
| | | mate.IsControlled = string.IsNullOrWhiteSpace(mate.IsControlled) ? "0" : mate.IsControlled; //是否受控 |
| | | mate.IsInspect = string.IsNullOrWhiteSpace(mate.IsInspect) ? "0" : mate.IsInspect; //是否免检 |
| | | mate.IsPasteCode = string.IsNullOrWhiteSpace(mate.IsPasteCode) ? "0" : mate.IsPasteCode; //是否免检 |
| | | mate.Origin = "WMS"; //来源 |
| | | mate.IsDel = "0"; |
| | | mate.CreateTime = Db.GetDate(); |
| | | Db.BeginTran(); |
| | | Db.Insertable(mate).ExecuteCommand(); |
| | | Db.CommitTran(); |
| | | return 1; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.RollbackTran(); |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | throw Oops.Bah("包装信息不能为空"); |
| | | if (await GetMateByNo(matedto.SkuNo) > 0) |
| | | throw Oops.Bah("系统中已存在该物料"); |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | mate.AuditStatusNo = "9"; //审核状态 |
| | | mate.Type = mate.Type; //类型 |
| | | mate.IsControlled = string.IsNullOrWhiteSpace(mate.IsControlled) ? "0" : mate.IsControlled; //是否受控 |
| | | mate.IsInspect = string.IsNullOrWhiteSpace(mate.IsInspect) ? "0" : mate.IsInspect; //是否免检 |
| | | mate.IsPasteCode = string.IsNullOrWhiteSpace(mate.IsPasteCode) ? "0" : mate.IsPasteCode; //是否免检 |
| | | mate.Origin = "WMS"; //来源 |
| | | mate.IsDel = "0"; |
| | | mate.CreateTime = DateTime.Now; |
| | | mate.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(mate).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelMate(SysMaterials mate) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _mate.DelMate(mate); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除物料异常", ex); |
| | | } |
| | | return await Db.Updateable<SysMaterials>() |
| | | .Where(s => s.Id == mate.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | if (matedto.AdventTime > 365 && matedto.AdventTime < 30) |
| | | { |
| | | if (matedto.AdventTime > 365 && matedto.AdventTime < 30) |
| | | { |
| | | return 2; |
| | | } |
| | | else if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | { |
| | | throw new Exception("包装不能为空"); |
| | | } |
| | | //else if (matedto.LowInventory > 1000) |
| | | //{ |
| | | // return 4; |
| | | //} |
| | | else |
| | | { |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | //编辑 |
| | | //根据id获取物料信息 |
| | | var list = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.Id == mate.Id); |
| | | //mate.CategoryNo = list.CategoryNo; |
| | | mate.Origin = list.Origin; |
| | | mate.CreateUser = list.CreateUser; |
| | | mate.UpdateTime = Db.GetDate(); |
| | | mate.CreateTime = list.CreateTime; |
| | | |
| | | int i = Db.Updateable(mate).ExecuteCommand(); |
| | | return i; |
| | | } |
| | | throw Oops.Bah("临期天数不可大于365及小于30"); |
| | | } |
| | | catch (Exception ex) |
| | | else if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | throw Oops.Bah("包装不能为空"); |
| | | } |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | //编辑 |
| | | //根据id获取物料信息 |
| | | var modMaterial = await Db.Queryable<SysMaterials>().FirstAsync(a => a.IsDel == "0" && a.Id == mate.Id); |
| | | //mate.CategoryNo = list.CategoryNo; |
| | | mate.Origin = modMaterial.Origin; |
| | | mate.CreateUser = modMaterial.CreateUser; |
| | | mate.UpdateTime = DateTime.Now; |
| | | mate.UpdateUser = _userManager.UserId; |
| | | mate.CreateTime = modMaterial.CreateTime; |
| | | int i = Db.Updateable(mate).ExecuteCommand(); |
| | | return i; |
| | | } |
| | | |
| | | #region 包装 单位 |
| | |
| | | /// 获取计量单位信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<SysUnit> GetUnitList() |
| | | public async Task<List<SysUnit>> GetUnitList() |
| | | { |
| | | List<SysUnit> unitlist = _mate.GetUnitList(); |
| | | return unitlist; |
| | | return await Db.Queryable<SysUnit>().Where(s => s.IsDel == "0").ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取包装信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<SysPackag> GetPackagList() |
| | | public async Task<List<SysPackag>> GetPackagList() |
| | | { |
| | | List<SysPackag> packlist = _mate.GetPackagList(); |
| | | return packlist; |
| | | return await Db.Queryable<SysPackag>().Where(s => s.IsDel == "0").ToListAsync(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <param name="DepartmentName">部门名称</param> |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | List<DepartmentDto> GetDepartmentList(string DepartmentName, string DepartmentNo); |
| | | Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id获取部门信息 |
| | | /// </summary> |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | SysDepartment GetDepartmentById(int id); |
| | | Task<SysDepartment> GetDepartmentById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据部门号获取部门信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | int GetDepartmentByNo(string DepartmentNo); |
| | | Task<int> GetDepartmentByNo(string DepartmentNo); |
| | | |
| | | /// <summary> |
| | | /// 新增部门信息 |
| | |
| | | /// <param name="IsEnable">开启状态</param> |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | List<FunSettingDto> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo); |
| | | Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id查询功能设定信息 |
| | | /// </summary> |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | SysFunSetting GetFunSettingById(int id); |
| | | Task<SysFunSetting> GetFunSettingById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据编号查询功能设定消息 |
| | | /// </summary> |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | SysFunSetting GetFunSettingByNo(string funSetNo); |
| | | Task<SysFunSetting> GetFunSettingByNo(string funSetNo); |
| | | |
| | | /// <summary> |
| | | /// 新增功能信息 |
| | |
| | | { |
| | | #region wms |
| | | |
| | | ///// <summary> |
| | | ///// 查询物料信息 |
| | | ///// </summary> |
| | | ///// <param name="skuNo">物料号</param> |
| | | ///// <param name="skuName">物料名称</param> |
| | | ///// <param name="type">物料类型</param> |
| | | ///// <param name="isInspect">是否免检</param> |
| | | ///// <param name="page"></param> |
| | | ///// <param name="limit"></param> |
| | | ///// <param name="count"></param> |
| | | ///// <returns></returns> |
| | | //List<MaterialsDto> GetMaterialsList(string skuNo, string skuName, string type, string isInspect, int page, int limit, out int count); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取物料信息列表 |
| | | /// </summary> |
| | |
| | | /// <param name="environment">存储环境</param> |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment,string categoryNo); |
| | | Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment,string categoryNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id查询物料信息 |
| | | /// </summary> |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | SysMaterials GetMateById(int id); |
| | | Task<SysMaterials> GetMateById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据编号查询物料信息 |
| | | /// </summary> |
| | | /// <param name="SkuNo">物料编号</param> |
| | | /// <returns></returns> |
| | | int GetMateByNo(string SkuNo); |
| | | Task<int> GetMateByNo(string SkuNo); |
| | | |
| | | /// <summary> |
| | | /// 新增物料信息 |
| | |
| | | /// 获取计量单位信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<SysUnit> GetUnitList(); |
| | | Task<List<SysUnit>> GetUnitList(); |
| | | |
| | | /// <summary> |
| | | /// 获取包装信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<SysPackag> GetPackagList(); |
| | | Task<List<SysPackag>> GetPackagList(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | { |
| | | List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | return Ok(new |
| | | { |
| | | data = departmentlist, |
| | | code = 0, |
| | | msg = "获取部门信息列表成功" |
| | | }); |
| | | return await _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetDepartmentById(int id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysDepartment> GetDepartmentById(int id) |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(id); |
| | | return Ok(new |
| | | { |
| | | data = department, |
| | | msg = "成功", |
| | | code = 0 |
| | | }); |
| | | return await _department.GetDepartmentById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddDepartment(DepartmentDto departmentdto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _department.AddDepartment(departmentdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | departmentdto.CreateUser = uid; |
| | | |
| | | int i = await _department.AddDepartment(departmentdto); |
| | | //判断是否新增成功 |
| | | 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("基础信息", "部门管理", departmentdto.DepartmentNo, "添加", "添加部门信息 部门号:" + departmentdto.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "新增成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("新增部门异常", ex); |
| | | } |
| | | |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = departmentdto.DepartmentNo, |
| | | TypeName = "添加", |
| | | Msg = "添加部门信息 部门号:" + departmentdto.DepartmentNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelDepartment(int Id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelDepartment(int Id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysDepartment department = await _department.GetDepartmentById(Id); |
| | | await _department.DelDepartment(department); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(Id); |
| | | |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | department.UpdateUser = uid; |
| | | int i = await _department.DelDepartment(department); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "删除失败" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "部门管理", department.DepartmentNo, "删除", "删除部门信息 部门号:" + department.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "删除成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除部门异常", ex); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = department.DepartmentNo, |
| | | TypeName = "删除", |
| | | Msg = "删除部门信息 部门号:" + department.DepartmentNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitDepartment(DepartmentDto departmentdto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task ExitDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _department.ExitDepartment(departmentdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | departmentdto.UpdateUser = uid; |
| | | int i = await _department.ExitDepartment(departmentdto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "编辑失败" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "部门管理", departmentdto.DepartmentNo, "修改", "编辑部门信息 部门号:" + departmentdto.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "编辑成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("编辑部门异常", ex); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = departmentdto.DepartmentNo, |
| | | TypeName = "编辑", |
| | | Msg = "编辑部门信息 部门号:" + departmentdto.DepartmentNo |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | { |
| | | List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | return Ok(new |
| | | { |
| | | data = settinglist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingById(int id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysFunSetting> GetFunSettingById(int id) |
| | | { |
| | | SysFunSetting settinglist = _setting.GetFunSettingById(id); |
| | | return Ok(new |
| | | { |
| | | data = settinglist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _setting.GetFunSettingById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingByNo(string funSetNo) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo) |
| | | { |
| | | try |
| | | { |
| | | var models = _setting.GetFunSettingByNo(funSetNo); |
| | | |
| | | return Ok(new { code = 0, msg = "功能设定信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _setting.GetFunSettingByNo(funSetNo); |
| | | } |
| | | /// <summary> |
| | | /// 新增功能信息 |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddFunSettings(FunSettingDto settingdto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _setting.AddFunSettings(settingdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //创建人 |
| | | settingdto.CreateUser = uid; |
| | | //新增 |
| | | int i = await _setting.AddFunSettings(settingdto); |
| | | //判断是否新增成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | }); |
| | | } |
| | | else if (i == 3) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 3, |
| | | msg = "功能号必须唯一" |
| | | }); |
| | | } |
| | | else if (i == 4) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 4, |
| | | msg = "显示顺序范围为1---5" |
| | | }); |
| | | } |
| | | else if (i == 5) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 5, |
| | | msg = "请输入正确组号" |
| | | }); |
| | | } |
| | | else if (i == 6) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 6, |
| | | msg = "每一组只能开启一个功能" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", settingdto.FunSetNo, "添加", "添加功能设定 功能号:" + settingdto.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = "新增功能异常:" + ex.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = settingdto.FunSetNo, |
| | | TypeName = "添加", |
| | | Msg = "添加功能设定 功能号:" + settingdto.FunSetNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelFunSettings(int id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelFunSettings(int id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysFunSetting funSetting = await _setting.GetFunSettingById(id); |
| | | await _setting.DelFunSettings(funSetting); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysFunSetting funSetting = _setting.GetFunSettingById(id); |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | funSetting.UpdateUser = uid; |
| | | //删除 |
| | | int i = await _setting.DelFunSettings(funSetting); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", funSetting.FunSetNo, "删除", "删除功能设定 功能号:" + funSetting.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除功能异常", ex); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = funSetting.FunSetNo, |
| | | TypeName = "删除", |
| | | Msg = "删除功能设定 功能号:" + funSetting.FunSetNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitFunSettings(FunSettingDto settingdto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task ExitFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _setting.ExitFunSettings(settingdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | settingdto.UpdateUser = uid; |
| | | //编辑 |
| | | int i = await _setting.ExitFunSettings(settingdto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | }); |
| | | } |
| | | else if (i == 6) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 6, |
| | | msg = "每一组只能开启一个功能" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", settingdto.FunSetNo, "修改", "修改功能设定 功能号:" + settingdto.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = "编辑功能异常:" + ex.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = settingdto.FunSetNo, |
| | | TypeName = "编辑", |
| | | Msg = "修改功能设定 功能号:" + settingdto.FunSetNo |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 物料管理 |
| | | |
| | | ///// <summary> |
| | | ///// 查询物料信息 |
| | | ///// </summary> |
| | | ///// <param name="matevm">物料编码视图模型</param> |
| | | ///// <returns></returns> |
| | | //[HttpPost] |
| | | //public IActionResult GetMaterialsList(GetMaterialsVm matevm) |
| | | //{ |
| | | // try |
| | | // { |
| | | // var bolls = _mate.GetMaterialsList(matevm.SkuNo, matevm.SkuName, matevm.Type, matevm.IsInspect, matevm.Page, matevm.Limit, out int count); |
| | | |
| | | // return Ok(new { code = 0, count, msg = "物料信息", data = bolls }); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // return Ok(new { code = 1, msg = e.Message }); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | #region yyk |
| | | |
| | |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | { |
| | | List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | return Ok(new |
| | | { |
| | | data = matedto, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetMateById(int id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysMaterials> GetMateById(int id) |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | return Ok(new |
| | | { |
| | | data = mate, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetMateById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="matedto">物料dto</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddMate(MaterialsDto matedto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task AddMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _mate.AddMate(matedto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //创建人 |
| | | matedto.CreateUser = uid; |
| | | //新增 |
| | | int i = await _mate.AddMate(matedto); |
| | | |
| | | await _operation.InsertOperation("基础信息", "物料管理", matedto.SkuNo, "添加", "添加物料信息 物料号:" + matedto.SkuNo, uid); |
| | | return Ok(new { data = i, code = 0, msg = "成功" }); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | return Ok(new { code = 1, msg = "新增物料异常" + ex.Message }); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = matedto.SkuNo, |
| | | TypeName = "添加", |
| | | Msg = "添加物料信息 物料号:" + matedto.SkuNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelMate(int id) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task DelMate(int id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysMaterials mate = await _mate.GetMateById(id); |
| | | await _mate.DelMate(mate); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | mate.UpdateUser = uid; |
| | | //删除 |
| | | int i = await _mate.DelMate(mate); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "物料管理", mate.SkuNo, "删除", "删除物料信息 物料号:" + mate.SkuNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除物料异常", ex); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = mate.SkuNo, |
| | | TypeName = "删除", |
| | | Msg = "删除物料信息 物料号:" + mate.SkuNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitMate(MaterialsDto matedto) |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task ExitMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _mate.ExitMate(matedto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更新人 |
| | | matedto.UpdateUser = uid; |
| | | //编辑 |
| | | int i = await _mate.ExitMate(matedto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new { data = i, code = 1, msg = "修改失败" }); |
| | | } |
| | | else if (i == 2) |
| | | { |
| | | return Ok(new { data = i, code = 2, msg = "临期天数不可大于365及小于30" }); |
| | | } |
| | | //else if (i == 4) |
| | | //{ |
| | | // return Ok(new { data = i, code = 4, msg = "低库存不可高于1000" }); |
| | | //} |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "物料管理", matedto.SkuNo, "修改", "编辑物料信息 物料号:" + matedto.SkuNo, uid); |
| | | return Ok(new { data = i, code = 0, msg = "修改成功" }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异 |
| | | return Ok(new { code = 1, msg = "编辑物料异常" + ex.Message }); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = matedto.SkuNo, |
| | | TypeName = "编辑", |
| | | Msg = "编辑物料信息 物料号:" + matedto.SkuNo |
| | | }); |
| | | } |
| | | |
| | | #region 包装 单位 |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetUnitList() |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysUnit>> GetUnitList() |
| | | { |
| | | List<SysUnit> unitlist = _mate.GetUnitList(); |
| | | return Ok(new |
| | | { |
| | | data = unitlist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetUnitList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetPackagList() |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysPackag>> GetPackagList() |
| | | { |
| | | List<SysPackag> packlist = _mate.GetPackagList(); |
| | | return Ok(new |
| | | { |
| | | data = packlist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetPackagList(); |
| | | } |
| | | |
| | | #endregion |