dobe_comic8/main/java/shkd/repc/resm/formplugin/OfficialSupplierEditNewPlug...

56 lines
2.4 KiB
Java
Raw Normal View History

package shkd.repc.resm.formplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.repc.common.util.resm.SupplierAptUtils;
import kd.repc.resm.formplugin.supplier.OfficialSupplierEdit;
import java.util.Iterator;
public class OfficialSupplierEditNewPlugin extends OfficialSupplierEdit {
@Override
protected void beforeBindData_serviceOrgAndGroup() {
DynamicObject dataEntity = this.getModel().getDataEntity(true);
if (dataEntity.getPkValue() == null || dataEntity.getLong("id") == 0L) {
DynamicObject belongOrgEntry = this.getCurrentBelongOrgEntry();
if (belongOrgEntry == null) {
belongOrgEntry = dataEntity.getDynamicObject("createorg");
}
DynamicObject[] groupArr = SupplierAptUtils.getDefaultGroup(dataEntity.getDynamicObject("createorg").getPkValue());
DynamicObjectCollection serviceOrgColl = this.getModel().getEntryEntity("entry_serviceorg");
Iterator var5 = serviceOrgColl.iterator();
while(var5.hasNext()) {
DynamicObject serviceOrg = (DynamicObject)var5.next();
QFilter qFilter = new QFilter("number", QCP.equals, "dobe");
DynamicObject[] load1 = BusinessDataServiceHelper.load("bos_org", "id", qFilter.toArray());
if (load1!=null&&load1.length>0) {
serviceOrg.set("orgarea", load1[0]);
}
DynamicObjectCollection supGroupColl = serviceOrg.getDynamicObjectCollection("supgroup");
DynamicObject supGroup = supGroupColl.addNew();
QFilter number = new QFilter("number", QCP.equals, "GYSFL-202411-002");
DynamicObject[] load = BusinessDataServiceHelper.load("bd_suppliergroup", "id", number.toArray());
if (load!=null&&load.length>0) {
supGroup.set("fbasedataid", load[0]);
}else{
Object value = groupArr.length > 0 ? groupArr[0] : null;
supGroup.set("fbasedataid", value);
}
serviceOrg.set("supgroup", supGroupColl);
}
dataEntity.set("entry_serviceorg", serviceOrgColl);
this.getView().updateView("entry_serviceorg");
}
}
}