Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
cb15d81951
|
|
@ -155,7 +155,7 @@ public class TaskApproveFormCkPlugin extends AbstractFormPlugin {
|
|||
return;
|
||||
}
|
||||
}*/
|
||||
if(!"G".equals(billstatus)) {
|
||||
if(!"G".equals(billstatus) && !"I".equals(billstatus)) {
|
||||
if("er_repaymentbill".equals(entityName)) {
|
||||
this.getView().showErrorNotification(String.format("审批结算任务:当前单据的收款未完成,请完成收款后提交。"));
|
||||
evt.setCancel(true);
|
||||
|
|
|
|||
|
|
@ -82,55 +82,7 @@ public class TaskListPayStatusCkOp extends AbstractOperationServicePlugIn {
|
|||
DynamicObject sourceBillObject = BusinessDataServiceHelper.loadSingle(entityName, new QFilter[]{accountTableFilter});
|
||||
String billstatus = sourceBillObject.getString("billstatus");
|
||||
//String billNo = sourceBillObject.getString("billno");
|
||||
|
||||
/*if("er_publicreimbursebill".equals(entityName) || "er_prepaybill".equals(entityName) || "er_dailyreimbursebill".equals(entityName) || "er_tripreimbursebill".equals(entityName)){
|
||||
boolean success = false;
|
||||
boolean isSk = false; //是否司库付款
|
||||
boolean settletypeNotNull = true;//付款方式不能为空
|
||||
DynamicObject[] dynamicObjectOrg = null;
|
||||
if("er_publicreimbursebill".equals(entityName) || "er_prepaybill".equals(entityName) ) {//对公报销单,预付单,付款申请单,查询付款处理单
|
||||
QFilter billTypeFilter = new QFilter("sourcebilltype",QCP.equals,entityName);
|
||||
QFilter billIdFilter = new QFilter("sourcebillid",QCP.equals,Long.valueOf(billid));
|
||||
//提交司库状态 cnbm_tbskstatus,司库付款状态:cnbm_skpayresult
|
||||
dynamicObjectOrg = BusinessDataServiceHelper.load("cas_paybill", "number,cnbm_tbskstatus,cnbm_skpayresult,settletype", new QFilter[]{billTypeFilter,billIdFilter});
|
||||
} else //if ("er_dailyreimbursebill".equals(entityName) || "er_tripreimbursebill".equals(entityName))
|
||||
{//差旅报销单、费用报销单,查询代发处理单
|
||||
//代发处理 cas_agentpaybill
|
||||
//提交司库状态:cnbm_tbskstatus ,司库付款状态:cnbm_skpayresult
|
||||
//提交司库状态 cnbm_tbskstatus,司库付款状态:cnbm_skpayresult
|
||||
QFilter billTypeFilter = new QFilter("sourcebilltype",QCP.equals,entityName);
|
||||
QFilter billNumberFilter = new QFilter("sourcebillnumber",QCP.equals,billnumber);
|
||||
dynamicObjectOrg = BusinessDataServiceHelper.load("cas_agentpaybill", "number,cnbm_tbskstatus,cnbm_skpayresult,settletype", new QFilter[]{billTypeFilter,billNumberFilter});
|
||||
}
|
||||
|
||||
if (dynamicObjectOrg != null && dynamicObjectOrg.length > 0) {
|
||||
for (DynamicObject dynamicObject : dynamicObjectOrg) {
|
||||
String tbskstatus = dynamicObject.getString("cnbm_tbskstatus");
|
||||
String skpayresult = dynamicObject.getString("cnbm_skpayresult");
|
||||
DynamicObject settletype = dynamicObject.getDynamicObject("settletype");
|
||||
if (settletype != null) {//没有选择结算方式,则跳过校验
|
||||
String settletypeNumber = settletype.getString("number");
|
||||
if("success".equals(tbskstatus) || "payed".equals(skpayresult)) {
|
||||
success = true;
|
||||
}
|
||||
if("001".equals(settletypeNumber) || "002".equals(settletypeNumber)) {
|
||||
isSk = true;
|
||||
}
|
||||
}else{
|
||||
settletypeNotNull = false;
|
||||
}
|
||||
}
|
||||
}else if(settletypeNotNull){
|
||||
//this.getView().showErrorNotification(String.format("没有下游付款处理或代发处理单,无法进行审批。"));
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("审批结算任务:【%s】没有下推付款处理或代发处理单,无法进行审批。",subject));
|
||||
return;
|
||||
}
|
||||
if(isSk && !success && settletypeNotNull){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("审批结算任务:【%s】付款处理单或代发处理单提交司库状态为同步成功或司库付款状态为已付款时,才能审批通过。",subject));
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
if(!"G".equals(billstatus)) {
|
||||
if(!"G".equals(billstatus) && !"I".equals(billstatus)) {
|
||||
if("er_repaymentbill".equals(entityName)) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("审批结算任务:【%s】的收款未完成,请完成收款后操作。",subject));
|
||||
}else if(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,195 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.entity.property.BasedataProp;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.ec.basedata.common.enums.CostControlModelEnum;
|
||||
import kd.ec.basedata.common.enums.StatusEnum;
|
||||
import kd.ec.basedata.common.utils.EcProjectHelper;
|
||||
import kd.ec.material.formplugin.MaterialOutCostMustInputEditPlugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MaterialOutCostMustInputEditPluginExt extends AbstractFormPlugin {
|
||||
|
||||
private static final List<String> cbsKeyList = (List) Stream.of("procbs", "cbs").collect(Collectors.toList());
|
||||
private static final List<String> caKeyList = (List)Stream.of("ca", "costaccount").collect(Collectors.toList());
|
||||
private static final List<String> boqKeyList = (List)Stream.of("proboq", "boq").collect(Collectors.toList());
|
||||
|
||||
public void afterBindData(EventObject e) {
|
||||
//因次方法需要调用父级的逻辑,所以需要重写当前插件
|
||||
super.afterBindData(e);
|
||||
this.controlCostMustInput();
|
||||
DynamicObject transtype = (DynamicObject)this.getModel().getValue("transtype");
|
||||
boolean impactcost = transtype == null ? false : (Boolean)transtype.get("impactcost");
|
||||
String billStatus = (String)this.getModel().getValue("billstatus");
|
||||
if (impactcost && StatusEnum.Checked.getValue().equalsIgnoreCase(billStatus)) {
|
||||
this.getView().setVisible(true, new String[]{"splitamount", "iscompleted"});
|
||||
} else {
|
||||
this.getView().setVisible(false, new String[]{"splitamount", "iscompleted"});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
if (!StringUtils.equals("project", name) && !StringUtils.equals("warehouse", name)) {
|
||||
if (StringUtils.equals("transtype", name)) {
|
||||
this.controlCostMustInput();
|
||||
this.showSplitAmount();
|
||||
} else if (StringUtils.equals("costtype", name)) {
|
||||
this.controlCostMustInput();
|
||||
} else if (StringUtils.equals("amount", name)) {
|
||||
this.onAmountChanged(e);
|
||||
}
|
||||
} else {
|
||||
this.controlCostMustInput();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void onAmountChanged(PropertyChangedArgs e) {
|
||||
BigDecimal amount = (BigDecimal)e.getChangeSet()[0].getNewValue();
|
||||
int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||
DynamicObject transType = this.getModel().getDataEntity().getDynamicObject("transtype");
|
||||
if (transType != null) {
|
||||
boolean impactcost = transType.getBoolean("impactcost");
|
||||
if (impactcost) {
|
||||
this.getModel().setValue("splitamount", amount, rowIndex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void showSplitAmount() {
|
||||
DynamicObject transType = this.getModel().getDataEntity().getDynamicObject("transtype");
|
||||
if (transType != null) {
|
||||
boolean impactcost = transType.getBoolean("impactcost");
|
||||
if (impactcost) {
|
||||
int rowCount = this.getModel().getEntryRowCount("entryentity");
|
||||
|
||||
for(int i = 0; i < rowCount; ++i) {
|
||||
BigDecimal amount = (BigDecimal)this.getModel().getValue("amount", i);
|
||||
this.getModel().setValue("splitamount", amount, i);
|
||||
}
|
||||
} else {
|
||||
int rowCount = this.getModel().getEntryRowCount("entryentity");
|
||||
|
||||
for(int i = 0; i < rowCount; ++i) {
|
||||
this.getModel().setValue("splitamount", (Object)null, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void controlCostMustInput() {
|
||||
this.clearMustInpt();
|
||||
DynamicObject transType = this.getModel().getDataEntity().getDynamicObject("transtype");
|
||||
if (transType != null) {
|
||||
boolean impactcost = transType.getBoolean("impactcost");
|
||||
if (impactcost) {
|
||||
String costType = (String)this.getModel().getValue("costtype");
|
||||
if (!StringUtils.equals("b", costType)) {
|
||||
DynamicObject project = this.getModel().getDataEntity().getDynamicObject("project");
|
||||
if (project != null) {
|
||||
List<String> modelList = EcProjectHelper.getCostControlModelList(project.getLong("id"));
|
||||
BasedataEdit basedataEdit = null;
|
||||
BasedataProp basedataProp = null;
|
||||
|
||||
for(String string : modelList) {
|
||||
if (StringUtils.equals(string, CostControlModelEnum.CBS.getValue())) {
|
||||
/*for(String cbsKey : cbsKeyList) { //移除必录
|
||||
basedataEdit = (BasedataEdit)this.getControl(cbsKey);
|
||||
basedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(cbsKey);
|
||||
if (basedataEdit != null) {
|
||||
basedataEdit.setMustInput(true);
|
||||
}
|
||||
|
||||
if (basedataProp != null) {
|
||||
basedataProp.setMustInput(true);
|
||||
}
|
||||
}*/
|
||||
} else if (StringUtils.equals(string, CostControlModelEnum.CA.getValue())) {
|
||||
for(String caKey : caKeyList) {
|
||||
basedataEdit = (BasedataEdit)this.getControl(caKey);
|
||||
basedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(caKey);
|
||||
if (basedataEdit != null) {
|
||||
basedataEdit.setMustInput(true);
|
||||
}
|
||||
|
||||
if (basedataProp != null) {
|
||||
basedataProp.setMustInput(true);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equals(string, CostControlModelEnum.BOQ.getValue())) {
|
||||
for(String boqKey : boqKeyList) {
|
||||
basedataEdit = (BasedataEdit)this.getControl(boqKey);
|
||||
basedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(boqKey);
|
||||
if (basedataEdit != null) {
|
||||
basedataEdit.setMustInput(true);
|
||||
}
|
||||
|
||||
if (basedataProp != null) {
|
||||
basedataProp.setMustInput(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearMustInpt() {
|
||||
BasedataEdit dBasedataEdit = null;
|
||||
BasedataProp dBasedataProp = null;
|
||||
|
||||
for(String cbsKey : cbsKeyList) {
|
||||
dBasedataEdit = (BasedataEdit)this.getControl(cbsKey);
|
||||
if (dBasedataEdit != null) {
|
||||
dBasedataEdit.setMustInput(false);
|
||||
}
|
||||
|
||||
dBasedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(cbsKey);
|
||||
if (dBasedataProp != null) {
|
||||
dBasedataProp.setMustInput(false);
|
||||
}
|
||||
}
|
||||
|
||||
for(String boqKey : boqKeyList) {
|
||||
dBasedataEdit = (BasedataEdit)this.getControl(boqKey);
|
||||
if (dBasedataEdit != null) {
|
||||
dBasedataEdit.setMustInput(false);
|
||||
}
|
||||
|
||||
dBasedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(boqKey);
|
||||
if (dBasedataProp != null) {
|
||||
dBasedataProp.setMustInput(false);
|
||||
}
|
||||
}
|
||||
|
||||
for(String caKey : caKeyList) {
|
||||
dBasedataEdit = (BasedataEdit)this.getControl(caKey);
|
||||
if (dBasedataEdit != null) {
|
||||
dBasedataEdit.setMustInput(false);
|
||||
}
|
||||
|
||||
dBasedataProp = (BasedataProp)this.getModel().getDataEntityType().findProperty(caKey);
|
||||
if (dBasedataProp != null) {
|
||||
dBasedataProp.setMustInput(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 出库单生产成本工序分摊校验插件
|
||||
*/
|
||||
public class MaterialoutbillProcbsCkOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
e.getFieldKeys().add("entryentity");
|
||||
e.getFieldKeys().add("entryentity.procbs");
|
||||
e.getFieldKeys().add("entryentity.zcgj_accounttype");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.getValidators().add(new ValidatorExt());
|
||||
}
|
||||
|
||||
class ValidatorExt extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
Set<String> key = new HashSet<String>();
|
||||
key.add("FL001");
|
||||
key.add("FL012");
|
||||
key.add("FL013");
|
||||
key.add("FL017");
|
||||
key.add("FL018");
|
||||
key.add("FL019");
|
||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
|
||||
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity");
|
||||
int i=0;
|
||||
for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
||||
i++;
|
||||
DynamicObject accounttype = dynamicObject.getDynamicObject("zcgj_accounttype");
|
||||
if(accounttype!=null){
|
||||
String number = accounttype.getString("number");
|
||||
if(key.contains(number)){
|
||||
DynamicObject procbs = dynamicObject.getDynamicObject("procbs");
|
||||
if(procbs==null){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("出库单明细第%d行,需要填写工序分摊!",i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplybillid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplyentryid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_boltamount");
|
||||
e.getFieldKeys().add("zcgj_isprepay");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -51,48 +52,36 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
for (int i = 0; i < entryEntityCollection.size(); i++) {
|
||||
DynamicObject entryEntity = entryEntityCollection.get(i);
|
||||
DynamicObjectCollection prepayentryCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//冲销预付分录
|
||||
int seq = 0;
|
||||
for (DynamicObject prepay : prepayentryCollection) {
|
||||
seq++;
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单冲销金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
String isprepay = dataEntity.getString("zcgj_isprepay");
|
||||
if("10".equals(isprepay)){
|
||||
if(prepayentryCollection == null || prepayentryCollection.isEmpty()){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("请录入冲销预付明细数据!"));
|
||||
}else{
|
||||
int seq = 0;
|
||||
for (DynamicObject prepay : prepayentryCollection) {
|
||||
seq++;
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单冲销金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
|
||||
for (DynamicObject dynamicObject : entryentityCollection) {
|
||||
BigDecimal thisrealpayamt = dynamicObject.getBigDecimal("thisrealpayamt");//付款申请单本次实付金额
|
||||
long pkValue = (long)dynamicObject.getPkValue();
|
||||
if(pkValue==sourceapplyentryid){
|
||||
BigDecimal zcgjYreversalamount = dynamicObject.getBigDecimal("zcgj_yreversalamount");
|
||||
zcgjYreversalamount = zcgjYreversalamount.add(boltamount);
|
||||
if(thisrealpayamt.subtract(zcgjYreversalamount).compareTo(BigDecimal.ZERO) < 0){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("冲销预付分录第%d行,冲销金额超限!",seq));
|
||||
for (DynamicObject dynamicObject : entryentityCollection) {
|
||||
BigDecimal thisrealpayamt = dynamicObject.getBigDecimal("thisrealpayamt");//付款申请单本次实付金额
|
||||
long pkValue = (long)dynamicObject.getPkValue();
|
||||
if(pkValue==sourceapplyentryid){
|
||||
BigDecimal zcgjYreversalamount = dynamicObject.getBigDecimal("zcgj_yreversalamount");
|
||||
zcgjYreversalamount = zcgjYreversalamount.add(boltamount);
|
||||
if(thisrealpayamt.subtract(zcgjYreversalamount).compareTo(BigDecimal.ZERO) < 0){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("冲销预付分录第%d行,冲销金额超限!",seq));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*DynamicObject contract = entryEntity.getDynamicObject("contract");//合同名称
|
||||
String contractNumber = null;
|
||||
if (contract != null) {
|
||||
contractNumber = contract.getString("number");//合同编号
|
||||
}
|
||||
String paymentType = entryEntity.getString("paymenttype");//支付类型
|
||||
DynamicObject settleType = entryEntity.getDynamicObject("settletype");//结算方式
|
||||
String settleTypeName = null;
|
||||
if (settleType != null) {
|
||||
settleTypeName = settleType.getString("name");//结算方式编码
|
||||
}
|
||||
String combinationKey = contractNumber + "|" + paymentType + "|" + settleTypeName;
|
||||
if (combinationIndices.containsKey(combinationKey)) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, "付款信息中一个合同不能填写多行相同的支付类型+结算方式");
|
||||
} else {
|
||||
List<Integer> indices = new ArrayList<>();
|
||||
indices.add(i);
|
||||
combinationIndices.put(combinationKey, indices);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ public class OutFinaceconfirmReversalamountOp extends AbstractOperationServicePl
|
|||
String operationKey = e.getOperationKey();
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
switch (operationKey) {
|
||||
case "submit"://提交
|
||||
case "audit"://提交
|
||||
log.info("执行OutFinaceconfirmReversalamountOp的提交操作,开始更新付款申请单付款信息分录冲销金额");
|
||||
updateInApplyReversaAmt(dataEntities, true);
|
||||
break;
|
||||
case "unsubmit"://撤销
|
||||
case "unaudit"://撤销
|
||||
log.info("执行OutFinaceconfirmReversalamountOp的撤销操作,开始更新付款申请单付款信息分录冲销金额");
|
||||
updateInApplyReversaAmt(dataEntities, false);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue