Merge branch 'dev-ljw' into test
This commit is contained in:
commit
26dd984ff8
@ -0,0 +1,26 @@
|
||||
package com.yem.wm.im.transportCosts.Op;
|
||||
|
||||
import com.yem.wm.im.transferorder.vaildator.TransFerOrderSubmitMustInputValidator;
|
||||
import com.yem.wm.im.transportCosts.validator.TransportCostsSaveValidator;
|
||||
import com.yem.wm.utils.DynamicObjectUtil;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
/**
|
||||
* @author ljw
|
||||
* @date 2024/8/31 15:54
|
||||
* @description TransportCostsSaveOp
|
||||
*/
|
||||
public class TransportCostsSaveOp extends AbstractOperationServicePlugIn {
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.addValidator(new TransportCostsSaveValidator());
|
||||
}
|
||||
}
|
@ -6,19 +6,14 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.bos.form.control.Control;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||
import kd.bos.ksql.util.StringUtil;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 装箱核算运输费用
|
||||
@ -102,7 +97,50 @@ public class TransportCostsFormPlugIn extends AbstractBillPlugIn implements Befo
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "yem_from":
|
||||
yemFrom(e);
|
||||
break;
|
||||
case"yem_reach":
|
||||
yemReach(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 至不允许小于等于从
|
||||
* @param e
|
||||
*/
|
||||
private void yemReach(PropertyChangedArgs e) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (rowIndex - 1 < 0) {
|
||||
return;
|
||||
}
|
||||
int parentRowIndex = changeData.getParentRowIndex();
|
||||
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
|
||||
DynamicObjectCollection yemBdLogistics = this.getModel().getEntryEntity("yem_bd_logistics");
|
||||
BigDecimal bigDecimal = yemBdLogistics.get(parentRowIndex).getDynamicObjectCollection("yem_subentryentity").get(rowIndex - 1).getBigDecimal("yem_from");
|
||||
if (bigDecimal.compareTo(newValue) >= 0) {
|
||||
this.getView().showMessage("!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从不能小于前一行的至
|
||||
* @param e
|
||||
*/
|
||||
private void yemFrom(PropertyChangedArgs e) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
if (rowIndex - 1 < 0) {
|
||||
return;
|
||||
}
|
||||
int parentRowIndex = changeData.getParentRowIndex();
|
||||
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
|
||||
DynamicObjectCollection yemBdLogistics = this.getModel().getEntryEntity("yem_bd_logistics");
|
||||
BigDecimal bigDecimal = yemBdLogistics.get(parentRowIndex).getDynamicObjectCollection("yem_subentryentity").get(rowIndex - 1).getBigDecimal("yem_reach");
|
||||
if (bigDecimal.compareTo(newValue) > 0) {
|
||||
this.getView().showMessage("!!!!");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.yem.wm.im.transportCosts.validator;
|
||||
|
||||
import com.yem.wm.utils.DynamicObjectUtil;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
/**
|
||||
* @author ljw
|
||||
* @date 2024/8/31 16:11
|
||||
* @description TransportCostsSaveValidator
|
||||
*/
|
||||
public class TransportCostsSaveValidator extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject eDataEntity = extendedDataEntity.getDataEntity();
|
||||
DynamicObjectCollection dynamicObjectCollection = eDataEntity.getDynamicObjectCollection("yem_bd_logistics");
|
||||
long aLong = eDataEntity.getLong("id");
|
||||
for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
||||
DynamicObject yemShippingmethod = dynamicObject.getDynamicObject("yem_shippingmethod");
|
||||
DynamicObject yemExpenseitems = dynamicObject.getDynamicObject("yem_expenseitems");
|
||||
DynamicObject yemPort = dynamicObject.getDynamicObject("yem_port");
|
||||
QFilter qFilter = new QFilter("id", QCP.not_equals, aLong);
|
||||
if (yemExpenseitems!=null){
|
||||
long yem_expenseitems = yemExpenseitems.getLong("id");
|
||||
qFilter.and("yem_bd_logistics.yem_expenseitems.id", QCP.equals, yem_expenseitems);
|
||||
}else {
|
||||
this.addMessage(extendedDataEntity,"费用项目不允许为空");
|
||||
return;
|
||||
}
|
||||
if (yemPort!=null){
|
||||
long yem_port = yemPort.getLong("id");
|
||||
qFilter.and("yem_bd_logistics.yem_port.id", QCP.equals, yem_port);
|
||||
}else {
|
||||
this.addMessage(extendedDataEntity,"运输方式不允许为空");
|
||||
return;
|
||||
}
|
||||
if (yemShippingmethod!=null){
|
||||
long yem_padexpense = yemShippingmethod.getLong("id");
|
||||
qFilter.and("yem_bd_logistics.yem_shippingmethod.id", QCP.equals, yem_padexpense);
|
||||
}else {
|
||||
this.addMessage(extendedDataEntity,"港口不允许为空");
|
||||
return;
|
||||
}
|
||||
String selectfield = DynamicObjectUtil.getSelectfields("yem_bd_transportcosts", false);
|
||||
String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_bd_transportcosts", "yem_bd_logistics", false);
|
||||
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle("yem_bd_transportcosts", selectfields, new QFilter[]{qFilter});
|
||||
if (dynamicObject1 != null) {
|
||||
this.addMessage(extendedDataEntity,"运输方式+费用项目+港口唯一");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user