收款单插件提交
This commit is contained in:
parent
a8ae352a38
commit
1067da45c0
|
|
@ -0,0 +1,138 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import shjh.jhzj7.fi.fi.plugin.form.info.RecFieldsInfo;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态表单插件-【收款处理单】
|
||||||
|
*
|
||||||
|
* @author LiGuiQiang
|
||||||
|
*/
|
||||||
|
public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterBindData(EventObject e) {
|
||||||
|
super.afterBindData(e);
|
||||||
|
this.getView().setVisible(false, RecFieldsInfo.ENTRY_CUSTOMER);
|
||||||
|
DynamicObjectCollection entry = (DynamicObjectCollection) this.getModel().getValue("entry");
|
||||||
|
if (null != entry && entry.size() != 0) {
|
||||||
|
setClosingStatus(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String fieldKey = e.getProperty().getName();
|
||||||
|
if (StringUtils.equals(fieldKey, RecFieldsInfo.CUSTOMER_SPLIT)) {
|
||||||
|
boolean result = (boolean) this.getModel().getValue(RecFieldsInfo.CUSTOMER_SPLIT);
|
||||||
|
if (result) {
|
||||||
|
handleCustomerSplitChange();
|
||||||
|
}
|
||||||
|
} else if (StringUtils.equals(fieldKey, RecFieldsInfo.ENTRY_CLOSING_STATUS)){
|
||||||
|
DynamicObjectCollection entry = this.getModel().getEntryEntity("entry");
|
||||||
|
if (null != entry && entry.size() != 0) {
|
||||||
|
setClosingStatus(entry);
|
||||||
|
}
|
||||||
|
}else if (StringUtils.equals(fieldKey, "customerf7")){
|
||||||
|
String type = (String) this.getModel().getValue(RecFieldsInfo.PAYER_TYPE);
|
||||||
|
if ("bd_customer".equals(type)){
|
||||||
|
DynamicObject customer = (DynamicObject) this.getModel().getValue(RecFieldsInfo.CUSTOMER_F7);
|
||||||
|
if (null!=customer){
|
||||||
|
//customer.getString("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleCustomerSplitChange() {
|
||||||
|
this.getView().setVisible(true, RecFieldsInfo.ENTRY_CUSTOMER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置表头清账状态
|
||||||
|
*
|
||||||
|
* @param entry 收款明细分录
|
||||||
|
*/
|
||||||
|
private void setClosingStatus(DynamicObjectCollection entry) {
|
||||||
|
// 是否包含待清账
|
||||||
|
boolean hasPendingClear = false;
|
||||||
|
// 是否包含已清账
|
||||||
|
boolean hasCleared = false;
|
||||||
|
// 是否包含反清账
|
||||||
|
boolean hasReversedClear = false;
|
||||||
|
// 是否包含无需金蝶清账
|
||||||
|
boolean hasNoClear = false;
|
||||||
|
// 是否所有分录行都是已清账
|
||||||
|
boolean allCleared = true;
|
||||||
|
// 是否所有分录行都是反清账
|
||||||
|
boolean allReversedCleared = true;
|
||||||
|
|
||||||
|
// 遍历分录行,判断清账状态
|
||||||
|
for (int i = 0; i < entry.size(); i++) {
|
||||||
|
String closingStatus = entry.get(i).getString("shjh_closingstatus");
|
||||||
|
if (null!=closingStatus){
|
||||||
|
switch (closingStatus) {
|
||||||
|
case "A":
|
||||||
|
hasNoClear = true;
|
||||||
|
break;
|
||||||
|
case "B":
|
||||||
|
hasPendingClear = true;
|
||||||
|
break;
|
||||||
|
case "C":
|
||||||
|
hasCleared = true;
|
||||||
|
// 如果有不是“已清账”的,就说明不是全部“已清账”
|
||||||
|
allCleared = false;
|
||||||
|
break;
|
||||||
|
case "D":
|
||||||
|
hasReversedClear = true;
|
||||||
|
// 如果有不是“反清账”的,就说明不是全部“反清账”
|
||||||
|
allReversedCleared = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断部分清账的条件:包含已清账但不全是已清账,并且不包含反清账
|
||||||
|
boolean isPartialCleared = hasCleared && !allCleared && !hasReversedClear;
|
||||||
|
|
||||||
|
// 判断部分反清账的条件:包含反清账但不全是反清账
|
||||||
|
boolean isPartialReversedCleared = hasReversedClear && !allReversedCleared;
|
||||||
|
|
||||||
|
// 根据分录行状态来设置表头清账状态
|
||||||
|
String headerStatus = "";
|
||||||
|
|
||||||
|
if (hasNoClear && !hasPendingClear && !hasCleared && !hasReversedClear) {
|
||||||
|
headerStatus = "A";
|
||||||
|
} else if (hasPendingClear && !hasCleared && !hasReversedClear) {
|
||||||
|
headerStatus = "B";
|
||||||
|
} else if (hasCleared && !hasReversedClear && !hasPendingClear) {
|
||||||
|
headerStatus = "C";
|
||||||
|
} else if (hasReversedClear && !hasPendingClear && !hasCleared) {
|
||||||
|
headerStatus = "D";
|
||||||
|
} else if (isPartialCleared) {
|
||||||
|
// 部分清账的条件
|
||||||
|
headerStatus = "E";
|
||||||
|
} else if (isPartialReversedCleared) {
|
||||||
|
// 部分反清账的条件
|
||||||
|
headerStatus = "F";
|
||||||
|
}else {
|
||||||
|
headerStatus = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置表头清账状态
|
||||||
|
this.getModel().setValue("shjh_qzzt", headerStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue