Beispiel #1
0
 //工事コードで決まる情報の取得(増えてきたのでまとめた)
 private void GetConstructionInfomations(string constructionCode, string planNo)
 {
     using (var service = new SocketPlanServiceNoTimeout())
     {
         Static.IsBeforeKakouIrai    = service.IsBeforeProcessRequest(constructionCode);
         Static.IsTenjijyo           = service.IsTenjijyoConstruction(constructionCode);
         Static.Schedule             = service.GetSchedule(constructionCode);
         Static.ConstructionTypeCode = service.GetConstructionTypeCode(constructionCode, Utilities.ConvertPlanNo(planNo));
     }
 }
        //加工依頼後で、回路図面が存在しない場合警告
        public static void WarnNotExistsKairoFrame(List <Drawing> drawings)
        {
            var messageId = @"There is no 提案HEMS回路図面. Please create a 提案HEMS回路図面 before do the option picking.";
            var validator = new Validator();

            validator.Validate = delegate()
            {
                //加工依頼前はノーチェック
                using (var server = new SocketPlanServiceNoTimeout())
                {
                    if (server.IsBeforeProcessRequest(Static.ConstructionCode))
                    {
                        return(null);
                    }
                }

                var error = new ErrorDialog(messageId, 0);

                //回路図面が見つからなかったらエラー
                var kairoLayoutName = "提案HEMS回路図面";
                foreach (var drawing in drawings)
                {
                    if (drawing.Floor < 1 || drawing.Floor > 3)
                    {
                        continue;
                    }

                    WindowController2.BringDrawingToTop(drawing.WindowHandle);
                    AutoCad.Command.SetCurrentLayoutToModel();
                    var modelLayout = AutoCad.Db.Layout.GetCurrent();
                    AutoCad.Command.SetCurrentLayout(kairoLayoutName);
                    var kairoLayout = AutoCad.Db.Layout.GetCurrent();
                    if (modelLayout == kairoLayout)
                    {
                        return(error);
                    }
                }
                return(null);
            };

            validator.Run(messageId);
        }
Beispiel #3
0
        /// <summary>
        /// 在庫のない照明を使用してたらエラー
        /// </summary>
        /// <param name="constractionCode">工事コード</param>
        /// <param name="symbols">シンボル群</param>
        public static void ValidateLightSerialOutOfStock(List <Symbol> symbols)
        {
            string messageId =
                @"Light serial of out of stock is used.
Please check light serial.";

            var validator = new Validator();

            validator.Validate = delegate()
            {
                List <Symbol> lightSymbols = symbols.FindAll(p => p.IsLight);
                if (lightSymbols.Count == 0)
                {
                    return(null);
                }

                //在庫無しの品番情報
                List <LightSerial> emptyStockLightSerials;
                //邸ごとの使用できる品番情報
                List <UsableLightSerial> usableLightSerials;
                //加工前依頼か否か
                bool isBeforeProcessRequest;
                using (var service = new SocketPlanServiceNoTimeout())
                {
                    emptyStockLightSerials = new List <LightSerial>(service.GetEmptyStockLightSerials());
                    usableLightSerials     = new List <UsableLightSerial>(service.GetUsableLightSerials(Static.ConstructionCode));
                    isBeforeProcessRequest = service.IsBeforeProcessRequest(Static.ConstructionCode);
                }

                //非許可の照明品番が設定されていた照明シンボルを設定するリスト
                List <Symbol> denialLightSymbols = new List <Symbol>();
                //非許可の品番名を設定するリスト
                List <String> deniialLightHinbanName = new List <string>();

                List <Light> lights = new List <Light>();
                lightSymbols.ForEach(p => lights.Add(new Light(p)));

                foreach (Light light in lights)
                {
                    List <string> hinbans = light.GetSerialsForDistinct();
                    foreach (string hinban in hinbans)
                    {
                        if (!emptyStockLightSerials.Exists(p => p.Name == hinban))
                        {
                            continue;
                        }

                        if (IsUsableHinban(hinban, isBeforeProcessRequest, usableLightSerials))
                        {
                            continue;
                        }

                        if (denialLightSymbols.IndexOf(light.Symbol) == -1)
                        {
                            denialLightSymbols.Add(light.Symbol);
                        }

                        if (deniialLightHinbanName.IndexOf(hinban) == -1)
                        {
                            deniialLightHinbanName.Add(hinban);
                        }
                    }
                }

                if (denialLightSymbols.Count == 0 && deniialLightHinbanName.Count == 0)
                {
                    return(null);
                }

                var error = new ErrorDialog(messageId, false);
                denialLightSymbols.ForEach(a => error.AddInfo(a));
                deniialLightHinbanName.ForEach(a => error.AddInfo(a + " out of stock."));
                return(error);
            };

            validator.Run(messageId);
        }