| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 | 
							- using System;
 
- using System.Data;
 
- using System.Collections.Generic;
 
- using WMS.Info;
 
- using WMS.Util;
 
- using SqlSugar;
 
- namespace WMS.Core
 
- {
 
-     /// <summary>
 
-     /// 描 述:权限分配
 
-     /// </summary>
 
-     public class ACLAuthorize
 
-     {
 
-         public const string ALLAuthorize = "7DC7155C4A674050BD591CF74B800958";
 
-         public const string IcoAuthorize = "fa fa-align-justify";
 
-         /// <summary>
 
-         /// 获取按钮列表树形数据(基于WebApp)
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public List<TreeModel> GetWebAppTree()
 
-         {
 
-             try
 
-             {
 
-                 List<ACL_ACLCONST> list = SysDbCore.GetDbCtx().Queryable<ACL_ACLCONST>().Where(it => it.F_APPTYPENUM == (int)EAppType.PC).ToList();
 
-                 List<TreeModel> WebAppTree = new List<TreeModel>();
 
-                 foreach (var webitem in list)
 
-                 {
 
-                     TreeModel node = new TreeModel();
 
-                     node.id = webitem.F_NO;
 
-                     node.text = webitem.F_NAME;
 
-                     node.value = webitem.F_NO;
 
-                     node.showcheck = true;
 
-                     node.checkstate = 0;
 
-                     node.isexpand = true;
 
-                     node.icon = ACLAuthorize.IcoAuthorize;
 
-                     node.parentId = webitem.F_PNO;
 
-                     WebAppTree.Add(node);
 
-                 }
 
-                 return WebAppTree.ToTree();
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 throw ex;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 获取按钮列表树形数据(基于OnLineRFApp)
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         public List<TreeModel> GetOnLineRFTree()
 
-         {
 
-             List<ACL_ACLCONST> list = SysDbCore.GetDbCtx().Queryable<ACL_ACLCONST>().Where(it => it.F_APPTYPENUM == (int)EAppType.OnLineRF).ToList();
 
-             List<TreeModel> OnRFAppTree = new List<TreeModel>();
 
-             foreach (var OnRFitem in list)
 
-             {
 
-                 TreeModel node = new TreeModel();
 
-                 node.id = OnRFitem.F_NO;
 
-                 node.text = OnRFitem.F_NAME;
 
-                 node.value = OnRFitem.F_NO;
 
-                 node.showcheck = true;
 
-                 node.checkstate = 0;
 
-                 node.isexpand = true;
 
-                 node.icon = ACLAuthorize.IcoAuthorize;
 
-                 node.parentId = OnRFitem.F_PNO;
 
-                 OnRFAppTree.Add(node);
 
-             }
 
-             return OnRFAppTree.ToTree();
 
-         }
 
-         public List<string> GetItemIdList(string objectNo, EACLType eACLType, EACLObjType eACLObjType)
 
-         {
 
-             try
 
-             {
 
-                 return SysDbCore.GetDbCtx().Queryable<ACL_AUTHORIZE>().Where(it => it.F_OBJNO == objectNo && it.F_ACLTYPENUM == (int)eACLType && it.F_OBJTYPENUM == (int)eACLObjType).Select(it => it.F_ITEMNO).ToList();
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 throw ex;
 
-             }
 
-         }
 
-         public void Authorize(AuthorizeInfo authorize)
 
-         {
 
-             try
 
-             {
 
-                 void action(SqlSugarClient ctx)
 
-                 {
 
-                     ctx.Deleteable<ACL_AUTHORIZE>().Where(it => it.F_OBJNO == authorize.ObjectNo && it.F_OBJTYPENUM == (int)authorize.ObjTypeNum).ExecuteCommand();
 
-                     if (authorize.WarehouseList != null)
 
-                     {
 
-                         foreach (var item in authorize.WarehouseList)
 
-                         {
 
-                             if (item == ACLAuthorize.ALLAuthorize)
 
-                             {
 
-                                 continue;
 
-                             }
 
-                             if (item.Contains(BaseWarehouse.WarehouseHead))
 
-                             {
 
-                                 continue;
 
-                             }
 
-                             ACL_AUTHORIZE insobj = new ACL_AUTHORIZE()
 
-                             {
 
-                                 F_OBJTYPENUM = (int)authorize.ObjTypeNum,
 
-                                 F_ITEMNO = item,
 
-                                 F_NO = Guid.NewGuid().ToString(),
 
-                                 F_OBJNO = authorize.ObjectNo,
 
-                                 F_ACLTYPENUM = (int)EACLType.Warehouse
 
-                             };
 
-                             ctx.Insertable<ACL_AUTHORIZE>(insobj).ExecuteCommand();
 
-                         }
 
-                     }
 
-                     if (authorize.WebAppNoList != null)
 
-                     {
 
-                         foreach (var item in authorize.WebAppNoList)
 
-                         {
 
-                             ACL_AUTHORIZE insobj = new ACL_AUTHORIZE()
 
-                             {
 
-                                 F_OBJTYPENUM = (int)authorize.ObjTypeNum,
 
-                                 F_ITEMNO = item,
 
-                                 F_NO = Guid.NewGuid().ToString(),
 
-                                 F_OBJNO = authorize.ObjectNo,
 
-                                 F_ACLTYPENUM = (int)EACLType.WebApp
 
-                             };
 
-                             ctx.Insertable<ACL_AUTHORIZE>(insobj).ExecuteCommand();
 
-                         }
 
-                     }
 
-                     if (authorize.OnlineRFNoList != null)
 
-                     {
 
-                         foreach (var item in authorize.OnlineRFNoList)
 
-                         {
 
-                             ACL_AUTHORIZE insobj = new ACL_AUTHORIZE()
 
-                             {
 
-                                 F_OBJTYPENUM = (int)authorize.ObjTypeNum,
 
-                                 F_ITEMNO = item,
 
-                                 F_NO = Guid.NewGuid().ToString(),
 
-                                 F_OBJNO = authorize.ObjectNo,
 
-                                 F_ACLTYPENUM = (int)EACLType.OnlineRF
 
-                             };
 
-                             ctx.Insertable<ACL_AUTHORIZE>(insobj).ExecuteCommand();
 
-                         }
 
-                     }
 
-                 };
 
-                 SysDbCore.DbTranExec(action);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 throw ex;
 
-             }
 
-         }
 
-         public Dictionary<string, V_WMS_AUTHORIZE> GetAuthorize(LoginUserInfo loginUser)
 
-         {
 
-             try
 
-             {
 
-                 Dictionary<string, V_WMS_AUTHORIZE> dics = new Dictionary<string, V_WMS_AUTHORIZE>();
 
-                 if (loginUser.UserType == EUserType.User)
 
-                 {
 
-                     SysDbCore.GetDbCtx().Queryable<V_WMS_AUTHORIZE>().Where(it => it.USERNO == loginUser.UserNo && it.ACLTYPENUM == (int)EACLType.WebApp).ToList().ForEach(it => dics.Add(it.ITEMNO, it));
 
-                 }
 
-                 return dics;
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 throw ex;
 
-             }
 
-         }
 
-         public ACL_AUTHORIZE GetAuthorizeSupperNo(string queryJson)
 
-         {
 
-             try
 
-             {
 
-                 var queryParam = queryJson.ToJObject();
 
-                 
 
-                 if (queryParam["F_NO"].IsEmpty() || queryParam["F_OBJTYPENUM"].IsEmpty() || queryParam["F_ACLTYPENUM"].IsEmpty())
 
-                 {
 
-                     throw SysExCore.ThrowFailException("参数不全,无法找到所属供应商");
 
-                 }
 
-                 int F_OBJTYPENUM = int.Parse(queryParam["F_OBJTYPENUM"].ToString());
 
-                 int F_ACLTYPENUM = int.Parse(queryParam["F_ACLTYPENUM"].ToString());
 
-                 var GetE = SysDbCore.GetDbCtx().Queryable<ACL_AUTHORIZE>().Where(v => v.F_OBJNO == queryParam["F_NO"].ToString() && v.F_ACLTYPENUM == F_ACLTYPENUM && v.F_OBJTYPENUM == F_OBJTYPENUM).First();
 
-                 if(GetE==null)
 
-                     throw SysExCore.ThrowFailException("所属供应商未赋值");
 
-                 return GetE;
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 throw SysExCore.ThrowFailException(ex.Message);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |