支出/收入合同结算作废功能开发
This commit is contained in:
parent
c89608a038
commit
a01328a5c6
|
@ -0,0 +1,83 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.bill.BillShowParameter;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.list.BillList;
|
||||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 收入合同结算-作废操作插件
|
||||
*/
|
||||
public class InContractSettleInvalidListPlugin extends AbstractListPlugin implements Plugin {
|
||||
private static final Log log = LogFactory.getLog(InContractSettleInvalidListPlugin.class);
|
||||
|
||||
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
super.itemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
if("zcgj_invalid".equals(itemKey)) {
|
||||
BillList billList = this.getView().getControl(AbstractListPlugin.BILLLISTID);
|
||||
//获取到选中行的数据
|
||||
ListSelectedRowCollection selectedRows = billList.getSelectedRows();
|
||||
if(selectedRows.isEmpty()){
|
||||
this.getView().showTipNotification(String.format("请选择要作废的数据。"));
|
||||
return;
|
||||
}
|
||||
if(selectedRows.size() > 1){
|
||||
this.getView().showTipNotification(String.format("请选择单个数据进行作废操作。。"));
|
||||
return;
|
||||
}
|
||||
for (ListSelectedRow selectedRow : selectedRows) {
|
||||
BillShowParameter showParameter = new BillShowParameter();
|
||||
String billStatus = selectedRow.getBillStatus();
|
||||
if("C".equals(billStatus)){
|
||||
Long contractSettleId = (Long)selectedRow.getPrimaryKeyValue();//收入合同结算id
|
||||
String billNo = selectedRow.getBillNo();
|
||||
QFilter accountTableFilter = new QFilter("zcgj_invalidbillid", QCP.equals,String.valueOf(contractSettleId));
|
||||
DynamicObject data = BusinessDataServiceHelper.loadSingle("ec_out_contract_settle", "id,number,zcgj_is_invalid,zcgj_is_reversabillid", new QFilter[]{accountTableFilter});
|
||||
if(data != null){
|
||||
if(data.getBoolean("zcgj_is_invalid")){
|
||||
this.getView().showTipNotification(String.format("当前结算单为作废单据,无法再次作废。"));
|
||||
return;
|
||||
}else if(data.getBoolean("zcgj_is_reversabillid")){
|
||||
this.getView().showTipNotification(String.format("当前结算单为冲销单据,无法作废。"));
|
||||
return;
|
||||
}else{
|
||||
this.getView().showTipNotification(String.format("当前结算单已作废,无法再次作废。"));
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
QFilter idFilter = new QFilter("id", QCP.equals,contractSettleId);
|
||||
DynamicObject selectData = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", "id,number,zcgj_is_invalid", new QFilter[]{idFilter});
|
||||
if(selectData.getBoolean("zcgj_is_invalid")){
|
||||
this.getView().showTipNotification(String.format("当前为作废单据,无法再次作废。"));
|
||||
return;
|
||||
}
|
||||
showParameter.setCustomParam("invalidbillid", contractSettleId);
|
||||
//showParameter.setPkId(contractSettleId);
|
||||
showParameter.setFormId("ec_in_contract_settle");
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||
getView().showForm(showParameter);
|
||||
}
|
||||
}else{
|
||||
this.getView().showTipNotification(String.format("只有已审核通过的数据才可进行作废操作。"));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.bill.BillShowParameter;
|
||||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.Toolbar;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* 支出合同结算单作废
|
||||
*/
|
||||
public class InContractSettleInvalidPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
//注册监听按钮
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
//注册整个工具栏监听器
|
||||
Toolbar toolbar = this.getView().getControl("tbmain");
|
||||
toolbar.addClickListener(this);
|
||||
super.registerListener(e);
|
||||
}
|
||||
|
||||
//操作栏点击事件
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
if(evt.getItemKey().equals("zcgj_showinvalidbill")){ //跳转到冲销单据
|
||||
boolean isInvalid = (Boolean)this.getModel().getValue("zcgj_is_invalid");
|
||||
if(isInvalid){
|
||||
String id = (String)this.getModel().getValue("zcgj_invalidbillid");
|
||||
BillShowParameter showParameter = new BillShowParameter();
|
||||
showParameter.setFormId("ec_in_contract_settle");
|
||||
showParameter.setPkId(id);
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||
getView().showForm(showParameter);
|
||||
}
|
||||
}
|
||||
super.itemClick(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
//如果是新增时
|
||||
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
||||
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
||||
// 获取当前页面的FormShowParameter对象
|
||||
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
||||
if(formShowParameter.getCustomParam("invalidbillid")!=null){
|
||||
// 获取自定义参数
|
||||
Object contractSettleIdObj = formShowParameter.getCustomParam("invalidbillid");
|
||||
if (contractSettleIdObj != null) {
|
||||
initData(contractSettleIdObj);
|
||||
this.getView().setEnable(false,"contract","org","period","begindate","enddate","iseqsettle","zcgj_adjustmounttax");
|
||||
//this.getView().invokeOperation("save");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initData(Object contractSettleIdObj){
|
||||
QFilter accountTableFilter = new QFilter("id", QCP.equals,(Long)contractSettleIdObj);
|
||||
DynamicObject ecincontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{accountTableFilter});
|
||||
getModel().setValue("zcgj_invalidbillid",ecincontractsettle.getLong("id"));
|
||||
getModel().setValue("billname",ecincontractsettle.getString("billname"));
|
||||
getModel().setValue("contract",ecincontractsettle.getDynamicObject("contract"));
|
||||
getModel().setValue("contattr",ecincontractsettle.getDynamicObject("contattr"));
|
||||
getModel().setValue("project",ecincontractsettle.getDynamicObject("project"));
|
||||
getModel().setValue("period",ecincontractsettle.getDynamicObject("period"));
|
||||
getModel().setValue("begindate",ecincontractsettle.getDate("begindate"));
|
||||
getModel().setValue("enddate",ecincontractsettle.getDate("enddate"));
|
||||
getModel().setValue("conttotaloftaxamount",ecincontractsettle.getBigDecimal("conttotaloftaxamount"));
|
||||
getModel().setValue("description",ecincontractsettle.getString("description"));
|
||||
getModel().setValue("currency",ecincontractsettle.getDynamicObject("currency"));
|
||||
getModel().setValue("ismultirate",ecincontractsettle.getBoolean("ismultirate"));
|
||||
getModel().setValue("ismulticurrency",ecincontractsettle.getBoolean("ismulticurrency"));
|
||||
getModel().setValue("isonlist",ecincontractsettle.getBoolean("isonlist"));
|
||||
getModel().setValue("zcgj_adjustmounttax",ecincontractsettle.getBoolean("zcgj_adjustmounttax"));
|
||||
getModel().setValue("unitproject",ecincontractsettle.getDynamicObject("unitproject"));
|
||||
getModel().setValue("zcgj_is_invalid",true);
|
||||
|
||||
DynamicObjectCollection itementry = ecincontractsettle.getDynamicObjectCollection("itementry");
|
||||
////DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("zcgj_itementry");
|
||||
DynamicObjectCollection entryEntity1 = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");
|
||||
entryEntity1.clear();
|
||||
BigDecimal settleamount = BigDecimal.ZERO;
|
||||
BigDecimal taxamount = BigDecimal.ZERO;
|
||||
BigDecimal settleoftaxamount = BigDecimal.ZERO;
|
||||
|
||||
for (DynamicObject dynamicObject : itementry) {
|
||||
DynamicObject item = entryEntity1.addNew();
|
||||
item.set("payitem",dynamicObject.getDynamicObject("payitem"));
|
||||
BigDecimal oftaxamount = dynamicObject.getBigDecimal("oftaxamount").multiply(new BigDecimal("-1"));
|
||||
item.set("oftaxamount",oftaxamount);
|
||||
BigDecimal amount = dynamicObject.getBigDecimal("amount").multiply(new BigDecimal("-1"));
|
||||
item.set("amount",amount);
|
||||
item.set("rate",dynamicObject.getBigDecimal("rate"));
|
||||
BigDecimal taxamt = dynamicObject.getBigDecimal("taxamt").multiply(new BigDecimal("-1"));
|
||||
item.set("taxamt",taxamt);
|
||||
item.set("remark",dynamicObject.getString("remark"));
|
||||
|
||||
settleamount = settleamount.add(amount);
|
||||
taxamount = taxamount.add(taxamt);
|
||||
settleoftaxamount = settleoftaxamount.add(oftaxamount);
|
||||
}
|
||||
getModel().setValue("settleamount",settleamount);
|
||||
getModel().setValue("taxamount",taxamount);
|
||||
getModel().setValue("settleoftaxamount",settleoftaxamount);
|
||||
if(ecincontractsettle.getBoolean("isonlist")){
|
||||
this.getView().setVisible(false,"zcgj_adjustmounttax");
|
||||
|
||||
}
|
||||
this.getView().updateView("itementry");
|
||||
}
|
||||
|
||||
}
|
|
@ -47,8 +47,16 @@ public class OutContractSettleInvalidListPlugin extends AbstractListPlugin imple
|
|||
QFilter accountTableFilter = new QFilter("zcgj_invalidbillid", QCP.equals,String.valueOf(contractSettleId));
|
||||
DynamicObject data = BusinessDataServiceHelper.loadSingle("ec_out_contract_settle", "id,number,zcgj_is_invalid", new QFilter[]{accountTableFilter});
|
||||
if(data != null){ //财务确认单
|
||||
this.getView().showTipNotification(String.format("当前结算单已作废,无法再次作废。"));
|
||||
return;
|
||||
if(data.getBoolean("zcgj_is_invalid")){
|
||||
this.getView().showTipNotification(String.format("当前结算单为作废单据,无法再次作废。"));
|
||||
return;
|
||||
}else if(data.getBoolean("zcgj_is_reversabillid")){
|
||||
this.getView().showTipNotification(String.format("当前结算单为冲销单据,无法作废。"));
|
||||
return;
|
||||
}else{
|
||||
this.getView().showTipNotification(String.format("当前结算单已作废,无法再次作废。"));
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
QFilter idFilter = new QFilter("id", QCP.equals,contractSettleId);
|
||||
DynamicObject selectData = BusinessDataServiceHelper.loadSingle("ec_out_contract_settle", "id,number,zcgj_is_invalid", new QFilter[]{idFilter});
|
||||
|
|
|
@ -6,6 +6,10 @@ import kd.bos.bill.OperationStatus;
|
|||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.Button;
|
||||
import kd.bos.form.control.Toolbar;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
@ -19,6 +23,31 @@ import java.util.EventObject;
|
|||
*/
|
||||
public class OutContractSettleInvalidPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
//注册监听按钮
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
//注册整个工具栏监听器
|
||||
Toolbar toolbar = this.getView().getControl("tbmain");
|
||||
toolbar.addClickListener(this);
|
||||
super.registerListener(e);
|
||||
}
|
||||
|
||||
//操作栏点击事件
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
if(evt.getItemKey().equals("zcgj_showinvalidbill")){ //跳转到冲销单据
|
||||
boolean isInvalid = (Boolean)this.getModel().getValue("zcgj_is_invalid");
|
||||
if(isInvalid){
|
||||
String id = (String)this.getModel().getValue("zcgj_invalidbillid");
|
||||
BillShowParameter showParameter = new BillShowParameter();
|
||||
showParameter.setFormId("ec_out_contract_settle");
|
||||
showParameter.setPkId(id);
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||
getView().showForm(showParameter);
|
||||
}
|
||||
}
|
||||
super.itemClick(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
|
|
|
@ -11,6 +11,8 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.Toolbar;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.form.events.HyperLinkClickEvent;
|
||||
import kd.bos.form.events.HyperLinkClickListener;
|
||||
import kd.bos.orm.query.QCP;
|
||||
|
@ -28,6 +30,31 @@ import java.util.EventObject;
|
|||
*/
|
||||
public class OutContractSettleReversalPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
//注册监听按钮
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
//注册整个工具栏监听器
|
||||
Toolbar toolbar = this.getView().getControl("tbmain");
|
||||
toolbar.addClickListener(this);
|
||||
super.registerListener(e);
|
||||
}
|
||||
|
||||
//操作栏点击事件
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
if(evt.getItemKey().equals("zcgj_showreversabill")){ //跳转到冲销单据
|
||||
boolean isReversabill = (Boolean)this.getModel().getValue("zcgj_is_reversabillid");
|
||||
if(isReversabill){
|
||||
String id = (String)this.getModel().getValue("zcgj_reversabillid");
|
||||
BillShowParameter showParameter = new BillShowParameter();
|
||||
showParameter.setFormId("ec_out_contract_settle");
|
||||
showParameter.setPkId(id);
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||
getView().showForm(showParameter);
|
||||
}
|
||||
}
|
||||
super.itemClick(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.ec.contract.opplugin.InContractSettleOp;
|
||||
import kd.ec.contract.opplugin.validator.ContractMeasureValidator;
|
||||
|
@ -8,6 +9,15 @@ import kd.ec.contract.opplugin.validator.InContractSettleValidator;
|
|||
import java.util.List;
|
||||
|
||||
public class InContractSettlementOp extends InContractSettleOp {
|
||||
|
||||
@Override
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
List<String> fields = e.getFieldKeys();
|
||||
fields.add("zcgj_is_reversabillid");
|
||||
fields.add("zcgj_is_invalid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
|
|
|
@ -21,6 +21,9 @@ public class InContractSettlementValidator extends InContractSettleValidator {
|
|||
|
||||
for (int var4 = 0; var4 < var3; ++var4) {
|
||||
ExtendedDataEntity dataEntity = var2[var4];
|
||||
if(dataEntity.getDataEntity().getBoolean("zcgj_is_reversabillid") || dataEntity.getDataEntity().getBoolean("zcgj_is_invalid")){
|
||||
return;
|
||||
}
|
||||
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
||||
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
||||
if (contractTemp == null) {
|
||||
|
|
|
@ -17,6 +17,7 @@ public class OutContractSettlementOp extends OutContractSettleOp {
|
|||
super.onPreparePropertys(e);
|
||||
List<String> fields = e.getFieldKeys();
|
||||
fields.add("zcgj_is_reversabillid");
|
||||
fields.add("zcgj_is_invalid");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.workflow;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.orm.query.QCP;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 收入合同结算单-作废单生成财务确认单工作流插件
|
||||
*/
|
||||
public class InContractSettleInvalidWorkFlowPlugin implements IWorkflowPlugin {
|
||||
|
||||
@Override
|
||||
public void notify(AgentExecution execution) {
|
||||
String eventName = execution.getEventName();
|
||||
String businessKey = execution.getBusinessKey();
|
||||
String entityNumber = execution.getEntityNumber();
|
||||
DynamicObject inContractSettle = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
|
||||
//如果是作废单据
|
||||
boolean isReversabillid = inContractSettle.getBoolean("zcgj_is_invalid");
|
||||
|
||||
if(isReversabillid) {
|
||||
DynamicObject inFinaceconfirm =BusinessDataServiceHelper.newDynamicObject("zcgj_ec_in_finaceconfirm");
|
||||
|
||||
inFinaceconfirm.set("zcgj_ec_in_contract_sett",inContractSettle.getLong("id"));
|
||||
inFinaceconfirm.set("zcgj_ec_in_contract_name",inContractSettle.getString("billname"));
|
||||
inFinaceconfirm.set("zcgj_ec_in_contractid", inContractSettle.getLong("id")); //id文本,冗余
|
||||
inFinaceconfirm.set("zcgj_billname",inContractSettle.getString("billname"));
|
||||
inFinaceconfirm.set("zcgj_contract",inContractSettle.getDynamicObject("contract"));
|
||||
inFinaceconfirm.set("zcgj_contattr",inContractSettle.getDynamicObject("contattr"));
|
||||
inFinaceconfirm.set("zcgj_project",inContractSettle.getDynamicObject("project"));
|
||||
inFinaceconfirm.set("zcgj_period",inContractSettle.getDynamicObject("period"));
|
||||
inFinaceconfirm.set("zcgj_begindate",inContractSettle.getDate("begindate"));
|
||||
inFinaceconfirm.set("zcgj_enddate",inContractSettle.getDate("enddate"));
|
||||
inFinaceconfirm.set("zcgj_conttotaloftaxamount",inContractSettle.getBigDecimal("conttotaloftaxamount"));
|
||||
inFinaceconfirm.set("zcgj_description",inContractSettle.getString("description"));
|
||||
inFinaceconfirm.set("zcgj_currency",inContractSettle.getDynamicObject("currency"));
|
||||
inFinaceconfirm.set("zcgj_invoice_org",inContractSettle.getDynamicObject("project").getDynamicObject("projectorg"));
|
||||
// getModel().setValue("zcgj_jscustomer",ecincontractsettle.getDynamicObject("zcgj_jscustomer"));
|
||||
inFinaceconfirm.set("billstatus","C");
|
||||
inFinaceconfirm.set("zcgj_is_invalid",true);
|
||||
|
||||
DynamicObjectCollection itementry = inContractSettle.getDynamicObjectCollection("itementry");
|
||||
|
||||
DynamicObjectCollection entryEntity1 = inFinaceconfirm.getDynamicObjectCollection("zcgj_itementry");
|
||||
entryEntity1.clear();
|
||||
BigDecimal oftaxamountAll = BigDecimal.ZERO;
|
||||
BigDecimal amountAll = BigDecimal.ZERO;
|
||||
BigDecimal taxamtAll = BigDecimal.ZERO;
|
||||
for (DynamicObject dynamicObject : itementry) {
|
||||
DynamicObject item = entryEntity1.addNew();
|
||||
item.set("zcgj_payitem",dynamicObject.getDynamicObject("payitem"));
|
||||
BigDecimal oftaxamount = dynamicObject.getBigDecimal("oftaxamount");
|
||||
item.set("zcgj_oftaxamount",oftaxamount);
|
||||
oftaxamountAll = oftaxamountAll.add(oftaxamount);
|
||||
BigDecimal amount = dynamicObject.getBigDecimal("amount");
|
||||
item.set("zcgj_amount",amount);
|
||||
amountAll = amountAll.add(amount);
|
||||
item.set("zcgj_rate",dynamicObject.getBigDecimal("rate"));
|
||||
BigDecimal taxamt = dynamicObject.getBigDecimal("taxamt");
|
||||
item.set("zcgj_taxamt",taxamt);
|
||||
taxamtAll = taxamtAll.add(taxamt);
|
||||
item.set("zcgj_remark",dynamicObject.getString("remark"));
|
||||
}
|
||||
inFinaceconfirm.set("zcgj_oftaxamount_all",oftaxamountAll);
|
||||
inFinaceconfirm.set("zcgj_amount_all",amountAll);
|
||||
inFinaceconfirm.set("zcgj_taxamt_all",taxamtAll);
|
||||
|
||||
OperationResult ecInFinaceconfirm = SaveServiceHelper.saveOperate("zcgj_ec_in_finaceconfirm", new DynamicObject[]{inFinaceconfirm}, null);//支出合同实体
|
||||
if(ecInFinaceconfirm.isSuccess()){
|
||||
String sourceBillId = inContractSettle.getString("zcgj_invalidbillid");
|
||||
DynamicObject sourceBill = BusinessDataServiceHelper.loadSingle(entityNumber, "id,billstatus,billno", new QFilter[]{new QFilter("id", QCP.equals, Long.valueOf(sourceBillId))});
|
||||
sourceBill.set("billstatus","D");
|
||||
SaveServiceHelper.update(sourceBill);
|
||||
|
||||
//计量单
|
||||
QFilter approvalFilter = new QFilter("settlebillno", QCP.equals,sourceBill.getString("billno") );
|
||||
DynamicObject[] incontractmeasures = BusinessDataServiceHelper.load("ec_incontractmeasure", "id,settlebillno,billstatus", new QFilter[]{approvalFilter});
|
||||
if (incontractmeasures!=null && incontractmeasures.length>0){
|
||||
for (DynamicObject dynamicObject : incontractmeasures) {
|
||||
dynamicObject.set("billstatus","D");
|
||||
SaveServiceHelper.update(dynamicObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成支出财务确认单 end
|
||||
}
|
||||
|
||||
|
||||
IWorkflowPlugin.super.notify(execution);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,8 @@ public class OutContractSettleFiConfirmWorkFlowPlugin implements IWorkflowPlugin
|
|||
String entityNumber = execution.getEntityNumber();
|
||||
DynamicObject outContractSettle = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
|
||||
boolean isReversabillid = outContractSettle.getBoolean("zcgj_is_reversabillid");
|
||||
if(!isReversabillid) {
|
||||
boolean isInvalid = outContractSettle.getBoolean("zcgj_is_invalid");
|
||||
if(!isReversabillid && !isInvalid) {
|
||||
//如果时冲销单据
|
||||
//生成支出财务确认单 start
|
||||
//收入合同结算
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.workflow;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.workflow.api.AgentExecution;
|
||||
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 支出合同结算单-作废单审核通过工作流插件
|
||||
*/
|
||||
public class OutContractSettleInvalidWorkFlowPlugin implements IWorkflowPlugin {
|
||||
|
||||
@Override
|
||||
public void notify(AgentExecution execution) {
|
||||
String eventName = execution.getEventName();
|
||||
String businessKey = execution.getBusinessKey();
|
||||
String entityNumber = execution.getEntityNumber();
|
||||
DynamicObject outContractSettle = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
|
||||
//如果时冲销单据
|
||||
boolean isReversabillid = outContractSettle.getBoolean("zcgj_is_invalid");
|
||||
if(isReversabillid) {
|
||||
DynamicObjectCollection itementry = outContractSettle.getDynamicObjectCollection("itementry");
|
||||
|
||||
//生成支出财务确认单 start
|
||||
//收入合同结算
|
||||
DynamicObject outFinaceconfirm =BusinessDataServiceHelper.newDynamicObject("zcgj_ec_out_finaceconfirm");
|
||||
|
||||
outFinaceconfirm.set("zcgj_ec_out_contract_sett",outContractSettle.getLong("id"));
|
||||
outFinaceconfirm.set("zcgj_ec_out_contract_name",outContractSettle.getString("billname"));
|
||||
outFinaceconfirm.set("zcgj_ec_out_contractid", outContractSettle.getLong("id")); //id文本,冗余
|
||||
outFinaceconfirm.set("zcgj_billname",outContractSettle.getString("billname"));
|
||||
outFinaceconfirm.set("zcgj_contract",outContractSettle.getDynamicObject("contract"));
|
||||
outFinaceconfirm.set("zcgj_contattr",outContractSettle.getDynamicObject("contattr"));
|
||||
outFinaceconfirm.set("zcgj_project",outContractSettle.getDynamicObject("project"));
|
||||
outFinaceconfirm.set("zcgj_period",outContractSettle.getDynamicObject("period"));
|
||||
outFinaceconfirm.set("zcgj_begindate",outContractSettle.getDate("begindate"));
|
||||
outFinaceconfirm.set("zcgj_enddate",outContractSettle.getDate("enddate"));
|
||||
outFinaceconfirm.set("zcgj_conttotaloftaxamount",outContractSettle.getBigDecimal("conttotaloftaxamount"));
|
||||
outFinaceconfirm.set("zcgj_description",outContractSettle.getString("description"));
|
||||
outFinaceconfirm.set("zcgj_currency",outContractSettle.getDynamicObject("currency"));
|
||||
outFinaceconfirm.set("zcgj_invoice_org",outContractSettle.getDynamicObject("project").getDynamicObject("projectorg"));
|
||||
outFinaceconfirm.set("zcgj_jscustomer",outContractSettle.getDynamicObject("zcgj_jscustomer"));
|
||||
outFinaceconfirm.set("billstatus","C");
|
||||
outFinaceconfirm.set("zcgj_is_invalid",true);
|
||||
|
||||
DynamicObjectCollection entryEntity1 = outFinaceconfirm.getDynamicObjectCollection("zcgj_itementry");
|
||||
entryEntity1.clear();
|
||||
BigDecimal oftaxamountAll = BigDecimal.ZERO;
|
||||
BigDecimal amountAll = BigDecimal.ZERO;
|
||||
BigDecimal taxamtAll = BigDecimal.ZERO;
|
||||
for (DynamicObject dynamicObject : itementry) {
|
||||
DynamicObject item = entryEntity1.addNew();
|
||||
item.set("zcgj_payitem",dynamicObject.getDynamicObject("payitem"));
|
||||
BigDecimal oftaxamount = dynamicObject.getBigDecimal("oftaxamount");
|
||||
item.set("zcgj_oftaxamount",oftaxamount);
|
||||
oftaxamountAll = oftaxamountAll.add(oftaxamount);
|
||||
BigDecimal amount = dynamicObject.getBigDecimal("amount");
|
||||
item.set("zcgj_amount",amount);
|
||||
amountAll = amountAll.add(amount);
|
||||
item.set("zcgj_rate",dynamicObject.getBigDecimal("rate"));
|
||||
BigDecimal taxamt = dynamicObject.getBigDecimal("taxamt");
|
||||
item.set("zcgj_taxamt",taxamt);
|
||||
taxamtAll = taxamtAll.add(taxamt);
|
||||
item.set("zcgj_remark",dynamicObject.getString("remark"));
|
||||
}
|
||||
outFinaceconfirm.set("zcgj_oftaxamount_all",oftaxamountAll);
|
||||
outFinaceconfirm.set("zcgj_amount_all",amountAll);
|
||||
outFinaceconfirm.set("zcgj_taxamt_all",taxamtAll);
|
||||
OperationResult zcgjEcOutFinaceconfirm = SaveServiceHelper.saveOperate("zcgj_ec_out_finaceconfirm", new DynamicObject[]{outFinaceconfirm}, null);//支出合同实体
|
||||
if(zcgjEcOutFinaceconfirm.isSuccess()){
|
||||
String sourceBillId = outContractSettle.getString("zcgj_invalidbillid");
|
||||
DynamicObject sourceBill = BusinessDataServiceHelper.loadSingle(entityNumber, "id,billstatus,billno", new QFilter[]{new QFilter("id", QCP.equals, Long.valueOf(sourceBillId))});
|
||||
sourceBill.set("billstatus","D");
|
||||
SaveServiceHelper.update(sourceBill);
|
||||
|
||||
//计量单
|
||||
QFilter approvalFilter = new QFilter("settlebillno", QCP.equals,sourceBill.getString("billno") );
|
||||
DynamicObject[] outcontractmeasures = BusinessDataServiceHelper.load("ec_outcontractmeasure", "id,settlebillno,billstatus", new QFilter[]{approvalFilter});
|
||||
if(outcontractmeasures!=null && outcontractmeasures.length>0){
|
||||
for (DynamicObject dynamicObject : outcontractmeasures) {
|
||||
dynamicObject.set("billstatus","D");
|
||||
SaveServiceHelper.update(dynamicObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成支出财务确认单 end
|
||||
}
|
||||
IWorkflowPlugin.super.notify(execution);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue