프로젝트

일반

사용자정보

개정판 037ab674

ID037ab6741cc8e731844afcd800a78c322fc38de3
상위 6927ec82
하위 19d6b221

semi 이(가) 4년 이상 전에 추가함

WCF 변경

Change-Id: Iac482667ce5ff20c3acee80186ef2356928bc6da

차이점 보기:

ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/FinalPDFViewModel.cs
25 25
using Newtonsoft.Json;
26 26
//using Markus.Service.Interface;
27 27
using static Markus.Service.StationController.Data.FinalPDF;
28
using System.Collections.ObjectModel;
28 29

  
29 30
namespace Markus.Service.StationController.ViewModel
30 31
{
......
53 54

  
54 55
        #region Properties
55 56

  
57
        DataService.DataServiceClient WcfClient = new DataService.DataServiceClient();
58

  
59
        public ObservableCollection<ProjectName> _ProjectNames;
60
        public ObservableCollection<ProjectName> ProjectNames
61
        {
62
            get
63
            {
64
                if (_ProjectNames == null)
65
                {
66
                    _ProjectNames = new System.Collections.ObjectModel.ObservableCollection<ProjectName>();
67
                }
68

  
69
                return _ProjectNames;
70
            }
71
            set
72
            {
73
                _ProjectNames = value;
74
                OnPropertyChanged(() => ProjectNames);
75
            }
76
        }
77

  
56 78
        private System.Collections.ObjectModel.ObservableCollection<FinalPDF> _FilterSearch;
57 79
        public System.Collections.ObjectModel.ObservableCollection<FinalPDF> FilterSearch
58 80
        {
......
136 158
        }
137 159

  
138 160

  
161
        private int _SelectedInt = 4;
162
        public int SelectedInt
163
        {
164
            get => _SelectedInt;
165
            set
166
            {
167
                _SelectedInt = value;
168
                OnPropertyChanged(() => SelectedInt);
169
            }
170
        }
171

  
172

  
139 173
        private Telerik.Windows.Data.EnumMemberViewModel _SelectedStatus;
140 174
        public Telerik.Windows.Data.EnumMemberViewModel SelectedStatus
141 175
        {
......
253 287
            }
254 288
        }
255 289

  
256
        public string _ProjectNumberFilter;
257
        public string ProjectNumberFilter
290
        public ProjectName _ProjectNumberFilter;
291
        public ProjectName ProjectNumberFilter
258 292
        {
259
            get { return _ProjectNumberFilter; }
260
            set
293
            get
261 294
            {
262
                if (_ProjectNumberFilter == "")
263
                {
264
                    _ProjectNumberFilter = null;
265
                }
266
                else if (_ProjectNumberFilter != value)
295
                if (_ProjectNumberFilter == null)
267 296
                {
268
                    _ProjectNumberFilter = value;
269
                    OnPropertyChanged(() => ProjectNumberFilter);
297
                    _ProjectNumberFilter = new ProjectName();
270 298
                }
299
                return _ProjectNumberFilter;
300
            }
301
            set
302
            {
303
                _ProjectNumberFilter = value;
304
                OnPropertyChanged(() => ProjectNumberFilter);
271 305
            }
272 306
        }
273 307

  
......
557 591
                OnPropertyChanged(() => ConvertShow);
558 592
            }
559 593
        }
594

  
595

  
596
        private bool _ExcptionCheck = false;
597
        public bool ExcptionCheck
598
        {
599
            get
600
            {
601
                return _ExcptionCheck;
602
            }
603
            set
604
            {
605
                _ExcptionCheck = value;
606
                OnPropertyChanged(() => ExcptionCheck);
607
            }
608
        }
560 609
        #endregion
561 610

  
562 611
        #region Command
......
616 665
            dispatcherTimer.Start();
617 666
        }
618 667

  
668
        private async void SearchTimer_Tick(object sender, EventArgs e)
669
        {
670
            dispatcherTimer.Stop();
671

  
672
            if (IsAcitve)
673
            {
674
                await App.Current.Dispatcher.InvokeAsync(() =>
675
                {
676
                    DataSearch(new[] { (StatusCodeType)(SelectedStatus.Value) }, FilterConvertSource);
677

  
678
                    RealDataSelect(new[] { StatusCodeType.None, StatusCodeType.Wait, StatusCodeType.PageLoading, StatusCodeType.Saving }, RealConvertSource);
679

  
680
                    AliveDataSelect();
681
                });
682
            }
683

  
684
            await Task.Delay(5000);
685
            //await Task.Delay(10000);
686

  
687
            //System.Threading.Thread.Sleep(new TimeSpan(0,0,0,0,100));
688

  
689
            dispatcherTimer.Start();
690
        }
691

  
692

  
619 693
        public override void Closed()
620 694
        {
621 695
            if (dispatcherTimer != null)
......
660 734

  
661 735
        }
662 736

  
663
        private void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
737
        private async void RealDataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
664 738
        {
665 739
            try
666 740
            {
667
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
668
                {
669
                    List<FinalPDF> Listitems = new List<FinalPDF>();
670

  
671
                    foreach (var coll in collection)
672
                    {
673
                        var items = entities.SELECT_FINAL_PDF_ITEM(coll.ConvertID, coll.ProjectNumber, null, null,null, null, null, null, null, null, null, null, null, null, null, null, null, null,
674
                            null).ToList();
675

  
676
                        foreach (var x in items)
677
                        {
678
                            var MarkusLink = "kcom://" + CreateMarkusParam(coll.ConvertID, coll.DocumentID, "doftech");
679

  
680
                            FinalPDF AddItem = new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, x.REVISION, x.CURRENT_PAGE,
681
                                x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
682
                            Listitems.Add(AddItem);
683

  
684
                        }
685
                    }
741
                IEnumerable<FinalPDF> Listitems = null;
686 742

  
687
                    Listitems.ForEach(newitem =>
688
                    {
689
                        collection.UpdateWhere(changeitem =>
690
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ConvertID == newitem.ConvertID && x.ProjectNumber == newitem.ProjectNumber);
691
                    });
743
                foreach (var coll in collection)
744
                {
745
                    Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(coll.ConvertID, coll.ProjectNumber, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null)
746
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.PROJECT_NO, x.DOCUMENT_ID, "doftech")
747
                                select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID, x.REVISION, x.CURRENT_PAGE,
748
                            x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
749
                }
692 750

  
693
                    RealConvert_Height = 80 + (10 * collection.Count());
694
                    DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
751
                foreach (var Listitem in Listitems)
752
                {
753
                    collection.UpdateWhere(changeitem =>
754
                    ConvertItemEx.ChangeValues(changeitem, Listitem), x => x.ProjectNumber == Listitem.ProjectNumber && x.ConvertID == Listitem.ConvertID);
695 755
                }
756

  
757
                RealConvert_Height = 80 + (10 * collection.Count());
758
                DataBase_ItemsHeight = 800 - (RealConvert_Height + Alive_Height);
696 759
            }
697 760
            catch (Exception ex)
698 761
            {
......
700 763
            }
701 764
        }
702 765

  
703
        private void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
766
        private async void DataSelect(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
704 767
        {
705 768
            try
706 769
            {
707
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
770
                int _status = 0;
771
                if (SelectedStatus != null)
708 772
                {
709
                    int _status = 0;
710
                    if (SelectedStatus != null)
711
                    {
712
                        _status = (int)SelectedStatus.Value;
713
                    }
714

  
715

  
716
                    var items = entities.SELECT_FINAL_PDF_ITEM(null, null, null, null, null, null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null,
717
                        null, null, null, null).ToList();
718

  
719
                    List<FinalPDF> Listitems = new List<FinalPDF>();
720

  
721
                    foreach (var x in items)
722
                    {
723
                        var MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech");
724

  
725
                        FinalPDF AddItem = new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
726
                            x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
727
                         , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
773
                    _status = (int)SelectedStatus.Value;
774
                }
728 775

  
729
                        Listitems.Add(AddItem);
730
                    }
776
                var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, null, null, null, null, null, null, null, _status, SelectedCount.ValueMember, null, null, null, null, null, null, null, null, null, null)
777
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
778
                                select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
779
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
780
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
731 781

  
732
                    if (collection.Count() == 0)
782
                if (collection.Count() == 0)
783
                {
784
                    if (statusCodeTypeList.Count() == 1)
733 785
                    {
734
                        if (statusCodeTypeList.Count() == 1)
786
                        foreach (var x in Listitems)
735 787
                        {
736
                            foreach (var x in Listitems)
737
                            {
738
                                collection.Add(x);
739
                            }
788
                            collection.Add(x);
740 789
                        }
741 790
                    }
742
                    else
791
                }
792
                else
793
                {
794
                    foreach (var newitem in Listitems)
743 795
                    {
796
                        collection.UpdateWhere(changeitem =>
797
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
798
                    }
744 799

  
745
                        //세미 업데이트
746
                        foreach (var newitem in Listitems)
747
                        {
748
                            collection.UpdateWhere(changeitem =>
749
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
750
                        }
751

  
752

  
753
                        if (statusCodeTypeList.Count() == 1)
800
                    if (statusCodeTypeList.Count() == 1)
801
                    {
802
                        for (int i = collection.Count() - 1; i >= 0; --i)
754 803
                        {
804
                            var item = collection[i];
755 805

  
756
                            //삭제
757
                            for (int i = collection.Count() - 1; i >= 0; --i)
806
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
758 807
                            {
759
                                var item = collection[i];
760

  
761
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
762
                                {
763
                                    collection.RemoveAt(i);
764
                                }
808
                                collection.RemoveAt(i);
765 809
                            }
766 810
                        }
811
                    }
767 812

  
768
                        if (statusCodeTypeList.Count() == 1)
813
                    if (statusCodeTypeList.Count() == 1)
814
                    {
815
                        foreach (var item in Listitems)
769 816
                        {
770
                            //추가 convert 후 추가됨
771
                            foreach (var item in Listitems)
817
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
772 818
                            {
773
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
819
                                for (int i = 0; i < 200; i++)
774 820
                                {
775
                                    for (int i = 0; i < 200; i++)
821
                                    if (i < collection.Count() - 1)
776 822
                                    {
777
                                        if (i < collection.Count() - 1)
778
                                        {
779
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
780
                                            {
781
                                                collection.Insert(i, item);
782
                                                break;
783
                                            }
784
                                        }
785
                                        else
823
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
786 824
                                        {
787
                                            collection.Add(item);
825
                                            collection.Insert(i, item);
788 826
                                            break;
789 827
                                        }
790 828
                                    }
791

  
829
                                    else
830
                                    {
831
                                        collection.Add(item);
832
                                        break;
833
                                    }
792 834
                                }
793 835

  
794 836
                            }
837

  
795 838
                        }
796 839
                    }
797 840
                }
798

  
799

  
800 841
            }
801 842
            catch (Exception ex)
802 843
            {
......
805 846
            }
806 847
        }
807 848

  
808
        private void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
849
        private async void DataSearch(IEnumerable<StatusCodeType> statusCodeTypeList, System.Collections.ObjectModel.ObservableCollection<FinalPDF> collection)
809 850
        {
810 851
            try
811 852
            {
812
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
853
                int _status = 0;
854
                if (SelectedStatus != null)
813 855
                {
814
                    int _status = 0;
815
                    if (SelectedStatus != null)
816
                    {
817
                        _status = (int)SelectedStatus.Value;
818
                    }
819

  
820
                    DateTime? Start_CreateTime = null;
821
                    DateTime? Finish_CreateTime = null;
822
                    if (SelectedCreateTimeBegin != DefaultCreateTime)
823
                    {
824
                        Start_CreateTime = SelectedCreateTimeBegin;
825
                    }
826
                    if (SelectedCreateTimeEnd != DefaultCreateTime)
827
                    {
828
                        Finish_CreateTime = SelectedCreateTimeEnd;
829
                    }
830

  
831
                    var items = entities.SELECT_FINAL_PDF_ITEM(null, ProjectNumberFilter, DocumentIDFilter, MarkupInfo_IDFilter, DOCINFO_IDFilter, Document_NameFilter, Document_NOFilter,
832
                        CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter).ToList();
833

  
834

  
835
                    List<FinalPDF> Listitems = new List<FinalPDF>();
856
                    _status = (int)SelectedStatus.Value;
857
                }
836 858

  
837
                    foreach (var x in items)
838
                    {
839
                        var MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech");
859
                DateTime? Start_CreateTime = null;
860
                DateTime? Finish_CreateTime = null;
861
                if (SelectedCreateTimeBegin != DefaultCreateTime)
862
                {
863
                    Start_CreateTime = SelectedCreateTimeBegin;
864
                }
865
                if (SelectedCreateTimeEnd != DefaultCreateTime)
866
                {
867
                    Finish_CreateTime = SelectedCreateTimeEnd;
868
                }
840 869

  
841
                        FinalPDF AddItem = new FinalPDF(x.ID, x.PROJECT_NO, _status, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
842
                            x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
843
                         , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
844
                        Listitems.Add(AddItem);
845
                        //이거 없으면 collection.Insert(i, item); 할때 문제 생김
846
                    }
870
                var Listitems = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(null, ProjectNumberFilter.Project_NO, DocumentIDFilter, MarkupInfo_IDFilter, DOCINFO_IDFilter, Document_NameFilter, Document_NOFilter,
871
                    CreateUser_IDFilter, _status, SelectedCount.ValueMember, GROUP_NOFilter, REVISIONFilter, Start_CreateTime, Finish_CreateTime, null, null, null, null, Document_URLFilter, ExcptionCheck)
872
                                let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
873
                                select new FinalPDF(x.ID, x.PROJECT_NO, _status, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
874
                                    x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
875
                                 , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
847 876

  
848
                    if (collection.Count() == 0)
877
                if (collection.Count() == 0)
878
                {
879
                    if (statusCodeTypeList.Count() == 1)
849 880
                    {
850
                        if (statusCodeTypeList.Count() == 1)
881
                        foreach (var x in Listitems)
851 882
                        {
852
                            foreach (var x in Listitems)
853
                            {
854
                                collection.Add(x);
855
                            }
883
                            collection.Add(x);
856 884
                        }
857 885
                    }
858
                    else
886
                }
887
                else
888
                {
889
                    foreach (var newitem in Listitems)
859 890
                    {
891
                        collection.UpdateWhere(changeitem =>
892
                        ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
893
                    }
860 894

  
861
                        //세미 업데이트
862
                        foreach (var newitem in Listitems)
863
                        {
864
                            collection.UpdateWhere(changeitem =>
865
                            ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID);
866
                        }
867

  
895
                    if (statusCodeTypeList.Count() == 1)
896
                    {
868 897

  
869
                        if (statusCodeTypeList.Count() == 1)
898
                        for (int i = collection.Count() - 1; i >= 0; --i)
870 899
                        {
900
                            var item = collection[i];
871 901

  
872
                            //삭제
873
                            for (int i = collection.Count() - 1; i >= 0; --i)
902
                            if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
874 903
                            {
875
                                var item = collection[i];
876

  
877
                                if (Listitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
878
                                {
879
                                    collection.RemoveAt(i);
880
                                }
904
                                collection.RemoveAt(i);
881 905
                            }
882 906
                        }
907
                    }
883 908

  
884
                        if (statusCodeTypeList.Count() == 1)
909
                    if (statusCodeTypeList.Count() == 1)
910
                    {
911
                        foreach (var item in Listitems)
885 912
                        {
886
                            //추가 convert 후 추가됨
887
                            foreach (var item in Listitems)
913
                            if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
888 914
                            {
889
                                if (collection.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0)
915
                                for (int i = 0; i < 200; i++)
890 916
                                {
891
                                    for (int i = 0; i < 200; i++)
917
                                    if (i < collection.Count() - 1)
892 918
                                    {
893
                                        if (i < collection.Count() - 1)
894
                                        {
895
                                            if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
896
                                            {
897
                                                collection.Insert(i, item);
898
                                                break;
899
                                            }
900
                                        }
901
                                        else
919
                                        if (DateTime.Compare(collection[i].CreateTime, item.CreateTime) < 0)
902 920
                                        {
903
                                            collection.Add(item);
921
                                            collection.Insert(i, item);
904 922
                                            break;
905 923
                                        }
906 924
                                    }
907

  
925
                                    else
926
                                    {
927
                                        collection.Add(item);
928
                                        break;
929
                                    }
908 930
                                }
909 931

  
910 932
                            }
911
                        }
912 933

  
934
                        }
913 935
                    }
914
                }
915

  
916 936

  
937
                }
917 938
            }
918 939
            catch (Exception ex)
919 940
            {
......
945 966
                                itemsToEach.ConvertID = item.ConvertID;
946 967
                                itemsToEach.ProjectNumber = item.ProjectNumber;
947 968

  
948
                                var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
969
                                var MarkusLink = "kcom://" + CreateMarkusParam(item.ProjectNumber, item.DocumentID, "doftech");
970

  
971
                                //var convertpath = GetSearchConvertPathAndMarkus(item.ProjectNumber, item.UniqueKey);
949 972

  
950 973
                                if (item.ConvertState != null)
951 974
                                {
......
966 989
                                itemsToEach.TotalPage = item.TotalPage;
967 990
                                itemsToEach.OriginfilePath = item.OriginfilePath;
968 991
                                itemsToEach.ConvertPath = item.ConvertPath;
969
                                itemsToEach.MarkusLink = convertpath[1];
992
                                itemsToEach.MarkusLink = MarkusLink;
970 993
                                itemsToEach.DocumentID = item.DocumentID;
971 994
                                itemsToEach.GroupNo = item.GroupNo;
972 995
                                itemsToEach.DocumentName = item.DocumnetName;
973 996
                                itemsToEach.Revision = item.Revision;
974 997
                                itemsToEach.Exception = item.Exception;
975
                                itemsToEach.ConvertPath = convertpath[0];
998
                                itemsToEach.ConvertPath = item.ConvertPath;
976 999
                                itemsToEach.CreateTime = item.CreateTime;
977 1000
                                itemsToEach.StartTime = item.StartTime;
978 1001
                                itemsToEach.EndTime = item.EndTime;
......
1110 1133

  
1111 1134
        #region Data Convert
1112 1135

  
1113
        private void DataConvert(object obj)
1136
        private async void DataConvert(object obj)
1114 1137
        {
1115 1138
            if (SelectFilterConvert == null && SelectRealConvert == null)
1116 1139
            {
......
1125 1148
                if (SelectRealConvert != null)
1126 1149
                {
1127 1150
                    //resultRealConvert = _DataConvert.SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1128
                    resultRealConvert = SetCleanUpItem(SelectRealConvert);//ConvertDataBase
1151
                    resultRealConvert = SetCleanUpItem(SelectRealConvert).Result;//ConvertDataBase
1129 1152
                }
1130 1153
                else if (SelectFilterConvert != null)
1131 1154
                {
1132 1155
                    //resultFiltertConvert = _DataConvert.SetCleanUpItem(SelectFilterConvert);//ConvertDataBase
1133
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert);
1156
                    resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result;
1134 1157
                }
1135 1158
                System.Diagnostics.Debug.WriteLine(resultRealConvert + "  " + resultFiltertConvert);
1136 1159

  
1137
                using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1138
                {
1139

  
1140
                    var items = entities.SELECT_FINAL_PDF_ITEM(SelectFilterConvert.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null); //프로시저 이용
1160
                var items = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(SelectFilterConvert.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null)
1161
                            let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech")
1162
                            select new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
1163
                        x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1164
                     , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1141 1165

  
1142 1166

  
1143
                    foreach (var x in items)
1144
                    {
1145
                        var MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech");
1146

  
1147
                        FinalPDF AddItem = new FinalPDF(x.ID, x.PROJECT_NO, x.STATUS, x.DOCUMENT_ID, x.MARKUPINFO_ID, x.DOCINFO_ID, x.DOCUMENT_NAME, x.DOCUMENT_NO, x.CREATE_USER_ID,
1148
                            x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME
1149
                         , x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink);
1167
                foreach (var item in items)
1168
                {
1150 1169

  
1151
                        RealConvertSource.Add(AddItem);
1170
                    RealConvertSource.Add(item);
1152 1171

  
1153
                        if (RealConvertSource.Count() == 1)
1154
                        {
1155
                            ConvertShow = true;
1156
                        }
1172
                    if (RealConvertSource.Count() == 1)
1173
                    {
1174
                        ConvertShow = true;
1157 1175
                    }
1158

  
1159 1176
                }
1160

  
1161 1177
            }
1162 1178
        }
1163 1179

  
1164 1180

  
1165
        public int SetCleanUpItem(FinalPDF _ConvertItem)
1181
        public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
1166 1182
        {
1167
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1168
            {
1169
                int result = 0;
1170

  
1171
                var items = entities.SELECT_FINAL_PDF_ITEM(_ConvertItem.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null).ToList();
1183
            int result = 0;
1172 1184

  
1173
                if (items.Count() > 0)
1174
                {
1175
                    var item = items.First();
1185
            var items = await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(_ConvertItem.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null);
1176 1186

  
1177
                    var _CREATE_DATETIME = DateTime.Now;
1178
                    var _STATUS = (int)StatusCodeType.None;
1187
            if (items.Count() > 0)
1188
            {
1189
                var item = items.First();
1179 1190

  
1180
                    entities.SELECT_RERECONVERT_ITEM(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1191
                var _CREATE_DATETIME = DateTime.Now;
1192
                var _STATUS = (int)StatusCodeType.None;
1181 1193

  
1182
                }
1194
                await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null);//_END_DATETIME = null 에러
1183 1195

  
1184
                return result;
1185 1196
            }
1197

  
1198
            return result;
1186 1199
        }
1187 1200

  
1188
        public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1189
        {
1190
            string[] ConvertPath = new string[2];
1191
            ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1192
            ConvertPath[1] = "kcom://" + CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1201
        //public string[] GetSearchConvertPathAndMarkus(string PROJECT_NO, string DOCUMENT_ID)
1202
        //{
1203
        //    string[] ConvertPath = new string[2];
1204
        //    ConvertPath[0] = GetConvertPath(PROJECT_NO, DOCUMENT_ID);
1205
        //    ConvertPath[1] = "kcom://" + CreateMarkusParam(PROJECT_NO, DOCUMENT_ID, "doftech");
1193 1206

  
1194
            return ConvertPath;
1195
        }
1207
        //    return ConvertPath;
1208
        //}
1196 1209

  
1197 1210
        public static string CreateMarkusParam(string projectNo, string documentID, string userID)
1198 1211
        {
......
1218 1231

  
1219 1232
        #region Convert Path
1220 1233

  
1221
        private string GetConvertPath(string ProjectNo, string DocumentID)
1222
        {
1223
            try
1224
            {
1225
                return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1226
            }
1227
            catch (Exception)
1228
            {
1229
                throw new Exception("GetConvertPath Error");
1230
            }
1231

  
1232
        }
1233

  
1234
        private string BaseStorage(string ProjectNo)
1235
        {
1236
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1237
            {
1238
                string result = "";
1239

  
1240
                var properties = entities.SELECT_FINAL_PDF_ITEM(null, ProjectNo, null, null, null, null, null, null, null, 1, null, null, null, null,
1241
                        null, null, null, null, null).ToList();
1242

  
1243

  
1244
                if (properties.Count() > 0)
1245
                {
1246
                    result = properties.First().PROPERTIES_VALUE;
1247
                }
1248
                else
1249
                {
1250
                    throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1251
                }
1252

  
1253
                return result;
1254
            }
1255
        }
1234
        //private string GetConvertPath(string ProjectNo, string DocumentID)
1235
        //{
1236
        //    try
1237
        //    {
1238
        //        return Path.Combine(BaseStorage(ProjectNo), ProjectNo + "_Tile", (System.Convert.ToInt64(DocumentID) / 100).ToString(), DocumentID);
1239
        //    }
1240
        //    catch (Exception)
1241
        //    {
1242
        //        throw new Exception("GetConvertPath Error");
1243
        //    }
1244

  
1245
        //}
1246

  
1247
        //private async string BaseStorage(string ProjectNo)
1248
        //{
1249
        //    using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1250
        //    {
1251
        //        string result = "";
1252

  
1253
        //        var properties = await WcfClient.GET_SELECT_FINAL_PDF_ITEM(null, ProjectNo, null, null, null, null, null, null, null, 1, null, null, null, null,
1254
        //                null, null, null, null, null);
1255

  
1256

  
1257
        //        if (properties.Count() > 0)
1258
        //        {
1259
        //            result = properties.First().PROPERTIES_VALUE;
1260
        //        }
1261
        //        else
1262
        //        {
1263
        //            throw new Exception($"Project {ProjectNo} BaseStorage Not Setting.");
1264
        //        }
1265

  
1266
        //        return result;
1267
        //    }
1268
        //}
1256 1269

  
1257 1270
        #endregion
1258 1271

  
......
1338 1351
            RadWindow.Alert("do you want to delete it??", this.OnClosed);
1339 1352
        }
1340 1353

  
1341
        private void OnClosed(object sender, WindowClosedEventArgs e)
1354
        private async void OnClosed(object sender, WindowClosedEventArgs e)
1342 1355
        {
1343
            using (markusEntities entities = new markusEntities(App.MarkusDataBaseConnecitonString))
1356
            var result = e.DialogResult;
1357
            if (result == true)
1344 1358
            {
1345
                var result = e.DialogResult;
1346
                if (result == true)
1359
                if (SelectRealConvert != null)
1347 1360
                {
1348
                    if (SelectRealConvert != null)
1349
                    {
1350
                        entities.SELECT_FINAL_PDF_DELETE(SelectRealConvert.ConvertID);
1351
                    }
1352
                    if (SelectFilterConvert != null)
1353
                    {
1354
                        entities.SELECT_FINAL_PDF_DELETE(SelectFilterConvert.ConvertID);
1355
                    }
1361
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID);
1362
                }
1363
                if (SelectFilterConvert != null)
1364
                {
1365
                    await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvert.ConvertID);
1356 1366
                }
1357 1367
            }
1358 1368
        }
......
1438 1448

  
1439 1449
        public void Reset(object obj)
1440 1450
        {
1441
            ProjectNumberFilter = null;
1451
            SelectedInt = 10;
1452
            ProjectNumberFilter = ProjectNames[0];
1442 1453
            DocumentIDFilter = null;
1443 1454
            MarkupInfo_IDFilter = null;
1444 1455
            DOCINFO_IDFilter = null;
......
1450 1461

  
1451 1462
            DefaultCreateTime = DateTime.Now;
1452 1463
            SelectedCreateTimeBegin = DefaultCreateTime;
1453
            SelectedCreateTimeEnd = DefaultCreateTime; 
1464
            SelectedCreateTimeEnd = DefaultCreateTime;
1454 1465

  
1466
            dispatcherTimer.Tick -= new EventHandler(SearchTimer_Tick);
1455 1467
            dispatcherTimer.Tick += new EventHandler(Timer_Tick);
1456 1468

  
1457 1469
        }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)