Exemplo n.º 1
0
        public static List <SiyoHeya> Get(string constructionCode, int siyoCode)
        {
            var rooms = new List <SiyoHeya>();

            if (ConstructionSchedule.IsBeforeProcessRequest(constructionCode))
            {
                var heyas = tbl_siyo_heya.Get(constructionCode, siyoCode);

                foreach (var heya in heyas)
                {
                    var siyoheya = new SiyoHeya();
                    siyoheya.ConstructionCode = heya.customerCode;
                    siyoheya.Floor            = heya.floorNum;
                    siyoheya.RoomCode         = heya.roomCd;
                    siyoheya.RoomName         = heya.roomName;

                    rooms.Add(siyoheya);
                }
            }
            else
            {
                var heyas = RoomLayout.Get(constructionCode);

                foreach (var heya in heyas)
                {
                    var siyoheya = new SiyoHeya();
                    siyoheya.ConstructionCode = heya.ConstructionCode;
                    siyoheya.Floor            = heya.Floor;
                    siyoheya.RoomCode         = heya.RoomCode;
                    siyoheya.RoomName         = heya.RoomName;

                    rooms.Add(siyoheya);
                }
            }

            return(rooms);
        }
Exemplo n.º 2
0
        public static List <ProductVa> Get(string constructionCode, string planNo)
        {
            var siyoCode   = tbl_siyo_boss.GetSiyoCode(constructionCode, planNo);
            var heyas      = SiyoHeya.Get(constructionCode, siyoCode);
            var productVas = ProductVa.GetAll();
            var result     = new List <ProductVa>();

            if (ConstructionSchedule.IsBeforeProcessRequest(constructionCode))
            {
                var shohins = tbl_siyo_syohin.Get(constructionCode, siyoCode);

                foreach (var shohin in shohins)
                {
                    var products = productVas.FindAll(p =>
                                                      shohin.komokuCd1 == p.Class1Code &&
                                                      shohin.komokuCd2 == p.Class2Code &&
                                                      shohin.shohinCd == p.ProductCode);

                    foreach (var product in products)
                    {
                        var clone = product.Clone();

                        if (shohin.floorNum.HasValue)
                        {
                            clone.Floor = shohin.floorNum.Value;
                        }

                        if (clone.Floor == 0 || clone.Floor == 9)
                        {
                            clone.Floor = 1;
                        }

                        clone.RoomCode = shohin.roomCd;

                        var heya = heyas.Find(p => p.RoomCode == clone.RoomCode);
                        if (heya != null)
                        {
                            clone.RoomName = heya.RoomName;
                        }
                        else
                        {
                            clone.RoomName = string.Empty;
                        }

                        result.Add(clone);
                    }
                }
            }
            else
            {
                var shohins = SpecificationProductDetail.Get(constructionCode);

                foreach (var shohin in shohins)
                {
                    var products = productVas.FindAll(p =>
                                                      shohin.Class1Code == p.Class1Code &&
                                                      shohin.Class2Code == p.Class2Code &&
                                                      shohin.ProductCode == p.ProductCode);

                    foreach (var product in products)
                    {
                        var clone = product.Clone();

                        clone.Floor = shohin.Floor;

                        if (clone.Floor == 0 || clone.Floor == 9)
                        {
                            clone.Floor = 1;
                        }

                        clone.RoomCode = shohin.RoomCode;

                        var heya = heyas.Find(p => p.RoomCode == clone.RoomCode);
                        if (heya != null)
                        {
                            clone.RoomName = heya.RoomName;
                        }
                        else
                        {
                            clone.RoomName = string.Empty;
                        }

                        result.Add(clone);
                    }
                }
            }

            result.Sort((p, q) =>
            {
                if (p.Class1Code != q.Class1Code)
                {
                    return(p.Class1Code.CompareTo(q.Class1Code));
                }

                if (p.Class2Code != q.Class2Code)
                {
                    return(p.Class2Code.CompareTo(q.Class2Code));
                }

                return(p.ProductCode.CompareTo(q.ProductCode));
            });

            return(result);
        }