Exemplo n.º 1
0
        /// <summary>勤務シフトに対してマッチしているか?(1日単位で)
        /// </summary>
        /// <returns>割合</returns>
        private double CheckPatternMuches()
        {
            double           ret     = 0.0;
            CRequirePatterns require = sdate.Require;

            if (require == null)
            {
                return(1.0);
            }
            List <CPattern> patterns = new List <CPattern>();

            for (int i = 0; i < require.Size(); i++)
            {
                patterns.Add(require.GetPattern(i));
            }
            int j = 0;

            for (int i = 0; i < patterns.Count; i++)
            {
                CPattern pattern = patterns[i];
                if (pattern.IsAvailable(sdate.Date))
                {
                    double work = CheckPatternMuches(pattern);
                    ret += work;
                    j++;
                }
            }
            ret = (j > 0 ? ret / (double)j : 1.0);
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>人員配置のセーブ
        /// </summary>
        public XmlElement SaveRequirePatterns(XmlDocument doc, CTimeTable all)
        {
            XmlElement element = doc.CreateElement("requires");

            SaveTmElement(doc, element, all.Requires);
            for (int i = 0; i < all.Requires.Size(true); i++)
            {
                CRequirePatterns require = all.Requires[i, true];
                if (!require.BuiltIn)
                {
                    XmlElement pNode = doc.CreateElement("require");
                    SaveTmElement(doc, pNode, require);
                    pNode.SetAttribute("name", require.Name);
                    // シフトごとの人数
                    for (int j = 0; j < require.Size(); j++)
                    {
                        CPattern pattern = require.GetPattern(j);
                        int      needs   = require.GetRequire(pattern);
                        if (needs > 0)
                        {
                            XmlElement nNode = doc.CreateElement("pattern");
                            nNode.SetAttribute("patternid", pattern.ObjectID.ToString());
                            nNode.SetAttribute("requirenums", needs.ToString());
                            pNode.AppendChild(nNode);
                        }
                    }
                    // エレメントを追加
                    element.AppendChild(pNode);
                }
            }
            return(element);
        }
Exemplo n.º 3
0
        /// <summary>
        /// パターンに対してマッチしているか?(1日単位で)
        /// </summary>
        /// <returns>割合</returns>
        private double CheckPatternMuches()
        {
            double           ret     = 0.0;
            CRequirePatterns require = sdate.Require;

            if (require == null)
            {
                return(1.0);
            }
            List <CPattern> patterns = new List <CPattern>();

            for (int i = 0; i < require.Size(); i++)
            {
                patterns.Add(require.GetPattern(i));
            }
            int j = 0;

            for (int i = 0; i < patterns.Count; i++)
            {
                CPattern pattern = patterns[i];
                if (pattern.IsAvailable(sdate.Date))
                {
                    double work = CheckPatternMuches(pattern);
                    //if (work > 1) {
                    //    work = 1.0;
                    //} else {
                    //    if (work < 1) {
                    //        AddItem(EvaluationResult.NOTICE, pattern.Name + "が必要な人数を満たしていません。");
                    //    } else if (work < 0.5) {
                    //        AddItem(EvaluationResult.WARNING, pattern.Name + "が必要な人数の半分を満たしていません。");
                    //    } else if (work <= 0.0) {
                    //        AddItem(EvaluationResult.ERROR, pattern.Name + "が必要な人数を満たしていません。");
                    //    }
                    //}
                    ret += work;
                    j++;
                }
            }
            ret = (j > 0 ? ret / (double)j : 1.0);
            return(ret);
        }