75 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Java
		
	
	
	
		
		
			
		
	
	
			75 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Java
		
	
	
	
| 
								 | 
							
								package tqq9.lc123.cloud.app.plugin.operate.im;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import kd.bos.dataentity.entity.DynamicObject;
							 | 
						||
| 
								 | 
							
								import kd.bos.dataentity.entity.DynamicObjectCollection;
							 | 
						||
| 
								 | 
							
								import kd.bos.entity.ExtendedDataEntity;
							 | 
						||
| 
								 | 
							
								import kd.bos.entity.ExtendedDataEntitySet;
							 | 
						||
| 
								 | 
							
								import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
							 | 
						||
| 
								 | 
							
								import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
							 | 
						||
| 
								 | 
							
								import kd.bos.logging.Log;
							 | 
						||
| 
								 | 
							
								import kd.bos.logging.LogFactory;
							 | 
						||
| 
								 | 
							
								import kd.bos.orm.query.QCP;
							 | 
						||
| 
								 | 
							
								import kd.bos.orm.query.QFilter;
							 | 
						||
| 
								 | 
							
								import kd.bos.servicehelper.BusinessDataServiceHelper;
							 | 
						||
| 
								 | 
							
								import kd.sdk.plugin.Plugin;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import java.util.Map;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 其他入库申请单转换插件
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								public class OtherInApplyConvertPlugin extends AbstractConvertPlugIn implements Plugin {
							 | 
						||
| 
								 | 
							
								    private final static Log logger = LogFactory.getLog(OtherInBillConvertPlugIn.class);
							 | 
						||
| 
								 | 
							
								    private static String TQQ9_OTHERINAPPLY = "tqq9_otherinapply";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @Override
							 | 
						||
| 
								 | 
							
								    public void afterConvert(AfterConvertEventArgs e) {
							 | 
						||
| 
								 | 
							
								        super.afterConvert(e);
							 | 
						||
| 
								 | 
							
								        ExtendedDataEntitySet targetExtDataEntitySet = e.getTargetExtDataEntitySet();
							 | 
						||
| 
								 | 
							
								        ExtendedDataEntity[] extendedDataEntities = targetExtDataEntitySet.FindByEntityKey(TQQ9_OTHERINAPPLY);
							 | 
						||
| 
								 | 
							
								        Map<String, String> variables = this.getOption().getVariables();
							 | 
						||
| 
								 | 
							
								        for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
							 | 
						||
| 
								 | 
							
								            //其他入库
							 | 
						||
| 
								 | 
							
								            DynamicObject dataEntity = extendedDataEntity.getDataEntity();
							 | 
						||
| 
								 | 
							
								            DynamicObject biztype = dataEntity.getDynamicObject("biztype");//业务类型
							 | 
						||
| 
								 | 
							
								            QFilter invschemeF=new QFilter("bitypeentry.biztype.number", QCP.in,new String[]{biztype.getString("number")});
							 | 
						||
| 
								 | 
							
								            DynamicObject invscheme = BusinessDataServiceHelper.loadSingle("im_invscheme", invschemeF.toArray());
							 | 
						||
| 
								 | 
							
								            DynamicObjectCollection invtypeentry = invscheme.getDynamicObjectCollection("invtypeentry");//入库库存类型单据体
							 | 
						||
| 
								 | 
							
								            DynamicObjectCollection invstatusentry = invscheme.getDynamicObjectCollection("invstatusentry");//入库库存状态单据体
							 | 
						||
| 
								 | 
							
								            DynamicObject invtype = null;//入库库存类型
							 | 
						||
| 
								 | 
							
								            String ownertype1 = null;//入库货主类型
							 | 
						||
| 
								 | 
							
								            String keepertype1 = null;//入库保管者类型
							 | 
						||
| 
								 | 
							
								            DynamicObject invstatus = null;//入库库存状态
							 | 
						||
| 
								 | 
							
								            for (DynamicObject dynamicObject : invtypeentry) {
							 | 
						||
| 
								 | 
							
								                Boolean invtypeisdefault = dynamicObject.getBoolean("invtypeisdefault");
							 | 
						||
| 
								 | 
							
								                if(invtypeisdefault){
							 | 
						||
| 
								 | 
							
								                    invtype = dynamicObject.getDynamicObject("invtype");//入库库存类型
							 | 
						||
| 
								 | 
							
								                    ownertype1 = dynamicObject.getString("ownertype1");//入库货主类型
							 | 
						||
| 
								 | 
							
								                    keepertype1 = dynamicObject.getString("keepertype1");//入库保管者类型
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								            for (DynamicObject dynamicObject : invstatusentry) {
							 | 
						||
| 
								 | 
							
								                Boolean invstatusisdefault = dynamicObject.getBoolean("invstatusisdefault");
							 | 
						||
| 
								 | 
							
								                if(invstatusisdefault){
							 | 
						||
| 
								 | 
							
								                    invstatus = dynamicObject.getDynamicObject("invstatus");//入库库存状态
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								            DynamicObject owner = dataEntity.getDynamicObject("org");//入库货主
							 | 
						||
| 
								 | 
							
								            DynamicObject keeper = dataEntity.getDynamicObject("org");//入库保管者
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");//物料明细
							 | 
						||
| 
								 | 
							
								            for (DynamicObject dynamicObject : billentry) {
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("invtype",invtype);//入库库存类型
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("ownertype",ownertype1);//入库货主类型
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("keepertype",keepertype1);//入库保管者类型
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("invstatus",invstatus);//入库库存状态
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("owner",owner);//入库货主
							 | 
						||
| 
								 | 
							
								                dynamicObject.set("keeper",keeper);//入库保管者
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |