@ -100,27 +100,29 @@ public class CreateEcnController extends KFXPanelController {
private List < String > parts = new ArrayList < String > ( ) ;
private List < String > reasons = new ArrayList < String > ( ) ;
private List < String > wips = new ArrayList < String > ( ) ;
private List < String > products = new ArrayList < String > ( ) ;
private List < EcnBean > ecnBeans = new ArrayList < EcnBean > ( ) ;
protected AbstractAIFApplication app ;
private TCSession session ;
private TCComponent target ;
@FXML
private RadioButton rb_formalChange ; //正式更改通知单
@FXML
private TextField factoryText ;
@FXML
private GridPane productPane ;
@FXML
private TextField htNameText ;
@FXML
p rivate TextField markText ;
p ublic TextField markText ;
@FXML
private TextField contractText ;
@FXML
private ComboBox < String > prodNameComb ;
@FXML
private FlowPane departPane ;
private List < RadioButton > partBtns = new ArrayList < > ( ) ;
private List < CheckBox > partBtns = new ArrayList < > ( ) ;
@FXML
private ComboBox < String > pmCombox ;
private CreateEcnController controller ;
@ -159,6 +161,8 @@ public class CreateEcnController extends KFXPanelController {
initText ( ) ;
}
@FXML
private Button createBtn ;
/ * *
* @param event
* @throws Exception
@ -253,7 +257,6 @@ public class CreateEcnController extends KFXPanelController {
//影响分析信息 保存到CHINT_ECN_NOTIFICATION中
try {
String groupID = SAPUtil . getGroupID ( ) ;
SqlUtil . getTCDataConnection ( database ) ;
String deleteSql = "delete CHINT_ECN_NOTIFICATION where \"ecncode\" = ? " ;
String endCode = ecnId . getText ( ) ;
@ -266,7 +269,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "1" , groupID , String . valueOf ( i + 1 ) ,
new String [ ] { endCode , "1" , refTableBean. getDepart ( ) , String . valueOf ( i + 1 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -274,7 +277,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "2" , groupID , String . valueOf ( i - 6 ) ,
new String [ ] { endCode , "2" , refTableBean. getDepart ( ) , String . valueOf ( i - 6 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -282,7 +285,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "3" , groupID , String . valueOf ( i - 10 ) ,
new String [ ] { endCode , "3" , refTableBean. getDepart ( ) , String . valueOf ( i - 10 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -290,7 +293,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "4" , groupID , String . valueOf ( i - 14 ) ,
new String [ ] { endCode , "4" , refTableBean. getDepart ( ) , String . valueOf ( i - 14 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -298,7 +301,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "5" , groupID , String . valueOf ( i - 18 ) ,
new String [ ] { endCode , "5" , refTableBean. getDepart ( ) , String . valueOf ( i - 18 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -306,7 +309,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "6" , groupID , String . valueOf ( i - 23 ) ,
new String [ ] { endCode , "6" , refTableBean. getDepart ( ) , String . valueOf ( i - 23 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -314,7 +317,7 @@ public class CreateEcnController extends KFXPanelController {
RefTableBean refTableBean = items . get ( i ) ;
String result = refTableBean . getShYes ( ) . isSelected ( ) ? "是" : "否" ;
SqlUtil . write (
new String [ ] { endCode , "7" , groupID , String . valueOf ( i - 26 ) ,
new String [ ] { endCode , "7" , refTableBean. getDepart ( ) , String . valueOf ( i - 26 ) ,
refTableBean . getMessage ( ) , result , refTableBean . getUser ( ) . getText ( ) ,
refTableBean . getCompDate ( ) . getText ( ) , refTableBean . getMark ( ) . getText ( ) } , insertSql ) ;
}
@ -323,7 +326,7 @@ public class CreateEcnController extends KFXPanelController {
} finally {
SqlUtil . freeAll ( ) ;
}
createBtn . setDisable ( true ) ;
}
/ * *
* @param 数 据 集
@ -435,11 +438,16 @@ public class CreateEcnController extends KFXPanelController {
contractNo = contractText . getText ( ) ; //合同代号
contractName = htNameText . getText ( ) ; //合同名称
productModel = pmCombox . getSelectionModel ( ) . getSelectedItem ( ) ; //产品型号
String productName = prodNameComb . getSelectionModel ( ) . getSelectedItem ( ) ;
String fileName = markText . getText ( ) ;
changeType = changeName ; //正式临时
item . setProperty ( "zt2_ContractNo" , contractNo ) ;
item . setProperty ( "zt2_ContractName" , contractName ) ;
item . setProperty ( "zt2_ProductModel" , productModel ) ;
item . setProperty ( "zt2_ChangeType" , changeType ) ;
item . setProperty ( "zt2_FileName" , fileName ) ;
item . setProperty ( "zt2_ProductName" , productName ) ;
item . setProperty ( "zt2_ChangRequestNo" , relateEcnText . getText ( ) ) ;
changeTime = changeDate . getEditor ( ) . getText ( ) ;
SimpleDateFormat sdf2 = new SimpleDateFormat ( "yyyy-M-dd" ) ;
if ( changeTime . length ( ) > 0 ) {
@ -448,7 +456,7 @@ public class CreateEcnController extends KFXPanelController {
}
StringBuilder unit = new StringBuilder ( "" ) ;
for ( int j = 0 ; j < partBtns . size ( ) ; j + + ) {
RadioButton radioButton = partBtns . get ( j ) ;
CheckBox radioButton = partBtns . get ( j ) ;
if ( radioButton . isSelected ( ) ) {
if ( unit . length ( ) > 0 ) {
unit . append ( ";" ) . append ( radioButton . getText ( ) ) ;
@ -471,6 +479,11 @@ public class CreateEcnController extends KFXPanelController {
changeAfter1 = new String [ rowCount ] ;
changeReason = new String [ rowCount ] ;
processType1 = new String [ rowCount ] ;
szVersionBefs = new String [ rowCount ] ;
szVersionAfts = new String [ rowCount ] ;
productSzs = new String [ rowCount ] ;
processSzs = new String [ rowCount ] ;
int modulus = changeDrawingNo . length % 5 ;
int dlivery = changeDrawingNo . length / 5 ;
@ -488,8 +501,14 @@ public class CreateEcnController extends KFXPanelController {
partition [ i ] = ecnBean . getPoiNum ( ) . getText ( ) ;
changeBefore1 [ i ] = ecnBean . getOverChange ( ) . getText ( ) ;
changeAfter1 [ i ] = ecnBean . getAfterChange ( ) . getText ( ) ;
changeReason [ i ] = ecnBean . getChangeReason ( ) . getSelectionModel ( ) . getSelectedItem ( ) ;
processType1 [ i ] = ecnBean . getWipTreat ( ) . getSelectionModel ( ) . getSelectedItem ( ) ;
String reasonItem = ecnBean . getChangeReason ( ) . getSelectionModel ( ) . getSelectedItem ( ) ;
changeReason [ i ] = reasonItem = = null ? "" : reasonItem ;
String processTypeItem = ecnBean . getWipTreat ( ) . getSelectionModel ( ) . getSelectedItem ( ) ;
processType1 [ i ] = processTypeItem = = null ? "" : processTypeItem ;
szVersionBefs [ i ] = ecnBean . getOverVersion ( ) . getText ( ) ;
szVersionAfts [ i ] = ecnBean . getAfterVersion ( ) . getText ( ) ;
productSzs [ i ] = ecnBean . getProductSz ( ) . getSelectionModel ( ) . getSelectedItem ( ) ;
processSzs [ i ] = rb_product . isSelected ( ) ? "Y" : "N" ;
}
item . getTCProperty ( "zt2_ChangeDrawingNo" ) . setStringValueArray ( changeDrawingNo ) ;
item . getTCProperty ( "zt2_Sign" ) . setStringValueArray ( sign ) ;
@ -498,6 +517,10 @@ public class CreateEcnController extends KFXPanelController {
item . getTCProperty ( "zt2_ChangeAfter1" ) . setStringValueArray ( changeAfter1 ) ;
item . getTCProperty ( "zt2_ChangeReason" ) . setStringValueArray ( changeReason ) ;
item . getTCProperty ( "zt2_ProcessType1" ) . setStringValueArray ( processType1 ) ;
item . getTCProperty ( "zt2_SZVersionbefore" ) . setStringValueArray ( szVersionBefs ) ;
item . getTCProperty ( "zt2_SZRevisedversion" ) . setStringValueArray ( szVersionAfts ) ;
item . getTCProperty ( "zt2_SZProduct" ) . setStringValueArray ( productSzs ) ;
item . getTCProperty ( "zt2_SZProcess" ) . setStringValueArray ( processSzs ) ;
}
private int pages = 0 ;
private String [ ] changeDrawingNo ; //属性zt2_ChangeDrawingNo
@ -508,6 +531,10 @@ public class CreateEcnController extends KFXPanelController {
private String [ ] changeAfter1 ; //属性zt2_ChangeAfter1
private String [ ] changeReason ; //属性zt2_ChangeReason
private String [ ] processType1 ; //属性zt2_ProcessType1
private String [ ] szVersionBefs ; // 变更前版本
private String [ ] szVersionAfts ; // 变更后版本
private String [ ] productSzs ; // 变更后版本
private String [ ] processSzs ; // 变更后版本
/ * *
* @param event
* @function 关 闭 页 面 操 作
@ -524,13 +551,15 @@ public class CreateEcnController extends KFXPanelController {
private void initText ( ) throws Exception {
List < String > productModelList = new ArrayList < > ( ) ;
productModelList = Util . getproductModel ( target , productModelList ) ;
factoryText . setEditable ( false ) ;
pmCombox . getItems ( ) . addAll ( productModelList ) ;
List < String > unitList = new ArrayList < > ( ) ;
contractText . setText ( Util . getProjectNo ( target ) ) ;
contractText . setEditable ( false ) ;
htNameText . setText ( Util . getProjectName ( target ) ) ;
htNameText . setEditable ( false ) ;
ecnId . setEditable ( false ) ;
rb_product . setSelected ( true ) ;
if ( target . getType ( ) . equals ( "ZT2_ProjectItem" ) ) {
//获取产成品的名称
List < String > ccpNameFromProject = KUtil . getCCPNameFromProject ( target , session ) ;
@ -562,7 +591,8 @@ public class CreateEcnController extends KFXPanelController {
target . refresh ( ) ;
properties = target . getTCProperties (
new String [ ] { "zt2_ChangeDrawingNo" , "zt2_Sign" , "zt2_PlacesNo" , "zt2_Partition" ,
"zt2_ChangeBefore1" , "zt2_ChangeAfter1" , "zt2_ChangeReason" , "zt2_ProcessType1" } ) ;
"zt2_ChangeBefore1" , "zt2_ChangeAfter1" , "zt2_ChangeReason" , "zt2_ProcessType1" , "zt2_SZVersionbefore" ,
"zt2_SZRevisedversion" , "zt2_SZProduct" , "zt2_SZProcess" } ) ;
} catch ( TCException e1 ) {
e1 . printStackTrace ( ) ;
}
@ -574,16 +604,35 @@ public class CreateEcnController extends KFXPanelController {
String [ ] ChangeAfter1 = properties [ 5 ] . getStringArrayValue ( ) ;
String [ ] ChangeReason = properties [ 6 ] . getStringArrayValue ( ) ;
String [ ] ProcessType1 = properties [ 7 ] . getStringArrayValue ( ) ;
String [ ] szVersionBef = properties [ 8 ] . getStringArrayValue ( ) ;
String [ ] szVersionAft = properties [ 9 ] . getStringArrayValue ( ) ;
String [ ] szProduct = properties [ 10 ] . getStringArrayValue ( ) ;
String [ ] szProcess = properties [ 11 ] . getStringArrayValue ( ) ;
if ( szProcess . length > 0 ) {
rb_Process . setSelected ( szProcess [ 0 ] . equals ( "N" ) ) ;
}
String fileName = target . getProperty ( "zt2_FileName" ) ;
String productName = target . getProperty ( "zt2_ProductName" ) ;
String changRequestNo = target . getProperty ( "zt2_ChangRequestNo" ) ; // relateEcnText.getText()
prodNameComb . getSelectionModel ( ) . select ( productName ) ;
markText . setText ( fileName ) ;
relateEcnText . setText ( changRequestNo ) ;
// String productName = prodNameComb.getSelectionModel().getSelectedItem();
// String fileName = markText.getText();
// item.setProperty("zt2_FileName", fileName);
// item.setProperty("zt2_ProductName", productName);
int rowNum = 0 ;
for ( int j = 0 ; j < ChangeDrawingNo . length ; j + + ) {
rowNum + + ;
ecnBeans . add ( new EcnBean ( rowNum , reasons , wips , ChangeDrawingNo [ j ] , sign [ j ] , placesNo [ j ]
, ChangeBefore1 [ j ] , ChangeAfter1 [ j ] , ChangeReason [ j ] , ProcessType1 [ j ] ) ) ;
EcnBean ecnBean = new EcnBean ( rowNum , reasons , wips , ChangeDrawingNo [ j ] , sign [ j ] , placesNo [ j ]
, ChangeBefore1 [ j ] , ChangeAfter1 [ j ] , ChangeReason [ j ] , ProcessType1 [ j ] , szVersionBef [ j ] , szVersionAft [ j ] ) ;
ecnBeans . add ( ecnBean ) ;
ecnBean . setProductSz ( szProduct [ j ] ) ;
}
}
tableView . getItems ( ) . addAll ( ecnBeans ) ;
for ( int i = 0 ; i < parts . size ( ) ; i + + ) {
RadioButton btn = new RadioButton ( parts . get ( i ) ) ;
CheckBox btn = new CheckBox ( parts . get ( i ) ) ;
partBtns . add ( btn ) ;
departPane . getChildren ( ) . add ( btn ) ;
if ( unitList . contains ( parts . get ( i ) ) ) {
@ -709,10 +758,11 @@ public class CreateEcnController extends KFXPanelController {
TableColumn < EcnBean , Integer > tc_xh = new TableColumn < EcnBean , Integer > ( "序号" ) ;
TableColumn < EcnBean , ComboBox < String > > tc_wipTreat = new TableColumn < EcnBean , ComboBox < String > > ( "在制品处理" ) ;
TableColumn < EcnBean , TextArea > tc_beforVer = new TableColumn < EcnBean , TextArea > ( "更改前版本" ) ;
TableColumn < EcnBean , ComboBox < String > > productSz = new TableColumn < EcnBean , ComboBox < String > > ( "特性等级" ) ;
TableColumn < EcnBean , ComboBox < String > > tc_reason = new TableColumn < EcnBean , ComboBox < String > > ( "更改原因" ) ;
TableColumn < EcnBean , TextArea > tc_poiNum = new TableColumn < EcnBean , TextArea > ( "处数" ) ;
tableView . getColumns ( ) . addAll ( tc_xh , tc_drawNo , tc_mark , tc_poiNum , tc_beforChange , tc_beforVer , tc_afterChange ,
tc_afterVer , tc_reason, tc_wipTreat ) ;
tc_afterVer , productSz, tc_reason, tc_wipTreat ) ;
tc_xh . setSortable ( false ) ;
tc_drawNo . setSortable ( false ) ;
@ -723,6 +773,7 @@ public class CreateEcnController extends KFXPanelController {
tc_afterChange . setSortable ( false ) ;
tc_afterVer . setSortable ( false ) ;
tc_reason . setSortable ( false ) ;
productSz . setSortable ( false ) ;
tc_wipTreat . setSortable ( false ) ;
//列绑定bean对象
tc_xh . setCellValueFactory ( new PropertyValueFactory < EcnBean , Integer > ( "num" ) ) ;
@ -735,17 +786,18 @@ public class CreateEcnController extends KFXPanelController {
tc_afterVer . setCellValueFactory ( new PropertyValueFactory < EcnBean , TextArea > ( "afterVersion" ) ) ;
tc_reason . setCellValueFactory ( new PropertyValueFactory < EcnBean , ComboBox < String > > ( "changeReason" ) ) ;
tc_wipTreat . setCellValueFactory ( new PropertyValueFactory < EcnBean , ComboBox < String > > ( "wipTreat" ) ) ;
productSz . setCellValueFactory ( new PropertyValueFactory < EcnBean , ComboBox < String > > ( "productSz" ) ) ;
tc_xh . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.06 ) ) ;
tc_drawNo . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 20 ) ) ;
tc_drawNo . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 18 ) ) ;
tc_mark . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.06 ) ) ;
tc_poiNum . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.06 ) ) ;
tc_beforChange . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.10 ) ) ;
tc_beforVer . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.0 8 ) ) ;
tc_afterChange . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 08 ) ) ;
tc_afterVer . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 1 ) ) ;
tc_reason . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.14 ) ) ;
tc_beforVer . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.0 6 ) ) ;
tc_afterChange . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 1 0) ) ;
productSz . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.06 ) ) ;
tc_afterVer . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0. 06 ) ) ;
tc_reason . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.14 ) ) ; //0.4
tc_wipTreat . prefWidthProperty ( ) . bind ( tableView . widthProperty ( ) . multiply ( 0.10 ) ) ;
}
@FXML
@ -883,19 +935,24 @@ public class CreateEcnController extends KFXPanelController {
SqlUtil . getTCDataConnection ( database ) ;
try {
String sql = "select PART,REASON,MANAGE,DATASET from CHINT_ECN_TYPE where CODE = ?";
String sql = "select PART,REASON,MANAGE,DATASET ,UNIT,GRADE from CHINT_ECN_TYPE where CODE = ?";
ResultSet read = SqlUtil . read ( sql , new String [ ] { SAPUtil . getGroupID ( ) } ) ;
if ( read . next ( ) ) {
String part = read . getString ( 1 ) ;
String reason = read . getString ( 2 ) ;
String manage = read . getString ( 3 ) ;
String dataset = read . getString ( 4 ) ;
String factory = read . getString ( 5 ) ;
String grade = read . getString ( 6 ) ;
factoryText . setText ( factory ) ;
String [ ] partArray = part . split ( ";" ) ;
String [ ] reasonArray = reason . split ( ";" ) ;
String [ ] manageArray = manage . split ( ";" ) ;
String [ ] grades = grade . split ( ";" ) ;
parts = new ArrayList < String > ( Arrays . asList ( partArray ) ) ;
reasons = new ArrayList < String > ( Arrays . asList ( reasonArray ) ) ;
wips = new ArrayList < String > ( Arrays . asList ( manageArray ) ) ;
products = new ArrayList < String > ( Arrays . asList ( grades ) ) ;
}
} catch ( Exception e ) {
@ -913,7 +970,7 @@ public class CreateEcnController extends KFXPanelController {
@FXML
void addRows ( ActionEvent event ) {
for ( int i = 0 ; i < 5 ; i + + ) {
ecnBeans . add ( new EcnBean ( ecnBeans . size ( ) + 1 , reasons , wip s) ) ;
ecnBeans . add ( new EcnBean ( ecnBeans . size ( ) + 1 , reasons , wip s, product s) ) ;
}
ObservableList < EcnBean > data = FXCollections . observableArrayList ( ecnBeans ) ;
tableView . getItems ( ) . clear ( ) ;
@ -925,7 +982,7 @@ public class CreateEcnController extends KFXPanelController {
* /
@FXML
void addRow ( ActionEvent event ) {
ecnBeans . add ( new EcnBean ( ecnBeans . size ( ) + 1 , reasons , wip s) ) ;
ecnBeans . add ( new EcnBean ( ecnBeans . size ( ) + 1 , reasons , wip s, product s) ) ;
ObservableList < EcnBean > data = FXCollections . observableArrayList ( ecnBeans ) ;
tableView . getItems ( ) . clear ( ) ;
tableView . setItems ( data ) ;