public Result PutSmartOperatorLevel([FromBody] IEnumerable <SmartOperatorLevel> operatorLevels)
        {
            if (operatorLevels == null || !operatorLevels.Any())
            {
                return(Result.GenError <Result>(Error.ParamError));
            }
            if (operatorLevels.Any(x => x.Level.IsNullOrEmpty()))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelNotEmpty));
            }
            if (operatorLevels.GroupBy(x => x.Level).Any(y => y.Count() > 1))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelDuplicate));
            }

            var wId   = operatorLevels.FirstOrDefault()?.WorkshopId ?? 0;
            var sames = operatorLevels.Select(x => x.Level);
            var ids   = operatorLevels.Select(x => x.Id);

            if (SmartOperatorLevelHelper.GetHaveSame(wId, sames, ids))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelIsExist));
            }

            var cnt = SmartOperatorLevelHelper.Instance.GetCountByIds(ids);

            if (cnt != operatorLevels.Count())
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelNotExist));
            }

            var markedDateTime = DateTime.Now;

            foreach (var operatorLevel in operatorLevels)
            {
                operatorLevel.MarkedDateTime = markedDateTime;
                operatorLevel.Remark         = operatorLevel.Remark ?? "";
            }
            SmartOperatorLevelHelper.Instance.Update(operatorLevels);
            OldWorkFlowHelper.Instance.OnSmartOperatorLevelChanged(operatorLevels);
            return(Result.GenError <Result>(Error.Success));
        }
        public Result PostSmartOperatorLevel([FromBody] IEnumerable <SmartOperatorLevel> operatorLevels)
        {
            if (operatorLevels == null || !operatorLevels.Any())
            {
                return(Result.GenError <Result>(Error.ParamError));
            }
            if (operatorLevels.Any(x => x.Level.IsNullOrEmpty()))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelNotEmpty));
            }
            if (operatorLevels.GroupBy(x => x.Level).Any(y => y.Count() > 1))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelDuplicate));
            }

            var wId   = operatorLevels.FirstOrDefault()?.WorkshopId ?? 0;
            var sames = operatorLevels.Select(x => x.Level);

            if (SmartOperatorLevelHelper.GetHaveSame(wId, sames))
            {
                return(Result.GenError <Result>(Error.SmartOperatorLevelIsExist));
            }

            var userId         = Request.GetIdentityInformation();
            var markedDateTime = DateTime.Now;

            foreach (var operatorLevel in operatorLevels)
            {
                operatorLevel.CreateUserId   = userId;
                operatorLevel.MarkedDateTime = markedDateTime;
                operatorLevel.Remark         = operatorLevel.Remark ?? "";
            }
            SmartOperatorLevelHelper.Instance.Add(operatorLevels);
            OldWorkFlowHelper.Instance.OnSmartOperatorLevelChanged(operatorLevels);
            return(Result.GenError <Result>(Error.Success));
        }