public void kdtEntrys_Changed(int rowIndex, int colIndex) throws Exception {
if ("BIMUDF0001".equalsIgnoreCase(kdtEntrys.getColumn(colIndex).getKey())) {
// TODO Auto-generated method stub
//分录物料可以多选功能开发
//设置分录物料F7支持多选
final KDBizPromptBox kdtEntrys_BIMUDF0001_PromptBox = new KDBizPromptBox();
kdtEntrys_BIMUDF0001_PromptBox.setQueryInfo("com.kingdee.eas.basedata.master.material.app.F7MaterialBaseInfoQuery");
kdtEntrys_BIMUDF0001_PromptBox.setVisible(true);
kdtEntrys_BIMUDF0001_PromptBox.setEditable(true);
kdtEntrys_BIMUDF0001_PromptBox.setEnabledMultiSelection(true);
kdtEntrys_BIMUDF0001_PromptBox.setDisplayFormat("$number$");
kdtEntrys_BIMUDF0001_PromptBox.setEditFormat("$number$");
kdtEntrys_BIMUDF0001_PromptBox.setCommitFormat("$number$");
KDTDefaultCellEditor kdtEntrys_BIMUDF0001_CellEditor = new KDTDefaultCellEditor(kdtEntrys_BIMUDF0001_PromptBox);
this.kdtEntrys.getColumn("BIMUDF0001").setEditor(kdtEntrys_BIMUDF0001_CellEditor);
Object c=this.kdtEntrys.getCell(rowIndex,"BIMUDF0001").getValue();
if(c==null){
return;
}else{
String f = c.toString();
if(f.indexOf("Ljava.lang.Object")!=-1){
Object[] F7cols = (Object[]) kdtEntrys.getCell(rowIndex,"BIMUDF0001").getValue();
if(F7cols != null){
int i = 0;
int max = rowIndex+F7cols.length;
while(rowIndex<max){
MaterialInfo info = (MaterialInfo) F7cols[i];
this.kdtEntrys.getCell(rowIndex, "BIMUDF0001").setValue(info);
String a = info.getModel();
BOSUuid b ;
MeasureUnitInfo baseUnitInfo=null;
if(null!=info.getBaseUnit()){
b=info.getBaseUnit().getId();
// 物料计量单位需要从另一个对象获取
baseUnitInfo = MeasureUnitFactory.getRemoteInstance().getMeasureUnitInfo(new ObjectUuidPK(info.getBaseUnit().getId()));
}
this.kdtEntrys.getCell(rowIndex, "BIMUDF0002").setValue(a);
this.kdtEntrys.getCell(rowIndex, "BIMUDF0003").setValue(baseUnitInfo.getName());//
rowIndex++;
i++;
this.kdtEntrys.addRow();
}
}else if(f==null||f.equals("")){
return;
}else{
return;
}
}
}
this.kdtEntrys.removeRow(rowIndex) ;
}
//====================================================================================================================================
for (int i = 0; i < this.kdtEntrys.getRowCount(); i++) {
if (null != this.kdtEntrys.getCell(i, "BIMUDF0001").getValue()) {
MaterialInfo material = (MaterialInfo) this.kdtEntrys.getCell(i,
"BIMUDF0001").getValue();
BOSUuid materialId = material.getId();
String sql = " select sum(FBaseQty) sumFBaseQty from T_IM_Inventory inner join T_IM_STORESTATE on T_IM_STORESTATE.fid=T_IM_Inventory.FStoreStatusID where FMaterialID='"
+ materialId + "' and FStoreStateType='1' ";
IRowSet qty = SQLExecutorFactory.getRemoteInstance(sql)
.executeSQL();
double sumQuty = 0.0;
while (qty.next()) {
sumQuty = Double.valueOf(qty.getDouble("sumFBaseQty"));
}
// MaterialInfo matrialvalue = (MaterialInfo) kdtEntrys.getCell(rowIndex,"BIMUDF0001").getValue() ;
// MeasureUnitInfo baseUnit = matrialvalue.getBaseUnit();
// if(null!=matrialvalue.getBaseUnit()){
// kdtEntrys.getCell(rowIndex,"BIMUDF0003").setValue(com.kingdee.bos.ui.face.UIRuleUtil.getString(com.kingdee.bos.ui.face.UIRuleUtil.getProperty((com.kingdee.bos.dao.IObjectValue)kdtEntrys.getCell(rowIndex,"BIMUDF0001").getValue(),"baseUnit.name")));
// }
this.kdtEntrys.getCell(i, "existingInventory").setValue(sumQuty);
}
}
// super.kdtEntrys_Changed(rowIndex, colIndex);
}