工序成本预算单据调整操作修改需选范围操作数据(测试
This commit is contained in:
parent
1fd14197ff
commit
00b4dd02ee
|
@ -0,0 +1,114 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.EntityMetadataCache;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.form.CloseCallBack;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.events.ClosedCallBackEvent;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.list.BillList;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.ec.basedata.common.enums.StatusEnum;
|
||||
import kd.ec.contract.common.utils.TypeUtils;
|
||||
import kd.ec.cost.formplugin.AbstractEccoListPlugin;
|
||||
import org.apache.commons.collections4.map.HashedMap;
|
||||
|
||||
public class AimcostcbsbillListPluginExt extends AbstractEccoListPlugin {
|
||||
private static final String KEY_DOREFRESH = "refresh";
|
||||
private static final String CALLBACKID_REFRESHBACK = "refreshcallback";
|
||||
|
||||
public AimcostcbsbillListPluginExt() {
|
||||
}
|
||||
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
FormOperate operate = (FormOperate)args.getSource();
|
||||
String operateKey = operate.getOperateKey();
|
||||
BillList billList = (BillList)this.getControl("billlistap");
|
||||
ListSelectedRowCollection selectedRows = billList.getSelectedRows();
|
||||
Object[] aimcostcbsPks = null;
|
||||
if (selectedRows != null && !selectedRows.isEmpty()) {
|
||||
aimcostcbsPks = new Object[selectedRows.size()];
|
||||
|
||||
for(int i = 0; i < selectedRows.size(); ++i) {
|
||||
aimcostcbsPks[i] = selectedRows.get(i).getPrimaryKeyValue();
|
||||
}
|
||||
}
|
||||
|
||||
if ("adjust".equals(operateKey)) {
|
||||
this.doAdjust(aimcostcbsPks);
|
||||
} else if ("summaryall".equals(operateKey)) {
|
||||
this.summaryAllBill(aimcostcbsPks);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void summaryAllBill(Object[] aimcostcbsPks) {
|
||||
if (aimcostcbsPks != null && aimcostcbsPks.length == 1) {
|
||||
DynamicObject obj = BusinessDataServiceHelper.loadSingle(aimcostcbsPks[0], "ecco_aimcostbillcbs");
|
||||
DynamicObject project = obj.getDynamicObject("project");
|
||||
FormShowParameter parameter = new FormShowParameter();
|
||||
parameter.setFormId("ecco_projecttotalbudget");
|
||||
parameter.setCustomParam("projectId", project != null ? project.getPkValue() : null);
|
||||
parameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||
this.getView().showForm(parameter);
|
||||
} else {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请选择单条预算后查看。", "AimcostcbsbillListPlugin_0", "ec-ecco-formplugin", new Object[0]));
|
||||
}
|
||||
}
|
||||
|
||||
protected void doAdjust(Object[] aimcostcbsPks) {
|
||||
if (aimcostcbsPks != null && aimcostcbsPks.length != 1) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请选中1条已审核的记录。", "AimcostcbsbillListPlugin_1", "ec-ecco-formplugin", new Object[0]));
|
||||
} else {
|
||||
DynamicObject[] aimcostcbsInfos = BusinessDataServiceHelper.load(aimcostcbsPks, EntityMetadataCache.getDataEntityType("ecco_aimcostbillcbs"));
|
||||
if (!StatusEnum.Checked.value.equalsIgnoreCase(TypeUtils.nullToString(aimcostcbsInfos[0].get("billstatus")))) {
|
||||
this.getView().showTipNotification(String.format(ResManager.loadKDString("只有已审核状态的数据才能调整,请重新选择:%s", "AimcostcbsbillListPlugin_2", "ec-ecco-formplugin", new Object[0]), aimcostcbsInfos[0].get("name")));
|
||||
} else {
|
||||
QFilter filter = new QFilter("versionno", ">", aimcostcbsInfos[0].get("versionno"));
|
||||
filter.and(new QFilter("zcgj_periodyear", "=", aimcostcbsInfos[0].get("zcgj_periodyear")));
|
||||
filter.and(new QFilter("project", "=", aimcostcbsInfos[0].getDynamicObject("project").getPkValue()));
|
||||
if (aimcostcbsInfos[0].get("unitproject") != null) {
|
||||
filter.and(new QFilter("unitproject", "=", aimcostcbsInfos[0].getDynamicObject("unitproject").getPkValue()));
|
||||
} else {
|
||||
filter.and(new QFilter("unitproject", "=", 0));
|
||||
}
|
||||
|
||||
DynamicObject[] gaobanbens = BusinessDataServiceHelper.load("ecco_aimcostbillcbs", "id", new QFilter[]{filter});
|
||||
if (gaobanbens.length > 0) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请在最新的版本上进行调整或编辑。", "AimcostcbsbillListPlugin_3", "ec-ecco-formplugin", new Object[0]));
|
||||
} else {
|
||||
HashedMap<String, Object> map = new HashedMap();
|
||||
map.put("formId", "ecco_aimcostbillcbs");
|
||||
map.put("projectId", aimcostcbsInfos[0].getDynamicObject("project").getPkValue());
|
||||
map.put("isadjust", true);
|
||||
map.put("oldInfoid", aimcostcbsInfos[0].getPkValue());
|
||||
FormShowParameter showParameter = FormShowParameter.createFormShowParameter(map);
|
||||
showParameter.setStatus(OperationStatus.ADDNEW);
|
||||
showParameter.setCloseCallBack(new CloseCallBack(this, "refreshcallback"));
|
||||
showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
||||
this.getView().showForm(showParameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||
super.closedCallBack(closedCallBackEvent);
|
||||
if (StringUtils.equals(closedCallBackEvent.getActionId(), "refreshcallback")) {
|
||||
this.getView().invokeOperation("refresh");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue