支出合同结算单作废功能开发
This commit is contained in:
parent
d3e465cdc0
commit
686680d16d
|
@ -0,0 +1,75 @@
|
|||
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 OutContractSettleInvalidListPlugin extends AbstractListPlugin implements Plugin {
|
||||
private static final Log log = LogFactory.getLog(OutContractSettleInvalidListPlugin.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", new QFilter[]{accountTableFilter});
|
||||
if(data != null){ //财务确认单
|
||||
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});
|
||||
if(selectData.getBoolean("zcgj_is_invalid")){
|
||||
this.getView().showTipNotification(String.format("当前为作废单据,无法再次作废。"));
|
||||
return;
|
||||
}
|
||||
showParameter.setCustomParam("invalidbillid", contractSettleId);
|
||||
//showParameter.setPkId(contractSettleId);
|
||||
showParameter.setFormId("ec_out_contract_settle");
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); //打开方式
|
||||
getView().showForm(showParameter);
|
||||
}
|
||||
}else{
|
||||
this.getView().showTipNotification(String.format("只有已审核通过的数据才可进行作废操作。"));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
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.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 OutContractSettleInvalidPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
|
||||
@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 ecoutcontractsettle = BusinessDataServiceHelper.loadSingle("ec_out_contract_settle", new QFilter[]{accountTableFilter});
|
||||
getModel().setValue("zcgj_invalidbillid",ecoutcontractsettle.getLong("id"));
|
||||
getModel().setValue("billname",ecoutcontractsettle.getString("billname")+"-作废");
|
||||
getModel().setValue("contract",ecoutcontractsettle.getDynamicObject("contract"));
|
||||
getModel().setValue("contattr",ecoutcontractsettle.getDynamicObject("contattr"));
|
||||
getModel().setValue("project",ecoutcontractsettle.getDynamicObject("project"));
|
||||
getModel().setValue("period",ecoutcontractsettle.getDynamicObject("period"));
|
||||
getModel().setValue("begindate",ecoutcontractsettle.getDate("begindate"));
|
||||
getModel().setValue("enddate",ecoutcontractsettle.getDate("enddate"));
|
||||
getModel().setValue("conttotaloftaxamount",ecoutcontractsettle.getBigDecimal("conttotaloftaxamount"));
|
||||
getModel().setValue("description","");
|
||||
getModel().setValue("currency",ecoutcontractsettle.getDynamicObject("currency"));
|
||||
getModel().setValue("zcgj_jscustomer",ecoutcontractsettle.getDynamicObject("zcgj_jscustomer"));
|
||||
getModel().setValue("isonlist",ecoutcontractsettle.getBoolean("isonlist"));
|
||||
getModel().setValue("isincost",ecoutcontractsettle.getBoolean("isincost"));
|
||||
getModel().setValue("zcgj_adjustmounttax",ecoutcontractsettle.getBoolean("zcgj_adjustmounttax"));
|
||||
getModel().setValue("zcgj_is_invalid",true);
|
||||
|
||||
DynamicObjectCollection itementry = ecoutcontractsettle.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(ecoutcontractsettle.getBoolean("isonlist")){
|
||||
this.getView().setVisible(false,"zcgj_adjustmounttax");
|
||||
|
||||
}
|
||||
this.getView().updateView("itementry");
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
|
|||
{
|
||||
|
||||
DynamicObject dataEntity1 = dataEntity.getDataEntity();
|
||||
if(dataEntity1.getBoolean("zcgj_is_reversabillid")){
|
||||
if(dataEntity1.getBoolean("zcgj_is_reversabillid") || dataEntity1.getBoolean("zcgj_is_invalid")){
|
||||
return true;
|
||||
}
|
||||
DynamicObjectCollection listmodelentrys = dataEntity1.getDynamicObjectCollection("listmodelentry");//分录
|
||||
|
|
Loading…
Reference in New Issue