采购申请字段过滤逻辑加仓库修改后清空采购申请字段逻辑添加
This commit is contained in:
parent
3e9c202d7f
commit
6833840038
|
@ -14,9 +14,14 @@ import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.*;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.events.ClosedCallBackEvent;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.RefBillEdit;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.orm.query.QCP;
|
||||
|
@ -33,15 +38,14 @@ import java.util.stream.Collectors;
|
|||
* 入库单表单插件
|
||||
* 说明:1:入库单点击选择采购申请按钮后弹出对应采购申请分录内容,后通过选择弹出的采购申请分录行赋值给入库单中
|
||||
* 2:采购申请字段内容修改后清空分录
|
||||
* 3:采购申请字段过滤逻辑加仓库修改后清空采购申请字段
|
||||
*/
|
||||
public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
FormOperate operate = (FormOperate) args.getSource();
|
||||
if ("purchaseapply".equals(operate.getOperateKey())) {
|
||||
//选择采购申请单
|
||||
this.doPurchaseApply();
|
||||
}
|
||||
public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
RefBillEdit purchaseApply = getView().getControl("zcgj_purchaseapply");//采购申请
|
||||
purchaseApply.addBeforeF7SelectListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +53,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
super.propertyChanged(e);
|
||||
String key = e.getProperty().getName();
|
||||
if ("zcgj_purchaseapply".equals(key)) {
|
||||
//采购申请
|
||||
ChangeData[] changeSet = e.getChangeSet();
|
||||
ChangeData changeData = changeSet[0];
|
||||
Object newValue = changeData.getNewValue();//新值
|
||||
|
@ -72,6 +77,67 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
entryCollection.clear();
|
||||
this.getView().updateView("entryentity");//刷新分录
|
||||
}
|
||||
} else if ("warehouse".equals(key)) {
|
||||
//仓库
|
||||
this.getModel().setValue("zcgj_purchaseapply", null);//清空采购申请单字段
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||
String propertyName = beforeF7SelectEvent.getProperty().getName();
|
||||
Object project = this.getModel().getValue("project");//项目
|
||||
if (project != null) {
|
||||
DynamicObject project1 = (DynamicObject) project;
|
||||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
List<QFilter> qFilters = new ArrayList<>();
|
||||
qFilters.add(new QFilter("project.id", QCP.in, project1.get("id")));
|
||||
formShowParameter.getListFilterParameter().setQFilters(qFilters);
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
FormOperate operate = (FormOperate) args.getSource();
|
||||
if ("purchaseapply".equals(operate.getOperateKey())) {
|
||||
//选择采购申请单
|
||||
this.doPurchaseApply();
|
||||
}
|
||||
}
|
||||
|
||||
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||
super.closedCallBack(closedCallBackEvent);
|
||||
String actionId = closedCallBackEvent.getActionId();
|
||||
DynamicObjectCollection returnDataCollection = (DynamicObjectCollection) closedCallBackEvent.getReturnData();
|
||||
if (returnDataCollection == null) {
|
||||
return;
|
||||
}
|
||||
if ("zcgj_selectpurchaseapply".equals(actionId) && returnDataCollection.size() > 0) {
|
||||
for (DynamicObject returnData : returnDataCollection) {
|
||||
int curIndex = this.getModel().createNewEntryRow("entryentity");
|
||||
this.getModel().updateCache();
|
||||
this.getView().setEnable(false, curIndex, new String[]{"oftaxamount", "notaxamount", "taxamount", "taxprice"});
|
||||
|
||||
long zcgj_bigintfield = returnData.getLong("zcgj_bigintfield");//采购申请单id
|
||||
QFilter filter = new QFilter("purchaseentry.id", QCP.equals, zcgj_bigintfield);
|
||||
DynamicObjectCollection purchaseApply = QueryServiceHelper.query("ecma_purchaseapply",
|
||||
"purchaseentry,purchaseentry.material,purchaseentry.purchaseqty,purchaseentry.entrytaxrate,purchaseentry.price,purchaseentry.id,purchaseentry.remarks,purchaseentry.zcgj_incount",
|
||||
new QFilter[]{filter});//采购申请单
|
||||
|
||||
long material = purchaseApply.get(0).getLong("purchaseentry.material");//采购申请分录-资源编码
|
||||
BigDecimal purchaseQty = (BigDecimal) purchaseApply.get(0).get("purchaseentry.purchaseqty");//采购申请分录-采购数量
|
||||
BigDecimal zcgj_inCount = (BigDecimal) purchaseApply.get(0).get("purchaseentry.zcgj_incount");//采购申请分录-已入库数量
|
||||
Object entryTaxRate = purchaseApply.get(0).get("purchaseentry.entrytaxrate");//采购申请分录-税率
|
||||
Object price = purchaseApply.get(0).get("purchaseentry.price");//采购申请分录-预估单价
|
||||
Object purchaseEntryId = purchaseApply.get(0).get("purchaseentry.id");//采购申请分录-预估单价
|
||||
Object remarks = purchaseApply.get(0).get("purchaseentry.remarks");//采购申请分录-备注
|
||||
this.getModel().setValue("material", material, curIndex);//资源编码
|
||||
this.getModel().setValue("entrytaxrate", entryTaxRate, curIndex);//税率名称
|
||||
this.getModel().setValue("qty", purchaseQty.subtract(zcgj_inCount), curIndex);//数量
|
||||
this.getModel().setValue("price", price, curIndex);//入库单价
|
||||
this.getModel().setValue("listingid", purchaseEntryId, curIndex);//合同清单id
|
||||
this.getModel().setValue("note", remarks, curIndex);//备注
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,40 +200,4 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
this.getView().showForm(formShowParameter);
|
||||
}
|
||||
}
|
||||
|
||||
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||
super.closedCallBack(closedCallBackEvent);
|
||||
String actionId = closedCallBackEvent.getActionId();
|
||||
DynamicObjectCollection returnDataCollection = (DynamicObjectCollection) closedCallBackEvent.getReturnData();
|
||||
if (returnDataCollection == null) {
|
||||
return;
|
||||
}
|
||||
if ("zcgj_selectpurchaseapply".equals(actionId) && returnDataCollection.size() > 0) {
|
||||
for (DynamicObject returnData : returnDataCollection) {
|
||||
int curIndex = this.getModel().createNewEntryRow("entryentity");
|
||||
this.getModel().updateCache();
|
||||
this.getView().setEnable(false, curIndex, new String[]{"oftaxamount", "notaxamount", "taxamount", "taxprice"});
|
||||
|
||||
long zcgj_bigintfield = returnData.getLong("zcgj_bigintfield");//采购申请单id
|
||||
QFilter filter = new QFilter("purchaseentry.id", QCP.equals, zcgj_bigintfield);
|
||||
DynamicObjectCollection purchaseApply = QueryServiceHelper.query("ecma_purchaseapply",
|
||||
"purchaseentry,purchaseentry.material,purchaseentry.purchaseqty,purchaseentry.entrytaxrate,purchaseentry.price,purchaseentry.id,purchaseentry.remarks,purchaseentry.zcgj_incount",
|
||||
new QFilter[]{filter});//采购申请单
|
||||
|
||||
long material = purchaseApply.get(0).getLong("purchaseentry.material");//采购申请分录-资源编码
|
||||
BigDecimal purchaseQty = (BigDecimal) purchaseApply.get(0).get("purchaseentry.purchaseqty");//采购申请分录-采购数量
|
||||
BigDecimal zcgj_inCount = (BigDecimal) purchaseApply.get(0).get("purchaseentry.zcgj_incount");//采购申请分录-已入库数量
|
||||
Object entryTaxRate = purchaseApply.get(0).get("purchaseentry.entrytaxrate");//采购申请分录-税率
|
||||
Object price = purchaseApply.get(0).get("purchaseentry.price");//采购申请分录-预估单价
|
||||
Object purchaseEntryId = purchaseApply.get(0).get("purchaseentry.id");//采购申请分录-预估单价
|
||||
Object remarks = purchaseApply.get(0).get("purchaseentry.remarks");//采购申请分录-备注
|
||||
this.getModel().setValue("material", material, curIndex);//资源编码
|
||||
this.getModel().setValue("entrytaxrate", entryTaxRate, curIndex);//税率名称
|
||||
this.getModel().setValue("qty", purchaseQty.subtract(zcgj_inCount), curIndex);//数量
|
||||
this.getModel().setValue("price", price, curIndex);//入库单价
|
||||
this.getModel().setValue("listingid", purchaseEntryId, curIndex);//合同清单id
|
||||
this.getModel().setValue("note", remarks, curIndex);//备注
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue