프로젝트

일반

사용자정보

개정판 54977253

ID54977253274659b86b0ee1e15d758fe39a7a4f24
상위 448d805e
하위 a597e7cf

유성호이(가) 약 2년 전에 추가함

issue #0000
전체 document 조회 추가
ID2 작업 : 시작시간, 종료 시간 있을 시 일:시:분:초 포멧으로 작업시간 보여주기
ID2 종료 시간 업데이트 로직 추가(ID2 Sync)

Change-Id: I8810e653bcd7c189b8b756df9d8e471ba7cc30f5

차이점 보기:

ID2.Manager/ID2.Manager.Controller/Controllers/DocumentController.cs
16 16

  
17 17
        public DocumentController(ID2ProjectInfo id2Info) : base(id2Info) { }
18 18

  
19
        public IEnumerable<Documents> GetAllDocuments()
20
        {
21
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
22
            {
23
                return rep.GetAllDocuments();
24
            }
25
        }
26

  
19 27
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult)
20 28
        {
21 29
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
......
107 115
            return (docs, 0);
108 116
        }
109 117

  
110
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList)
118
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList, string userId)
111 119
        {
112 120
            using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
113 121
            {
114
                return rep.SetDocumentData(docList, delDocList);
122
                return rep.SetDocumentData(docList, delDocList, userId);
115 123
            }
116 124
        }
117 125

  
......
132 140
                return rep.GetID2DrawingsByProject(id2Info);
133 141
            }
134 142
        }
143

  
144
        public bool SetID2Sync(List<ID2ProjectInfo> id2Infos, string userId)
145
        {
146
            bool isSuccess = false;
147

  
148
            try
149
            {
150
                IEnumerable<Documents> docs = this.GetAllDocuments();
151
                List<ID2Drawings> id2docs = null;
152

  
153
                if (id2Infos.Any())
154
                {
155
                    id2docs = new List<ID2Drawings>();
156
                    id2Infos.ForEach(x =>
157
                    {
158
                        id2docs.AddRange(new DocumentController(x).GetID2DrawingsByProject(x));
159
                    });
160
                }
161

  
162
                if (docs != null && id2docs != null && docs.Any() && id2docs.Any())
163
                {
164
                    var result = from doc in docs
165
                                 join id2 in id2docs on new { projCd = doc.RefProjectCode, DocNo = doc.DocumentNo } equals new { projCd = id2.PROJECTNAME, DocNo = id2.DOCNAME }
166
                                 select new Documents()
167
                                 {
168
                                     DocID = doc.DocID,
169
                                     ID2EndDate = id2?.DATETIME == null ? (DateTime?)null : Convert.ToDateTime(id2?.DATETIME)
170
                                 };
171

  
172
                    if (result.Any())
173
                    {
174
                        using (DocumentRepository rep = new DocumentRepository(this._MSSQLCONNSTR))
175
                        {
176
                            isSuccess = rep.SetDocumentDatasField(result.ToList(), userId);
177
                        }
178
                    }
179
                }
180
            }
181
            catch (Exception ex)
182
            {
183
                throw ex;
184
            }
185

  
186
            return isSuccess;
187
        }
135 188
    }
136 189
}
ID2.Manager/ID2.Manager.Dapper/Repository/DocumentRepository.cs
4 4
using System.Text;
5 5
using System.Threading.Tasks;
6 6

  
7
using System.Data;
8

  
7 9
using ID2.Manager.Data.Models;
8 10

  
9 11
using Dapper;
......
17 19
        public IEnumerable<Documents> GetAllDocuments()
18 20
        {
19 21
            string query = $@"
20
select   doc.*,
21

  
22
  (
23
    select markus.*
24
	from [markus_SEC].[dbo].[ViewMarkupData] markus where doc.DocumentNo = markus.DOCUMENT_ID
25
	FOR JSON PATH
26
  ) as MarkupText
22
select   doc.*
27 23
from     dbo.Documents doc
28 24
where    doc.IsDeleted=0
29 25
order by doc.Seq;";
30

  
31 26
            return Query<Documents>(query);
32 27
        }
33 28

  
34 29
        public (IEnumerable<Documents> dwgs, int totalCnt) GetDocuments(string projectCode, string personIncharge, string jobLevel, string documentNo, string isToIsDiscussion, string isFrReviewStatus, string isID2Work, string id2Status, string avevaStatus, string prodIsResult, string clientIsResult)
35 30
        {
36 31
            var dynamicParameters = new DynamicParameters();
37
            dynamicParameters.Add("Total", dbType: System.Data.DbType.Int32, direction: System.Data.ParameterDirection.Output);
32
            dynamicParameters.Add("Total", dbType: DbType.Int32, direction: ParameterDirection.Output);
38 33

  
39 34
            StringBuilder sbWhere = new StringBuilder();
40 35
            var parameters = new Dictionary<string, object>();
......
100 95
            }
101 96

  
102 97
            string query = $@"
103
select   doc.*,
98
select   doc.*, datediff(SECOND, doc.ID2StartDate, doc.ID2EndDate) as ID2JobTime,
104 99

  
105 100
  (
106 101
    select markus.*
......
126 121
            return (ret, totalCount);
127 122
        }
128 123

  
129
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList)
124
        public bool SetDocumentData(List<Documents> docList, List<Documents> delDocList, string userId)
130 125
        {
131 126
            bool isSuccess = false;
132 127

  
......
145 140
                            query = $@"
146 141
update dbo.Documents
147 142
set    IsDeleted=1
148
      ,DeletedDate=getdate()
149
where  [DocID] in ('{docIDList}');";
150
                            base.Execute(query, transaction);
143
      ,DeletedDate=getdate(),
144
      ,DeletedUser=@DeletedUser
145
where  DocID in ('{docIDList}');";
146
                            base.Execute(query, new { DeletedUser = userId }, transaction);
151 147
                        }
152 148
                    }
153 149

  
......
155 151
                    {
156 152
                        if (string.IsNullOrEmpty(doc.DocID))
157 153
                        {
154
                            doc.RegisteredUser = userId;
158 155
                            query = $@"
159 156
insert into dbo.Documents
160 157
(
161
     [DocID]
162
    ,[DocumentNo]
163
    ,[RevisonNo]
164
    ,[RefProjectCode]
165
    ,[DocFilePath]
166
    ,[DocFileName]
167
    ,[JobLevel]
168
    ,[IsTypical]
169
    ,[PersonInCharge]
170
    ,[ToIsDiscussion]
171
    ,[ToRemarks]
172
    ,[ToCreator]
173
    ,[ToCapture]
174
    ,[ToIsMarkup]
175
    ,[FrReviewStatus]
176
    ,[FrRemarks]
177
    ,[FrCreator]
178
    ,[FrCapture]
179
    ,[FrIsMarkup]
180
    ,[IsID2Work]
181
    ,[ID2Connection]
182
    ,[ID2StartDate]
183
    ,[ID2EndDate]
184
    ,[ID2JobTime]
185
    ,[ID2Status]
186
    ,[ID2Issues]
187
    ,[AVEVAConnection]
188
    ,[AVEVAConvertDate]
189
    ,[AVEVAReviewDate]
190
    ,[AVEVAStatus]
191
    ,[AVEVAIssues]
192
    ,[ReviewFilePath]
193
    ,[ReviewFileName]
194
    ,[ProdReviewer]
195
    ,[ProdIsResult]
196
    ,[ProdRemarks]
197
    ,[ClientReviewer]
198
    ,[ClientIsResult]
199
    ,[ClientRemarks]
200
    ,[DTIsGateWay]
201
    ,[DTIsImport]
202
    ,[DTIsRegSystem]
203
    ,[DTRemarks]
158
     DocID
159
    ,DocumentNo
160
    ,RevisonNo
161
    ,RefProjectCode
162
    ,DocFilePath
163
    ,DocFileName
164
    ,JobLevel
165
    ,IsTypical
166
    ,PersonInCharge
167
    ,RegisteredDate
168
    ,RegisteredUser
169
    ,ToIsDiscussion
170
    ,ToRemarks
171
    ,ToCreator
172
    ,ToCapture
173
    ,ToIsMarkup
174
    ,FrReviewStatus
175
    ,FrRemarks
176
    ,FrCreator
177
    ,FrCapture
178
    ,FrIsMarkup
179
    ,IsID2Work
180
    ,ID2Connection
181
    ,ID2StartDate
182
    ,ID2EndDate
183
    ,ID2JobTime
184
    ,ID2Status
185
    ,ID2Issues
186
    ,AVEVAConnection
187
    ,AVEVAConvertDate
188
    ,AVEVAReviewDate
189
    ,AVEVAStatus
190
    ,AVEVAIssues
191
    ,ReviewFilePath
192
    ,ReviewFileName
193
    ,ProdReviewer
194
    ,ProdIsResult
195
    ,ProdRemarks
196
    ,ClientReviewer
197
    ,ClientIsResult
198
    ,ClientRemarks
199
    ,DTIsGateWay
200
    ,DTIsImport
201
    ,DTIsRegSystem
202
    ,DTRemarks
204 203
)
205 204
values 
206 205
(
......
213 212
    ,@JobLevel
214 213
    ,@IsTypical
215 214
    ,@PersonInCharge
215
    ,getdate()
216
    ,@RegisteredUser
216 217
    ,@ToIsDiscussion
217 218
    ,@ToRemarks
218 219
    ,@ToCreator
......
251 252
                        }
252 253
                        else
253 254
                        {
255
                            doc.ModifiedUser = userId;
254 256
                            query = $@"
255 257
update dbo.Documents
256
set    [DocumentNo]=@DocumentNo
257
      ,[RevisonNo]=@RevisonNo
258
      ,[RefProjectCode]=@RefProjectCode
259
      ,[DocFilePath]=@DocFilePath
260
      ,[DocFileName]=@DocFileName
261
      ,[JobLevel]=@JobLevel
262
      ,[IsTypical]=@IsTypical
263
      ,[PersonInCharge]=@PersonInCharge
264
      ,[ModifiedDate]=getdate()
265
      ,[ToIsDiscussion]=@ToIsDiscussion
266
      ,[ToRemarks]=@ToRemarks
267
      ,[ToCreator]=@ToCreator
268
      ,[ToCapture]=@ToCapture
269
      ,[ToIsMarkup]=@ToIsMarkup
270
      ,[FrReviewStatus]=@FrReviewStatus
271
      ,[FrRemarks]=@FrRemarks
272
      ,[FrCreator]=@FrCreator
273
      ,[FrCapture]=@FrCapture
274
      ,[FrIsMarkup]=@FrIsMarkup
275
      ,[IsID2Work]=@IsID2Work
276
      ,[ID2Connection]=@ID2Connection
277
      ,[ID2StartDate]=@ID2StartDate
278
      ,[ID2EndDate]=@ID2EndDate
279
      ,[ID2JobTime]=@ID2JobTime
280
      ,[ID2Status]=@ID2Status
281
      ,[ID2Issues]=@ID2Issues
282
      ,[AVEVAConnection]=@AVEVAConnection
283
      ,[AVEVAConvertDate]=@AVEVAConvertDate
284
      ,[AVEVAReviewDate]=@AVEVAReviewDate
285
      ,[AVEVAStatus]=@AVEVAStatus
286
      ,[AVEVAIssues]=@AVEVAIssues
287
      ,[ReviewFilePath]=@ReviewFilePath
288
      ,[ReviewFileName]=@ReviewFileName
289
      ,[ProdReviewer]=@ProdReviewer
290
      ,[ProdIsResult]=@ProdIsResult
291
      ,[ProdRemarks]=@ProdRemarks
292
      ,[ClientReviewer]=@ClientReviewer
293
      ,[ClientIsResult]=@ClientIsResult
294
      ,[ClientRemarks]=@ClientRemarks
295
      ,[DTIsGateWay]=@DTIsGateWay
296
      ,[DTIsImport]=@DTIsImport
297
      ,[DTIsRegSystem]=@DTIsRegSystem
298
      ,[DTRemarks]=@DTRemarks
299
where  [DocID]=@DocID;";
258
set    DocumentNo=@DocumentNo
259
      ,RevisonNo=@RevisonNo
260
      ,RefProjectCode=@RefProjectCode
261
      ,DocFilePath=@DocFilePath
262
      ,DocFileName=@DocFileName
263
      ,JobLevel=@JobLevel
264
      ,IsTypical=@IsTypical
265
      ,PersonInCharge=@PersonInCharge
266
      ,ModifiedDate=getdate()
267
      ,ModifiedUser=@ModifiedUser
268
      ,ToIsDiscussion=@ToIsDiscussion
269
      ,ToRemarks=@ToRemarks
270
      ,ToCreator=@ToCreator
271
      ,ToCapture=@ToCapture
272
      ,ToIsMarkup=@ToIsMarkup
273
      ,FrReviewStatus=@FrReviewStatus
274
      ,FrRemarks=@FrRemarks
275
      ,FrCreator=@FrCreator
276
      ,FrCapture=@FrCapture
277
      ,FrIsMarkup=@FrIsMarkup
278
      ,IsID2Work=@IsID2Work
279
      ,ID2Connection=@ID2Connection
280
      ,ID2StartDate=@ID2StartDate
281
      ,ID2EndDate=@ID2EndDate
282
      ,ID2JobTime=@ID2JobTime
283
      ,ID2Status=@ID2Status
284
      ,ID2Issues=@ID2Issues
285
      ,AVEVAConnection=@AVEVAConnection
286
      ,AVEVAConvertDate=@AVEVAConvertDate
287
      ,AVEVAReviewDate=@AVEVAReviewDate
288
      ,AVEVAStatus=@AVEVAStatus
289
      ,AVEVAIssues=@AVEVAIssues
290
      ,ReviewFilePath=@ReviewFilePath
291
      ,ReviewFileName=@ReviewFileName
292
      ,ProdReviewer=@ProdReviewer
293
      ,ProdIsResult=@ProdIsResult
294
      ,ProdRemarks=@ProdRemarks
295
      ,ClientReviewer=@ClientReviewer
296
      ,ClientIsResult=@ClientIsResult
297
      ,ClientRemarks=@ClientRemarks
298
      ,DTIsGateWay=@DTIsGateWay
299
      ,DTIsImport=@DTIsImport
300
      ,DTIsRegSystem=@DTIsRegSystem
301
      ,DTRemarks=@DTRemarks
302
where  DocID=@DocID;";
300 303
                        }
301 304
                        base.Execute(query, doc, transaction);
302 305
                    }
......
338 341

  
339 342
                        if (parameters.Count > 0)
340 343
                        {
341
                            sbSet.Append(" ,DocID=@DocID ");
342
                            parameters.Add("DocID", doc.DocID);
343

  
344 344
                            sbSet.Append(" ,ModifiedUser=@ModifiedUser ");
345 345
                            parameters.Add("ModifiedUser", userId);
346 346

  
347
                            parameters.Add("DocID", doc.DocID);
348

  
347 349
                            query = $@"
348 350
declare @DateTimeNow datetime
349 351
set @DateTimeNow = getdate()
......
375 377
            return resultData;
376 378
        }
377 379

  
380
        public bool SetDocumentDatasField(List<Documents> docs, string userId)
381
        {
382
            bool isSuccess = false;
383

  
384
            try
385
            {
386
                using (var transaction = base.BeginTransaction())
387
                {
388
                    foreach (Documents doc in docs)
389
                    {
390
                        string query = string.Empty;
391

  
392
                        if (!string.IsNullOrEmpty(doc.DocID))
393
                        {
394
                            StringBuilder sbSet = new StringBuilder();
395
                            var parameters = new Dictionary<string, object>();
396

  
397
                            #region Update 할 목록
398
                            if (doc.ID2EndDate != null)
399
                            {
400
                                sbSet.Append(" ,ID2EndDate=@ID2EndDate ");
401
                                parameters.Add("ID2EndDate", doc.ID2EndDate);
402
                            }
403
                            #endregion
404

  
405
                            if (parameters.Count > 0)
406
                            {
407
                                sbSet.Append(" ,ModifiedUser=@ModifiedUser ");
408
                                parameters.Add("ModifiedUser", userId);
409

  
410
                                parameters.Add("DocID", doc.DocID);
411

  
412
                                query = $@"
413
update dbo.Documents
414
set    ModifiedDate=getdate() {sbSet}
415
where  [DocID]=@DocID;";
416
                                 base.Execute(query, parameters, transaction);
417
                            }
418
                        }
419
                    }
420
                    transaction.Commit();
421
                    isSuccess = true;
422
                }
423
            }
424
            catch (Exception ex)
425
            {
426
                throw ex;
427
            }
428

  
429
            return isSuccess;
430
        }
431

  
378 432

  
379 433
        //ID2
380 434
        public IEnumerable<ID2Drawings> GetID2DrawingsByProject(ID2ProjectInfo id2Info)
ID2.Manager/ID2.Manager.Data/Models/Documents.cs
50 50
        [DataMember]
51 51
        public DateTime? DeletedDate { get; set; }
52 52
        [DataMember]
53
        public string RegisteredUser { get; set; }
54
        [DataMember]
55
        public string ModifiedUser { get; set; }
56
        [DataMember]
57
        public string DeletedUser { get; set; }
58
        [DataMember]
53 59
        public string ToIsDiscussion { get; set; }
54 60
        [DataMember]
55 61
        public string ToRemarks { get; set; }
......
79 85
        public DateTime? ID2EndDate { get; set; }
80 86
        [DataMember]
81 87
        public int ID2JobTime { get; set; }
88
        public string ID2JobTimetoString
89
        {
90
            get
91
            {
92
                StringBuilder sbTemp;
93
                if (ID2JobTime > 0)
94
                {
95
                    sbTemp = new StringBuilder(TimeSpan.FromSeconds(Convert.ToInt32(ID2JobTime)).ToString(@"dd\:hh\:mm\:ss"));
96
                }
97
                else if (ID2JobTime < 0)
98
                {
99
                    sbTemp = new StringBuilder(TimeSpan.FromSeconds(Convert.ToInt32(ID2JobTime)).ToString(@"dd\:hh\:mm\:ss"));
100
                    sbTemp.Insert(0, "-");
101
                }
102
                else
103
                {
104
                    sbTemp = new StringBuilder();
105
                }
106

  
107
                return sbTemp.ToString();
108
            }
109
        }
82 110
        [DataMember]
83 111
        public string ID2Status { get; set; }
84 112
        [DataMember]
ID2.Manager/ID2.Manager/Main.Designer.cs
1005 1005
            gridViewDateTimeColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
1006 1006
            gridViewDateTimeColumn2.Width = 120;
1007 1007
            gridViewTextBoxColumn5.EnableExpressionEditor = false;
1008
            gridViewTextBoxColumn5.FieldName = "ID2JobTime";
1008
            gridViewTextBoxColumn5.FieldName = "ID2JobTimetoString";
1009 1009
            gridViewTextBoxColumn5.HeaderText = "작업시간";
1010 1010
            gridViewTextBoxColumn5.Name = "ID2JobTime";
1011 1011
            gridViewTextBoxColumn5.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
ID2.Manager/ID2.Manager/Main.cs
1274 1274
                var worker = new DocumentsWorker(this.documents, this.orgDocuments, setDocuments, delDocuments, this.radGridViewDocuments);
1275 1275
                worker.OnWorkCompletedHandler += () =>
1276 1276
                {
1277
                    bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments);
1277
                    bool result = new DocumentController().SetDocumentData(setDocuments, delDocuments, informations.ActiveUser.ID);
1278 1278

  
1279 1279
                    bool markusResult = new MarkusInfoController().SetMarkusInfo(this.documents);
1280 1280

  
......
1309 1309

  
1310 1310
        private void RadButtonElementSync_Click(object sender, EventArgs e)
1311 1311
        {
1312
            this.GetDocListbyID2();
1313
            this.DocumentListBinding();
1312
            if (RadMessageBox.Show("Do you want to ID2 Sync?", Globals.Name, MessageBoxButtons.YesNo, RadMessageIcon.Question) == DialogResult.Yes)
1313
            {
1314
                var id2Prjs = informations.ProjectList.Where(x => x.GroupID.Equals(informations.ActiveProject.ProjectID)).Select(x => x.ID2Info).ToList();
1315

  
1316
                bool result = new DocumentController().SetID2Sync(id2Prjs, informations.ActiveUser.ID);
1317

  
1318
                if (result)
1319
                {
1320
                    this.GetDocListbyID2();
1321
                    this.DocumentListBinding();
1322
                }
1323
            }
1314 1324
        }
1315 1325

  
1316 1326
        private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e)

내보내기 Unified diff

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