 package com.connor.erp.ProcessImport.ProcessAddTransferToERP;
 
 import com.connor.erp.toolkit.IsContinueDialog;
 import com.connor.erp.toolkit.UtilApi;
 import com.teamcenter.rac.aif.AbstractAIFCommand;
 import com.teamcenter.rac.aif.AbstractAIFUIApplication;
 import com.teamcenter.rac.aif.kernel.AIFComponentContext;
 import com.teamcenter.rac.kernel.TCComponentBOMLine;
 import com.teamcenter.rac.kernel.TCComponentForm;
 import com.teamcenter.rac.kernel.TCComponentItemRevision;
 import com.teamcenter.rac.kernel.TCComponentMEOPRevision;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCException;
 import com.teamcenter.rac.kernel.TCSession;
 import com.teamcenter.rac.util.MessageBox;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import javax.swing.SwingUtilities;
 
 /*     */ public class ProcessAddTransferToERPCommand
 /*     */   extends AbstractAIFCommand
 /*     */ {
 /*     */   private TCSession session;
 /*     */   private AbstractAIFUIApplication application;
 /*     */   private List<TCComponentItemRevision> listProcessRevisions;
 /*     */   private StringBuffer detailInfo;
 /*  49 */   private List<String[]> listRowDatas = (List)new ArrayList<String>();
 /*     */   
 /*  51 */   private Map<String, List<String>> map = new HashMap<String, List<String>>();
 /*     */   
 /*  53 */   private List<TCComponentForm> listProcessRevMasters = new ArrayList<TCComponentForm>();
 /*     */ 
 /*     */   private List<String> listProcessRevs = new ArrayList<String>();
 /*     */   private boolean isPrivilege;
 /*     */ 
 /*     */   
 /*     */   private boolean isDepartmentNull = false;
 /*     */ 
 /*     */ 
 /*     */   
 /*     */   public ProcessAddTransferToERPCommand(TCSession pSession, AbstractAIFUIApplication app, List<TCComponentItemRevision> listProcessRevisions, StringBuffer detailInfo, boolean isPrivilege) {
 /*  64 */     this.session = pSession;
 /*  65 */     this.application = app;
 /*  66 */     this.listProcessRevisions = listProcessRevisions;
 /*  67 */     this.detailInfo = detailInfo;
 /*  68 */     this.isPrivilege = isPrivilege;
 /*  69 */     postDialog();
 /*     */   }
 /*     */ 
 /*     */ 
 /*     */ 
 /*     */   
 /*     */   public void postDialog() {
 /*  76 */     int listSize = this.listProcessRevisions.size();
 				for(int i = 0; i < listSize; i++) {
 					try {
						System.out.println(listProcessRevisions.get(i).getStringProperty("object_string"));
					} catch (TCException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
 				}
 /*  77 */     for (int i = 0; i < listSize; i++) {
 /*  78 */       TCComponentItemRevision revision = this.listProcessRevisions.get(i);
 /*     */       try {
 /*  80 */         this.listProcessRevMasters.add((TCComponentForm)revision.getRelatedComponent("IMAN_master_form_rev"));
 /*  81 */       } catch (TCException e2) {
 /*  82 */         e2.printStackTrace();
 /*     */       } 
 /*  84 */       TCComponentBOMLine bomline = UtilApi.getNewBOMLine(this.session, revision, null);
 /*  85 */       String process_item_id = "";
 /*     */       try {
 /*  87 */         process_item_id = revision.getProperty("item_id");
 /*  88 */       } catch (TCException e1) {
 /*  89 */         e1.printStackTrace();
 /*     */       } 
 /*  91 */       String part_item_id = process_item_id.substring(0, process_item_id.length() - 2);
 /*     */       
 /*  93 */       List<String> list = new ArrayList<String>();
 /*     */       try {
 /*  95 */         AIFComponentContext[] opers = bomline.getChildren();
 /*  96 */         int childCount = opers.length;
 /*  97 */         int operNum = 0;

 /*  98 */         for (int j = 0; j < childCount; j++) {
 /*  99 */           TCComponentBOMLine operBom = (TCComponentBOMLine)opers[j].getComponent();
 /* 100 */           TCComponentItemRevision itemRevision = operBom.getItemRevision();
 /* 101 */           if (itemRevision instanceof TCComponentMEOPRevision || itemRevision.getType().equals("NHL8_RigOutGXRevision")) {
// /* 102 */             TCComponentMEOPRevision operRevision = (TCComponentMEOPRevision)itemRevision;
 System.out.println("oper"+itemRevision.getTCClass().getSuperClass().toString());
 /* 103 */             if (itemRevision.getTCClass().getSuperClass().toString().equals("NHL8_MEOPRevision")|| itemRevision.getType().equals("NHL8_RigOutGXRevision")) {
 /* 104 */               if ((itemRevision.getReferenceListProperty("release_status_list")).length == 0) {
 /* 105 */                 if (!this.isPrivilege) {
 /* 106 */                   MessageBox.post(itemRevision + " 对象未发布", "警告", 4);
 /*     */                   return;
 /*     */                 } 
 /* 109 */                 this.detailInfo.append(itemRevision + " 对象未发布<br>");
 /*     */               } 
 /* 112 */               String[] rowData = new String[6];
 /* 113 */               rowData[0] = part_item_id;
 /* 114 */               rowData[1] = operBom.getProperty("bl_sequence_no");
 /* 115 */               rowData[2] = itemRevision.getProperty("object_name");
 /* 116 */               TCComponentForm form = (TCComponentForm)itemRevision.getRelatedComponent("IMAN_master_form_rev");
 /* 117 */               String[] formProNames = { "nhl8_StandardWH", "nhl8_AuxiliaryWH" };
 /* 118 */               String[] formProValues = form.getProperties(formProNames);
 							
// 						if(formProValues[1].equals(" ")||formProValues[1].equals("")) {
// 							try {
// 								System.out.println("获取double类型");
// 								formProValues[1]=String.valueOf(form.getDoubleProperty("nhl8_AuxiliaryWH"));
// 							}catch (Exception e) {
//								// TODO: handle exception
// 								e.printStackTrace();
//							}
// 							
// 						}
 /* 119 */               rowData[4] = formProValues[0];
 /* 120 */               rowData[5] = formProValues[1];
 /* 121 */               AIFComponentContext[] children = operBom.getChildren();
 /* 122 */               int childCount2 = children.length;
 /* 123 */               boolean existEquipment = false;
 /* 124 */               for (int k = 0; k < childCount2; k++) {
 /* 125 */                 if (((TCComponentBOMLine)children[k].getComponent()).getItem().getType().equals("NHL8_Equipments")) {
 /* 126 */                   String equ_id = "";
 /*     */                   try {
	 System.out.println("equ_id"+children[k].getComponent().getProperty("bl_item_item_id"));
 /* 128 */                     equ_id = children[k].getComponent().getProperty("bl_item_item_id").substring(4);
 /* 129 */                   } catch (Exception e) {
 /* 130 */                     e.printStackTrace();
 /*     */                   } 
 /* 132 */                   rowData[3] = equ_id;
 /* 133 */                   list.add(equ_id);
 /* 134 */                   existEquipment = true;
 /*     */                   break;
 /*     */                 } 
 /*     */               } 
 /* 138 */               if (!existEquipment) {
 /* 139 */                 this.isDepartmentNull = true;
 /*     */               }
 /* 141 */               this.listRowDatas.add(rowData);
 /* 142 */               operNum++;
 /*     */             } 
 /*     */           } 
 /*     */         } 
 /* 146 */         if (operNum == 0) {
 /* 147 */           MessageBox.post(this.application.getDesktop().getShell(), revision + "下面没有任何的工序对象！", "警告", 4);
 /*     */           return;
 /*     */         } 
 /* 150 */       } catch (TCException e) {
 /* 151 */         e.printStackTrace();
 /*     */       } 
 /* 153 */       this.map.put(part_item_id, list);
 /*     */     } 
 System.out.println("isPrivilege"+isPrivilege);
 /* 155 */     if (this.isPrivilege) {
 /* 156 */       if (!this.detailInfo.toString().equals("")) {
 /* 157 */         setRunnable((Runnable)new IsContinueDialog(this, "所选部分工艺/工序对象未发布", this.detailInfo.toString()));
 /*     */       } else {
 /* 159 */         setRunnable((Runnable)new ProcessAddTransferToERPDialog(this.session, this.application, this.listRowDatas, this.map, this.listProcessRevMasters, this.isDepartmentNull));
 /*     */       } 
 /*     */     } else {
 /* 162 */       setRunnable((Runnable)new ProcessAddTransferToERPDialog(this.session, this.application, this.listRowDatas, this.map, this.listProcessRevMasters, this.isDepartmentNull));
 /*     */     } 
 /*     */   }
 /*     */   
 /*     */   public void postDialog2() {
 /* 167 */     SwingUtilities.invokeLater((Runnable)new ProcessAddTransferToERPDialog(this.session, this.application, this.listRowDatas, this.map, this.listProcessRevMasters, this.isDepartmentNull));
 /*     */   }
 /*     */ }

