This commit is contained in:
parent
6385e97a73
commit
d0b31577d0
|
@ -13,6 +13,7 @@ public class ContractPublicValidator extends AbstractValidator {
|
|||
@Override
|
||||
public void validate() {
|
||||
for (ExtendedDataEntity dataEntity : this.getDataEntities()) {
|
||||
if (dataEntity!=null){
|
||||
DynamicObject dynamicObject = dataEntity.getDataEntity();
|
||||
String zcgjPricetype = dynamicObject.getString("zcgj_pricetype");
|
||||
if (zcgjPricetype.equals("gddj")){
|
||||
|
@ -35,3 +36,4 @@ public class ContractPublicValidator extends AbstractValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
@ -13,17 +15,25 @@ public class ContractSettleOp extends AbstractOperationServicePlugIn {
|
|||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
System.out.println();
|
||||
super.onAddValidators(e);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e) {
|
||||
super.beginOperationTransaction(e);
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
if(dataEntities1!=null && dataEntities1.length>0){
|
||||
DynamicObject object = dataEntities1[0];
|
||||
Object changetype = object.getString("changetype");
|
||||
DynamicObject ecoutrevision = BusinessDataServiceHelper.loadSingle("ec_outrevision", new QFilter[]{new QFilter("billno", "=", object.getString("billno"))});
|
||||
Object changetype = ecoutrevision.getString("changetype");
|
||||
if (changetype != null) {
|
||||
if (changetype.toString().equals("03")) {
|
||||
DynamicObject contract = object.getDynamicObject("contract");
|
||||
DynamicObject contract = ecoutrevision.getDynamicObject("contract");
|
||||
String billName = contract.getDataEntityType().getName();
|
||||
DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb");
|
||||
DynamicObjectCollection zcgjOtherpart = object.getDynamicObjectCollection("zcgj_otherpart");
|
||||
DynamicObject zcgjpartb = ecoutrevision.getDynamicObject("zcgj_partb");
|
||||
DynamicObjectCollection zcgjOtherpart = ecoutrevision.getDynamicObjectCollection("zcgj_otherpart");
|
||||
if (billName.equals("ec_out_contract_f7")) {
|
||||
QFilter f1 = new QFilter("number", "=", contract.getString("number"));
|
||||
DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
|
||||
|
@ -34,11 +44,23 @@ public class ContractSettleOp extends AbstractOperationServicePlugIn {
|
|||
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
|
||||
outContract.set("partb", zcgjpartb);
|
||||
if (zcgjOtherpart.size()>0) {
|
||||
// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
|
||||
outContract.set("otherpart", zcgjOtherpart);
|
||||
// 深度克隆集合
|
||||
DynamicObjectCollection otherpart = outContract.getDynamicObjectCollection("otherpart");
|
||||
DynamicObjectCollection clone =(DynamicObjectCollection) otherpart.clone();
|
||||
clone.clear();
|
||||
for(DynamicObject item : zcgjOtherpart) {
|
||||
DynamicObject bd_supplier = new DynamicObject(otherpart.getDynamicObjectType());
|
||||
bd_supplier.set("fbasedataid",item.get(2));
|
||||
clone.add(bd_supplier);
|
||||
}
|
||||
|
||||
// 设置并标记修改
|
||||
outContract.set("otherpart", clone);
|
||||
// outContract.set("otherpart", true); // 关键!
|
||||
|
||||
outContract.set("ismulticontract", true);
|
||||
}
|
||||
OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContract}, null);//支出合同实体
|
||||
SaveServiceHelper.save(new DynamicObject[]{outContract});//支出合同实体
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue