当前位置: 首页>>代码示例>>C#>>正文


C# User.HasPermission方法代码示例

本文整理汇总了C#中com.Sconit.Entity.MasterData.User.HasPermission方法的典型用法代码示例。如果您正苦于以下问题:C# User.HasPermission方法的具体用法?C# User.HasPermission怎么用?C# User.HasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.Sconit.Entity.MasterData.User的用法示例。


在下文中一共展示了User.HasPermission方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadPSModelFromXls


//.........这里部分代码省略.........
            if (colIndex < 0)
                throw new BusinessErrorException("Import.PSModel.Shift.Not.Exist", shift.ShiftName);

            ImportHelper.JumpRows(rows, 2);

            while (rows.MoveNext())
            {
                Row row = (HSSFRow)rows.Current;
                if (!this.CheckValidDataRow(row, 1, 4))
                {
                    break;//边界
                }

                //string regCode=row.GetCell(
                string fCode = string.Empty;
                string itemCode = string.Empty;
                int seq = 0;
                decimal planQty = 0;
                Cell cell = null;

                #region 读取生产线
                fCode = row.GetCell(1).StringCellValue;
                if (fCode.Trim() == string.Empty)
                    throw new BusinessErrorException("Import.PSModel.Empty.Error.Flow", (row.RowNum + 1).ToString());

                if (flowCode != null && flowCode.Trim() != string.Empty)
                {
                    if (fCode.Trim().ToUpper() != flowCode.Trim().ToUpper())
                        continue;//生产线过滤
                }
                #endregion

                #region 读取序号
                try
                {
                    string seqStr = row.GetCell(2).StringCellValue;
                    seq = row.GetCell(2).StringCellValue.Trim() != string.Empty ? int.Parse(row.GetCell(2).StringCellValue) : 0;
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.Seq", (row.RowNum + 1).ToString());
                }
                #endregion

                #region 读取成品代码
                try
                {
                    itemCode = row.GetCell(3).StringCellValue;
                    if (itemCode == string.Empty)
                        throw new BusinessErrorException("Import.PSModel.Empty.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                #endregion

                #region 读取计划量
                try
                {
                    cell = row.GetCell(colIndex);
                    if (cell == null || cell.CellType == NPOI.SS.UserModel.CellType.BLANK)
                        continue;

                    planQty = Convert.ToDecimal(row.GetCell(colIndex).NumericCellValue);
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.PlanQty", (row.RowNum + 1).ToString());
                }
                #endregion

                FlowDetail flowDetail = flowDetailMgr.LoadFlowDetail(fCode, itemCode, seq);
                if (flowDetail == null)
                    throw new BusinessErrorException("Import.PSModel.FlowDetail.Not.Exist", (row.RowNum + 1).ToString());

                //区域权限过滤
                if (regionCode != null && regionCode.Trim() != string.Empty)
                {
                    if (regionCode.Trim().ToUpper() != flowDetail.Flow.PartyTo.Code.ToUpper())
                        continue;
                }
                if (!user.HasPermission(flowDetail.Flow.PartyTo.Code))
                    continue;

                ShiftPlanSchedule sps = new ShiftPlanSchedule();
                sps.FlowDetail = flowDetail;
                sps.ReqDate = date;
                sps.Shift = shift;
                sps.PlanQty = planQty;
                sps.LastModifyUser = user;
                sps.LastModifyDate = DateTime.Now;
                spsList.Add(sps);
            }

            if (spsList.Count == 0)
                throw new BusinessErrorException("Import.Result.Error.ImportNothing");

            return spsList;
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:101,代码来源:ImportMgr.cs

示例2: CheckLoadHuLocationLotDetail

 public LocationLotDetail CheckLoadHuLocationLotDetail(string huId, User user, string locationCode)
 {
     IList<LocationLotDetail> locationLotDetailList = this.GetHuLocationLotDetail(locationCode, huId);
     if (locationLotDetailList == null || locationLotDetailList.Count == 0)
     {
         throw new BusinessErrorException("Common.Business.Error.HuNoInventory", locationCode, huId);
     }
     else if (locationLotDetailList.Count > 1)
     {
         throw new BusinessErrorException("Common.Business.Error.FindMultiHu", locationCode, huId);
     }
     else
     {
         if (user != null)
         {
             string regionCode = locationLotDetailList[0].Location.Region.Code;
             if (!user.HasPermission(regionCode))
             {
                 throw new BusinessErrorException("Common.Business.Error.NoPermission");
             }
         }
         return locationLotDetailList[0];
     }
 }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:24,代码来源:LocationLotDetailMgr.cs

示例3: ReadCycleCountFromXls

        public IList<CycleCountDetail> ReadCycleCountFromXls(Stream inputStream, User user, CycleCount cycleCount)
        {
            if (inputStream.Length == 0)
                throw new BusinessErrorException("Import.Stream.Empty");

            //区域权限过滤
            if (!user.HasPermission(cycleCount.Location.Region.Code))
            {
                throw new BusinessErrorException("Common.Business.Error.NoPartyPermission", cycleCount.Location.Region.Code);
            }

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

            Sheet sheet = workbook.GetSheetAt(0);
            IEnumerator rows = sheet.GetRowEnumerator();

            ImportHelper.JumpRows(rows, 11);

            #region 列定义
            int colItem = 1;//物料代码
            int colUom = 3;//单位
            int colQty = 4;//数量
            int colHu = 5;//条码
            int colBin = 6;//库格
            #endregion

            IList<CycleCountDetail> cycleCountDetailList = new List<CycleCountDetail>();
            while (rows.MoveNext())
            {
                Row row = (HSSFRow)rows.Current;
                if (!this.CheckValidDataRow(row, 1, 7))
                {
                    break;//边界
                }

                if (row.GetCell(colHu) == null)
                {
                    string itemCode = string.Empty;
                    decimal qty = 0;
                    string uomCode = string.Empty;

                    #region 读取数据
                    #region 读取物料代码
                    itemCode = row.GetCell(colItem) != null ? row.GetCell(colItem).StringCellValue : string.Empty;
                    if (itemCode == null || itemCode.Trim() == string.Empty)
                        this.ThrowCommonError(row.RowNum, colItem, row.GetCell(colItem));

                    var i = (
                        from c in cycleCountDetailList
                        where c.HuId == null && c.Item.Code.Trim().ToUpper() == itemCode.Trim().ToUpper()
                        select c).Count();

                    if (i > 0)
                        throw new BusinessErrorException("Import.Business.Error.Duplicate", itemCode, (row.RowNum + 1).ToString(), (colItem + 1).ToString());
                    #endregion

                    #region 读取数量
                    try
                    {
                        qty = Convert.ToDecimal(row.GetCell(colQty).NumericCellValue);
                    }
                    catch
                    {
                        this.ThrowCommonError(row.RowNum, colQty, row.GetCell(colQty));
                    }
                    #endregion

                    #region 读取单位
                    uomCode = row.GetCell(colUom) != null ? row.GetCell(colUom).StringCellValue : string.Empty;
                    if (uomCode == null || uomCode.Trim() == string.Empty)
                        throw new BusinessErrorException("Import.Read.Error.Empty", (row.RowNum + 1).ToString(), colUom.ToString());
                    #endregion
                    #endregion

                    #region 填充数据
                    Item item = itemMgr.CheckAndLoadItem(itemCode);
                    Uom uom = uomMgr.CheckAndLoadUom(uomCode);
                    //单位换算
                    if (item.Uom.Code.Trim().ToUpper() != uom.Code.Trim().ToUpper())
                    {
                        qty = uomConversionMgr.ConvertUomQty(item, uom, qty, item.Uom);
                    }

                    CycleCountDetail cycleCountDetail = new CycleCountDetail();
                    cycleCountDetail.CycleCount = cycleCount;
                    cycleCountDetail.Item = item;
                    cycleCountDetail.Qty = qty; cycleCountDetailList.Add(cycleCountDetail);
                    #endregion
                }
                else
                {
                    string huId = string.Empty;
                    string binCode = string.Empty;

                    #region 读取数据
                    #region 读取条码
                    huId = row.GetCell(colHu) != null ? row.GetCell(colHu).StringCellValue : string.Empty;
                    if (huId == null || huId.Trim() == string.Empty)
                        throw new BusinessErrorException("Import.Read.Error.Empty", (row.RowNum + 1).ToString(), colHu.ToString());

//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:101,代码来源:ImportMgr.cs

示例4: ReadShipScheduleYFKFromXls


//.........这里部分代码省略.........
                //            continue;//客户过滤
                //    }
                //}
                //catch
                //{
                //    throw new BusinessErrorException("Import.MRP.Read.Error.Customer", (row.RowNum + 1).ToString());
                //}
                #endregion

                #region 读取参考订单号
                try
                {
                    refOrderNo = row.GetCell(3).StringCellValue;
                }
                catch { throw new BusinessErrorException("Import.MRP.Read.Error.RefOrderNo", (row.RowNum + 1).ToString()); }

                #endregion

                #region 读取Flow
                try
                {
                    flowCode = row.GetCell(colFlow).StringCellValue;
                    if (flowCode.Trim() == string.Empty)
                        continue;
                }
                catch
                {
                    this.ThrowCommonError(row, colIndex);
                }
                #endregion

                #region 读取成品代码
                try
                {
                    itemCode = row.GetCell(4).StringCellValue;
                    if (itemCode == string.Empty)
                        throw new BusinessErrorException("Import.PSModel.Empty.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                #endregion

                #region 读取单包装
                try
                {
                    UC = Convert.ToDecimal(row.GetCell(colUC).NumericCellValue);
                }
                catch
                {
                    this.ThrowCommonError(row.RowNum, colUC, row.GetCell(colUC));
                }
                #endregion

                #region 读取计划量
                try
                {
                    planQty = Convert.ToDecimal(row.GetCell(colIndex).NumericCellValue);
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.PlanQty", (row.RowNum + 1).ToString());
                }
                #endregion

                FlowDetail flowDetail = this.LoadFlowDetailByFlow(flowCode, itemCode, UC);
                if (flowDetail == null)
                    throw new BusinessErrorException("Import.MRP.Distribution.FlowDetail.Not.Exist", (row.RowNum + 1).ToString());

                if (partyCode != null && partyCode.Trim() != string.Empty)
                {
                    if (!StringHelper.Eq(flowCode, partyCode))
                        continue;//客户过滤
                }

                //区域过滤
                if (partyCode != null && partyCode.Trim() != string.Empty)
                {
                    if (!StringHelper.Eq(partyCode, flowDetail.Flow.PartyTo.Code))
                        continue;//客户过滤
                }
                //区域权限过滤
                if (!user.HasPermission(flowDetail.Flow.PartyFrom.Code) && !user.HasPermission(flowDetail.Flow.PartyTo.Code))
                    continue;

                FlowPlan flowPlan = new FlowPlan();
                flowPlan.FlowDetail = flowDetail;
                flowPlan.TimePeriodType = timePeriodType;
                flowPlan.ReqDate = date;
                flowPlan.PlanQty = planQty;
                flowPlan.RefOrderNo = refOrderNo;
                flowPlanList.Add(flowPlan);
            }

            if (flowPlanList.Count == 0)
                throw new BusinessErrorException("Import.Result.Error.ImportNothing");

            return flowPlanList;
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:101,代码来源:ImportMgr.cs

示例5: CreateRepack

        private Repack CreateRepack(IList<RepackDetail> repackDetailList, string type, User user)
        {
            IList<RepackDetail> inRepackDetailList = new List<RepackDetail>();
            IList<RepackDetail> outRepackDetailList = new List<RepackDetail>();

            #region 判断RepackDetailList是否为空
            if (repackDetailList != null && repackDetailList.Count > 0)
            {
                foreach (RepackDetail repackDetail in repackDetailList)
                {
                    if (repackDetail.Qty != 0)
                    {
                        if (repackDetail.IOType == BusinessConstants.IO_TYPE_IN)
                        {
                            inRepackDetailList.Add(repackDetail);
                        }
                        else if (repackDetail.IOType == BusinessConstants.IO_TYPE_OUT)
                        {
                            outRepackDetailList.Add(repackDetail);
                        }
                        else
                        {
                            throw new TechnicalException("Invalid IO Type:" + repackDetail.IOType);
                        }
                    }
                }

                if (inRepackDetailList.Count == 0 || outRepackDetailList.Count == 0)
                {
                    throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty");
                }
            }
            else
            {
                throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty");
            }
            #endregion

            #region 检查In和Out明细数量是否匹配
            IDictionary<string, decimal> inItemQtyDic = new Dictionary<string, decimal>();
            Location location = null;

            #region 收集In数量
            foreach (RepackDetail inRepackDetail in inRepackDetailList)
            {
                LocationLotDetail inLocationLotDetail = this.locationLotDetailMgrE.LoadLocationLotDetail(inRepackDetail.LocationLotDetail.Id);

                if (location == null)
                {
                    location = inLocationLotDetail.Location;

                    if (!user.HasPermission(inLocationLotDetail.Location.Region.Code))
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Repack.Error.NoPermission", location.Code);
                    }
                }
                else if (location.Code != inLocationLotDetail.Location.Code)
                {
                    throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InRepackDetailLocationNotEqual");
                }

                if (inItemQtyDic.ContainsKey(inLocationLotDetail.Item.Code))
                {
                    inItemQtyDic[inLocationLotDetail.Item.Code] += inRepackDetail.Qty;
                }
                else
                {
                    inItemQtyDic.Add(inLocationLotDetail.Item.Code, inRepackDetail.Qty);
                }
            }
            #endregion

            #region 收集Out数量
            IDictionary<string, decimal> outItemQtyDic = new Dictionary<string, decimal>();

            foreach (RepackDetail outRepackDetail in outRepackDetailList)
            {
                if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK)
                {
                    if (outRepackDetail.Hu == null)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuIdIsEmpty");
                    }
                    else
                    {
                        if (outItemQtyDic.ContainsKey(outRepackDetail.Hu.Item.Code))
                        {
                            outItemQtyDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty;
                        }
                        else
                        {
                            outItemQtyDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty);
                        }
                    }
                }
                else if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING)
                {
                    string itemCode = outRepackDetail.Hu != null ? outRepackDetail.Hu.Item.Code : outRepackDetail.itemCode;

                    if (itemCode == null)
//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:101,代码来源:RepackMgr.cs

示例6: AnalyzeBarcode

        public Resolver AnalyzeBarcode(string barcode, User user, string moduleType)
        {
            Resolver resolver = new Resolver();
            resolver.ModuleType = moduleType;
            resolver.UserCode = user.Code;

            if (barcode == null || barcode.Trim() == string.Empty)
            {
                return resolver;
            }
            //Order
            if (barcode.StartsWith(BusinessConstants.CODE_PREFIX_ORDER))
            {
                resolver.BarcodeHead = BusinessConstants.CODE_PREFIX_ORDER;
                resolver.Code = barcode;
                OrderHead orderHead = orderHeadMgr.CheckAndLoadOrderHead(resolver.Code);
                Flow flow = this.flowMgr.LoadFlow(orderHead.Flow);

                #region CopyProperty from OrderHead
                resolver.Description = flow.Description;
                resolver.NeedPrintAsn = orderHead.NeedPrintAsn;
                resolver.NeedPrintReceipt = orderHead.NeedPrintReceipt;
                resolver.AllowExceed = orderHead.AllowExceed;
                resolver.OrderType = orderHead.Type;
                resolver.AntiResolveHu = orderHead.AntiResolveHu;
                if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIP)
                {
                    resolver.IsScanHu = orderHead.IsShipScanHu;
                }
                else if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_RECEIVE)
                {
                    resolver.IsScanHu = orderHead.IsReceiptScanHu;
                }
                else
                {
                    resolver.IsScanHu = orderHead.IsShipScanHu || orderHead.IsReceiptScanHu;
                }
                #endregion

                #region 校验
                //校验权限
                if (!user.HasPermission(orderHead.PartyFrom.Code)
                 || !user.HasPermission(orderHead.PartyTo.Code))
                {
                    throw new BusinessErrorException("Common.Business.Error.NoPermission");
                }

                #region 校验状态:Status
                if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIP
                    || moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_RECEIVE
                    || moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_OFFLINE)
                {
                    if (orderHead.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
                    {
                        throw new BusinessErrorException("Common.Business.Error.StatusError", orderHead.OrderNo, orderHead.Status);
                    }
                }
                else if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_ONLINE)
                {
                    if (orderHead.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)
                    {
                        throw new BusinessErrorException("Common.Business.Error.StatusError", orderHead.OrderNo, orderHead.Status);
                    }
                }
                #endregion

                #region 校验类型:Type
                if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_OFFLINE
                    || moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_ONLINE)
                {
                    if (orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        throw new BusinessErrorException("Order.Error.OrderOfflineIsNotProduction", orderHead.OrderNo, orderHead.Type);
                    }
                }
                else if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIP)
                {
                    if (orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT
                        && orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION
                        && orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)
                    {
                        throw new BusinessErrorException("Order.Error.OrderShipIsNotProduction", orderHead.OrderNo, orderHead.Type);
                    }
                }
                else if (moduleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_RECEIVE)
                {
                    if (orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_CUSTOMERGOODS
                    && orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT
                    && orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)
                    {
                        throw new BusinessErrorException("Order.Error.OrderReceiveIsNotProduction", orderHead.OrderNo, orderHead.Type);
                    }
                }
                #endregion

                #endregion
            }
            //PickList
            else if (barcode.StartsWith(BusinessConstants.CODE_PREFIX_PICKLIST))
            {
//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:101,代码来源:ScanBarcodeMgr.cs

示例7: CreateRepack


//.........这里部分代码省略.........
            #region �ж��Ƿ񱻼��
            foreach (RepackDetail inRepackDetail in inRepackDetailList)
            {
                if (inRepackDetail.LocationLotDetail.Hu != null && this.locationMgr.IsHuOcuppyByPickList(inRepackDetail.LocationLotDetail.Hu.HuId))
                {
                    throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuOccupied", inRepackDetail.Hu.HuId);
                }
            }
            #endregion

            #region �жϷ���������Ƿ�Ϊ������
            foreach (RepackDetail outRepackDetail in outRepackDetailList)
            {
                if (outRepackDetail.Hu != null && outRepackDetail.Hu.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
                {
                    throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuStatusNotCreate", outRepackDetail.Hu.HuId);
                }
            }
            #endregion

            #region ���In��Out��ϸ�����Ƿ�ƥ��
            IDictionary<string, decimal> inItemQtyDic = new Dictionary<string, decimal>();
            Location location = null;

            #region �ռ�In����
            foreach (RepackDetail inRepackDetail in inRepackDetailList)
            {
                LocationLotDetail inLocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inRepackDetail.LocationLotDetail.Id);

                if (location == null)
                {
                    location = inLocationLotDetail.Location;

                    if (!user.HasPermission(inLocationLotDetail.Location.Region.Code))
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Repack.Error.NoPermission", location.Code);
                    }
                }
                else if (location.Code != inLocationLotDetail.Location.Code)
                {
                    throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InRepackDetailLocationNotEqual");
                }

                if (inItemQtyDic.ContainsKey(inLocationLotDetail.Item.Code))
                {
                    inItemQtyDic[inLocationLotDetail.Item.Code] += inRepackDetail.Qty;
                }
                else
                {
                    inItemQtyDic.Add(inLocationLotDetail.Item.Code, inRepackDetail.Qty);
                }
            }
            #endregion

            #region �ռ�Out����
            IDictionary<string, decimal> outItemQtyDic = new Dictionary<string, decimal>();

            foreach (RepackDetail outRepackDetail in outRepackDetailList)
            {
                if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK)
                {
                    if (outRepackDetail.Hu == null)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuIdIsEmpty");
                    }
                    else
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:67,代码来源:RepackMgr.cs


注:本文中的com.Sconit.Entity.MasterData.User.HasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。