优化代码 解决合同计量行带出有误的问题
This commit is contained in:
parent
fed724c980
commit
e19f96774d
|
@ -6,6 +6,7 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.entity.operate.result.OperationResult;
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
|
import kd.bos.form.control.Button;
|
||||||
import kd.bos.form.control.Control;
|
import kd.bos.form.control.Control;
|
||||||
import kd.bos.form.control.events.BeforeClickEvent;
|
import kd.bos.form.control.events.BeforeClickEvent;
|
||||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
@ -41,8 +42,10 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
// 注册按钮点击事件
|
// 注册按钮点击事件
|
||||||
this.addClickListeners("bar_audit");
|
// this.addClickListeners("bar_audit");
|
||||||
this.addItemClickListeners("bar_audit");
|
// this.addItemClickListeners("bar_audit");
|
||||||
|
// Button button = this.getView().getControl("bar_audit");
|
||||||
|
// button.addClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,13 +57,15 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
|
||||||
@Override
|
@Override
|
||||||
public void click(EventObject evt) {
|
public void click(EventObject evt) {
|
||||||
super.click(evt);
|
super.click(evt);
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeItemClick(BeforeItemClickEvent evt) {
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
super.beforeItemClick(evt);
|
super.beforeItemClick(evt);
|
||||||
Control source = (Control) evt.getSource();
|
Control source = (Control) evt.getSource();
|
||||||
if (StringUtils.equals("bar_audit", source.getKey())) {
|
String key = source.getKey();
|
||||||
|
if (StringUtils.equals("bar_audit", key)) {
|
||||||
// 在此添加业务逻辑
|
// 在此添加业务逻辑
|
||||||
Object changetype = this.getModel().getValue("changetype");
|
Object changetype = this.getModel().getValue("changetype");
|
||||||
if (changetype != null) {
|
if (changetype != null) {
|
||||||
|
|
|
@ -1,20 +1,45 @@
|
||||||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
import kd.bos.entity.tree.TreeNode;
|
|
||||||
import kd.bos.form.FormShowParameter;
|
import kd.bos.form.FormShowParameter;
|
||||||
import kd.bos.form.IPageCache;
|
|
||||||
import kd.bos.form.control.TreeView;
|
|
||||||
import kd.ec.basedata.common.enums.ResourceTypeEnum;
|
|
||||||
import kd.ec.basedata.formplugin.ResourceFilterPlugin;
|
|
||||||
import kd.ec.basedata.formplugin.ResourceItemListPlugin;
|
import kd.ec.basedata.formplugin.ResourceItemListPlugin;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
|
public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
|
||||||
|
@Override
|
||||||
|
public void beforeBindData(EventObject e) {
|
||||||
|
// super.afterBindData(e);
|
||||||
|
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
||||||
|
Map<String, Object> customParams = formShowParameter.getCustomParams();
|
||||||
|
Object contractType = customParams.get("contractType");
|
||||||
|
String firstOpen = this.getPageCache().get("firstOpen");
|
||||||
|
if (firstOpen != null) {
|
||||||
|
// this.getPageCache().put("firstOpen", "false");
|
||||||
|
this.getPageCache().remove("firstOpen");
|
||||||
|
|
||||||
|
if (contractType != null) {
|
||||||
|
if (contractType.toString().equals("wzcg")) {//物资采购
|
||||||
|
this.setResourceTypeStyle("material");
|
||||||
|
this.afterSelectedTag("material");
|
||||||
|
} else if (contractType.toString().equals("sbcg")) {//设备采购
|
||||||
|
this.setResourceTypeStyle("equipment");
|
||||||
|
this.afterSelectedTag("equipment");
|
||||||
|
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物
|
||||||
|
this.setResourceTypeStyle("turnover");
|
||||||
|
this.afterSelectedTag("turnover");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getPageCache().put("firstOpen","false");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBindData(EventObject e) {
|
public void afterBindData(EventObject e) {
|
||||||
super.afterBindData(e);
|
|
||||||
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
||||||
Map<String, Object> customParams = formShowParameter.getCustomParams();
|
Map<String, Object> customParams = formShowParameter.getCustomParams();
|
||||||
Object contractType = customParams.get("contractType");
|
Object contractType = customParams.get("contractType");
|
||||||
|
@ -25,24 +50,14 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
|
||||||
if (contractType.toString().equals("wzcg")) {//物资采购
|
if (contractType.toString().equals("wzcg")) {//物资采购
|
||||||
this.getView().setVisible(true, new String[]{"flexpanelmaterial"});
|
this.getView().setVisible(true, new String[]{"flexpanelmaterial"});
|
||||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"});
|
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"});
|
||||||
this.setResourceTypeStyle("material");
|
} else if (contractType.toString().equals("sbcg")) {//设备采购
|
||||||
this.afterSelectedTag("material");
|
|
||||||
} else if (contractType.toString().equals("cs2")) {//设备采购
|
|
||||||
this.getView().setVisible(true, new String[]{"flexpanelequipment"});
|
this.getView().setVisible(true, new String[]{"flexpanelequipment"});
|
||||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"});
|
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"});
|
||||||
this.setResourceTypeStyle("equipment");
|
|
||||||
this.afterSelectedTag("equipment");
|
|
||||||
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物
|
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物
|
||||||
this.getView().setVisible(true, new String[]{"flexpanelturnover"});
|
this.getView().setVisible(true, new String[]{"flexpanelturnover"});
|
||||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
|
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
|
||||||
this.setResourceTypeStyle("turnover");
|
|
||||||
this.afterSelectedTag("turnover");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
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.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
public class ContractSettleOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||||
|
DynamicObject object = dataEntities1[0];
|
||||||
|
Object changetype = object.getString("changetype");
|
||||||
|
if (changetype != null) {
|
||||||
|
if (changetype.toString().equals("03")) {
|
||||||
|
DynamicObject contract = object.getDynamicObject("contract");
|
||||||
|
String billName = contract.getDataEntityType().getName();
|
||||||
|
DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb");
|
||||||
|
DynamicObjectCollection zcgjOtherpart = object.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});
|
||||||
|
outContractF7.set("partb", zcgjpartb);
|
||||||
|
OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
|
||||||
|
|
||||||
|
QFilter f2 = new QFilter("billno", "=", contract.getString("number"));
|
||||||
|
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
|
||||||
|
outContract.set("partb", zcgjpartb);
|
||||||
|
if (zcgjOtherpart != null) {
|
||||||
|
// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
|
||||||
|
outContract.set("otherpart", zcgjOtherpart);
|
||||||
|
outContract.set("ismulticontract", true);
|
||||||
|
}
|
||||||
|
OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
|
||||||
|
System.out.println(saveOperationResult1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ public class InContractSettlementValidator extends InContractSettleValidator {
|
||||||
long id = dataEntity.getDataEntity().getLong("id");
|
long id = dataEntity.getDataEntity().getLong("id");
|
||||||
QFilter f1 = new QFilter("id", "=", id);
|
QFilter f1 = new QFilter("id", "=", id);
|
||||||
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
|
DynamicObject incontractsettle = BusinessDataServiceHelper.loadSingle("ec_in_contract_settle", new QFilter[]{f1});
|
||||||
|
if(incontractsettle!=null){
|
||||||
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
|
DynamicObjectCollection itementry = incontractsettle.getDynamicObjectCollection("itementry");
|
||||||
if(itementry == null) {
|
if(itementry == null) {
|
||||||
if(itementry.isEmpty()) {
|
if(itementry.isEmpty()) {
|
||||||
|
@ -45,6 +46,7 @@ public class InContractSettlementValidator extends InContractSettleValidator {
|
||||||
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
|
// DynamicObjectCollection payitemdetailap = incontractsettle.getDynamicObjectCollection("payitemdetailap");
|
||||||
// if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
|
// if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
|
||||||
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||||
|
|
Loading…
Reference in New Issue