개정판 29cd086e
ConvertPDF 동일하게 수정
Change-Id: Ic507c5abe47db006549e3bb5ff098c58bbed5cbd
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/FinalPDFViewModel.cs | ||
---|---|---|
1234 | 1234 |
|
1235 | 1235 |
private async void DataConvert(object obj) |
1236 | 1236 |
{ |
1237 |
if (SelectFilterConvert == null && SelectRealConvert == null) |
|
1237 |
if (obj is FinalPDF) |
|
1238 |
{ |
|
1239 |
|
|
1240 |
if (obj != null) |
|
1241 |
{ |
|
1242 |
var convertitem = obj as FinalPDF; |
|
1243 |
|
|
1244 |
SelectRealConvert = convertitem; |
|
1245 |
SetCleanUpItem(SelectRealConvert); |
|
1246 |
|
|
1247 |
|
|
1248 |
var items = from x in await WcfClient.GET_SELECT_FINAL_PDF_ITEMAsync(SelectRealConvert.ConvertID, null, null, null, null, null, null, null, null, 1, null, null, null, null, null, null, null, null, null, null) |
|
1249 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
|
1250 |
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, |
|
1251 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
|
1252 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
|
1253 |
|
|
1254 |
foreach (var item in items) |
|
1255 |
{ |
|
1256 |
if (RealConvertSource.Count(x => x.ConvertID == item.ConvertID) < 1) |
|
1257 |
{ |
|
1258 |
RealConvertSource.Add(item); |
|
1259 |
} |
|
1260 |
if (RealConvertSource.Count() == 1) |
|
1261 |
{ |
|
1262 |
ConvertShow = true; |
|
1263 |
} |
|
1264 |
} |
|
1265 |
} |
|
1266 |
} |
|
1267 |
else if (SelectFilterConvertList == null) |
|
1238 | 1268 |
{ |
1239 | 1269 |
MessageBox.Show("왼쪽 버튼 클릭 후 Converter 해주세요!"); |
1240 | 1270 |
} |
1241 | 1271 |
else |
1242 | 1272 |
{ |
1243 |
var resultRealConvert = 0; |
|
1244 |
var resultFiltertConvert = 0; |
|
1245 |
|
|
1246 |
if (SelectRealConvert != null) |
|
1247 |
{ |
|
1248 |
resultRealConvert = SetCleanUpItem(SelectRealConvert).Result; |
|
1249 |
} |
|
1250 |
else if (SelectFilterConvert != null) |
|
1273 |
if (SelectFilterConvertList != null) |
|
1251 | 1274 |
{ |
1252 |
resultFiltertConvert = SetCleanUpItem(SelectFilterConvert).Result; |
|
1275 |
foreach (var SelectFilterConvert in SelectFilterConvertList) |
|
1276 |
{ |
|
1277 |
SetCleanUpItem(SelectFilterConvert); |
|
1278 |
} |
|
1253 | 1279 |
} |
1254 |
System.Diagnostics.Debug.WriteLine(resultRealConvert + " " + resultFiltertConvert); |
|
1255 | 1280 |
|
1256 |
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) |
|
1257 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
|
1258 |
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, |
|
1259 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
|
1260 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
|
1281 |
foreach (var SelectFilterConvert in SelectFilterConvertList) |
|
1282 |
{ |
|
1283 |
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) |
|
1284 |
let MarkusLink = "kcom://" + CreateMarkusParam(x.ID, x.DOCUMENT_ID, "doftech") |
|
1285 |
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, |
|
1286 |
x.REVISION, x.CURRENT_PAGE, x.TOTAL_PAGE, x.EXCEPTION, x.GROUP_NO, x.CREATE_DATETIME, x.START_DATETIME, x.END_DATETIME |
|
1287 |
, x.ORIGINAL_FILE, x.CONVERT_PATH, MarkusLink); |
|
1261 | 1288 |
|
1262 | 1289 |
|
1263 |
foreach (var item in items) |
|
1264 |
{ |
|
1265 |
if (RealConvertSource.Count(x => x.ConvertID == item.ConvertID) < 1) |
|
1290 |
foreach (var item in items) |
|
1266 | 1291 |
{ |
1267 |
RealConvertSource.Add(item); |
|
1268 |
} |
|
1269 |
if (RealConvertSource.Count() == 1) |
|
1270 |
{ |
|
1271 |
ConvertShow = true; |
|
1292 |
if (RealConvertSource.Count(x => x.ConvertID == item.ConvertID) < 1) |
|
1293 |
{ |
|
1294 |
RealConvertSource.Add(item); |
|
1295 |
} |
|
1296 |
if (RealConvertSource.Count() == 1) |
|
1297 |
{ |
|
1298 |
ConvertShow = true; |
|
1299 |
} |
|
1272 | 1300 |
} |
1273 | 1301 |
} |
1274 | 1302 |
} |
1275 | 1303 |
} |
1276 | 1304 |
|
1277 | 1305 |
|
1278 |
public async Task<int> SetCleanUpItem(FinalPDF _ConvertItem)
|
|
1306 |
public async void SetCleanUpItem(FinalPDF _ConvertItem)
|
|
1279 | 1307 |
{ |
1280 |
int result = 0; |
|
1281 | 1308 |
|
1282 | 1309 |
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); |
1283 | 1310 |
|
... | ... | |
1291 | 1318 |
await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(_ConvertItem.ConvertID, 0, _CREATE_DATETIME, _STATUS, null); |
1292 | 1319 |
|
1293 | 1320 |
} |
1294 |
|
|
1295 |
return result; |
|
1296 | 1321 |
} |
1297 | 1322 |
|
1298 | 1323 |
public static string CreateMarkusParam(string projectNo, string documentID, string userID) |
... | ... | |
1323 | 1348 |
|
1324 | 1349 |
private void DataValidate(object obj) |
1325 | 1350 |
{ |
1351 |
if (obj is FinalPDF) |
|
1352 |
{ |
|
1326 | 1353 |
|
1327 |
bool result = false; |
|
1354 |
if (obj != null) |
|
1355 |
{ |
|
1356 |
var convertitem = obj as FinalPDF; |
|
1328 | 1357 |
|
1329 |
WebRequest webRequest = WebRequest.Create(SelectFilterConvert.OriginfilePath); |
|
1330 |
webRequest.Timeout = 1200; // miliseconds |
|
1331 |
webRequest.Method = "HEAD"; |
|
1358 |
SelectRealConvert = convertitem; |
|
1332 | 1359 |
|
1333 |
HttpWebResponse response = null; |
|
1360 |
bool result = false; |
|
1361 |
WebRequest webRequest = WebRequest.Create(SelectRealConvert.OriginfilePath); |
|
1362 |
webRequest.Timeout = 1200; // miliseconds |
|
1363 |
webRequest.Method = "HEAD"; |
|
1334 | 1364 |
|
1335 |
try |
|
1365 |
HttpWebResponse response = null; |
|
1366 |
|
|
1367 |
try |
|
1368 |
{ |
|
1369 |
response = (HttpWebResponse)webRequest.GetResponse(); |
|
1370 |
result = true; |
|
1371 |
} |
|
1372 |
catch (WebException webException) |
|
1373 |
{ |
|
1374 |
MessageBox.Show(SelectRealConvert.FileName + " doesn't exist: " + webException.Message); |
|
1375 |
result = true; |
|
1376 |
} |
|
1377 |
finally |
|
1378 |
{ |
|
1379 |
if (response != null) |
|
1380 |
{ |
|
1381 |
response.Close(); |
|
1382 |
} |
|
1383 |
} |
|
1384 |
if (result == true) |
|
1385 |
{ |
|
1386 |
MessageBox.Show("File exists"); |
|
1387 |
} |
|
1388 |
} |
|
1389 |
} |
|
1390 |
else if (SelectFilterConvertList.Count() > 1) |
|
1336 | 1391 |
{ |
1337 |
response = (HttpWebResponse)webRequest.GetResponse(); |
|
1338 |
result = true; |
|
1392 |
MessageBox.Show("하나만 클릭해 주세요"); |
|
1339 | 1393 |
} |
1340 |
catch (WebException webException)
|
|
1394 |
else if (SelectFilterConvertList.Count() == 0)
|
|
1341 | 1395 |
{ |
1342 |
MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message); |
|
1343 |
result = true; |
|
1396 |
MessageBox.Show("왼쪽 버튼 클릭 후 Validate 해주세요!"); |
|
1344 | 1397 |
} |
1345 |
finally
|
|
1398 |
else
|
|
1346 | 1399 |
{ |
1347 |
if (response != null) |
|
1400 |
bool result = false; |
|
1401 |
WebRequest webRequest = WebRequest.Create(SelectFilterConvertList[0].OriginfilePath); |
|
1402 |
webRequest.Timeout = 1200; // miliseconds |
|
1403 |
webRequest.Method = "HEAD"; |
|
1404 |
|
|
1405 |
HttpWebResponse response = null; |
|
1406 |
|
|
1407 |
try |
|
1348 | 1408 |
{ |
1349 |
response.Close(); |
|
1409 |
response = (HttpWebResponse)webRequest.GetResponse(); |
|
1410 |
result = true; |
|
1411 |
} |
|
1412 |
catch (WebException webException) |
|
1413 |
{ |
|
1414 |
MessageBox.Show(SelectFilterConvert.FileName + " doesn't exist: " + webException.Message); |
|
1415 |
result = true; |
|
1416 |
} |
|
1417 |
finally |
|
1418 |
{ |
|
1419 |
if (response != null) |
|
1420 |
{ |
|
1421 |
response.Close(); |
|
1422 |
} |
|
1423 |
} |
|
1424 |
if (result == true) |
|
1425 |
{ |
|
1426 |
MessageBox.Show("File exists"); |
|
1350 | 1427 |
} |
1351 | 1428 |
} |
1352 |
if (result == true) |
|
1353 |
{ |
|
1354 |
MessageBox.Show("File exists"); |
|
1355 |
} |
|
1429 |
|
|
1356 | 1430 |
} |
1357 | 1431 |
|
1358 | 1432 |
#endregion |
... | ... | |
1361 | 1435 |
|
1362 | 1436 |
private void DataDelete(object obj) |
1363 | 1437 |
{ |
1364 |
RadWindow.Alert("do you want to delete it??", this.OnClosed); |
|
1438 |
EventHandler<WindowClosedEventArgs> handler = (snd, evt) => |
|
1439 |
{ |
|
1440 |
var result = evt.DialogResult; |
|
1441 |
|
|
1442 |
if (result == true) |
|
1443 |
{ |
|
1444 |
OnClosed(obj); |
|
1445 |
} |
|
1446 |
}; |
|
1447 |
|
|
1448 |
RadWindow.Confirm("Do you want to delete it??", handler); |
|
1365 | 1449 |
} |
1366 | 1450 |
|
1367 |
private async void OnClosed(object sender, WindowClosedEventArgs e)
|
|
1451 |
private async void OnClosed(object obj)
|
|
1368 | 1452 |
{ |
1369 |
var result = e.DialogResult; |
|
1370 |
if (result == true) |
|
1453 |
if (obj is FinalPDF) |
|
1371 | 1454 |
{ |
1372 |
if (SelectFilterConvertList.Count() > 1)
|
|
1455 |
if (obj != null)
|
|
1373 | 1456 |
{ |
1374 |
MessageBox.Show("하나만 클릭해 주세요!"); |
|
1457 |
var convertitem = obj as FinalPDF; |
|
1458 |
|
|
1459 |
SelectRealConvert = convertitem; |
|
1460 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID); |
|
1461 |
|
|
1375 | 1462 |
} |
1376 |
else |
|
1463 |
} |
|
1464 |
else if (SelectFilterConvertList.Count() > 1) |
|
1465 |
{ |
|
1466 |
MessageBox.Show("하나만 클릭해 주세요!"); |
|
1467 |
} |
|
1468 |
else if (SelectFilterConvertList.Count() == 0) |
|
1469 |
{ |
|
1470 |
MessageBox.Show("왼쪽 버튼 클릭 후 Delete 해주세요!"); |
|
1471 |
} |
|
1472 |
else |
|
1473 |
{ |
|
1474 |
if (SelectFilterConvertList != null) |
|
1377 | 1475 |
{ |
1378 |
if (SelectRealConvert != null) |
|
1379 |
{ |
|
1380 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectRealConvert.ConvertID); |
|
1381 |
} |
|
1382 |
if (SelectFilterConvertList != null) |
|
1383 |
{ |
|
1384 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID); |
|
1385 |
} |
|
1476 |
await WcfClient.GET_SELECT_CONVERT_DELETEAsync(SelectFilterConvertList[0].ConvertID); |
|
1386 | 1477 |
} |
1387 | 1478 |
} |
1388 | 1479 |
} |
1389 | 1480 |
|
1390 |
|
|
1391 | 1481 |
#endregion |
1392 | 1482 |
|
1393 | 1483 |
#region Stop Process |
... | ... | |
1397 | 1487 |
|
1398 | 1488 |
string convertid = ""; |
1399 | 1489 |
|
1400 |
#if DEBUG |
|
1401 |
convertid = "TEST"; |
|
1402 |
#endif |
|
1403 |
if (SelectRealConvert != null) |
|
1404 |
{ |
|
1405 |
if (AliveItems.Count(x => x.ConvertID == SelectRealConvert.ConvertID) == 0) |
|
1406 |
{ |
|
1407 |
convertid = SelectRealConvert.ConvertID; |
|
1408 |
} |
|
1409 |
} |
|
1410 |
if (SelectAliveConvert != null) |
|
1490 |
if (obj is FinalPDF) |
|
1411 | 1491 |
{ |
1412 |
if (RealConvertSource.Count(x => x.ConvertID == SelectAliveConvert.ConvertID) == 0) |
|
1492 |
|
|
1493 |
if (obj != null) |
|
1413 | 1494 |
{ |
1414 |
convertid = SelectAliveConvert.ConvertID; |
|
1495 |
var convertitem = obj as FinalPDF; |
|
1496 |
|
|
1497 |
SelectRealConvert = convertitem; |
|
1498 |
|
|
1499 |
SelectAliveConvert = convertitem; |
|
1500 |
|
|
1501 |
convertid = convertitem.ConvertID; |
|
1415 | 1502 |
} |
1416 | 1503 |
} |
1417 | 1504 |
|
1505 |
|
|
1506 |
#if DEBUG |
|
1507 |
convertid = "TEST"; |
|
1508 |
#endif |
|
1509 |
|
|
1418 | 1510 |
EventHandler<WindowClosedEventArgs> handler = (snd, evt) => |
1419 | 1511 |
{ |
1420 | 1512 |
var result = evt.DialogResult; |
... | ... | |
1425 | 1517 |
} |
1426 | 1518 |
}; |
1427 | 1519 |
|
1428 |
//ID 찾아서 멈춰라 |
|
1429 | 1520 |
RadWindow.Confirm("프로세스 종료 할까요??", handler); |
1430 | 1521 |
} |
1431 | 1522 |
|
1432 |
private void Stop_Process(string convertId) |
|
1523 |
private async void Stop_Process(string convertId)
|
|
1433 | 1524 |
{ |
1525 |
System.Threading.Thread.Sleep(new TimeSpan(0, 0, 0, 10)); |
|
1434 | 1526 |
|
1435 | 1527 |
var process = Process.GetProcessesByName("Markus.Service.ConvertProcess"); |
1436 | 1528 |
|
... | ... | |
1444 | 1536 |
{ |
1445 | 1537 |
if (commandLines[0] == convertId) |
1446 | 1538 |
{ |
1539 |
|
|
1540 |
var _CREATE_DATETIME = DateTime.Now; |
|
1541 |
|
|
1542 |
await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(convertId, 2, _CREATE_DATETIME, 3, null); |
|
1543 |
process[i].WaitForExit(5000); |
|
1544 |
await WcfClient.GET_SELECT_RERECONVERT_ITEMAsync(convertId, 2, _CREATE_DATETIME, 99, null); |
|
1447 | 1545 |
process[i].Kill(); |
1448 | 1546 |
} |
1449 | 1547 |
} |
... | ... | |
1454 | 1552 |
} |
1455 | 1553 |
} |
1456 | 1554 |
} |
1555 |
|
|
1457 | 1556 |
#endregion |
1458 | 1557 |
|
1459 | 1558 |
#region DataFilter |
내보내기 Unified diff