/*     */ package com.connor.erp.ProcessImport.ProcessChgTransferToERP;
import com.connor.erp.BomChgTransferToERP.DBUtils;
import com.connor.erp.BomChgTransferToERP.UserList;
/*     */ 
/*     */ import com.connor.erp.ProcessImport.ProcessImportReadXMLStr;
/*     */ import com.connor.erp.ProcessImport.TransferRouteXMLWriter;
/*     */ import com.connor.erp.ProcessImport.ValidateFailDialog;
/*     */ import com.connor.erp.ProcessImport.ValidateRouteXMLWriter;
import com.connor.erp.ProcessImport.ProcessAddTransferToERP.RootAddEnty;
import com.connor.erp.ProcessImport.ProcessAddTransferToERP.RootCheckResult;
import com.connor.erp.ProcessImport.ProcessAddTransferToERP.RootEntry;
import com.connor.erp.processresource.EquipmentAcquiredFromERP.TCPreferenceUitl;
/*     */ import com.connor.erp.toolkit.ActionType;
/*     */ import com.connor.erp.toolkit.AimType;
/*     */ import com.connor.erp.toolkit.FileType;
import com.connor.erp.toolkit.HttpUtil;
/*     */ import com.connor.erp.toolkit.UtilApi;
import com.connor.erpintegration.entity.RouteCheckResult;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
///*     */ import com.connor.tcerp.conn.PlmErpIntegration;
/*     */ import com.teamcenter.rac.aif.AbstractAIFDialog;
/*     */ import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
/*     */ import com.teamcenter.rac.common.TCTable;
import com.teamcenter.rac.kernel.TCComponent;
/*     */ import com.teamcenter.rac.kernel.TCComponentForm;
/*     */ import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
/*     */ import com.teamcenter.rac.kernel.TCSession;
/*     */ import com.teamcenter.rac.kernel.TCUserService;
/*     */ import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/*     */ import java.awt.BorderLayout;
/*     */ import java.awt.Color;
/*     */ import java.awt.Component;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.io.File;
/*     */ import java.io.FileNotFoundException;
import java.net.URLEncoder;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Collections;
/*     */ import java.util.Comparator;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
import java.util.ResourceBundle;

/*     */ import javax.swing.Icon;
/*     */ import javax.swing.ImageIcon;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JScrollPane;
/*     */ import javax.swing.JTabbedPane;
/*     */ import javax.swing.JTable;
/*     */ import javax.swing.SwingUtilities;
/*     */ import javax.swing.table.DefaultTableCellRenderer;
/*     */ import javax.xml.parsers.ParserConfigurationException;
/*     */ import javax.xml.transform.TransformerException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ProcessChgTransferToERPDialog
/*     */   extends AbstractAIFDialog
/*     */   implements ActionListener
/*     */ {
/*     */   private static final long serialVersionUID = 1L;
/*     */   private TCSession session;
/*     */   private AbstractAIFUIApplication application;
/*     */   private TCTable newTable;
/*     */   private TCTable oldTable;
/*     */   private List<String[]> listRowDatas;
/*     */   private JButton btnImport;
/*     */   private JButton btnValidate;
/*     */   private JButton btnCancel;
/*     */   private JScrollPane newScrollPane;
/*     */   private JScrollPane oldScrollPane;
/*  87 */   private JTabbedPane tabbedPane = null;
/*     */   
/*     */   private Map<String, List<String>> map;
/*     */   
/*     */   private List<TCComponentForm> listProcessRevMasters;
/*     */   
/*     */   private boolean isDepartmentNull = false;
/*     */ 
/*     */   private static String erpPreference = "connor_tc_to_erp_url";
/*     */   private String msgString;
/*     */   public ProcessChgTransferToERPDialog(TCSession pSession, AbstractAIFUIApplication app, List<String[]> plistRowDatas, Map<String, List<String>> pmap, List<TCComponentForm> plistProcessRevMasters, boolean isDepartmentNull) {
/*  97 */     super(false);
/*  98 */     this.session = pSession;
/*  99 */     this.application = app;
/* 100 */     this.listRowDatas = plistRowDatas;
/* 101 */     this.map = pmap;
/* 102 */     this.listProcessRevMasters = plistProcessRevMasters;
/* 103 */     this.isDepartmentNull = isDepartmentNull;
/* 104 */     initUI();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private void initUI() {
/* 111 */     setTitle("变更工艺路线");
this.setLayout(new PropertyLayout());
/* 112 */     String[] colName = { "装配件号", "工序号", "工序说明", "部门", "标准工时", "辅助工时", "状态" };
/* 113 */     this.newTable = new TCTable(this.session, colName)
/*     */       {
/*     */         private static final long serialVersionUID = 1L;
/*     */ 
/*     */ 
/*     */ 
/*     */         
/*     */         public boolean isCellEditable(int i, int j) {
/* 121 */           return false;
/*     */         }
/*     */       };
/*     */     
/* 125 */     String[] colName2 = { "装配件号", "工序号", "工序说明", "部门", "标准工时", "辅助工时" };
/* 126 */     this.oldTable = new TCTable(this.session, colName2)
/*     */       {
/*     */         private static final long serialVersionUID = 1L;
/*     */ 
/*     */ 
/*     */ 
/*     */         
/*     */         public boolean isCellEditable(int i, int j) {
/* 134 */           return false;
/*     */         }
/*     */       };
/*     */ 
/*     */     
/* 139 */     fillData();
/*     */     
/* 141 */     int totalWidth = UtilApi.FitTableColumns((JTable)this.newTable);
/* 142 */     this.btnValidate = new JButton("工艺路线导入验证");
/* 143 */     this.btnValidate.addActionListener(this);
/*     */     
/* 145 */     this.btnImport = new JButton("工艺路线导入ERP系统");
/* 146 */     this.btnImport.addActionListener(this);
/* 147 */     this.btnImport.setEnabled(false);
/*     */     
/* 149 */     this.btnCancel = new JButton("取消");
/* 150 */     this.btnCancel.addActionListener(this);
/*     */     
/* 152 */     JPanel paneButton = new JPanel();
/* 153 */     paneButton.add(this.btnValidate);
/* 154 */     paneButton.add(this.btnImport);
/* 155 */     paneButton.add(this.btnCancel);
/*     */     
/* 157 */     this.newScrollPane = new JScrollPane((Component)this.newTable);
/*     */     
/* 159 */     this.oldScrollPane = new JScrollPane((Component)this.oldTable);
/*     */     
/* 161 */     this.tabbedPane = new JTabbedPane(1);
/* 162 */     this.tabbedPane.setTabPlacement(1);
/* 163 */     Icon icon = new ImageIcon("projectobject_16.png");
/* 164 */     this.tabbedPane.addTab("PLM新工艺", icon, this.newScrollPane, "PLM新工艺");
/* 165 */     this.tabbedPane.addTab("ERP老工艺", icon, this.oldScrollPane, "ERP老工艺");
/* 166 */     this.tabbedPane.setEnabledAt(1, false);
/* 167 */     JPanel paneMain = new JPanel(new BorderLayout());
/* 168 */     paneMain.add("Center", this.tabbedPane);
/* 169 */     paneMain.add("South", paneButton);
/* 170 */     this.add("1.1.left.top",paneMain);
/* 171 */     setPreferredSize(new Dimension(500, 600));
showDialog();
this.setVisible(true);
/*     */   }
/*     */   
/*     */   public void fillData() {
/* 175 */     int vecSize = this.listRowDatas.size();
/* 176 */     Collections.sort((List)this.listRowDatas, (Comparator)new Comparator<String[]>()
/*     */         {
/*     */           public int compare(String[] o1, String[] o2)
/*     */           {
/* 180 */             if (o1[0].equals(o2[0])) {
/* 181 */               return o1[1].compareTo(o2[1]);
/*     */             }
/* 183 */             return o1[0].compareTo(o2[0]);
/*     */           }
/*     */         });
/*     */     
/* 187 */     for (int i = 0; i < vecSize; i++) {
/* 188 */       this.newTable.addRow(this.listRowDatas.get(i));
/*     */     }
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   			private ResourceBundle resource = ResourceBundle.getBundle("tcUser_erpUser");

/*     */   private void doImport() throws TCException {
/* 197 */     String user_id = "";
/*     */     try {
/* 199 */       user_id = this.session.getUser().getProperty("user_id");
/* 200 */     } catch (TCException ex) {
/* 201 */       ex.printStackTrace();
/*     */     } 

			Map<String, String> userMap=new HashMap<String, String>();
			userMap.put("TCUser", user_id);
			List<UserList> doPost = DBUtils.doPost(userMap, session);
			UserList userList = doPost.get(0);
			
/* 203 */     List<RootAddEnty> entryMap=new ArrayList<RootAddEnty>();
			List<Map<String, String>> list=new ArrayList<Map<String,String>>();
			Map bomMap=new HashMap();
//			if(resource.containsKey(user_id)) {
//				bomMap.put("creater", resource.getString(user_id));
//             }else {
            	 bomMap.put("creater", userList.getERP_USER_CODE());
            	 System.out.println("creater"+userList.getERP_USER_CODE());
//			}
			RootAddEnty rootEntry=new RootAddEnty();
			String assembly = newTable.getValueAt(0, 0).toString();
			int rowCount = this.newTable.getRowCount();
			int t=0;
			 for (int i = 0; i < rowCount; i++) {
				 String state = this.newTable.getValueAt(i, 6).toString();
				 if(state.equals("删除")) {
					 System.out.println("跳过删除");
					 if(rootEntry.getAssembly_item()!=null && !rootEntry.getAssembly_item().equals("")) {
						if(i==rowCount-1) {
							entryMap.add(rootEntry);
							rootEntry.setRouteLine(list);
						}
						//						rootEntry=new RootAddEnty();
					 }
					 continue;
				 }
				 rootEntry.setAssembly_item(assembly);
				 TCComponentForm tcComponentForm = listProcessRevMasters.get(t);
				 AIFComponentContext[] whereReferenced = tcComponentForm.whereReferenced();
				 TCComponent component = (TCComponent) whereReferenced[0].getComponent();
				 rootEntry.setVersion(component.getStringProperty("item_revision_id"));
				if(!assembly.equals(newTable.getValueAt(i, 0).toString())) {
					System.out.println("new ArrayList？"+newTable.getValueAt(i, 0).toString());
					t++;
					entryMap.add(rootEntry);
					rootEntry.setRouteLine(list);
					rootEntry=new RootAddEnty();
					assembly=newTable.getValueAt(i, 0).toString();
					list=new ArrayList<Map<String,String>>();
				}
				if(i==rowCount-1) {
					entryMap.add(rootEntry);
					rootEntry.setRouteLine(list);
					System.out.println("assembly"+assembly+"rootEntry"+rootEntry.getAssembly_item());
				}
				Map<String, String> jsonMap=new HashMap<String, String>();
				jsonMap.put("operation_seq_num", newTable.getValueAt(i, 1).toString());
				jsonMap.put("operation_description", newTable.getValueAt(i, 2).toString());
				jsonMap.put("department_code", newTable.getValueAt(i, 3).toString());
				
				String amount = newTable.getValueAt(i, 4).toString();
				if(amount.equals(" ") || amount.equals("0") || amount.equals("")) {
					amount=null;
				}
				
				String amount_auxiliary= newTable.getValueAt(i, 5).toString();
				if(amount_auxiliary.equals(" ")|| amount_auxiliary.equals("0")  || amount.equals("")) {
					amount_auxiliary=null;
				}
				
				jsonMap.put("usage_rate_or_amount", amount);
				jsonMap.put("usage_rate_or_amount_auxiliary", amount_auxiliary);
				list.add(jsonMap);
			 }
//			 for(RootAddEnty bAdd:entryMap) {
//				 List<RootAddEnty> entryMap2=new ArrayList<RootAddEnty>();
//				 entryMap2.add(bAdd);
//				 bomMap.put("ROUTE", entryMap2);
//				 String doPost = doPost1(bomMap,"ROUTEChg");
//				 if (!msgString.equals("succ")) {
// /* 207 */       MessageBox.post(this.application.getDesktop().getShell(), msgString, "导入出现错误", 1);
// /*     */       return;
// /*     */     }
//				DBUtils.InsertData(bAdd.getAssembly_item(), "工艺路线", doPost, user_id, bAdd.getVersion(), session); 
//			 }
			 dispose();
			 System.out.println("测试"+entryMap.size());
//			 MessageBox.post("工艺路线任务已经成功发送给ERP，如果需要查询是否传递请在“ERP集成”—“ERP任务导入记录”中查找", "发送到ERP成功", 2);
			 ProcessChgTransferOperation operation=new ProcessChgTransferOperation(application,session,entryMap,bomMap,ProcessChgTransferToERPDialog.this);
/* 243 */     session.queueOperation(operation);
/*     */ }
/*     */ 
/*     */ 
/*     */  

/*     */   public void validateImport() {
/* 263 */     if (this.isDepartmentNull) {
/* 264 */       MessageBox.post(this.application.getDesktop().getShell(), "部分工艺的部门为空，请填写部门再进行导入！", "警告", 4);
/*     */       return;
/*     */     } 
/* 267 */     String user_id = "";
/*     */     try {
/* 269 */       user_id = this.session.getUser().getProperty("user_id");
/* 270 */     } catch (TCException ex) {
/* 271 */       ex.printStackTrace();
/*     */     } 
/* 273 */     List<RootEntry> entryMap=new ArrayList<RootEntry>();
				List<Map<String, String>> list=new ArrayList<Map<String,String>>();
				Map<String, List> bomMap=new HashMap<String, List>();
				RootEntry rootEntry=new RootEntry();
				String assembly = newTable.getValueAt(0, 0).toString();
				int rowCount = this.newTable.getRowCount();
				 for (int i = 0; i < rowCount; i++) {
					 rootEntry.setAssembly_item(assembly);
					
					if(assembly!=newTable.getValueAt(i, 0).toString()) {
						entryMap.add(rootEntry);
						rootEntry.setRouteLine(list);
						rootEntry=new RootEntry();
						assembly=newTable.getValueAt(i, 0).toString();
						list=new ArrayList<Map<String,String>>();
					}
					if(i==rowCount-1) {
						entryMap.add(rootEntry);
						rootEntry.setRouteLine(list);
				//		rootEntry=new RootEntry();
					}
					Map<String, String> jsonMap=new HashMap<String, String>();
					jsonMap.put("department_code", newTable.getValueAt(i, 3).toString());
					jsonMap.put("operation_seq_num", newTable.getValueAt(i, 1).toString());
					list.add(jsonMap);
/*     */   } 

				 bomMap.put("ROUTE", entryMap);
				 List<RouteCheckResult> doPost = doPost(bomMap,"RouteChgCheck");
				 System.out.println(doPost.size());
///* 288 */     String result = "";
//		UtilApi.getErrorInfoFromCode(PlmErpIntegration.validateData(xmlFilePath));
/* 289 */     if (!msgString.equals("succ")) {
/* 290 */       MessageBox.post(this.application.getDesktop().getShell(), msgString, "验证出现错误", 1);
/*     */       return;
/*     */     } 
/* 293 */     List<String> listAll = new ArrayList<String>();
/* 294 */     List<String> listAllAssAndOper = new ArrayList<String>();
/* 295 */     List<String[]> listOld = (List)new ArrayList<String>();
/* 296 */     List<String> listOldAssAndOper = new ArrayList<String>();
/* 297 */     String errorInfo = "";
		StringBuffer buffer=new StringBuffer();
		ProcessImportReadXMLStr.loadChgElements(doPost,buffer,listAll, listAllAssAndOper, listOld, listOldAssAndOper);
		errorInfo=buffer.toString();
/* 298 */     if (errorInfo.equals("")) {
/*     */       
/* 300 */       Collections.sort((List)listOld, (Comparator)new Comparator<String[]>()
/*     */           {
/*     */             public int compare(String[] o1, String[] o2)
/*     */             {
/* 304 */               if (o1[0].equals(o2[0])) {
/* 305 */                 return o1[1].compareTo(o2[1]);
/*     */               }
/* 307 */               return o1[0].compareTo(o2[0]);
/*     */             }
/*     */           });
/*     */       
/* 311 */       this.oldTable.clear();
/* 312 */       int listOldSize = listOld.size();
/* 313 */       for (int i = 0; i < listOldSize; i++) {
/* 314 */         this.oldTable.addRow(listOld.get(i));
/*     */       }
/* 316 */       this.tabbedPane.setEnabledAt(1, true);
///* 317 */       int rowCount = this.newTable.getRowCount();
/*     */       
/* 319 */       List<String[]> resultList = (List)new ArrayList<String>();
/* 320 */       int notChangeNum = 0;
/* 321 */       for (int row = 0; row < rowCount; row++) {
/* 322 */         String[] newRowData = new String[7];
/* 323 */         String assembly_item_number = this.newTable.getValueAt(row, 0).toString();
/* 324 */         String operation_seq_num = this.newTable.getValueAt(row, 1).toString();
/* 325 */         String operation_description = this.newTable.getValueAt(row, 2).toString();
/* 326 */         String department_code = this.newTable.getValueAt(row, 3).toString();
/* 327 */         String usage_rate_or_amount = this.newTable.getValueAt(row, 4).toString();
/* 328 */         String usage_rate_or_amount_auxiliary = this.newTable.getValueAt(row, 5).toString();
/* 329 */         StringBuffer assAndOper = (new StringBuffer(assembly_item_number)).append(",").append(operation_seq_num);
/* 330 */         StringBuffer allSb = (new StringBuffer(assAndOper.toString())).append(",").append(operation_description).append(",").append(department_code).append(",").append(usage_rate_or_amount).append(",").append(usage_rate_or_amount_auxiliary);
/* 331 */         newRowData[0] = assembly_item_number;
/* 332 */         newRowData[1] = operation_seq_num;
/* 333 */         newRowData[2] = operation_description;
/* 334 */         newRowData[3] = department_code;
/* 335 */         newRowData[4] = usage_rate_or_amount;
/* 336 */         newRowData[5] = usage_rate_or_amount_auxiliary;
/* 337 */         if (!listOldAssAndOper.contains(assAndOper.toString())) {
/* 338 */           newRowData[6] = "新增";
/*     */         }
/* 340 */         else if (listAll.contains(allSb.toString())) {
/* 341 */           newRowData[6] = "未改";
/* 342 */           notChangeNum++;
/*     */         } else {
/* 344 */           newRowData[6] = "修改";
/*     */         } 
/*     */         
/* 347 */         int index = listAllAssAndOper.indexOf(assAndOper.toString());
/* 348 */         if (index != -1) {
/* 349 */           listAll.remove(index);
/* 350 */           listAllAssAndOper.remove(assAndOper.toString());
/*     */         } 
/* 352 */         resultList.add(newRowData);
/*     */       } 
/* 354 */       int listNewSize = listAll.size();
/* 355 */       if (listNewSize > 0) {
/* 356 */         for (int k = 0; k < listNewSize; k++) {
/* 357 */           String[] newRowData = new String[7];
/* 358 */           String[] str = ((String)listAll.get(k)).split(",");
/* 359 */           String oldAssAndOper = str[0] + "," + str[1];
/* 360 */           //String[] oldStr = listOld.get(listOldAssAndOper.indexOf(oldAssAndOper));
					if(listOldAssAndOper!=null) {
						System.out.println("listOldAssAndOper:"+listOldAssAndOper.toString());
					}
					if(oldAssAndOper!=null) {
						System.out.println("oldAssAndOper:"+oldAssAndOper.toString());
					}
					
					int index = listOldAssAndOper.indexOf(oldAssAndOper);
					if (index >= 0 && index < listOld.size()) {
					    String[] oldStr = listOld.get(index);
					    newRowData[0] = str[0];
					    /* 362 */           newRowData[1] = str[1];
					    /* 363 */           newRowData[2] = oldStr[2];
					    /* 364 */           newRowData[3] = oldStr[3];
					    /* 365 */           newRowData[4] = oldStr[4];
					    /* 366 */           newRowData[5] = oldStr[5];
					    /* 367 */           newRowData[6] = "删除";
					    /* 368 */           resultList.add(newRowData);
					    // do something
					} else {
					    // 处理下标越界的情况
						continue;
					}
/* 361 */           
/*     */         } 
/*     */       }
/* 371 */       Collections.sort((List)resultList, (Comparator)new Comparator<String[]>()
/*     */           {
/*     */             public int compare(String[] o1, String[] o2)
/*     */             {
/* 375 */               if (o1[0].equals(o2[0])) {
/* 376 */                 return o1[1].compareTo(o2[1]);
/*     */               }
/* 378 */               return o1[0].compareTo(o2[0]);
/*     */             }
/*     */           });
/*     */       
/* 382 */       int newSize = resultList.size();
/* 383 */       this.newTable.clear(); int j;
/* 384 */       for (j = 0; j < newSize; j++) {
/* 385 */         this.newTable.addRow(resultList.get(j));
/*     */       }
/* 387 */       for (j = 0; j < 7; j++) {
/* 388 */         this.newTable.getColumn(this.newTable.getColumnName(j)).setCellRenderer(new MyDefaultTableCellRenderer());
/*     */       }
/* 390 */       int oldWidth = UtilApi.FitTableColumns((JTable)this.oldTable);
/* 391 */       int newWidth = UtilApi.FitTableColumns((JTable)this.newTable);
/* 392 */       if (oldWidth > newWidth) {
/* 393 */         setPreferredSize(new Dimension(oldWidth, 400));
/*     */       } else {
/* 395 */         setPreferredSize(new Dimension(newWidth, 400));
/*     */       } 
/* 397 */       if (notChangeNum == resultList.size()) {
/* 398 */         MessageBox.post(this.application.getDesktop().getShell(), "与ERP中的工艺路线（工序号、工序说明、部门、工时）一致，无需导入！", "警告", 4);
/* 399 */         int formNum = this.listProcessRevMasters.size();
/* 400 */         Object[] obj = new Object[1];
/* 401 */         obj[0] = Integer.valueOf(11);
/* 402 */         TCUserService service = this.session.getUserService();
/* 403 */         for (int k = 0; k < formNum; k++) {
/*     */           try {
/* 405 */             service.call("openByPass", obj);
/* 406 */             ((TCComponentForm)this.listProcessRevMasters.get(k)).setLogicalProperty("nhl8_ERPimpSucc", true);
/* 407 */             service.call("closeByPass", obj);
/* 408 */           } catch (TCException e) {
/* 409 */             e.printStackTrace();
/*     */           } 
/*     */         } 
/*     */         return;
/*     */       } 
/* 414 */       MessageBox.post(this.application.getDesktop().getShell(), "导入验证成功，可以执行导入操作！", "成功", 2);
/* 415 */       this.btnImport.setEnabled(true);
/*     */     } else {
/*     */       
/* 418 */       SwingUtilities.invokeLater((Runnable)new ValidateFailDialog("验证失败，请查看详细信息：", "警告", errorInfo));
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void actionPerformed(ActionEvent e) {
/* 429 */     if (e.getSource() == this.btnImport) {
/* 430 */       dispose();
/* 431 */       try {
					doImport();
				} catch (TCException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
/* 432 */     } else if (e.getSource() == this.btnValidate) {
/* 433 */       validateImport();
/* 434 */     } else if (e.getSource() == this.btnCancel) {
/* 435 */       dispose();
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   public class MyDefaultTableCellRenderer
/*     */     extends DefaultTableCellRenderer
/*     */   {
/*     */     private static final long serialVersionUID = 1L;
/*     */ 
/*     */     
/*     */     public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
/* 447 */       String sixValue = table.getValueAt(row, 6).toString();
/* 448 */       if (sixValue.equals("删除")) {
/* 449 */         setBackground(Color.RED);
/* 450 */       } else if (sixValue.equals("新增")) {
/* 451 */         setBackground(Color.GREEN);
/* 452 */       } else if (sixValue.equals("修改")) {
/* 453 */         setBackground(Color.YELLOW);
/* 454 */       } else if (sixValue.equals("未改")) {
/* 455 */         setBackground(Color.WHITE);
/*     */       } 
/* 457 */       return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
/*     */     }
/*     */   }

private List<RouteCheckResult> doPost(Map itemCheckMap, String svr) {
	HashMap<String, String> preferenceHashMap = TCPreferenceUitl.getPreferenceHashMap(session, TCPreferenceService.TC_preference_site, erpPreference);
	String url = preferenceHashMap.get("url");
	String token = preferenceHashMap.get("token");
	String jsonString=new Gson().toJson(itemCheckMap);
	JSONObject itemCheckJson = JSONObject.fromObject(jsonString);
	String sid = null;
	try {
		System.out.println("开始发送请求");
		String args = itemCheckJson.toString();
		System.out.println(args);
		token = URLEncoder.encode(token,"UTF-8");
		svr = URLEncoder.encode(svr,"UTF-8");
		args = URLEncoder.encode(args,"UTF-8");
		String param = "usr="+token+"&svr="+svr+"&args="+args;
		
		System.out.println("url=============="+url);
		System.out.println("param==========="+args);
		String response = HttpUtil.doPost(url, param); //.doGet(url+"?"+param)
		
//		System.out.println("请求结果================"+response);
		
		JSONObject jsonObject = JSONObject.fromObject(response);
		System.out.println("json格式==============="+jsonObject);
		if(svr.equals("RouteChgCheck")) {
			msgString = jsonObject.getString("msg");
			if(jsonObject.has("cont")) {
				JSONObject jsonObject2 = jsonObject.getJSONObject("cont");
				if(jsonObject2.has("checkResult")) {
					JSONArray jsonObject3 = jsonObject2.getJSONArray("checkResult");
					Gson gson = new Gson();  
					List<RouteCheckResult> list= gson.fromJson(jsonObject3.toString(), new TypeToken<List<RouteCheckResult>>() {}.getType());
					
					return list;
				}
			}
		}
	} catch (Exception e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	}
	return null;
}
/*     */ }

