二开系统插件标记
This commit is contained in:
parent
077a42523f
commit
e9458c36d9
|
@ -0,0 +1,143 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.Search;
|
||||
import kd.bos.form.control.events.SearchEnterEvent;
|
||||
import kd.bos.form.control.events.SearchEnterListener;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
/**
|
||||
* 领料申请单物料列表,动态表单
|
||||
*/
|
||||
public class MaterialApplyEntryUIPluginExt extends AbstractFormPlugin implements SearchEnterListener {
|
||||
public MaterialApplyEntryUIPluginExt() {
|
||||
}
|
||||
|
||||
public void beforeBindData(EventObject e) {
|
||||
super.beforeBindData(e);
|
||||
this.refreshEntryEntity((String)null);
|
||||
}
|
||||
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
Search searchAp = (Search)this.getView().getControl("searchap");
|
||||
searchAp.addEnterListener(this);
|
||||
}
|
||||
|
||||
public void search(SearchEnterEvent paramSearchEnterEvent) {
|
||||
Search search = (Search)paramSearchEnterEvent.getSource();
|
||||
String searchText = paramSearchEnterEvent.getText();
|
||||
if (StringUtils.equals("searchap", search.getKey())) {
|
||||
this.refreshEntryEntity(searchText.trim());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
FormOperate formOperate = (FormOperate)args.getSource();
|
||||
String operateName = formOperate.getOperateKey();
|
||||
EntryGrid entryGrid = (EntryGrid)this.getControl("entryentity");
|
||||
int[] selectRows = entryGrid.getSelectRows();
|
||||
switch (operateName) {
|
||||
case "confirm":
|
||||
List<Long> applyEntryIdList = new ArrayList();
|
||||
|
||||
for(int i = 0; i < selectRows.length; ++i) {
|
||||
DynamicObject entry = this.getModel().getEntryRowEntity("entryentity", selectRows[i]);
|
||||
applyEntryIdList.add((Long)entry.get("applyentryid"));
|
||||
}
|
||||
|
||||
Map<String, Object> returnData = new HashMap();
|
||||
returnData.put("applyEntryIdList", applyEntryIdList);
|
||||
this.getView().returnDataToParent(returnData);
|
||||
this.getView().invokeOperation("close");
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshEntryEntity(String searchText) {
|
||||
Map<String, Object> params = this.getView().getFormShowParameter().getCustomParams();
|
||||
Object applyBillIdObject = params.get("applyBillId");
|
||||
Object selectedEntryIdObject = params.get("selectedEntryId");
|
||||
if (applyBillIdObject != null) {
|
||||
Long applyBillId = (Long)applyBillIdObject;
|
||||
List<Long> selectedApplyEntryIdList = new ArrayList();
|
||||
if (selectedEntryIdObject != null) {
|
||||
String applyEntryIdString = (String)selectedEntryIdObject;
|
||||
String[] applyEntryIdStringArr = applyEntryIdString.split(",");
|
||||
String[] var9 = applyEntryIdStringArr;
|
||||
int var10 = applyEntryIdStringArr.length;
|
||||
|
||||
for(int var11 = 0; var11 < var10; ++var11) {
|
||||
String item = var9[var11];
|
||||
if (StringUtils.isNotEmpty(item)) {
|
||||
selectedApplyEntryIdList.add(Long.parseLong(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObject applyBill = BusinessDataServiceHelper.loadSingle(applyBillId, "ecma_materialapplybill");
|
||||
this.getModel().setValue("currency", applyBill.getDynamicObject("currency"));
|
||||
DynamicObjectCollection applyEntries = applyBill.getDynamicObjectCollection("entryentity");
|
||||
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entryentity");
|
||||
entryEntity.clear();
|
||||
DynamicObjectType entryDt = entryEntity.getDynamicObjectType();
|
||||
Iterator var23 = applyEntries.iterator();
|
||||
|
||||
while(true) {
|
||||
Long id;
|
||||
BigDecimal restQty;
|
||||
String materialNumber;
|
||||
String materialName;
|
||||
DynamicObject entry;
|
||||
do {
|
||||
do {
|
||||
do {
|
||||
if (!var23.hasNext()) {
|
||||
this.getModel().updateEntryCache(entryEntity);
|
||||
this.getView().updateView("entryentity");
|
||||
return;
|
||||
}
|
||||
|
||||
entry = (DynamicObject)var23.next();
|
||||
id = (Long)entry.getPkValue();
|
||||
restQty = entry.getBigDecimal("restqty");
|
||||
DynamicObject material = entry.getDynamicObject("material");
|
||||
materialNumber = material.getString("number");
|
||||
materialName = material.getString("name");
|
||||
} while(selectedApplyEntryIdList.contains(id));
|
||||
} while(restQty.compareTo(BigDecimal.ZERO) == 0);
|
||||
} while(StringUtils.isNotEmpty(searchText) && !materialNumber.contains(searchText) && !materialName.contains(searchText));
|
||||
|
||||
DynamicObject newEntry = new DynamicObject(entryDt);
|
||||
newEntry.set("applyentryid", id);
|
||||
newEntry.set("material", entry.get("material"));
|
||||
newEntry.set("modelnum", entry.get("modelnum"));
|
||||
newEntry.set("lotid", entry.get("lotid"));
|
||||
newEntry.set("realoutqty", entry.get("realoutqty"));
|
||||
newEntry.set("price", entry.get("price"));
|
||||
newEntry.set("amount", entry.get("amount"));
|
||||
entryEntity.add(newEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue