parent
e85afb0702
commit
49672d3fa1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,32 @@
|
|||||||
|
preferr=\u9996\u9009\u9879\u914D\u7F6E\u4E0D\u6B63\u786E
|
||||||
|
#XYBOM
|
||||||
|
ok=\u786E\u5B9A
|
||||||
|
err=\u9519\u8BEF\uFF1A
|
||||||
|
cel=\u53D6\u6D88
|
||||||
|
notbom= \u4E0D\u662FBOM\u884C\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
||||||
|
setbox=\u8BBE\u7F6E\u88C5\u7BB1\u5355
|
||||||
|
boxfinish=\u88C5\u7BB1\u5355\u8BBE\u7F6E\u5B8C\u6210\uFF01
|
||||||
|
#BoxReport
|
||||||
|
choose=\u8BF7\u9009\u62E9\u5BFC\u51FA\u683C\u5F0F\uFF1A
|
||||||
|
multiple=\u591A\u9875
|
||||||
|
single=\u5355\u9875
|
||||||
|
nottop=\u9009\u4E2D\u5BF9\u8C61\u4E0D\u662FBOM\u9876\u5C42\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
||||||
|
sheetname=\u88C5\u7BB1\u660E\u7EC6
|
||||||
|
sheeterr=sheet\u9875\u672A\u627E\u5230\uFF01
|
||||||
|
exportsuccess=\u5BFC\u51FA\u5B8C\u6210\uFF01
|
||||||
|
boxno=\u7B2C;\u7BB1
|
||||||
|
numstr=\u96F6;\u4E00;\u4E8C;\u4E09;\u56DB;\u4E94;\u516D;\u4E03;\u516B;\u4E5D;\u5341
|
||||||
|
importing=\u6B63\u5728\u5BFC\u51FA\uFF0C\u8BF7\u7A0D\u5019...
|
||||||
|
#EditClassification
|
||||||
|
chooserev=\u8BF7\u9009\u62E9Item\u8FDB\u884C\u4FEE\u6539\uFF01
|
||||||
|
notinoptions=\u6B64\u529F\u80FD\u914D\u7F6E\u6CA1\u6709\u5F53\u524D\u5BF9\u8C61\u7C7B\u578B
|
||||||
|
noaccess=\u6CA1\u6709\u7248\u672C\u4FEE\u6539\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458
|
||||||
|
revcounterr=\u5B58\u5728\u591A\u7248\u672C\uFF0C\u65E0\u6CD5\u4FEE\u6539ID
|
||||||
|
statuserr=\u5B58\u5728\u72B6\u6001\u6807\u8BC6\uFF0C\u65E0\u6CD5\u4FEE\u6539ID
|
||||||
|
noclasserr=\u5F53\u524D\u5BF9\u8C61\u672A\u88AB\u5206\u7C7B
|
||||||
|
classtitle=\u4FEE\u6539\u5206\u7C7B\u5C5E\u6027
|
||||||
|
delete=\u5220\u9664
|
||||||
|
send=\u53D1\u9001
|
||||||
|
message1=\u5206\u7C7B\u5C5E\u6027\u5931\u8D25
|
||||||
|
message2=\uFF0C\u9519\u8BEF\u53F7\uFF1A
|
||||||
|
message3=\uFF0C\u8FD4\u56DE\u7ED3\u679C\uFF1A
|
@ -1,10 +0,0 @@
|
|||||||
preferr=\u9996\u9009\u9879\u914D\u7F6E\u4E0D\u6B63\u786E
|
|
||||||
#XYBOM
|
|
||||||
ok=\u786E\u5B9A
|
|
||||||
err=\u9519\u8BEF\uFF1A
|
|
||||||
cel=\u53D6\u6D88
|
|
||||||
notbom= \u4E0D\u662FBOM\u884C\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
|
||||||
setbox=\u8BBE\u7F6E\u88C5\u7BB1\u5355
|
|
||||||
boxfinish=\u88C5\u7BB1\u5355\u8BBE\u7F6E\u5B8C\u6210\uFF01
|
|
||||||
#BoxReport
|
|
||||||
nottop=\u9009\u4E2D\u5BF9\u8C61\u4E0D\u662FBOM\u9876\u5C42\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
foldercut=\u4E0D\u80FD\u5BF9\u8BE5\u7C7B\u578B\u7684\u6587\u4EF6\u5939\u8FDB\u884C\u526A\u5207\u64CD\u4F5C
|
Binary file not shown.
@ -0,0 +1,285 @@
|
|||||||
|
package com.connor.cust.box;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFPrintSetup;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
import com.connor.cust.util.POIUtil;
|
||||||
|
import com.connor.cust.util.ProgressReporterDialog;
|
||||||
|
import com.connor.cust.util.TCUtil;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
/**
|
||||||
|
* 功能描述: 装箱单报表
|
||||||
|
* 创建日期:2024-01-05
|
||||||
|
* @author 李冬阳
|
||||||
|
*
|
||||||
|
* 修改日期 修改人 修改描述
|
||||||
|
* 2019-01-24 XXXX 创建程序
|
||||||
|
*/
|
||||||
|
public class BoxReportOperation extends AbstractAIFOperation {
|
||||||
|
|
||||||
|
private TCSession session;
|
||||||
|
private boolean single;
|
||||||
|
private TCComponentBOMLine target;
|
||||||
|
private String[] options;
|
||||||
|
private LinkedList<String[]> datas;
|
||||||
|
private HashMap<String, Integer> boxMap;
|
||||||
|
|
||||||
|
private final int PAGE_CNT = 23;//
|
||||||
|
private final int TITLE_CNT = 4;
|
||||||
|
private final int PAGE = PAGE_CNT + TITLE_CNT;
|
||||||
|
private final int COL_CNT = 9;
|
||||||
|
/**
|
||||||
|
* 装箱单报表
|
||||||
|
* @param session TCSession
|
||||||
|
* @param target 所选顶层BOM
|
||||||
|
* @param options Excel模板首选项值
|
||||||
|
* @param single 是否单页
|
||||||
|
*/
|
||||||
|
public BoxReportOperation(TCSession session, TCComponentBOMLine target, String[] options, boolean single) {
|
||||||
|
this.session = session;
|
||||||
|
this.target = target;
|
||||||
|
this.options = options;
|
||||||
|
this.single = single;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeOperation() throws Exception {
|
||||||
|
TCComponent model = session.stringToComponent(options[single ? 0 : 1]);
|
||||||
|
if(model==null || !model.getType().equals("MSExcelX")) {
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), "KWC_ReportTemplate_XYBOX" + PlmLocale.getString("preferr"), "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File directory = TCUtil.saveExcelChooser();
|
||||||
|
if(directory == null)
|
||||||
|
return;
|
||||||
|
final ProgressReporterDialog reporter = new ProgressReporterDialog("INFO");
|
||||||
|
reporter.reportProgressMessage(PlmLocale.getString("importing"));
|
||||||
|
new Thread(reporter).start();
|
||||||
|
new Thread() {
|
||||||
|
public void run(){
|
||||||
|
FileInputStream input = null;
|
||||||
|
FileOutputStream output = null;
|
||||||
|
XSSFWorkbook workbook = null;
|
||||||
|
try {
|
||||||
|
datas = new LinkedList<>();
|
||||||
|
boxMap = new HashMap<>();
|
||||||
|
String topid = target.getProperty("bl_item_item_id");
|
||||||
|
recycleBom(target.getChildren(), topid);
|
||||||
|
if(datas.size() == 0) {
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), PlmLocale.getString("sheetname") + PlmLocale.getString("sheeterr"), "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//按照XYBOX属性排序
|
||||||
|
Collections.sort(datas, new Comparator<String[]>() {
|
||||||
|
public int compare(String[] data1, String[] data2) {
|
||||||
|
return Integer.parseInt(data1[COL_CNT]) - Integer.parseInt(data2[COL_CNT]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
File file = ((TCComponentDataset)model).getTcFiles()[0].getFile(System.getProperty("java.io.tmpdir"));
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
workbook = new XSSFWorkbook(input);
|
||||||
|
XSSFSheet sheet = workbook.getSheet(PlmLocale.getString("sheetname"));
|
||||||
|
if(sheet == null) {
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), PlmLocale.getString("sheetname") + PlmLocale.getString("sheeterr"), "ERROR", MessageBox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int sheet0 = workbook.getSheetIndex(sheet);
|
||||||
|
if(single) {
|
||||||
|
//单页
|
||||||
|
XSSFRow xssfrow = TCUtil.getRow(sheet, 0);
|
||||||
|
XSSFCell cell = TCUtil.getCell(xssfrow, 9);
|
||||||
|
cell.setCellValue(topid);
|
||||||
|
int pageCnt = 0;
|
||||||
|
for(int b : boxMap.values()) {
|
||||||
|
pageCnt += b/PAGE_CNT;
|
||||||
|
if(b % PAGE_CNT > 0)
|
||||||
|
pageCnt ++;
|
||||||
|
}
|
||||||
|
for(int i=1; i<=pageCnt; i++) {
|
||||||
|
// sheet.copyRows(0, PAGE, i*PAGE, null);
|
||||||
|
POIUtil.copyRows(workbook, sheet, 0, PAGE-1, i*PAGE, COL_CNT, 1);
|
||||||
|
}
|
||||||
|
int row = 0, rbox = 0, pbox = 0;
|
||||||
|
for(String[] data : datas) {
|
||||||
|
int box = Integer.parseInt(data[COL_CNT]);
|
||||||
|
if(box != pbox) {
|
||||||
|
//换箱号
|
||||||
|
row --;
|
||||||
|
int page = row / PAGE;
|
||||||
|
if(row % PAGE > 0)
|
||||||
|
page ++;
|
||||||
|
row = page * PAGE + TITLE_CNT;
|
||||||
|
rbox = 1;
|
||||||
|
pbox = box;
|
||||||
|
|
||||||
|
xssfrow = TCUtil.getRow(sheet, page * PAGE + 1);
|
||||||
|
cell = TCUtil.getCell(xssfrow, 5);
|
||||||
|
String[] boxno = PlmLocale.getString("boxno").split(";");
|
||||||
|
cell.setCellValue(boxno[0] + getNumStr(box) + boxno[1]);
|
||||||
|
}else if(row % PAGE == 1) {
|
||||||
|
//换页
|
||||||
|
xssfrow = TCUtil.getRow(sheet, row);
|
||||||
|
cell = TCUtil.getCell(xssfrow, 5);
|
||||||
|
String[] boxno = PlmLocale.getString("boxno").split(";");
|
||||||
|
cell.setCellValue(boxno[0] + getNumStr(box) + boxno[1]);
|
||||||
|
|
||||||
|
int page = row / PAGE + 1;
|
||||||
|
row = page * PAGE + TITLE_CNT;
|
||||||
|
}
|
||||||
|
xssfrow = TCUtil.getRow(sheet, row);
|
||||||
|
cell = TCUtil.getCell(xssfrow, 0);
|
||||||
|
cell.setCellValue(rbox);
|
||||||
|
for(int i=1; i<COL_CNT; i++) {
|
||||||
|
if(i == 2)
|
||||||
|
continue;
|
||||||
|
cell = TCUtil.getCell(xssfrow, i);
|
||||||
|
cell.setCellValue(data[i]);
|
||||||
|
}
|
||||||
|
row ++;
|
||||||
|
rbox ++;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//多页
|
||||||
|
XSSFRow xssfrow = TCUtil.getRow(sheet, 0);
|
||||||
|
XSSFCell cell = TCUtil.getCell(xssfrow, 9);
|
||||||
|
cell.setCellValue(topid);
|
||||||
|
XSSFPrintSetup ps = sheet.getPrintSetup();
|
||||||
|
for(int i=0; i<boxMap.size(); i++) {
|
||||||
|
XSSFSheet sheet2 = workbook.cloneSheet(sheet0);
|
||||||
|
workbook.setSheetOrder(sheet2.getSheetName(), sheet0+i+1);
|
||||||
|
XSSFPrintSetup ps2 = sheet2.getPrintSetup();
|
||||||
|
ps2.setLandscape(ps.getLandscape());
|
||||||
|
ps2.setPaperSize(ps.getPaperSizeEnum());
|
||||||
|
}
|
||||||
|
int row = 0, rbox = 0, pbox = 0;
|
||||||
|
for(String[] data : datas) {
|
||||||
|
int box = Integer.parseInt(data[COL_CNT]);
|
||||||
|
if(box != pbox) {
|
||||||
|
//换箱号
|
||||||
|
sheet = workbook.getSheetAt(sheet0 + box - 1);
|
||||||
|
row = TITLE_CNT;
|
||||||
|
rbox = 1;
|
||||||
|
pbox = box;
|
||||||
|
|
||||||
|
xssfrow = TCUtil.getRow(sheet, 0);
|
||||||
|
cell = TCUtil.getCell(xssfrow, 5);
|
||||||
|
String[] boxno = PlmLocale.getString("boxno").split(";");
|
||||||
|
cell.setCellValue(boxno[0] + getNumStr(box) + boxno[1]);
|
||||||
|
}
|
||||||
|
xssfrow = TCUtil.getRow(sheet, row);
|
||||||
|
cell = TCUtil.getCell(xssfrow, 0);
|
||||||
|
cell.setCellValue(rbox);
|
||||||
|
for(int i=1; i<COL_CNT; i++) {
|
||||||
|
if(i == 2)
|
||||||
|
continue;
|
||||||
|
cell = TCUtil.getCell(xssfrow, i);
|
||||||
|
cell.setCellValue(data[i]);
|
||||||
|
}
|
||||||
|
row ++;
|
||||||
|
rbox ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output = new FileOutputStream(file.getPath());
|
||||||
|
workbook.write(output);
|
||||||
|
workbook.close();
|
||||||
|
output.close();
|
||||||
|
input.close();
|
||||||
|
if(directory.exists())
|
||||||
|
directory.delete();
|
||||||
|
file.renameTo(directory);
|
||||||
|
|
||||||
|
reporter.requestCanceling();
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), PlmLocale.getString("exportsuccess"), "INFO", MessageBox.INFORMATION);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
reporter.requestCanceling();
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), PlmLocale.getString("err") + e1.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
if(workbook != null)
|
||||||
|
workbook.close();
|
||||||
|
if(output != null)
|
||||||
|
output.close();
|
||||||
|
if(input != null)
|
||||||
|
input.close();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 遍历BOM读取数据
|
||||||
|
* @param contexts 父级BOM.getChildren()
|
||||||
|
* @param pid 父级item_id
|
||||||
|
*/
|
||||||
|
private void recycleBom(AIFComponentContext[] contexts, String pid) throws Exception {
|
||||||
|
for(AIFComponentContext c : contexts) {
|
||||||
|
TCComponentBOMLine bom = (TCComponentBOMLine) c.getComponent();
|
||||||
|
String id = bom.getProperty("bl_item_item_id");
|
||||||
|
String box = bom.getProperty("XYBOX");
|
||||||
|
if(!box.isEmpty()) {
|
||||||
|
TCComponentItemRevision rev = bom.getItemRevision();
|
||||||
|
String[] data = new String[COL_CNT + 1];
|
||||||
|
data[0] = "";
|
||||||
|
data[1] = id;
|
||||||
|
data[2] = "";
|
||||||
|
data[3] = rev.getProperty("object_name");
|
||||||
|
data[4] = TCUtil.getItemRevisionMasterForm(rev).getProperty("item_id");
|
||||||
|
data[5] = pid;
|
||||||
|
data[6] = bom.getProperty("Detail_ID");
|
||||||
|
data[7] = bom.getProperty("bl_quantity");
|
||||||
|
data[8] = "";
|
||||||
|
data[9] = box;
|
||||||
|
|
||||||
|
if(boxMap.containsKey(box))
|
||||||
|
boxMap.put(box, boxMap.get(box) + 1);
|
||||||
|
else
|
||||||
|
boxMap.put(box, 1);
|
||||||
|
datas.add(data);
|
||||||
|
}
|
||||||
|
recycleBom(bom.getChildren(), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 数字转换为汉字形式
|
||||||
|
* @param num 待转换数字
|
||||||
|
*/
|
||||||
|
private String getNumStr(int num) throws Exception {
|
||||||
|
String[] nums = PlmLocale.getString("numstr").split(";");
|
||||||
|
StringBuilder numstr = new StringBuilder("");
|
||||||
|
if(num < 11) {
|
||||||
|
numstr.append(nums[num]);
|
||||||
|
}else if(num < 20) {
|
||||||
|
numstr.append(nums[10]).append(nums[num%10]);
|
||||||
|
}else if(num%10 == 0) {
|
||||||
|
numstr.append(nums[num/10]).append(nums[10]);
|
||||||
|
}else {
|
||||||
|
numstr.append(nums[num/10]).append(nums[10]).append(nums[num%10]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return numstr.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
preferr=\u9996\u9009\u9879\u914D\u7F6E\u4E0D\u6B63\u786E
|
||||||
|
#XYBOM
|
||||||
|
ok=\u786E\u5B9A
|
||||||
|
err=\u9519\u8BEF\uFF1A
|
||||||
|
cel=\u53D6\u6D88
|
||||||
|
notbom= \u4E0D\u662FBOM\u884C\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
||||||
|
setbox=\u8BBE\u7F6E\u88C5\u7BB1\u5355
|
||||||
|
boxfinish=\u88C5\u7BB1\u5355\u8BBE\u7F6E\u5B8C\u6210\uFF01
|
||||||
|
#BoxReport
|
||||||
|
choose=\u8BF7\u9009\u62E9\u5BFC\u51FA\u683C\u5F0F\uFF1A
|
||||||
|
multiple=\u591A\u9875
|
||||||
|
single=\u5355\u9875
|
||||||
|
nottop=\u9009\u4E2D\u5BF9\u8C61\u4E0D\u662FBOM\u9876\u5C42\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
||||||
|
sheetname=\u88C5\u7BB1\u660E\u7EC6
|
||||||
|
sheeterr=sheet\u9875\u672A\u627E\u5230\uFF01
|
||||||
|
exportsuccess=\u5BFC\u51FA\u5B8C\u6210\uFF01
|
||||||
|
boxno=\u7B2C;\u7BB1
|
||||||
|
numstr=\u96F6;\u4E00;\u4E8C;\u4E09;\u56DB;\u4E94;\u516D;\u4E03;\u516B;\u4E5D;\u5341
|
||||||
|
importing=\u6B63\u5728\u5BFC\u51FA\uFF0C\u8BF7\u7A0D\u5019...
|
||||||
|
#EditClassification
|
||||||
|
chooserev=\u8BF7\u9009\u62E9Item\u8FDB\u884C\u4FEE\u6539\uFF01
|
||||||
|
notinoptions=\u6B64\u529F\u80FD\u914D\u7F6E\u6CA1\u6709\u5F53\u524D\u5BF9\u8C61\u7C7B\u578B
|
||||||
|
noaccess=\u6CA1\u6709\u7248\u672C\u4FEE\u6539\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458
|
||||||
|
revcounterr=\u5B58\u5728\u591A\u7248\u672C\uFF0C\u65E0\u6CD5\u4FEE\u6539ID
|
||||||
|
statuserr=\u5B58\u5728\u72B6\u6001\u6807\u8BC6\uFF0C\u65E0\u6CD5\u4FEE\u6539ID
|
||||||
|
noclasserr=\u5F53\u524D\u5BF9\u8C61\u672A\u88AB\u5206\u7C7B
|
||||||
|
classtitle=\u4FEE\u6539\u5206\u7C7B\u5C5E\u6027
|
||||||
|
delete=\u5220\u9664
|
||||||
|
send=\u53D1\u9001
|
||||||
|
message1=\u5206\u7C7B\u5C5E\u6027\u5931\u8D25
|
||||||
|
message2=\uFF0C\u9519\u8BEF\u53F7\uFF1A
|
||||||
|
message3=\uFF0C\u8FD4\u56DE\u7ED3\u679C\uFF1A
|
@ -1,10 +0,0 @@
|
|||||||
preferr=\u9996\u9009\u9879\u914D\u7F6E\u4E0D\u6B63\u786E
|
|
||||||
#XYBOM
|
|
||||||
ok=\u786E\u5B9A
|
|
||||||
err=\u9519\u8BEF\uFF1A
|
|
||||||
cel=\u53D6\u6D88
|
|
||||||
notbom= \u4E0D\u662FBOM\u884C\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
|
||||||
setbox=\u8BBE\u7F6E\u88C5\u7BB1\u5355
|
|
||||||
boxfinish=\u88C5\u7BB1\u5355\u8BBE\u7F6E\u5B8C\u6210\uFF01
|
|
||||||
#BoxReport
|
|
||||||
nottop=\u9009\u4E2D\u5BF9\u8C61\u4E0D\u662FBOM\u9876\u5C42\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\uFF01
|
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.connor.cust.classification;
|
||||||
|
|
||||||
|
public class ClassPropBean {
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public ClassPropBean(String id, String name, String value) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.connor.cust.classification;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
|
||||||
|
import com.connor.cust.box.PlmLocale;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
/**
|
||||||
|
* 功能描述: 修改分类属性和ItemID
|
||||||
|
* 创建日期:2024-01-10
|
||||||
|
* @author 李冬阳
|
||||||
|
*
|
||||||
|
* 修改日期 修改人 修改描述
|
||||||
|
* 2019-01-24 XXXX 创建程序
|
||||||
|
*/
|
||||||
|
public class EditClassificationHandler extends AbstractHandler{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
|
System.out.println("EditClassificationHandler");
|
||||||
|
try {
|
||||||
|
new EditClassificationDialog(AIFUtility.getCurrentApplication());
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MessageBox.post(AIFUtility.getActiveDesktop(), PlmLocale.getString("err") + e.getMessage(), "ERROR", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,160 @@
|
|||||||
|
package com.connor.cust.classification;
|
||||||
|
|
||||||
|
import java.awt.event.ItemEvent;
|
||||||
|
import java.awt.event.ItemListener;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.KeyListener;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.ComboBoxModel;
|
||||||
|
import javax.swing.DefaultComboBoxModel;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
@SuppressWarnings({ "serial", "rawtypes", "unchecked" })
|
||||||
|
public class JAutoCompleteComboBox extends JComboBox {
|
||||||
|
private AutoCompleter completer;
|
||||||
|
|
||||||
|
public JAutoCompleteComboBox() {
|
||||||
|
super();
|
||||||
|
addCompleter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JAutoCompleteComboBox(ComboBoxModel cm) {
|
||||||
|
super(cm);
|
||||||
|
addCompleter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JAutoCompleteComboBox(Object[] items) {
|
||||||
|
super(items);
|
||||||
|
addCompleter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JAutoCompleteComboBox(List v) {
|
||||||
|
super((Vector) v);
|
||||||
|
addCompleter();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCompleter() {
|
||||||
|
setEditable(true);
|
||||||
|
completer = new AutoCompleter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void autoComplete(String str) {
|
||||||
|
this.completer.autoComplete(str, str.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return ((JTextField) getEditor().getEditorComponent()).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
((JTextField) getEditor().getEditorComponent()).setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsItem(String itemString) {
|
||||||
|
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||||
|
String _item = " " + this.getModel().getElementAt(i);
|
||||||
|
if (_item.equals(itemString))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"rawtypes"})
|
||||||
|
class AutoCompleter implements KeyListener, ItemListener {
|
||||||
|
|
||||||
|
private JComboBox owner = null;
|
||||||
|
private JTextField editor = null;
|
||||||
|
|
||||||
|
private ComboBoxModel model = null;
|
||||||
|
|
||||||
|
public AutoCompleter(JComboBox comboBox) {
|
||||||
|
owner = comboBox;
|
||||||
|
editor = (JTextField) comboBox.getEditor().getEditorComponent();
|
||||||
|
editor.addKeyListener(this);
|
||||||
|
model = comboBox.getModel();
|
||||||
|
owner.addItemListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyTyped(KeyEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public void keyReleased(KeyEvent e) {
|
||||||
|
char ch = e.getKeyChar();
|
||||||
|
// if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch)
|
||||||
|
// || ch == KeyEvent.VK_DELETE)
|
||||||
|
// return;
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
|
int caretPosition = editor.getCaretPosition();
|
||||||
|
String str = editor.getText();
|
||||||
|
if (str.length() == 0)
|
||||||
|
return;
|
||||||
|
autoComplete(str, caretPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "unused" })
|
||||||
|
protected void autoComplete(String strf, int caretPosition) {
|
||||||
|
Object[] opts;
|
||||||
|
opts = getMatchingOptions(strf.substring(0, caretPosition));
|
||||||
|
if (owner != null) {
|
||||||
|
model = new DefaultComboBoxModel(opts);
|
||||||
|
owner.setModel(model);
|
||||||
|
}
|
||||||
|
if (opts.length > 0) {
|
||||||
|
String str = opts[0].toString();
|
||||||
|
editor.setCaretPosition(caretPosition);
|
||||||
|
if (owner != null) {
|
||||||
|
try {
|
||||||
|
owner.showPopup();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected Object[] getMatchingOptions(String str) {
|
||||||
|
List v = new Vector();
|
||||||
|
List v1 = new Vector();
|
||||||
|
// v.add(str);
|
||||||
|
for (int k = 0; k < model.getSize(); k++) {
|
||||||
|
Object itemObj = model.getElementAt(k);
|
||||||
|
if (itemObj != null) {
|
||||||
|
String item = itemObj.toString().toLowerCase();
|
||||||
|
if (item.indexOf((str.toLowerCase())) > -1)
|
||||||
|
v.add(model.getElementAt(k));
|
||||||
|
else
|
||||||
|
v1.add(model.getElementAt(k));
|
||||||
|
} else
|
||||||
|
v1.add(model.getElementAt(k));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < v1.size(); i++) {
|
||||||
|
v.add(v1.get(i));
|
||||||
|
}
|
||||||
|
// if (v.isEmpty())
|
||||||
|
return v.toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void itemStateChanged(ItemEvent event) {
|
||||||
|
if (event.getStateChange() == ItemEvent.SELECTED) {
|
||||||
|
int caretPosition = editor.getCaretPosition();
|
||||||
|
if (caretPosition != -1) {
|
||||||
|
try {
|
||||||
|
editor.moveCaretPosition(caretPosition);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,159 @@
|
|||||||
|
package com.connor.cust.util;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.Dialog;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JProgressBar;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ProgressReporterDialog extends AbstractAIFDialog
|
||||||
|
{
|
||||||
|
|
||||||
|
private JLabel messageLabel;
|
||||||
|
|
||||||
|
private JProgressBar progressBar;
|
||||||
|
|
||||||
|
private boolean requestCanceling;
|
||||||
|
|
||||||
|
private int percent;
|
||||||
|
|
||||||
|
public ProgressReporterDialog(String title)
|
||||||
|
{
|
||||||
|
//super(false);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
setAlwaysOnTop(true);
|
||||||
|
|
||||||
|
initializeComponents();
|
||||||
|
//setTitle(title);
|
||||||
|
registerComponentsListeners();
|
||||||
|
addComponents();
|
||||||
|
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
}
|
||||||
|
public ProgressReporterDialog(Dialog parent, String title)
|
||||||
|
{
|
||||||
|
super(parent, false);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
// setAlwaysOnTop(true);
|
||||||
|
setDefaultCloseOperation(AbstractAIFDialog.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
|
initializeComponents();
|
||||||
|
// setTitle(title);
|
||||||
|
registerComponentsListeners();
|
||||||
|
addComponents();
|
||||||
|
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
}
|
||||||
|
public ProgressReporterDialog(Frame parent, String title)
|
||||||
|
{
|
||||||
|
super(parent, false);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
// setAlwaysOnTop(true);
|
||||||
|
setDefaultCloseOperation(AbstractAIFDialog.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
|
initializeComponents();
|
||||||
|
// setTitle(title);
|
||||||
|
registerComponentsListeners();
|
||||||
|
addComponents();
|
||||||
|
|
||||||
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeComponents()
|
||||||
|
{
|
||||||
|
messageLabel = new JLabel(" ", JLabel.LEFT);
|
||||||
|
progressBar = new JProgressBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerComponentsListeners()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComponents()
|
||||||
|
{
|
||||||
|
add(messageLabel, BorderLayout.NORTH);
|
||||||
|
add(progressBar, BorderLayout.SOUTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void centerToClientScreen()
|
||||||
|
{
|
||||||
|
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
|
||||||
|
int x = screen.width - getWidth();
|
||||||
|
int y = screen.height - getHeight();
|
||||||
|
|
||||||
|
setLocation(x / 2, y / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reportProgressMessage(String message)
|
||||||
|
{
|
||||||
|
messageLabel.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgressPercent(int percent)
|
||||||
|
{
|
||||||
|
this.percent = percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void requestCanceling()
|
||||||
|
{
|
||||||
|
requestCanceling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
pack();
|
||||||
|
setSize(400, getHeight());
|
||||||
|
centerToClientScreen();
|
||||||
|
setVisible(true);
|
||||||
|
|
||||||
|
while (!requestCanceling)
|
||||||
|
{
|
||||||
|
if(percent > progressBar.getMaximum())
|
||||||
|
{
|
||||||
|
percent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
progressBar.setValue(percent);
|
||||||
|
|
||||||
|
percent += 5;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(100);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProgess()
|
||||||
|
{
|
||||||
|
return progressBar.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRequestCanceling()
|
||||||
|
{
|
||||||
|
return requestCanceling;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximum(int n) {
|
||||||
|
progressBar.setMaximum(n);
|
||||||
|
}
|
||||||
|
public void setProgess(int n) {
|
||||||
|
progressBar.setValue(n);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,280 @@
|
|||||||
|
package com.teamcenter.rac.commands.cut;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||||
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||||
|
import com.teamcenter.rac.common.TCUtilities;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMViewRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentTask;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentType;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCTaskState;
|
||||||
|
import com.teamcenter.rac.kernel.bom.BOMMarkupHelper;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
import com.teamcenter.rac.util.Registry;
|
||||||
|
import com.teamcenter.rac.util.Utilities;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class CutCommand extends AbstractAIFCommand {
|
||||||
|
private Frame parent;
|
||||||
|
|
||||||
|
private ArrayList<TCComponentBOMViewRevision> parentsWithNoAccess = new ArrayList<>();
|
||||||
|
|
||||||
|
public CutCommand() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext[] paramArrayOfAIFComponentContext, Frame paramFrame, Boolean paramBoolean1,
|
||||||
|
Boolean paramBoolean2) {
|
||||||
|
this.parent = paramFrame;
|
||||||
|
AIFComponentContext[] arrayOfAIFComponentContext = checkInput(this.parent, paramArrayOfAIFComponentContext);
|
||||||
|
if (arrayOfAIFComponentContext != null) {
|
||||||
|
boolean bool = showConfirmation(arrayOfAIFComponentContext);
|
||||||
|
setRunnable((Runnable) new CutDialog(arrayOfAIFComponentContext, this.parent, bool,
|
||||||
|
paramBoolean2.booleanValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext[] paramArrayOfAIFComponentContext, Boolean paramBoolean1,
|
||||||
|
Boolean paramBoolean2) {
|
||||||
|
AIFComponentContext[] arrayOfAIFComponentContext = checkInput((Frame) null, paramArrayOfAIFComponentContext);
|
||||||
|
if (arrayOfAIFComponentContext != null) {
|
||||||
|
boolean bool = showConfirmation(arrayOfAIFComponentContext);
|
||||||
|
setRunnable((Runnable) new CutDialog(arrayOfAIFComponentContext, bool, paramBoolean2.booleanValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext paramAIFComponentContext, Frame paramFrame, Boolean paramBoolean1,
|
||||||
|
Boolean paramBoolean2) {
|
||||||
|
this(new AIFComponentContext[]{paramAIFComponentContext}, paramFrame, paramBoolean1, paramBoolean2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext paramAIFComponentContext, Boolean paramBoolean1, Boolean paramBoolean2) {
|
||||||
|
this(new AIFComponentContext[]{paramAIFComponentContext}, paramBoolean1, paramBoolean2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext[] paramArrayOfAIFComponentContext, Boolean paramBoolean1,
|
||||||
|
Boolean paramBoolean2, Boolean paramBoolean3) {
|
||||||
|
AIFComponentContext[] arrayOfAIFComponentContext = checkInput((Frame) null, paramArrayOfAIFComponentContext);
|
||||||
|
if (arrayOfAIFComponentContext != null && paramBoolean1.booleanValue()) {
|
||||||
|
boolean bool = showConfirmation(arrayOfAIFComponentContext);
|
||||||
|
setRunnable((Runnable) new CutDialog(arrayOfAIFComponentContext, bool, paramBoolean3.booleanValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CutCommand(AIFComponentContext paramAIFComponentContext, Boolean paramBoolean1, Boolean paramBoolean2,
|
||||||
|
Boolean paramBoolean3) {
|
||||||
|
this(new AIFComponentContext[]{paramAIFComponentContext}, paramBoolean1, paramBoolean2, paramBoolean3);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AIFComponentContext[] checkInput(Frame paramFrame,
|
||||||
|
AIFComponentContext[] paramArrayOfAIFComponentContext) {
|
||||||
|
Registry registry = Registry.getRegistry(this);
|
||||||
|
ArrayList<AIFComponentContext> arrayList1 = new ArrayList<>();
|
||||||
|
ArrayList<AIFComponentContext> arrayList2 = new ArrayList<>();
|
||||||
|
ArrayList<TCComponentBOMViewRevision> arrayList = new ArrayList<>();
|
||||||
|
if (paramArrayOfAIFComponentContext == null || paramArrayOfAIFComponentContext.length == 0) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("noSelection"), registry.getString("error.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean bool = false;
|
||||||
|
InterfaceAIFComponent interfaceAIFComponent = paramArrayOfAIFComponentContext[0].getComponent();
|
||||||
|
if (interfaceAIFComponent instanceof TCComponentBOMViewRevision
|
||||||
|
|| interfaceAIFComponent instanceof com.teamcenter.rac.kernel.TCComponentBOMView) {
|
||||||
|
TCPreferenceService tCPreferenceService = ((TCSession) interfaceAIFComponent.getSession())
|
||||||
|
.getPreferenceService();
|
||||||
|
if (tCPreferenceService != null
|
||||||
|
&& tCPreferenceService.isDefinitionExistForPreference("PS_allow_cut_in_pseudofolder")
|
||||||
|
&& tCPreferenceService.getLogicalValue("PS_allow_cut_in_pseudofolder").booleanValue())
|
||||||
|
bool = true;
|
||||||
|
}
|
||||||
|
String str = "User_Inbox";
|
||||||
|
for (int b = 0; b < paramArrayOfAIFComponentContext.length; b++) {
|
||||||
|
InterfaceAIFComponent interfaceAIFComponent1 = paramArrayOfAIFComponentContext[b].getParentComponent();
|
||||||
|
InterfaceAIFComponent interfaceAIFComponent2 = paramArrayOfAIFComponentContext[b].getComponent();
|
||||||
|
if (interfaceAIFComponent2 == null) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("invalidSelection"), registry.getString("error.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
//TODO 自定义的文件夹类型【KWC6_FOLDER】;禁止剪切,只允许删除
|
||||||
|
System.out.println("getType:"+interfaceAIFComponent2.getType());
|
||||||
|
if(interfaceAIFComponent2.getType().equals("KWC6_FOLDER")) {
|
||||||
|
MessageBox.post(paramFrame, "不能对该类型的文件夹进行剪切操作!", registry.getString("error.TITLE"), MessageBox.ERROR);
|
||||||
|
//Registry.getRegistry(CutCommand.class).getString("foldercut")
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interfaceAIFComponent2 instanceof TCComponentBOMViewRevision
|
||||||
|
&& (interfaceAIFComponent1 instanceof TCComponentItemRevision
|
||||||
|
|| (interfaceAIFComponent1 instanceof com.teamcenter.rac.kernel.TCComponentPseudoFolder
|
||||||
|
&& !bool))
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext() != null
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext().toString().equals("structure_revisions")) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("invalidSelectionBOMViewRev"),
|
||||||
|
registry.getString("error.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentBOMView
|
||||||
|
&& (interfaceAIFComponent1 instanceof com.teamcenter.rac.kernel.TCComponentItem
|
||||||
|
|| (interfaceAIFComponent1 instanceof com.teamcenter.rac.kernel.TCComponentPseudoFolder
|
||||||
|
&& !bool))
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext() != null
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext().toString().equals("bom_view_tags")) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("invalidSelectionBOMView"),
|
||||||
|
registry.getString("error.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentPseudoFolder) {
|
||||||
|
MessageBox
|
||||||
|
.post(paramFrame,
|
||||||
|
String.valueOf(Utilities.trimString(registry.getString("invalidSelection"), "."))
|
||||||
|
+ " -- " + interfaceAIFComponent2 + ".",
|
||||||
|
registry.getString("command.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentAssemblyArrangement
|
||||||
|
&& interfaceAIFComponent1 != null && interfaceAIFComponent1 instanceof TCComponentBOMViewRevision
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext() != null
|
||||||
|
&& (paramArrayOfAIFComponentContext[b].getContext().toString().equals("TC_Arrangement")
|
||||||
|
|| paramArrayOfAIFComponentContext[b].getContext().toString()
|
||||||
|
.equals("TC_DefaultArrangement")
|
||||||
|
|| paramArrayOfAIFComponentContext[b].getContext().toString()
|
||||||
|
.equals("Fnd0AsSavedArrangement"))) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("invalidSelectionAssemblyArrangement"),
|
||||||
|
registry.getString("error.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentIDCLine
|
||||||
|
&& interfaceAIFComponent1 instanceof com.teamcenter.rac.kernel.TCComponentIDCLine) {
|
||||||
|
MessageBox.post(paramFrame, registry.getString("invalidSelection"), registry.getString("command.TITLE"),
|
||||||
|
1);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof TCComponentBOMLine) {
|
||||||
|
if (!BOMMarkupHelper.allowStructureEdit(AIFUtility.getActiveDesktop().getShell(),
|
||||||
|
(TCComponentBOMLine) interfaceAIFComponent2))
|
||||||
|
return null;
|
||||||
|
try {
|
||||||
|
TCComponentBOMViewRevision tCComponentBOMViewRevision = ((TCComponentBOMLine) interfaceAIFComponent1)
|
||||||
|
.getBOMViewRevision();
|
||||||
|
if (tCComponentBOMViewRevision != null) {
|
||||||
|
if (!arrayList.contains(tCComponentBOMViewRevision)) {
|
||||||
|
tCComponentBOMViewRevision.clearCache("is_modifiable");
|
||||||
|
arrayList.add(tCComponentBOMViewRevision);
|
||||||
|
}
|
||||||
|
arrayList2.add(paramArrayOfAIFComponentContext[b]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} catch (TCException tCException) {
|
||||||
|
tCException.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentTaskInBox) {
|
||||||
|
TCComponent tCComponent = (TCComponent) paramArrayOfAIFComponentContext[b].getParentComponent();
|
||||||
|
if (tCComponent instanceof com.teamcenter.rac.kernel.TCComponentTaskInBox
|
||||||
|
|| tCComponent.getType().equals(str)) {
|
||||||
|
MessageBox
|
||||||
|
.post(paramFrame,
|
||||||
|
String.valueOf(Utilities.trimString(registry.getString("invalidSelection"), "."))
|
||||||
|
+ " -- " + interfaceAIFComponent2 + ".",
|
||||||
|
registry.getString("command.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (interfaceAIFComponent1 instanceof com.teamcenter.rac.kernel.TCComponentTaskInBox) {
|
||||||
|
boolean bool1 = true;
|
||||||
|
if (interfaceAIFComponent2 instanceof TCComponentTask)
|
||||||
|
try {
|
||||||
|
if (((TCComponentTask) interfaceAIFComponent2).getState() == TCTaskState.COMPLETED)
|
||||||
|
bool1 = false;
|
||||||
|
} catch (TCException tCException) {
|
||||||
|
}
|
||||||
|
if (bool1) {
|
||||||
|
MessageBox
|
||||||
|
.post(paramFrame,
|
||||||
|
String.valueOf(Utilities.trimString(registry.getString("invalidSelection"), "."))
|
||||||
|
+ " -- " + interfaceAIFComponent2 + ".",
|
||||||
|
registry.getString("command.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (interfaceAIFComponent2.getType().equals(str)) {
|
||||||
|
TCComponent tCComponent = (TCComponent) paramArrayOfAIFComponentContext[b].getParentComponent();
|
||||||
|
if (tCComponent == null) {
|
||||||
|
MessageBox
|
||||||
|
.post(paramFrame,
|
||||||
|
String.valueOf(Utilities.trimString(registry.getString("invalidSelection"), "."))
|
||||||
|
+ " -- " + interfaceAIFComponent2 + ".",
|
||||||
|
registry.getString("command.TITLE"), 4);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interfaceAIFComponent2 instanceof com.teamcenter.rac.kernel.TCComponentArchitecture
|
||||||
|
&& interfaceAIFComponent1 instanceof TCComponentItemRevision
|
||||||
|
&& paramArrayOfAIFComponentContext[b].getContext().equals(TCUtilities.ARCHITECTURE_RELATION)) {
|
||||||
|
try {
|
||||||
|
TCComponentItemRevision tCComponentItemRevision = (TCComponentItemRevision) paramArrayOfAIFComponentContext[b]
|
||||||
|
.getParentComponent();
|
||||||
|
TCComponentItemRevision[] arrayOfTCComponentItemRevision = TCUtilities
|
||||||
|
.getAllContextRevisions(tCComponentItemRevision, null);
|
||||||
|
Utilities.addElements(arrayList1,
|
||||||
|
(Object[]) AIFComponentContext.getContexts(
|
||||||
|
(InterfaceAIFComponent[]) arrayOfTCComponentItemRevision,
|
||||||
|
paramArrayOfAIFComponentContext[b].getComponent(),
|
||||||
|
paramArrayOfAIFComponentContext[b].getContext()),
|
||||||
|
true);
|
||||||
|
} catch (TCException tCException) {
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
arrayList1.add(paramArrayOfAIFComponentContext[b]);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!arrayList.isEmpty())
|
||||||
|
try {
|
||||||
|
TCComponentType.getTCPropertiesSet(arrayList, new String[]{"is_modifiable"});
|
||||||
|
for (AIFComponentContext aIFComponentContext : arrayList2) {
|
||||||
|
InterfaceAIFComponent interfaceAIFComponent1 = aIFComponentContext.getParentComponent();
|
||||||
|
TCComponentBOMViewRevision tCComponentBOMViewRevision = ((TCComponentBOMLine) interfaceAIFComponent1)
|
||||||
|
.getBOMViewRevision();
|
||||||
|
if (tCComponentBOMViewRevision != null && !tCComponentBOMViewRevision.okToModify()) {
|
||||||
|
if (!this.parentsWithNoAccess.contains(tCComponentBOMViewRevision))
|
||||||
|
this.parentsWithNoAccess.add(tCComponentBOMViewRevision);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
arrayList1.add(aIFComponentContext);
|
||||||
|
}
|
||||||
|
} catch (TCException tCException) {
|
||||||
|
tCException.printStackTrace();
|
||||||
|
}
|
||||||
|
if (this.parentsWithNoAccess.size() > 0) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
String str1 = ", ";
|
||||||
|
for (byte b1 = 0; b1 < this.parentsWithNoAccess.size(); b1++) {
|
||||||
|
if (b1 == this.parentsWithNoAccess.size() - 1)
|
||||||
|
str1 = "";
|
||||||
|
stringBuffer.append(this.parentsWithNoAccess.get(b1));
|
||||||
|
stringBuffer.append(str1);
|
||||||
|
}
|
||||||
|
MessageBox.post(paramFrame,
|
||||||
|
String.valueOf(MessageFormat.format(registry.getString("inaccessibleBOMViewRev"),
|
||||||
|
new Object[]{stringBuffer.toString()})) + " " + registry.getString("acessDenied"),
|
||||||
|
registry.getString("error.TITLE"), 4);
|
||||||
|
}
|
||||||
|
return arrayList1.isEmpty()
|
||||||
|
? null
|
||||||
|
: arrayList1.<AIFComponentContext>toArray(new AIFComponentContext[arrayList1.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean showConfirmation(AIFComponentContext[] paramArrayOfAIFComponentContext) {
|
||||||
|
if (paramArrayOfAIFComponentContext == null)
|
||||||
|
return true;
|
||||||
|
Registry registry = Registry.getRegistry(this);
|
||||||
|
int i = registry.getInt("confirmationLimit", 10);
|
||||||
|
return (paramArrayOfAIFComponentContext.length > i);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
foldercut=\u4E0D\u80FD\u5BF9\u8BE5\u7C7B\u578B\u7684\u6587\u4EF6\u5939\u8FDB\u884C\u526A\u5207\u64CD\u4F5C
|
Loading…
Reference in new issue