Merge remote-tracking branch 'orinin/main'
This commit is contained in:
commit
5bcd784a04
@ -1,15 +1,21 @@
|
||||
package com.yem.wm.es.exportpresent.validator;
|
||||
|
||||
import com.yem.wm.es.shippingdetails.util.PaymentControlUtil;
|
||||
import com.yem.wm.utils.DynamicObjectUtil;
|
||||
import com.yem.wm.utils.YEM;
|
||||
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.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.yem.wm.es.contractamtlist.util.FunUtil.getPayBills;
|
||||
import static com.yem.wm.es.contractamtlist.util.FunUtil.getShipBills;
|
||||
@ -20,8 +26,38 @@ import static com.yem.wm.es.contractamtlist.util.FunUtil.getShipBills;
|
||||
* @Created by ZZSLL
|
||||
*/
|
||||
|
||||
public class ExportPresentSubmitValidator extends AbstractValidator
|
||||
{
|
||||
public class ExportPresentSubmitValidator extends AbstractValidator {
|
||||
// @Override
|
||||
// public void validate() {
|
||||
// ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||
// for (ExtendedDataEntity data : dataEntities) {
|
||||
// DynamicObject dataEntity = data.getDataEntity();
|
||||
// // 款项类型
|
||||
// String paymenttype = dataEntity.getString("yem_paymenttype");
|
||||
//
|
||||
// // 是否见提单
|
||||
// String isladingbill = dataEntity.getString("yem_isladingbill");
|
||||
// // 收汇信息
|
||||
// DynamicObjectCollection receiveC = dataEntity.getDynamicObjectCollection("yem_es_exportpre_erf");
|
||||
// DynamicObjectCollection detailC = dataEntity.getDynamicObjectCollection("yem_es_exportpre_el");
|
||||
//
|
||||
// Set<String> salesOrder = new HashSet<>();
|
||||
// for (DynamicObject d : detailC) {
|
||||
// salesOrder.add(d.getString("yem_contractnum"));
|
||||
// }
|
||||
// String selectfields = DynamicObjectUtil.getSelectfields("yem_es_salesorder");
|
||||
// selectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_salesorder", "yem_es_salescontrac_s");
|
||||
// Map<Object, DynamicObject> orders = BusinessDataServiceHelper.loadFromCache("yem_es_salesorder", selectfields, new QFilter[]{new QFilter("billno", "in", salesOrder)});
|
||||
//
|
||||
// if ("A".equals(paymenttype)) {
|
||||
//
|
||||
// if ("A".equals(isladingbill)) {
|
||||
// prePayAmtValidator(data, orders, detailC, receiveC);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void validate()
|
||||
{
|
||||
@ -36,6 +72,79 @@ public class ExportPresentSubmitValidator extends AbstractValidator
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 0、见提单并且100%L/C,100%OA、100%DP、100%DA并且没有预收款:判断预收款项是否认领完成
|
||||
* 0、见提单并且100%L/C,100%OA、100%DP、100%DA并且有预收款:只判断预收款项是否认领完成
|
||||
* 通过或不进行1234校验
|
||||
* 1、见提单并且正常款项:判断合同是否认领完成
|
||||
* 2、见提单并且特殊款项:判断合同是否认领完成
|
||||
* 1或2通过不进行后续校验
|
||||
* 3、未件提单并且正常款项:判断合同是否认领完成
|
||||
* 4、未件提单并且特殊款项:判断合同是否认领完成
|
||||
* 3或4通过不进行后续校验
|
||||
*
|
||||
*/
|
||||
// private void prePayAmtValidator(ExtendedDataEntity data, Map<Object, DynamicObject> orders, DynamicObjectCollection detailC, DynamicObjectCollection receiveC) {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (Map.Entry<Object, DynamicObject> entry : orders.entrySet()) {
|
||||
// DynamicObject order = entry.getValue();
|
||||
// BigDecimal shipPreRapRate = PaymentControlUtil.getShipPreRapRate(order);
|
||||
// BigDecimal procPreRapRate = PaymentControlUtil.getProcPreRapRate(order);
|
||||
// // 该合同是否包含预付
|
||||
// boolean isPre = shipPreRapRate.add(procPreRapRate).compareTo(BigDecimal.ZERO) > 0;
|
||||
// DynamicObjectCollection collection = order.getDynamicObjectCollection("yem_es_salescontrac_s");
|
||||
// boolean isSpecialRapStyle = false;
|
||||
// for (DynamicObject d : collection) {
|
||||
// DynamicObject rapstyle = d.getDynamicObject("yem_rapstyle_c");
|
||||
// if (YEM.isNotEmpty(rapstyle) && "D/A JSFS08 L/C OA D/A".contains(rapstyle.getString("number"))) {
|
||||
// isSpecialRapStyle = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 合同金额
|
||||
// BigDecimal offeramount = order.getBigDecimal("yem_offeramount");
|
||||
// String billno = order.getString("billno");
|
||||
// // 合同已认领金额
|
||||
// BigDecimal climeAmt = PaymentControlUtil.getContractClimeAmt(order, "");
|
||||
// // 只判断预付款是否认领完成
|
||||
// if (isSpecialRapStyle && isPre) {
|
||||
// BigDecimal climeAmtShip = PaymentControlUtil.getContractClimeAmt(order, "D");
|
||||
// BigDecimal climeAmtProc = PaymentControlUtil.getContractClimeAmt(order, "E");
|
||||
//
|
||||
// BigDecimal climePreAmt = climeAmtShip.add(climeAmtProc);
|
||||
//
|
||||
// BigDecimal shipAmt = PaymentControlUtil.getAdvancePayment(shipPreRapRate, offeramount);
|
||||
// BigDecimal procAmt = PaymentControlUtil.getAdvancePayment(procPreRapRate, offeramount);
|
||||
//
|
||||
// BigDecimal orderPreAmt = shipAmt.add(procAmt);
|
||||
//
|
||||
// if (climePreAmt.compareTo(orderPreAmt) < 0) {
|
||||
// sb.append(String.format("合同 [ %s ] ,合同预收金额 [ %s ], 合同预收已认领金额合计 [ %s ],合同预收款未认领完成,请核对后提交!(L/C、OA、DP、DA)",
|
||||
// billno,
|
||||
// orderPreAmt.setScale(4, RoundingMode.HALF_UP).toPlainString(),
|
||||
// climePreAmt.setScale(4, RoundingMode.HALF_UP).toPlainString())).append("\r\n");
|
||||
// }
|
||||
// } else {
|
||||
// if (climeAmt.compareTo(offeramount) < 0) {
|
||||
// boolean passed = arrearsVerification(data.getDataEntity(), data, receiveC);
|
||||
// if (!passed) {
|
||||
// sb.append(String.format("合同 [ %s ] ,合同金额 [ %s ], 合同已认领金额合计 [ %s ],合同未认领完成,请核对后提交!",
|
||||
// billno,
|
||||
// offeramount.setScale(4, RoundingMode.HALF_UP).toPlainString(),
|
||||
// climeAmt.setScale(4, RoundingMode.HALF_UP).toPlainString())).append("\r\n");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (sb.length() > 0) {
|
||||
// this.addErrorMessage(data, String.valueOf(sb));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 走储备申请或者走欠条申请,但是款项未认领完成,不允许提交寄单放单
|
||||
*/
|
||||
private void arrearsVerification(DynamicObject dataEntity, ExtendedDataEntity data)
|
||||
{
|
||||
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_es_exportpre_erf");
|
||||
|
@ -38,15 +38,21 @@ public class StorgeTransToExportPresentConvert extends AbstractConvertPlugIn
|
||||
List<DynamicObject> storageTrans = (List<DynamicObject>) findByEntityKey.getValue("ConvertSource");
|
||||
Set<Long> shipIds = new HashSet();
|
||||
Set<Long> saleIds = new HashSet();
|
||||
Set<Long> st_ids = new HashSet();
|
||||
for (DynamicObject storageTran : storageTrans) {
|
||||
long id = storageTran.getLong("id");
|
||||
storageTran = BusinessDataServiceHelper.loadSingle(id, name);
|
||||
DynamicObjectCollection materialInfos = storageTran.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
// storageTran = BusinessDataServiceHelper.loadSingle(id, name);
|
||||
st_ids.add(id);
|
||||
}
|
||||
DynamicObject[] st_load = BusinessDataServiceHelper.load(name, "yem_es_materialinfo.yem_sourcebillid_d, yem_es_materialinfo.yem_corebillid_d, id, billno", new QFilter[]{new QFilter("id", "in", st_ids)});
|
||||
for (DynamicObject st : st_load) {
|
||||
DynamicObjectCollection materialInfos = st.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
for (DynamicObject materialInfo : materialInfos) {
|
||||
shipIds.add(materialInfo.getLong("yem_sourcebillid_d"));
|
||||
saleIds.add(materialInfo.getLong("yem_corebillid_d"));
|
||||
}
|
||||
}
|
||||
|
||||
Map<Long, DynamicObject> saleMap = new HashMap();
|
||||
String selectFields = DynamicObjectUtil.getSelectfields("yem_shippingdetails", false);
|
||||
DynamicObject[] shippingDetails = BusinessDataServiceHelper.load("yem_shippingdetails", selectFields,
|
||||
|
Loading…
Reference in New Issue
Block a user