Compare commits
No commits in common. "97dd88085d005064f0cf8ac5b26e5dfd41c7a3d6" and "a6674f5a2cf4fcdf36ddc9133124ee6b042db564" have entirely different histories.
97dd88085d
...
a6674f5a2c
|
@ -23,7 +23,6 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.QueryServiceHelper;
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -49,27 +48,15 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
||||||
HashMap<String, Object> paramters = new HashMap<>();
|
HashMap<String, Object> paramters = new HashMap<>();
|
||||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//入库单分录
|
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
List<Long> entryIds = new ArrayList<>();
|
List<Long> entryIds = new ArrayList<>();
|
||||||
// List<Long> entryIds2 = new ArrayList<>();
|
List<Long> entryIds2 = new ArrayList<>();
|
||||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
Long entryEntityId = entryEntity.getLong("listingid");//合同清单id
|
Long entryEntityId = entryEntity.getLong("listingid");//合同清单id
|
||||||
entryIds.add(entryEntityId);
|
entryIds.add(entryEntityId);
|
||||||
// entryIds2.add(entryEntityId);
|
entryIds2.add(entryEntityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
long purchaseApplyId = purchaseApply.getLong("id");//采购申请单id
|
long purchaseApplyId = purchaseApply.getLong("id");//采购申请单id
|
||||||
QFilter[] qFilter = new QFilter[]{new QFilter("id", QCP.equals, purchaseApplyId)};
|
QFilter[] qFilte = new QFilter[]{new QFilter("zcgj_purchaseapply.id", QCP.equals, purchaseApplyId)};
|
||||||
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
|
|
||||||
"purchaseentry,purchaseentry.purchaseqty,purchaseentry.zcgj_incount,purchaseentry.id", qFilter);//采购申请单
|
|
||||||
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
|
||||||
for (DynamicObject purchaseEntry : purchaseEntryCollection) {
|
|
||||||
BigDecimal purchaseQty = purchaseEntry.getBigDecimal("purchaseqty");//采购数量
|
|
||||||
BigDecimal zcgj_inCount = purchaseEntry.getBigDecimal("zcgj_incount");//已入库数量
|
|
||||||
if (purchaseQty.compareTo(zcgj_inCount) == 0) {
|
|
||||||
long purchaseEntryId = purchaseEntry.getLong("id");
|
|
||||||
entryIds.add(purchaseEntryId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* QFilter[] qFilte = new QFilter[]{new QFilter("zcgj_purchaseapply.id", QCP.equals, purchaseApplyId)};
|
|
||||||
DynamicObject[] ecma_materialInBills = BusinessDataServiceHelper.load("ecma_materialinbill","entryentity,entryentity.listingid", qFilte);//入库单
|
DynamicObject[] ecma_materialInBills = BusinessDataServiceHelper.load("ecma_materialinbill","entryentity,entryentity.listingid", qFilte);//入库单
|
||||||
for (DynamicObject materialInBill : ecma_materialInBills) {
|
for (DynamicObject materialInBill : ecma_materialInBills) {
|
||||||
DynamicObjectCollection entryEntityCollection1 = materialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
DynamicObjectCollection entryEntityCollection1 = materialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
@ -82,7 +69,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
||||||
}
|
}
|
||||||
entryIds.add(entryEntityId);
|
entryIds.add(entryEntityId);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
paramters.put("purchaseApplyId", purchaseApplyId);
|
paramters.put("purchaseApplyId", purchaseApplyId);
|
||||||
paramters.put("entryIds", entryIds);
|
paramters.put("entryIds", entryIds);
|
||||||
formShowParameter.setCustomParams(paramters);
|
formShowParameter.setCustomParams(paramters);
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
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 kd.bos.orm.query.QFilter;
|
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入库单审核操作插件:校验是否合计数量超过采购申请单数量
|
|
||||||
*/
|
|
||||||
public class MaterialInbValidatorAuditOp extends AbstractOperationServicePlugIn {
|
|
||||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
||||||
super.onPreparePropertys(e);
|
|
||||||
e.getFieldKeys().add("matinsource");
|
|
||||||
e.getFieldKeys().add("zcgj_purchaseapply");
|
|
||||||
e.getFieldKeys().add("entryentity");
|
|
||||||
e.getFieldKeys().add("listingid");
|
|
||||||
e.getFieldKeys().add("qty");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
|
||||||
super.onAddValidators(e);
|
|
||||||
e.getValidators().add(new ValidatorExt());
|
|
||||||
}
|
|
||||||
|
|
||||||
class ValidatorExt extends AbstractValidator {
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
|
||||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
|
||||||
DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
|
|
||||||
String matInSource = ecma_MaterialInBill.getString("matinsource");//入库来源
|
|
||||||
DynamicObject zcgj_purchaseApply = ecma_MaterialInBill.getDynamicObject("zcgj_purchaseapply");//采购申请
|
|
||||||
if ("6".equals(matInSource) && zcgj_purchaseApply != null) {
|
|
||||||
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
|
|
||||||
new QFilter[]{new QFilter("id", "=", zcgj_purchaseApply.getLong("id"))});//采购申请单
|
|
||||||
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
|
||||||
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
|
||||||
for (int i = 0; i < entryEntityCollection.size(); i++) {
|
|
||||||
DynamicObject entryEntity = entryEntityCollection.get(i);
|
|
||||||
String listingId = entryEntity.getString("listingid");//入库单分录-合同清单id
|
|
||||||
|
|
||||||
for (DynamicObject purchaseEntry : purchaseEntryCollection) {
|
|
||||||
String purchaseEntryId = purchaseEntry.getString("id");//采购明细单据体-id
|
|
||||||
if (purchaseEntryId != null && purchaseEntryId.equals(listingId)) {
|
|
||||||
BigDecimal qty = entryEntity.getBigDecimal("qty");//入库单分录-数量
|
|
||||||
BigDecimal inCount = purchaseEntry.getBigDecimal("zcgj_incount");//采购明细单据体-已入库数量
|
|
||||||
BigDecimal purchaseQty = purchaseEntry.getBigDecimal("purchaseqty");//采购明细单据体-采购数量
|
|
||||||
BigDecimal sum = qty.add(inCount);
|
|
||||||
if (sum.compareTo(purchaseQty) > 0) {
|
|
||||||
int i1 = i + 1;
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "第" + i1 + "行,填写数量大于采购申请对应的采购数量!!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,12 +2,8 @@ package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.entity.ExtendedDataEntity;
|
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
|
||||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
|
||||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
import kd.bos.entity.validate.AbstractValidator;
|
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
@ -17,7 +13,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库单审核反审核操作插件:审核、反审核时,将入库单数量反写至采购申请单
|
* 入库单保存删除插件:保存、删除时,将入库单数量反写至采购申请单
|
||||||
*/
|
*/
|
||||||
public class PurchaseReqBackWriteOp extends AbstractOperationServicePlugIn {
|
public class PurchaseReqBackWriteOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@ -39,8 +35,8 @@ public class PurchaseReqBackWriteOp extends AbstractOperationServicePlugIn {
|
||||||
//为采购申请单时反写数量
|
//为采购申请单时反写数量
|
||||||
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
|
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
|
||||||
new QFilter[]{new QFilter("id", "=", zcgj_purchaseApply.getLong("id"))});//采购申请单
|
new QFilter[]{new QFilter("id", "=", zcgj_purchaseApply.getLong("id"))});//采购申请单
|
||||||
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
|
||||||
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
||||||
|
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
String listingId = entryEntity.getString("listingid");//入库单分录-合同清单id
|
String listingId = entryEntity.getString("listingid");//入库单分录-合同清单id
|
||||||
|
|
||||||
|
@ -49,11 +45,9 @@ public class PurchaseReqBackWriteOp extends AbstractOperationServicePlugIn {
|
||||||
if (purchaseEntryId != null && purchaseEntryId.equals(listingId)) {
|
if (purchaseEntryId != null && purchaseEntryId.equals(listingId)) {
|
||||||
BigDecimal qty = entryEntity.getBigDecimal("qty");//入库单分录-数量
|
BigDecimal qty = entryEntity.getBigDecimal("qty");//入库单分录-数量
|
||||||
BigDecimal inCount = purchaseEntry.getBigDecimal("zcgj_incount");//采购明细单据体-已入库数量
|
BigDecimal inCount = purchaseEntry.getBigDecimal("zcgj_incount");//采购明细单据体-已入库数量
|
||||||
if ("audit".equals(operationKey)) {
|
if ("save".equals(operationKey)) {
|
||||||
//审核时
|
|
||||||
purchaseEntry.set("zcgj_incount", inCount.add(qty));//采购明细单据体-已入库数量
|
purchaseEntry.set("zcgj_incount", inCount.add(qty));//采购明细单据体-已入库数量
|
||||||
} else if ("unaudit".equals(operationKey)) {
|
} else {
|
||||||
//反审核时
|
|
||||||
purchaseEntry.set("zcgj_incount", inCount.subtract(qty));//采购明细单据体-已入库数量
|
purchaseEntry.set("zcgj_incount", inCount.subtract(qty));//采购明细单据体-已入库数量
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue