合同变更供应商变更
This commit is contained in:
parent
a2782869eb
commit
ac25877ad7
|
@ -0,0 +1,87 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import com.alibaba.druid.util.StringUtils;
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
|
import kd.bos.form.control.Control;
|
||||||
|
import kd.bos.form.control.events.BeforeClickEvent;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据界面插件
|
||||||
|
*/
|
||||||
|
public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
// 注册按钮点击事件
|
||||||
|
this.addClickListeners("bar_save");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeClick(BeforeClickEvent evt) {
|
||||||
|
super.beforeClick(evt);
|
||||||
|
Control source = (Control) evt.getSource();
|
||||||
|
if (StringUtils.equals("bar_save", source.getKey())) {
|
||||||
|
// 在此添加业务逻辑
|
||||||
|
Object changetype = this.getModel().getValue("changetype");
|
||||||
|
if (changetype != null) {
|
||||||
|
if (changetype.toString().equals("03")) {
|
||||||
|
Object contract = this.getModel().getValue("contract");
|
||||||
|
DynamicObject contractInfo = (DynamicObject) contract;
|
||||||
|
String billName = contractInfo.getDataEntityType().getName();
|
||||||
|
DynamicObject zcgjParta = (DynamicObject)this.getModel().getValue("zcgj_parta");
|
||||||
|
Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart");
|
||||||
|
if (billName.equals("ec_out_contract_f7")) {
|
||||||
|
QFilter f1 = new QFilter("number", "=", contractInfo.getString("number"));
|
||||||
|
DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
|
||||||
|
outContractF7.set("parta",zcgjParta);
|
||||||
|
OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
|
||||||
|
|
||||||
|
QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number"));
|
||||||
|
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
|
||||||
|
outContract.set("parta",zcgjParta);
|
||||||
|
if(zcgjOtherpart!=null){
|
||||||
|
DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
|
||||||
|
outContract.set("otherpart",otherpart);
|
||||||
|
outContract.set("ismulticontract",true);
|
||||||
|
}
|
||||||
|
OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
|
||||||
|
System.out.println(saveOperationResult1);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evt.setCancel(true); // 取消后续处理,将不会再触发click事件
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
if(name.equals("changetype")){
|
||||||
|
Object changetype = this.getModel().getValue("changetype");
|
||||||
|
if(changetype!=null){
|
||||||
|
if(changetype.toString().equals("03")){
|
||||||
|
this.getView().setVisible(true,"zcgj_parta");
|
||||||
|
this.getView().setVisible(true,"zcgj_otherpart");
|
||||||
|
}else {
|
||||||
|
this.getView().setVisible(false,"zcgj_parta");
|
||||||
|
this.getView().setVisible(false,"zcgj_otherpart");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +16,7 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
||||||
|
|
||||||
private String entryName = "treelistentry";//分录标识
|
private String entryName = "treelistentry";//分录标识
|
||||||
|
|
||||||
private String ecContract = "";//
|
private String ecContract = "incontract";//
|
||||||
@Override
|
@Override
|
||||||
public void propertyChanged(PropertyChangedArgs e) {
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
super.propertyChanged(e);
|
super.propertyChanged(e);
|
||||||
|
@ -22,28 +24,44 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
||||||
if(changeName.equals(ecContract)){//收入合同字段值改变
|
if(changeName.equals(ecContract)){//收入合同字段值改变
|
||||||
Object outC = this.getModel().getValue(ecContract);
|
Object outC = this.getModel().getValue(ecContract);
|
||||||
if(outC!=null){
|
if(outC!=null){
|
||||||
DynamicObject outContract = (DynamicObject) outC;
|
DynamicObject contractF7 = (DynamicObject) outC;
|
||||||
DynamicObjectCollection ecCEntrys = outContract.getDynamicObjectCollection(entryName);//获取收入合同合同清单
|
String paydirection = contractF7.getString("paydirection");//支出/收入
|
||||||
for (int i = 0; i < ecCEntrys.size(); i++) {
|
String contractNumber = contractF7.getString("number");//获取收入合同合同清单
|
||||||
DynamicObject ecCEntry = ecCEntrys.get(i);
|
if(paydirection.equals("in")){
|
||||||
int row = this.getModel().insertEntryRow(entryName, i);
|
QFilter f1 = new QFilter("billno", "=", contractNumber);
|
||||||
this.getModel().setValue(entryName, ecCEntry.get(""), row);
|
DynamicObject inContract = BusinessDataServiceHelper.loadSingle("ec_in_contract", new QFilter[]{f1});
|
||||||
}
|
DynamicObjectCollection listmodelentry = inContract.getDynamicObjectCollection("listmodelentry");
|
||||||
DynamicObjectCollection outCEntry = this.getModel().getEntryEntity(entryName);
|
for (int x = 0; x < listmodelentry.size(); x++ ) {
|
||||||
if (outCEntry.size() < 0) {
|
DynamicObject dynamicObject = listmodelentry.get(x);
|
||||||
for (int i = 0; i < ecCEntrys.size(); i++) {
|
this.getModel().getEntryEntity("listmodelentry").add(x,dynamicObject);
|
||||||
outCEntry.add(i, ecCEntrys.get(i));
|
DynamicObjectCollection sublistentry = dynamicObject.getDynamicObjectCollection("sublistentry");
|
||||||
|
for (int i = 0; i < sublistentry.size(); i++) {
|
||||||
|
DynamicObject object = sublistentry.get(i);
|
||||||
|
int row = this.getModel().insertEntryRow("sublistentry", i+1);
|
||||||
|
this.getModel().setValue("sysnumber",object.getString("sysnumber"),row+1);
|
||||||
|
this.getModel().setValue("listnumber",object.getString("listnumber"),row);
|
||||||
|
this.getModel().setValue("listname",object.getString("listname"),row);
|
||||||
|
this.getModel().setValue("resourceitem",object.getString("resourceitem"),row);
|
||||||
|
this.getModel().setValue("measureunit",object.getString("measureunit"),row);
|
||||||
|
this.getModel().setValue("qty",object.getString("qty"),row);
|
||||||
|
this.getModel().setValue("price",object.getString("price"),row);
|
||||||
|
this.getModel().setValue("amount",object.getString("amount"),row);
|
||||||
|
this.getModel().setValue("rateobj",object.getString("rateobj"),row);
|
||||||
|
this.getModel().setValue("tax",object.getString("tax"),row);
|
||||||
|
this.getModel().setValue("taxprice",object.getString("taxprice"),row);
|
||||||
|
this.getModel().setValue("oftax",object.getString("oftax"),row);
|
||||||
|
this.getModel().setValue("listunitproject",object.getString("listunitproject"),row);
|
||||||
|
this.getModel().setValue("desc",object.getString("desc"),row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.getView().updateView(entryName);
|
this.getView().updateView("listmodelentry");
|
||||||
}
|
this.getView().updateView("treelistentry");
|
||||||
outCEntry = this.getModel().getEntryEntity(entryName);
|
} else if (paydirection.equals("out")) {
|
||||||
if (outCEntry.size() < 0) {
|
|
||||||
for (int i = 0; i < ecCEntrys.size(); i++) {
|
|
||||||
outCEntry.add(ecCEntrys.get(i));
|
|
||||||
}
|
|
||||||
this.getView().updateView(entryName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.workflow;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.bos.workflow.api.AgentExecution;
|
||||||
|
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
|
||||||
|
|
||||||
|
public class OutContractWorkFlowPlugin implements IWorkflowPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notify(AgentExecution execution) {
|
||||||
|
String businessKey = execution.getBusinessKey();
|
||||||
|
String entityNumber = execution.getEntityNumber();
|
||||||
|
DynamicObject outContractSettle = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
|
||||||
|
String changetype = outContractSettle.getString("changetype");
|
||||||
|
if(changetype.equals("03")) {
|
||||||
|
DynamicObject contractInfo = outContractSettle.getDynamicObject("contract");
|
||||||
|
// DynamicObject contractInfo = (DynamicObject) contract;
|
||||||
|
// String billName = contractInfo.getDataEntityType().getName();
|
||||||
|
DynamicObject zcgjParta = outContractSettle.getDynamicObject("zcgj_parta");
|
||||||
|
DynamicObjectCollection zcgjOtherpart = outContractSettle.getDynamicObjectCollection("zcgj_otherpart");
|
||||||
|
QFilter f1 = new QFilter("number", "=", contractInfo.getString("number"));
|
||||||
|
DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
|
||||||
|
outContractF7.set("parta", zcgjParta);
|
||||||
|
SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
|
||||||
|
|
||||||
|
QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number"));
|
||||||
|
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
|
||||||
|
outContract.set("parta", zcgjParta);
|
||||||
|
if (zcgjOtherpart != null) {
|
||||||
|
// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
|
||||||
|
outContract.set("otherpart", zcgjOtherpart);
|
||||||
|
outContract.set("ismulticontract", true);
|
||||||
|
}
|
||||||
|
SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContract}, null);//支出合同实体
|
||||||
|
}
|
||||||
|
IWorkflowPlugin.super.notify(execution);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue