2.外销合同变更单删除行效验
This commit is contained in:
ljw 2024-11-07 15:14:38 +08:00
parent ce129ac8e0
commit f85526f6e5

View File

@ -1,9 +1,11 @@
package com.yem.wm.es.xsalesorder.from; package com.yem.wm.es.xsalesorder.from;
import com.yem.wm.utils.DynamicObjectUtil;
import com.yem.wm.utils.FunctionalCommon; import com.yem.wm.utils.FunctionalCommon;
import com.yem.wm.utils.YEM; import com.yem.wm.utils.YEM;
import kd.bos.bill.AbstractBillPlugIn; import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.botp.runtime.BFRow; import kd.bos.entity.botp.runtime.BFRow;
import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.RowDataEntity; import kd.bos.entity.datamodel.RowDataEntity;
@ -92,12 +94,32 @@ public class XSalesOrderFromEdit extends AbstractBillPlugIn {
if ("yem_es_materialinfo".equals(name)) { if ("yem_es_materialinfo".equals(name)) {
for(int rowIndex : rowIndexs){ for(int rowIndex : rowIndexs){
Long yem_sourceentryid = (Long)model.getValue("yem_sourceentryid",rowIndex); Long yem_sourceentryid = (Long)model.getValue("yem_sourceentryid",rowIndex);
List<BFRow> loadSourceRowIds = BFTrackerServiceHelper.loadSourceRowIds("yem_es_salesorder", name,new Long[]{yem_sourceentryid} ); // List<BFRow> loadSourceRowIds = BFTrackerServiceHelper.loadSourceRowIds("yem_es_salesorder", name,new Long[]{yem_sourceentryid} );
List<BFRow> loadTargetRowIds = BFTrackerServiceHelper.loadTargetRowIds("yem_es_salesorder", name,new Long[]{yem_sourceentryid} ); // List<BFRow> loadTargetRowIds = BFTrackerServiceHelper.loadTargetRowIds("yem_es_salesorder"
if(loadTargetRowIds.size() > 0) { // , name,new Long[]{(long)model.getValue("yem_masterid")},new Long[]{yem_sourceentryid} ,null);
e.setCancel(true);//阻断增行 String selectfield = DynamicObjectUtil.getSelectfields("yem_es_salesorder", false);
view.showTipNotification("该分录已存在下游,禁止删除。"); String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_es_salesorder", "yem_es_materialinfo", false);
DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", selectfields
, new QFilter[]{new QFilter("id", QCP.equals, model.getValue("yem_masterid"))});
if (loadSingle!=null) {
DynamicObjectCollection yemEsMaterialinfo = loadSingle.getDynamicObjectCollection("yem_es_materialinfo");
if (!yemEsMaterialinfo.isEmpty()){
for (DynamicObject dynamicObject : yemEsMaterialinfo) {
long aLong = dynamicObject.getLong("id");
if (aLong == yem_sourceentryid){
String yemIntauditbusano = dynamicObject.getString("yem_intauditbusano");
if (!"".equals(yemIntauditbusano)){
e.setCancel(true);//阻断增行
view.showTipNotification(""+(rowIndex+1)+"行分录已存在下游,禁止删除。");
}
}
}
}
} }
// if(loadTargetRowIds.size() > 0) {
// e.setCancel(true);//阻断增行
// view.showTipNotification("该分录已存在下游,禁止删除。");
// }
} }
} }
} }