|
|
@@ -4,7 +4,6 @@ package nckd.jxccl.hr.hdm.plugin.form.transfer;
|
|
|
import kd.bos.coderule.api.CodeRuleInfo;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
-import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
|
import kd.bos.entity.QueryEntityType;
|
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
import kd.bos.form.ConfirmCallBackListener;
|
|
|
@@ -109,16 +108,37 @@ public class TransferApplyBillFormPlugin extends AbstractFormPlugin {
|
|
|
}
|
|
|
|
|
|
// 判断变更的属性是否影响调令顺序号生成
|
|
|
- List<IDataEntityProperty> dataEntityProperties = getModel().getDataEntity().getDataEntityState().GetDirtyProperties();
|
|
|
- for (IDataEntityProperty property : dataEntityProperties) {
|
|
|
- if (HRStringUtils.equalsAny(property.getName(), TransferApplyBillConstant.PLANDATE_KEY, TransferApplyBillConstant.NCKD_TRANSFERNO_KEY)) {
|
|
|
- getModel().setValue(TransferApplyBillConstant.NCKD_GEN_SERIALNO_KEY, true);
|
|
|
- break;
|
|
|
- }
|
|
|
+ DynamicObject transferApplyDy = transferApplyHelper.loadOne(String.join(",", TransferApplyBillConstant.PLANDATE_KEY, TransferApplyBillConstant.NCKD_TRANSFERNO_KEY), getModel().getValue(TransferApplyBillConstant.ID_KEY));
|
|
|
+ boolean isChange;
|
|
|
+ List<Boolean> booleanList = new ArrayList<>();
|
|
|
+ Object oldPlanDate = transferApplyDy.get(TransferApplyBillConstant.PLANDATE_KEY);
|
|
|
+ Object newPlanDate = getModel().getValue(TransferApplyBillConstant.PLANDATE_KEY);
|
|
|
+ isChange = compareValues(oldPlanDate, newPlanDate);
|
|
|
+ booleanList.add(isChange);
|
|
|
+
|
|
|
+ Object oldTransferNo = transferApplyDy.get(TransferApplyBillConstant.NCKD_TRANSFERNO_KEY);
|
|
|
+ Object newTransferNo = getModel().getValue(TransferApplyBillConstant.NCKD_TRANSFERNO_KEY);
|
|
|
+ isChange = isChange || compareValues(oldTransferNo, newTransferNo);
|
|
|
+ booleanList.add(isChange);
|
|
|
+
|
|
|
+ if (booleanList.stream().allMatch(Boolean::booleanValue)) {
|
|
|
+ getModel().setValue(TransferApplyBillConstant.NCKD_GEN_SERIALNO_KEY, true);
|
|
|
+ } else {
|
|
|
+ getModel().setValue(TransferApplyBillConstant.NCKD_GEN_SERIALNO_KEY, false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Boolean compareValues(Object newValue, Object oldValue) {
|
|
|
+ if (HRObjectUtils.isEmpty(oldValue) && HRObjectUtils.isEmpty(newValue)) {
|
|
|
+ return false;
|
|
|
+ } else if ((HRObjectUtils.isEmpty(oldValue) && !HRObjectUtils.isEmpty(newValue)) || (!HRObjectUtils.isEmpty(oldValue) && HRObjectUtils.isEmpty(newValue))) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return HRDynamicObjectUtils.compareValues(oldValue, newValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
|
|
super.afterDoOperation(afterDoOperationEventArgs);
|
|
|
@@ -127,7 +147,7 @@ public class TransferApplyBillFormPlugin extends AbstractFormPlugin {
|
|
|
switch (operateKey){
|
|
|
case TransferApplyBillConstant.SAVE_OP:
|
|
|
OperationResult operationResult = afterDoOperationEventArgs.getOperationResult();
|
|
|
- if (!operationResult.isSuccess() || operationResult.getSuccessPkIds().isEmpty() || !HRStringUtils.equals("true", getModel().getDataEntity().getString(TransferApplyBillConstant.NCKD_GEN_SERIALNO_KEY))) {
|
|
|
+ if (!operationResult.isSuccess() || operationResult.getSuccessPkIds().isEmpty() || !getModel().getDataEntity().getBoolean(TransferApplyBillConstant.NCKD_GEN_SERIALNO_KEY)) {
|
|
|
break;
|
|
|
}
|
|
|
|