Merge branch 'main' into dev-zzs

# Conflicts:
#	src/main/java/com/yem/wm/es/salesorder/validator/SaleOrdeExportisVoidValidator.java
This commit is contained in:
zzs01@yunemao.com 2024-09-09 09:20:00 +08:00
commit ae32277b96
27 changed files with 1371 additions and 62 deletions

View File

@ -20,8 +20,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: 整机发运明细表
@ -61,6 +60,8 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
Date start = filter.getDate("yem_fshipdate_start");
Date end = filter.getDate("yem_fshipdate_end");
String fisshiped = filter.getString("yem_fisshiped");
StringBuilder sb = new StringBuilder();
sb.append("1=1");
if (YEM.isNotEmpty(start)) {
@ -69,9 +70,20 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
if (YEM.isNotEmpty(end)) {
sb.append(" AND TO_DATE(yem_shipdate, 'yyyy-MM-dd') <= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(end)));
}
if (YEM.isNotEmpty(fisshiped)) {
if ("A".equals(fisshiped)) {//已发货
sb.append(" AND yem_dnbillno IS NOT NULL AND yem_dnbillno != '' ");
}
if ("B".equals(fisshiped)) {//未发货
sb.append(" AND yem_dnbillno IS NULL OR yem_dnbillno = ''");
}
}
dataSet = dataSet.where(sb.toString());
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
"CASE WHEN yem_dnbillno IS NOT NULL AND yem_dnbillno != '' THEN '是' ELSE '否' END yem_isshiped");
return dataSet;
}
@ -87,6 +99,7 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
String forderno = filter.getString("yem_forderno");
long fcustom = filter.getLong("yem_fcustom");
long fresourceno = filter.getLong("yem_fresourceno");
long producttype = filter.getLong("yem_bd_producttype");
QFilter qFilter = getBaseQFilter(new String[]{"B", "C"});
qFilter.and("yem_signconfirmstatus", "=", "A");//回签确认状态
if (YEM.isNotEmpty(forderno)) {
@ -103,6 +116,13 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
qFilter.and("yem_es_materialinfo.yem_resourcenog.id", "=", fresourceno);
}
if (producttype > 0) {
qFilter.and("yem_bd_products.id", "=", producttype);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
if (!fproducttypem.isEmpty()) {
qFilter.and("yem_bd_products.id", "IN", fproducttypem);
}
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_es_materialinfo.id main_detail_id");
selectfields.add("id main_id");
@ -110,6 +130,7 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
selectfields.add("yem_customer yem_custom");
selectfields.add("yem_currency yem_currency");
selectfields.add("yem_es_materialinfo.yem_productmodel.yem_products.id yem_product");//产品机型
selectfields.add("yem_bd_products yem_products");//产品分类
selectfields.add("yem_priceitem yem_priceitem");//价格条款-交货方式
selectfields.add("yem_es_materialinfo.yem_sapricepriceclause yem_price");//销售单价价格条款-单价
selectfields.add("yem_es_materialinfo.yem_qty yem_qty");//数量-台数

View File

@ -0,0 +1,536 @@
package com.yem.rf.salescommission;
import com.yem.tws.common1.BigDecimalUtils;
import com.yem.wm.utils.RptUtil;
import com.yem.wm.utils.YEM;
import com.yem.wm.utils.groupfunc.GroupConcatFunction;
import com.yem.wm.utils.groupfunc.GroupConcatFunctionByComma;
import com.yem.wm.utils.groupfunc.GroupTopOneFunction;
import kd.bos.algo.DataSet;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.report.AbstractReportListDataPlugin;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.ReportQueryParam;
import kd.bos.orm.ORM;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import org.apache.commons.compress.utils.Lists;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
/**
* @Description: 出口报关明细报表
* @Date: 2024/9/4 10:04
* @Created: by ZZSLL
*/
public class ExportDeclarationDetailsReportPlugin extends AbstractReportListDataPlugin {
private static final String algoKey = ExportDeclarationDetailsReportPlugin.class.getName();
@Override
public DataSet query(ReportQueryParam param, Object o) throws Throwable {
FilterInfo filter = param.getFilter();
DataSet declaredocx = queryDeclareDocx(param);
DataSet declaredocx_relation = queryDeclareDocx_Relation(param);
DataSet exportinvoice = queryExportInvoice(param);
DataSet salesorder_info = querySalesOrder_Info(param);
DataSet dataSet;
dataSet = declaredocx.leftJoin(declaredocx_relation)
.on("merged_seq", "rl_merged_seq")
.on("declaredocx_id", "declare_id_gp_fk")
.select(RptUtil.getDataSetFiledAlias(declaredocx), RptUtil.getDataSetFiledAlias(declaredocx_relation))
.finish();
dataSet = dataSet.leftJoin(exportinvoice)
.on("merged_id", "ddd_id_ei_entry_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(exportinvoice))
.finish();
dataSet = dataSet.leftJoin(salesorder_info)
.on("main_id", "detail_id_info_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(salesorder_info))
.finish();
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//原币离岸价
"yem_amount - tmp_reightamtend - tmp_premiumamtcy yem_basefobamt");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//人民币离岸价
"yem_basefobamt * yem_baserate yem_cnyfobamt");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//人民币离岸价与开票额差额
"yem_cnyfobamt - yem_cnyinvoiced yem_fobsubinvoiced");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//美元离岸价
"CASE WHEN yem_usdrate > 0 THEN yem_cnyfobamt / yem_usdrate ELSE 0.0 END yem_usdfobamt");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//出口创汇
"yem_usdfobamt + usd_sea_amt + usd_pmamt_amt yem_earning");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//应退税额
"yem_cnyfobamt * yem_degrate / 100 yem_refundabletax");
StringBuilder sb = new StringBuilder();
Date fexportdate_start = filter.getDate("yem_fexportdate_start");//出口日期
Date fexportdate_end = filter.getDate("yem_fexportdate_end");//出口日期
String fcontactno = filter.getString("yem_fcontactno");//合同号
Long fcustomer = filter.getLong("yem_fcustomer");//客户
String fladingno = filter.getString("yem_fladingno");//提单号
sb.append("1=1");
if (YEM.isNotEmpty(fexportdate_start)) {
sb.append(" AND TO_DATE(yem_exportdate, 'yyyy-MM-dd') >= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(fexportdate_start)));
}
if (YEM.isNotEmpty(fexportdate_end)) {
sb.append(" AND TO_DATE(yem_exportdate, 'yyyy-MM-dd') <= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(fexportdate_end)));
}
if (YEM.isNotEmpty(fcontactno)) {
sb.append(" AND yem_contactno LIKE '%").append(fcontactno.trim()).append("%'");
}
if (YEM.isNotEmpty(fcustomer)) {
sb.append(" AND yem_customer = ").append(fcustomer);
}
if (YEM.isNotEmpty(fladingno)) {
sb.append(" AND yem_ladingno LIKE '%").append(fladingno.trim()).append("%'");
}
return dataSet.where(sb.toString());
}
/**
* 查询出口报关单
* 查询出口报关单.报关商品
* @param param
* @return
*/
private DataSet queryDeclareDocx(ReportQueryParam param) {
QFilter qFilter = getCommonDeclareDocxFilter(param);
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("id declaredocx_id");
selectfields.add("billno yem_declaredocxno");//出口报关单号
selectfields.add("yem_es_declare_ec.seq merged_seq");//报关商品分录序号
selectfields.add("yem_es_declare_ec.id merged_id");//报关商品分录序号
selectfields.add("yem_custombrokers yem_custombrokers");//报关行
selectfields.add("yem_cfscompnaytxt yem_cfscompnaytxt");//货代公司文本
selectfields.add("yem_customer.id yem_customer");//订单客户
selectfields.add("TO_CHAR(yem_exportdate, 'yyyy-MM-dd') yem_exportdate");//出口日期
selectfields.add("yem_customer.group.id yem_customer_group");//买方所在国
selectfields.add("yem_commcountry yem_destinationcount");//贸易国别-目的国
selectfields.add("yem_es_declare_ec.yem_cusqty yem_qty");//数量
selectfields.add("yem_es_declare_ec.yem_cushscode yem_hscode");//海关商品编码-出口商品代码
selectfields.add("yem_es_declare_ec.yem_decmatericalname yem_cncustomclass");//报关分类名称-商品名称中文
selectfields.add("yem_settlement yem_settlementxt");//结算方式-付款方式
selectfields.add("yem_currency yem_currency");//结算币别-币别
selectfields.add("yem_priceitem yem_priceitem");//价格条款-贸易方式
selectfields.add("yem_es_declare_ec.yem_cusconsalesprice yem_unitprice");//单价
selectfields.add("yem_es_declare_ec.yem_cusamount yem_amount");//金额
selectfields.add("yem_realbringbillno yem_ladingno");//提单号
selectfields.add("yem_sctcompnayname.id yem_sctcompnayname");//船公司
selectfields.add("yem_cyreightamt yem_cyreightamt");//海运费币别
selectfields.add("yem_cypmamt yem_cypmamt");//保费币别
selectfields.add("yem_reightamt yem_seausdamtsum");//海运费原币-海运费USD总价
selectfields.add("yem_premiumamt yem_premiumamt");//保费原币-保险费
selectfields.add("yem_usbexrate yem_usdrate");//美元汇率
selectfields.add("yem_es_declare_ec.yem_taxrefundrates yem_degrate");//退税率
selectfields.add("yem_declarenumber yem_declarationno");//报关单号
selectfields.add("yem_es_declare_ec.yem_declarationelee yem_declarationeletxt");//实际申报要素-规格型号
selectfields.add("yem_reightamtbase yem_reightamtbase");//海运费本位币
selectfields.add("yem_premiumamtbase yem_premiumamtbase");//保费本位币
selectfields.add("yem_reightamtend yem_reightamtend");//海运费结算币别
selectfields.add("yem_premiumamtcy yem_premiumamtcy");//保费结算币别
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_declaredocx", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
// 2海运费美元=海运费本位币/美元汇率
"CASE WHEN yem_usdrate > 0 THEN yem_reightamtbase / yem_usdrate ELSE 0.0 END usd_sea_amt, " +
// 3运保费美元=运保费本位币/美元汇率
"CASE WHEN yem_usdrate > 0 THEN yem_premiumamtbase / yem_usdrate ELSE 0.0 END usd_pmamt_amt, " +
// 美元汇率
"yem_usdrate * 100 yem_usdratehund");
DataSet aggPort = aggBaseDataPort(qFilter);
dataSet = dataSet.leftJoin(aggPort)
.on("declaredocx_id", "declaredocx_id_agg_port_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(aggPort))
.finish();
dataSet = doAmountApportionment(dataSet);
return dataSet;
}
/**
* 金额分摊处理
* @param dataSet
* @return
*/
private DataSet doAmountApportionment(DataSet dataSet) {
dataSet = dataSet.addField("0.0", "yem_baseseaamt");//原币海运费
dataSet = dataSet.addField("0.0", "yem_usdseaamt");//美元海运费
dataSet = dataSet.addField("0.0", "yem_basepremiumamt");//原币保险费
dataSet = dataSet.addField("0.0", "yem_usdpremiumamt");//美元保险费
dataSet = dataSet.addField("0.0", "tmp_reightamtend");//海运费结算币别
dataSet = dataSet.addField("0.0", "tmp_premiumamtcy");//保费结算币别
dataSet = dataSet.addField("0", "yem_cnycurrency");//人民币币别
dataSet = dataSet.addField("0", "yem_usdcurrency");//美元币别
DynamicObject cny = BusinessDataServiceHelper.loadSingle("bd_currency", "id", new QFilter[]{new QFilter("number", "=", "CNY")});
long cnyId = 0L;
if (YEM.isNotEmpty(cny)) {
cnyId = cny.getLong("id");
}
DynamicObject usd = BusinessDataServiceHelper.loadSingle("bd_currency", "id", new QFilter[]{new QFilter("number", "=", "USD")});
long usdId = 0L;
if (YEM.isNotEmpty(usd)) {
usdId = usd.getLong("id");
}
dataSet = RptUtil.zeroNullNums(dataSet);
DynamicObjectCollection collection = ORM.create().toPlainDynamicObjectCollection(dataSet.copy());
Map<String, List<DynamicObject>> map = new LinkedHashMap<>();
for (DynamicObject d : collection) {
String declaredocxno = d.getString("yem_declaredocxno");
List<DynamicObject> list;
if (map.containsKey(declaredocxno)) {
list = map.get(declaredocxno);
} else {
list = new ArrayList<>();
}
list.add(d);
map.put(declaredocxno, list);
}
DynamicObjectCollection dc = new DynamicObjectCollection();
for (Map.Entry<String, List<DynamicObject>> entry : map.entrySet()) {
List<DynamicObject> value = entry.getValue();
BigDecimal sumAmt = BigDecimal.ZERO;
for (DynamicObject d : value) {
BigDecimal amount = d.getBigDecimal("yem_amount");
sumAmt = sumAmt.add(amount);
}
BigDecimal share_baseseaamt = BigDecimal.ZERO;//原币海运费分摊
BigDecimal share_usdseaamt = BigDecimal.ZERO;//美元海运费分摊
BigDecimal share_basepremiumamt = BigDecimal.ZERO;//原币保险费分摊
BigDecimal share_usdpremiumamt = BigDecimal.ZERO;//美元保险费分摊
BigDecimal share_tmp_reightamtend = BigDecimal.ZERO;//海运费结算币别分摊
BigDecimal share_tmp_premiumamtcy = BigDecimal.ZERO;//保费结算币别分摊
for (DynamicObject d : value) {
BigDecimal amount = d.getBigDecimal("yem_amount");//金额
BigDecimal seausdamtsum = d.getBigDecimal("yem_seausdamtsum");//海运费USD总价
BigDecimal usdSeaAmt = d.getBigDecimal("usd_sea_amt");//海运费美元
BigDecimal premiumamt = d.getBigDecimal("yem_premiumamt");//原币保险费
BigDecimal usdPmamtAmt = d.getBigDecimal("usd_pmamt_amt");//美元保险费
BigDecimal reightamtend = d.getBigDecimal("yem_reightamtend");//海运费结算币别
BigDecimal premiumamtcy = d.getBigDecimal("yem_premiumamtcy");//保费结算币别
BigDecimal rate = BigDecimalUtils.div(amount, sumAmt, 10);
//原币海运费 = 金额/金额汇总*海运费原币
BigDecimal baseseaamt = rate.multiply(seausdamtsum);
baseseaamt = baseseaamt.setScale(2, RoundingMode.HALF_UP);
//美元海运费 = 金额/金额汇总*海运费美元
BigDecimal usdseaamt = rate.multiply(usdSeaAmt);
usdseaamt = usdseaamt.setScale(2, RoundingMode.HALF_UP);
//原币保险费 = 金额/金额汇总*保险费原币
BigDecimal basepremiumamt = rate.multiply(premiumamt);
basepremiumamt = basepremiumamt.setScale(2, RoundingMode.HALF_UP);
//美元保险费 = 金额/金额汇总*保险费美元
BigDecimal usdpremiumamt = rate.multiply(usdPmamtAmt);
usdpremiumamt = usdpremiumamt.setScale(2, RoundingMode.HALF_UP);
//海运费结算币别
BigDecimal tmp_reightamtend = rate.multiply(reightamtend);
tmp_reightamtend = tmp_reightamtend.setScale(2, RoundingMode.HALF_UP);
//保费结算币别
BigDecimal tmp_premiumamtcy = rate.multiply(premiumamtcy);
tmp_premiumamtcy = tmp_premiumamtcy.setScale(2, RoundingMode.HALF_UP);
if (isLastRow(d, value)) {
d.set("yem_baseseaamt", seausdamtsum.subtract(share_baseseaamt));//原币海运费
d.set("yem_usdseaamt", usdSeaAmt.subtract(share_usdseaamt));//美元海运费
d.set("yem_basepremiumamt", premiumamt.subtract(share_basepremiumamt));//原币保险费
d.set("yem_usdpremiumamt", usdPmamtAmt.subtract(share_usdpremiumamt));//美元保险费
d.set("tmp_reightamtend", reightamtend.subtract(share_tmp_reightamtend));//海运费结算币别
d.set("tmp_premiumamtcy", premiumamtcy.subtract(share_tmp_premiumamtcy));//保费结算币别
} else {
share_baseseaamt = share_baseseaamt.add(baseseaamt);
share_usdseaamt = share_usdseaamt.add(usdseaamt);
share_basepremiumamt = share_basepremiumamt.add(basepremiumamt);
share_usdpremiumamt = share_usdpremiumamt.add(usdpremiumamt);
share_tmp_reightamtend = share_tmp_reightamtend.add(tmp_reightamtend);
share_tmp_premiumamtcy = share_tmp_premiumamtcy.add(tmp_premiumamtcy);
d.set("yem_baseseaamt", baseseaamt);//原币海运费
d.set("yem_usdseaamt", usdseaamt);//美元海运费
d.set("yem_basepremiumamt", basepremiumamt);//原币保险费
d.set("yem_usdpremiumamt", usdpremiumamt);//美元保险费
d.set("tmp_reightamtend", tmp_reightamtend);//海运费结算币别
d.set("tmp_premiumamtcy", tmp_premiumamtcy);//保费结算币别
}
d.set("yem_cnycurrency", cnyId);
d.set("yem_usdcurrency", usdId);
dc.add(d);
}
}
return RptUtil.plainDataSet(algoKey, dataSet, dc);
}
private boolean isLastRow(DynamicObject d, List<DynamicObject> value) {
return value.indexOf(d) == value.size() - 1;
}
/**
* 查询出口报关 报关商品对照表
* 查询需要拼接的字段完成拼接
* @param param
* @return
*/
private DataSet queryDeclareDocx_Relation(ReportQueryParam param) {
QFilter qFilter = getCommonDeclareDocxFilter(param);
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("id declare_id_gp_fk");
selectfields.add("yem_es_declare_ecd.yem_fgseq rl_detail_seq");//商品明细序号
selectfields.add("yem_es_declare_ecd.yem_decsourceentryidtext rl_detail_id");//商品明细分录行id
selectfields.add("yem_es_declare_ecd.yem_decgoodsseq rl_merged_seq");//报关商品序号
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_declaredocx", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.select("CAST(rl_detail_seq as Integer) rl_detail_seq, CAST(rl_detail_id as Long) rl_detail_id, CAST(rl_merged_seq as Integer) rl_merged_seq, declare_id_gp_fk");
DataSet declaredocx_detail = queryDeclareDocx_Detail(param);
DataSet delivernotice = queryDeliverNotice(param);
DataSet salesorder = querySalesOrder(param);
dataSet = dataSet.leftJoin(declaredocx_detail)
.on("rl_detail_id","detail_id")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(declaredocx_detail))
.finish();
dataSet = dataSet.leftJoin(delivernotice)
.on("main_order_id_ddd_fk", "dn_main_id_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(delivernotice))
.finish();
dataSet = dataSet.leftJoin(salesorder)
.on("dn_main_id_fk", "main_id")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(salesorder))
.finish();
DataSet infoDataSet1 = dataSet.copy().groupBy(new String[]{"declare_id_gp_fk", "rl_merged_seq"})
.agg(new GroupConcatFunctionByComma(), "yem_bizdate", "yem_shipdate")
.agg(new GroupConcatFunctionByComma(), "yem_contactno", "yem_contactno")
.finish()
.select("declare_id_gp_fk declare_id_gp_fk_1, rl_merged_seq rl_merged_seq_1, yem_shipdate, yem_contactno");
DataSet infoDataSet2 = dataSet.copy().groupBy(new String[]{"declare_id_gp_fk", "rl_merged_seq"})
.agg(new GroupTopOneFunction(), "rl_detail_id", "rl_detail_id")
.agg(new GroupTopOneFunction(), "main_id", "main_id")
.agg(new GroupTopOneFunction(), "yem_orderno", "yem_orderno")
.agg(new GroupTopOneFunction(), "rl_merged_seq", "rl_merged_seq")
.finish()
.select("declare_id_gp_fk declare_id_gp_fk_2, rl_merged_seq rl_merged_seq_2, rl_detail_id, main_id, yem_orderno, rl_merged_seq");
dataSet = infoDataSet1.leftJoin(infoDataSet2)
.on("declare_id_gp_fk_1", "declare_id_gp_fk_2")
.on("rl_merged_seq_1", "rl_merged_seq_2")
.select(RptUtil.getDataSetFiledAlias(infoDataSet1), RptUtil.getDataSetFiledAlias(infoDataSet2))
.finish();
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + ", declare_id_gp_fk_1 declare_id_gp_fk");
return dataSet;
}
/**
* 查询出口报关 商品明细
* @param param
* @return
*/
private DataSet queryDeclareDocx_Detail(ReportQueryParam param) {
QFilter qFilter = getCommonDeclareDocxFilter(param);
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_es_materialinfo.id detail_id");
selectfields.add("yem_es_materialinfo.yem_coreentryid main_order_id_ddd_fk");
return ORM.create().queryDataSet(algoKey, "yem_es_declaredocx", String.join(",", selectfields), qFilter.toArray());
}
/**
* 查询销售出库
* @param param
* @return
*/
private DataSet queryDeliverNotice(ReportQueryParam param) {
QFilter qFilter = getBaseQFilter();
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_es_materialinfo.yem_coreentryid dn_main_id_fk");//合同分录ID
selectfields.add("yem_bizdate");//业务日期
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_delivernotice", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.select("dn_main_id_fk, TO_CHAR(yem_bizdate, 'yyyy-MM-dd') yem_bizdate");
dataSet = dataSet.groupBy(new String[]{"dn_main_id_fk"})
.agg(new GroupConcatFunctionByComma(), "yem_bizdate", "yem_bizdate")
.finish();
return dataSet;
}
/**
* 查询外销合同
* @param param
* @return
*/
private DataSet querySalesOrder(ReportQueryParam param) {
QFilter qFilter = getBaseQFilter();
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_agreementew.billno framework_billno");//框架合同
selectfields.add("yem_agreementew.billno framework_id");//框架合同
selectfields.add("billno contact_billno");//外销合同号
selectfields.add("yem_es_materialinfo.id main_id");//合同分录ID
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.select("main_id, contact_billno, framework_id, framework_billno, " +
// 有框架合同取框架合同号否则取合同号
"CASE WHEN framework_billno IS NOT NULL AND framework_billno != '' " +
"THEN framework_billno " +
"ELSE contact_billno " +
"END yem_contactno, " +
// 是否有框架合同有1.0 没有0.0
"CASE WHEN framework_billno IS NOT NULL AND framework_billno != '' " +
"THEN 1.0 " +
"ELSE 0.0 " +
"END contains_framework_sign ");
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
"CASE WHEN contains_framework_sign = 1 THEN contact_billno ELSE '' END yem_orderno");
// DataSet framework = dataSet.copy().where("contains_framework_sign = 1.0");
//
// framework = framework.groupBy(new String[]{"framework_billno"})
// .agg(new GroupConcatFunctionByComma(), "contact_billno", "yem_orderno")
// .finish();
//
// framework = framework.select("framework_billno framework_billno_fk, yem_orderno");
//
// dataSet = dataSet.leftJoin(framework)
// .on("framework_billno", "framework_billno_fk")
// .select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(framework))
// .finish();
return dataSet;
}
private DataSet querySalesOrder_Info(ReportQueryParam param) {
QFilter qFilter = getBaseQFilter();
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_es_materialinfo.id detail_id_info_fk");
selectfields.add("yem_operator yem_salesman");
return ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
}
public QFilter getCommonDeclareDocxFilter(ReportQueryParam param) {
FilterInfo filter = param.getFilter();
String fdeclaredocxno = filter.getString("yem_fdeclaredocxno");
QFilter qFilter = getBaseQFilter();
if (YEM.isNotEmpty(fdeclaredocxno)) {
qFilter.and("billno", "=", fdeclaredocxno);
}
return qFilter;
}
/**
* 查询多选基础资料港口
*
* @param qFilter
* @return
*/
private DataSet aggBaseDataPort(QFilter qFilter) {
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("id declaredocx_id_agg_port_fk");
selectfields.add("yem_shipports.fbasedataid.name yem_departurport");//起运港
selectfields.add("yem_destports.fbasedataid.name yem_destinationport");//目的港
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_declaredocx", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.groupBy(new String[]{"declaredocx_id_agg_port_fk"})
.agg(new GroupConcatFunctionByComma(), "yem_departurport", "yem_departurport")
.agg(new GroupConcatFunctionByComma(), "yem_destinationport", "yem_destinationport")
.finish();
return dataSet;
}
/**
* 查询出口发票
* @param param
* @return
*/
private DataSet queryExportInvoice(ReportQueryParam param) {
QFilter qFilter = getBaseQFilter();
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("billno exportinvoice_billno");
selectfields.add("yem_exportinvoice_c.yem_customsdeclaration yem_unit");
selectfields.add("yem_exportinvoice_c.yem_sourcebillentryid ddd_id_ei_entry_fk");
selectfields.add("yem_exportinvoice_c.yem_cusamount yem_cnyinvoiced");//金额-人民币开票额
selectfields.add("yem_exrate yem_baserate");//原币汇率
selectfields.add("yem_invoicenumber yem_invoiceno");//发票号码
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_exportinvoice", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(dataSet)) + "," +
//原币汇率
"yem_baserate * 100 yem_baserathund");
return dataSet;
}
}

View File

@ -17,8 +17,7 @@ import kd.bos.servicehelper.QueryServiceHelper;
import java.math.BigDecimal;
import java.util.*;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: TODO
@ -80,6 +79,7 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
long fcustomer = filter.getLong("yem_fcustomer");//客户
Date forderdateStart = filter.getDate("yem_forderdate_start");
Date forderdateEnd = filter.getDate("yem_forderdate_end");
long producttype = filter.getLong("yem_bd_producttype");//产品分类
StringBuilder sb = new StringBuilder();
sb.append("yem_businesssort = 'Z' AND dn_status != 'C'");
@ -101,6 +101,15 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
if (YEM.isNotEmpty(forderdateEnd)) {
sb.append(" AND forderdate <= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(forderdateEnd)));
}
if (producttype > 0) {
sb.append(" AND yem_products = ").append(producttype);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
String concated = concatFBaseDataFilter(fproducttypem, "yem_products");
sb.append(concated);
resDataSet = resDataSet.addField("0.0", "yem_inventoryqty");
DataSet where = resDataSet.where(sb.toString());
@ -140,6 +149,8 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
selectfields.add("yem_es_materialinfo.yem_businesssort yem_businesssort");
selectfields.add("createtime");
selectfields.add("yem_bd_products");//产品分类
selectfields.add("yem_bd_products yem_products");//产品分类
selectfields.add("yem_es_materialinfo.yem_es_salesorder_z.yem_currentstate yem_currentstate");//当前状态
return ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray())
.orderBy(new String[]{"createtime DESC"});
@ -160,9 +171,20 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
selectfields.add("yem_shippingplan_entry.yem_plandetail_entry.id order_plan_detail_id");//跟单任务明细子分录ID
selectfields.add("yem_shippingplan_entry.yem_plandetail_entry.yem_srcentryid order_detail_id_plan_fk");
return ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
}
private DataSet queryOrderProReqBill(ReportQueryParam param) {
QFilter qFilter = getBaseQFilter();
List<String> selectfields = new ArrayList<>();
selectfields.add("TO_CHAR(yem_es_materialinfo.yem_yieldetacdate, 'yyyy-MM-dd') yem_prodfeedbackdate");//预计完成时间
selectfields.add("yem_es_materialinfo.yem_sourceentryid order_req_main_detail_fk");
return ORM.create().queryDataSet(algoKey, "yem_orderproreqbill", String.join(",", selectfields), qFilter.toArray());
}
/**
* 查询已提交订舱通知
* @param param
@ -210,11 +232,22 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
private DataSet queryTrackTaskConsoleProcEntry(ReportQueryParam param) {
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_es_salesorder_r.id task_order_plan_id");
selectfields.add("yem_es_salesorder_r.yem_entrtyid plan_proc_detail_fk");
selectfields.add("yem_es_salesorder_r.yem_stockway yem_ifreform");
selectfields.add("TO_CHAR(yem_es_salesorder_r.yem_yieldetacdate, 'yyyy-MM-dd') yem_prodfeedbackdate");//预计完成时间
// selectfields.add("TO_CHAR(yem_es_salesorder_r.yem_yieldetacdate, 'yyyy-MM-dd') yem_prodfeedbackdate");//预计完成时间
selectfields.add("TO_CHAR(yem_es_salesorder_r.yem_yieldfactacdate, 'yyyy-MM-dd') yem_plancompdate");//实际完成时间
return ORM.create().queryDataSet(algoKey, "yem_tracktaskconsole", String.join(",", selectfields), null);
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_tracktaskconsole", String.join(",", selectfields), null);
DataSet proReqBill = queryOrderProReqBill(param);
dataSet = dataSet.leftJoin(proReqBill)
.on("task_order_plan_id", "order_req_main_detail_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(proReqBill))
.finish();
return dataSet;
}
/**
@ -344,8 +377,7 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
for (DynamicObject dynamicObject : collection) {
String vehicleno = dynamicObject.getString("yem_vehicleno");
if (YEM.isNotEmpty(vehicleno)) {
BigDecimal inventoryqty = dynamicObject.getBigDecimal("yem_inventoryqty");
dynamicObject.set("yem_reqqty", inventoryqty);
dynamicObject.set("yem_reqqty", new BigDecimal("1"));
}
}

View File

@ -18,8 +18,7 @@ import java.util.List;
import static com.yem.rf.salescommission.CompleteShipDetailReportPlugin.queryGathering_ClaimDate;
import static com.yem.rf.salescommission.CompleteShipDetailReportPlugin.querySalesOrder_PayRate;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: TODO
@ -75,6 +74,12 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
long resourceno = filter.getLong("yem_resourceno");//资源号
Date start = filter.getDate("yem_ladingdate_start");//提单日期-开始
Date end = filter.getDate("yem_ladingdate_end");//提单日期-结束
Date fshipdate_start = filter.getDate("yem_fshipdate_start");
Date fshipdate_end = filter.getDate("yem_fshipdate_end");
long foperator = filter.getLong("yem_foperator");//
where.append("salesorder_billtype IN ('yem_es_salesorder_nmzj', 'yem_es_salesorder_ZJ') AND salesorder_commissiontype IN ('Z', 'ZP')");
if (YEM.isNotEmpty(salesorderno)) {
where.append(" AND yem_contractno LIKE '%").append(salesorderno).append("%'");
@ -91,12 +96,29 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
if (resourceno > 0) {
where.append(" AND yem_resourcescode = ").append(resourceno);
}
if (YEM.isNotEmpty(start)) {
if (YEM.isNotEmpty(start)) {
where.append(" AND TO_DATE(yem_ladingdatetext,'yyyy-MM-dd') >= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(start)));
}
if (YEM.isNotEmpty(end)) {
where.append(" AND TO_DATE(yem_ladingdatetext,'yyyy-MM-dd') <= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(end)));
}
if (YEM.isNotEmpty(fshipdate_start)) {
where.append(" AND TO_DATE(yem_shipdate,'yyyy-MM-dd') >= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(fshipdate_start)));
}
if (YEM.isNotEmpty(fshipdate_end)) {
where.append(" AND TO_DATE(yem_shipdate,'yyyy-MM-dd') <= ").append(String.format("TO_DATE('%s','yyyy-MM-dd')", formatDate(fshipdate_end)));
}
if (foperator > 0) {
where.append(" AND yem_salesman = ").append(foperator);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
String concated = concatFBaseDataFilter(fproducttypem, "yem_products");
where.append(concated);
resDataSet = resDataSet.where(where.toString());
return resDataSet;
@ -131,13 +153,15 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
selectfields.add("yem_es_materialinfo.yem_es_salesorder_z.yem_vehicleno yem_vehicleno");//整机编号
selectfields.add("yem_es_materialinfo.yem_es_salesorder_z.yem_resourcescode yem_resourcescode");//资源号
selectfields.add("yem_es_materialinfo.yem_es_salesorder_z.yem_milltype yem_productmodel");//资源号
selectfields.add("yem_es_materialinfo.yem_qty yem_qty");//数量
// selectfields.add("yem_es_materialinfo.yem_qty yem_qty");//数量
selectfields.add("yem_currency yem_currency");//结算币别
selectfields.add("yem_exrate yem_exrate");//汇率
selectfields.add("createtime");
return ORM.create().queryDataSet(algoKey, "yem_es_delivernotice", String.join(",", selectfields), qFilter.toArray())
selectfields.add("TO_CHAR(yem_bizdate, 'yyyy-MM-dd') yem_shipdate");//业务日期-发货日期
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_delivernotice", String.join(",", selectfields), qFilter.toArray())
.orderBy(new String[]{"createtime DESC"});
dataSet = dataSet.addField("1.0", "yem_qty");
return dataSet;
}
/**
@ -168,13 +192,14 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
selectfields.add("id salesorderid");
selectfields.add("yem_es_materialinfo.id salesorderenid");
selectfields.add("yem_reccondition yem_reccondition");//收款条件
selectfields.add("yem_es_materialinfo.yem_saamtpriceclause yem_safobamount");//销售金额价格条款 整机合计价格
selectfields.add("yem_es_materialinfo.yem_safobprice yem_safobamount");//销售FOB单价 整机合计价格
selectfields.add("yem_es_materialinfo.yem_singlepartgiftmat yem_singlepartgiftmat");//单台配件赠送金额 赠送配件金额
selectfields.add("yem_es_materialinfo.yem_fobamount yem_companystandamt");//公司标准价
selectfields.add("CASE WHEN yem_issinosurecon = '1' THEN 'A' ELSE 'B' END yem_iscredit");//是否信保合同
selectfields.add("yem_billtype.number salesorder_billtype");//单据类型
selectfields.add("yem_es_materialinfo.yem_commissiontype salesorder_commissiontype");//业务分类
selectfields.add("yem_offeramount");
selectfields.add("yem_operator yem_salesman");//销售员
return ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
}

View File

@ -95,7 +95,7 @@ public class ShipmentsChedulePlugin extends AbstractReportListDataPlugin {
StringBuilder sb = new StringBuilder();
sb.append("yem_customsdeclaration1 = 'A'");
sb.append("yem_customsdeclaration1 = 'B'");
if (YEM.isNotEmpty(yemContract)) {
sb.append(" AND yem_contractnumber like '").append("%").append(yemContract).append("%").append("'");
}

View File

@ -0,0 +1,274 @@
package com.yem.rf.salescommission;
import com.yem.wm.utils.RptUtil;
import com.yem.wm.utils.YEM;
import kd.bos.algo.DataSet;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.report.AbstractReportListDataPlugin;
import kd.bos.entity.report.FilterInfo;
import kd.bos.entity.report.ReportQueryParam;
import kd.bos.orm.ORM;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import java.util.*;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static kd.fi.er.report.query.TripOrderRpt.algoKey;
/**
* @author ljw
* @date 2024/9/5 16:06
* @description SparepartsNotShippedPlugin
*/
public class SparepartsNotShippedPlugin extends AbstractReportListDataPlugin {
@Override
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
DataSet resDataSet;
DataSet yemEsSalesorder = yemEsSalesorder();
DataSet yemEsStoragetrans = yemEsStoragetrans();
DataSet yemImEncasement = yemImEncasement();
DataSet yemGathering = yemGathering();
DataSet yemShippingdetails = yemShippingdetails();
resDataSet = yemEsSalesorder.leftJoin(yemEsStoragetrans).on("queryDeliverNoticeid", "yem_corebillid").select(RptUtil.getDataSetFiledAlias(yemEsSalesorder), RptUtil.getDataSetFiledAlias(yemEsStoragetrans)).finish();
resDataSet = resDataSet.leftJoin(yemImEncasement).on("queryDeliverNoticeid", "encasementcorebillid").select(RptUtil.getDataSetFiledAlias(resDataSet), RptUtil.getDataSetFiledAlias(yemImEncasement)).finish();
resDataSet = resDataSet.leftJoin(yemGathering).on("queryDeliverNoticeid", "yem_titleid").select(RptUtil.getDataSetFiledAlias(resDataSet), RptUtil.getDataSetFiledAlias(yemGathering)).finish();
resDataSet = resDataSet.leftJoin(yemShippingdetails).on("queryDeliverNoticeid", "yemShippingdetailsyem_sourcebillid").select(RptUtil.getDataSetFiledAlias(resDataSet), RptUtil.getDataSetFiledAlias(yemShippingdetails)).finish();
resDataSet = resDataSet.distinct();
resDataSet = RptUtil.zeroNullNums(resDataSet);
DataSet selected = resDataSet.select(String.join(",", RptUtil.getDataSetFiledAlias(resDataSet)) +
",(yem_offeramounts-yem_theamountpaid) yem_theamountowed" +
",CASE WHEN (yem_contractamount = yem_salcontractclaamt) THEN paymenttime ELSE null END yem_bizdate");
selected = selected.removeFields("paymenttime");
FilterInfo filter = reportQueryParam.getFilter();
String yemContract = filter.getString("yem_billnos");
DynamicObject yemClient = filter.getDynamicObject("yem_clientname");
DynamicObjectCollection yem_bd_producttype = filter.getDynamicObjectCollection("yem_bd_producttype");
StringBuilder sb = new StringBuilder();
DataSet result = selected.where("yem_billno != ''");
sb.append("yem_billno != ''");
if (YEM.isNotEmpty(yemContract)) {
sb.append(" AND delivernoticebillno like '").append("%").append(yemContract).append("%").append("'");
}
if (YEM.isNotEmpty(yemClient)) {
sb.append(" AND yem_client = ").append("'" + yemClient.getString("name") + "'");
}
if (YEM.isNotEmpty(yem_bd_producttype)){
List<String> names = new ArrayList<>();
for (DynamicObject dynamicObject : yem_bd_producttype) {
String name = dynamicObject.getString("name");
names.add(name);
}
Map<String,Object> map = new HashMap<>();
map.put("var",names);
result = result.filter("yem_bd_products in var",map);
}
DataSet where = result.where(sb.toString());
return where.distinct();
}
/**
* 发运明细单
*
* @return
*/
private DataSet yemShippingdetails() {
QFilter qFilter = getBaseQFilter();
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_iswithaccessories yem_boardaccessor");
selectfields.add("yem_transportstyle.name yem_shippingmethod");
selectfields.add("yem_sourcebillid yemShippingdetailsyem_sourcebillid");
DataSet yemShippingdetails = ORM.create().queryDataSet(algoKey, "yem_shippingdetails", String.join(",", selectfields), qFilter.toArray());
yemShippingdetails = yemShippingdetails.select(String.join(",", RptUtil.getDataSetFiledAlias(yemShippingdetails)) +
",CASE WHEN yem_boardaccessor = 'A' THEN '是' ELSE '否' END yem_boardaccessory");
yemShippingdetails = yemShippingdetails
.groupBy(new String[]{"yemShippingdetailsyem_sourcebillid"})
.groupConcat("yem_boardaccessory", "yem_boardaccessory", "")
.groupConcat("yem_shippingmethod", "yem_shippingmethod", "")
.finish();
return yemShippingdetails;
}
/**
* 收款单金额对比
*
* @return
*/
private DataSet yemGathering() {
QFilter qFilter = getBaseQFilter(new String[]{"B", "C"});
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_receiptdetail.yem_claimdetail.yem_salcontractno.id yem_titleid");//收款单的合同号id
selectfields.add("yem_receiptdetail.yem_claimdetail.yem_salcontractclaamt yem_salcontractclaamt");//收款单的合同金额
DataSet yemShippingdetails = ORM.create().queryDataSet(algoKey, "yem_gathering", String.join(",", selectfields), qFilter.toArray());
yemShippingdetails = yemShippingdetails.groupBy(new String[]{"yem_titleid"})
.sum("yem_salcontractclaamt")
.finish();
yemShippingdetails = getYemShippingdetails(qFilter, yemShippingdetails);
return yemShippingdetails;
}
/**
* 收款单认领时间
*
* @param qFilter
* @param yemShippingdetails
* @return
*/
private static DataSet getYemShippingdetails(QFilter qFilter, DataSet yemShippingdetails) {
List<String> selectfield = new ArrayList<>();
selectfield.add("yem_receiptdetail.yem_claimdetail.yem_salcontractno.id yem_salcontractnoid");//收款单的合同号id
selectfield.add("yem_bizdate paymenttimes");//
DataSet yemShippingdetail = ORM.create().queryDataSet(algoKey, "yem_gathering", String.join(",", selectfield), qFilter.toArray());
yemShippingdetail = yemShippingdetail.groupBy(new String[]{"yem_salcontractnoid"}).max("paymenttimes").finish();
yemShippingdetail = yemShippingdetail.addField("TO_CHAR(paymenttimes, 'yyyy-MM-dd') paymenttime","paymenttime");
yemShippingdetails = yemShippingdetail.leftJoin(yemShippingdetails)
.on("yem_salcontractnoid", "yem_titleid")
.select(RptUtil.getDataSetFiledAlias(yemShippingdetail), RptUtil.getDataSetFiledAlias(yemShippingdetails))
.finish();
DataSet claimedAmt = queryGathering_ClaimedAmt();
yemShippingdetails = yemShippingdetails.leftJoin(claimedAmt).on("yem_salcontractnoid","salesorderid")
.select(RptUtil.getDataSetFiledAlias(yemShippingdetails), RptUtil.getDataSetFiledAlias(claimedAmt)).finish();
return yemShippingdetails;
}
/**
* 查询合同各个款项性质的已认领金额合计
*
* @return
*/
private static DataSet queryGathering_ClaimedAmt() {
QFilter qFilter = getBaseQFilter(new String[]{"B", "C"});
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_receiptdetail.yem_claimdetail.yem_salcontractno.id salesorderid");
selectfields.add("yem_receiptdetail.yem_claimdetail.yem_claimamt yem_theamountpaid");//收款认领金额
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_gathering", String.join(",", selectfields), qFilter.toArray());
dataSet = dataSet
.groupBy(new String[]{"salesorderid"})
.sum("yem_theamountpaid")
.finish();
return dataSet;
}
/**
* 装箱单
*
* @return
*/
private DataSet yemImEncasement() {
QFilter qFilter = getBaseQFilter();
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_corebillid encasementcorebillid");
selectfields.add("yem_completionstatuspj yem_completionstatuspj");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_im_encasement", String.join(",", selectfields), qFilter.toArray());
return yemEsSalesorder;
}
/**
* 订舱通知单
*
* @return
*/
private DataSet yemEsStoragetrans() {
QFilter qFilter = getBaseQFilter();
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_corebillid yem_corebillid");
selectfields.add("yem_origcurrepremium yem_origcurrepremium");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_es_storagetrans", String.join(",", selectfields), qFilter.toArray());
yemEsSalesorder = yemEsSalesorder.groupBy(new String[]{"yem_corebillid"}).sum("yem_origcurrepremium").finish();
return yemEsSalesorder;
}
/**
* 外销合同
*
* @return
*/
private DataSet yemEsSalesorder() {
QFilter qFilter = getBaseQFilter();
qFilter.and("yem_es_materialinfo.yem_businesssort", QCP.equals, "P");
List<String> selectfields = new ArrayList<>();
selectfields.add("id queryDeliverNoticeid");
selectfields.add("yem_operator yem_salesman");
selectfields.add("yem_billtype.name yem_billtype");
selectfields.add("billno yem_billno");
selectfields.add("yem_customer yem_customer");
selectfields.add("yem_priceitem yem_priceitem");
selectfields.add("yem_offeramount yem_offeramount");
selectfields.add("yem_offeramount yem_offeramounts");
selectfields.add("yem_interestamt yem_interestamt");
selectfields.add("yem_creditamt yem_creditamt");
selectfields.add("yem_fundpoolamt yem_fundpoolamt");
selectfields.add("yem_premiumamt yem_premiumamt");
selectfields.add("yem_customer.name yem_client");
selectfields.add("yem_seafreight yem_seafreight");
selectfields.add("yem_landcarrycost yem_landcarrycost");
selectfields.add("yem_airliftcost yem_airliftcost");
selectfields.add("yem_expresscost yem_expresscost");
selectfields.add("yem_offeramount yem_contractamount");
selectfields.add("yem_shipports yem_shipports");
selectfields.add("yem_destports yem_destports");
selectfields.add("yem_clientcountry yem_clientcountry");
selectfields.add("TO_CHAR(yem_acshipdate, 'yyyy-MM-dd') yem_acshipdate");
selectfields.add("yem_reccondition yem_reccondition");
selectfields.add("yem_currency.name yem_currency");
selectfields.add("yem_companyname yem_companyname");
selectfields.add("yem_bd_products.name yem_bd_products");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
yemEsSalesorder = yemEsSalesorder.distinct();
yemEsSalesorder = yemEsSalesorder.select(String.join(",", RptUtil.getDataSetFiledAlias(yemEsSalesorder)) +
",yem_seafreight+yem_landcarrycost+yem_airliftcost+yem_expresscost yem_freight");
DataSet rightDataSet = yemEsSalesorders();
yemEsSalesorder = yemEsSalesorder.leftJoin(rightDataSet).on("queryDeliverNoticeid", "Noticeid")
.select(RptUtil.getDataSetFiledAlias(yemEsSalesorder), RptUtil.getDataSetFiledAlias(rightDataSet)).finish();
DataSet yemPlaceexamine = yemPlaceexamine();
yemEsSalesorder = yemEsSalesorder.leftJoin(yemPlaceexamine).on("queryDeliverNoticeid","yem_sourcebillid")
.select(RptUtil.getDataSetFiledAlias(yemEsSalesorder), RptUtil.getDataSetFiledAlias(yemPlaceexamine)).finish();
DataSet yemEsDelivernotice = yemEsDelivernotice();
yemEsSalesorder = yemEsSalesorder.leftJoin(yemEsDelivernotice).on("queryDeliverNoticeid","delivernoticecorebillid")
.select(RptUtil.getDataSetFiledAlias(yemEsSalesorder), RptUtil.getDataSetFiledAlias(yemEsDelivernotice)).finish();
yemEsSalesorder = yemEsSalesorder.where("billstatus = 'B' OR billstatus = 'C'");
yemEsSalesorder = yemEsSalesorder.where("delivernoticebillstatus != 'C'");
yemEsSalesorder = yemEsSalesorder.distinct();
return yemEsSalesorder;
}
private DataSet yemEsDelivernotice() {
QFilter qFilter = getBaseQFilter(new String[]{"A","B"});
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_corebillid delivernoticecorebillid");
selectfields.add("billstatus delivernoticebillstatus");
selectfields.add("billno delivernoticebillno");
selectfields.add("TO_CHAR(auditdate, 'yyyy-MM-dd') yem_shipdate");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_es_delivernotice", String.join(",", selectfields), qFilter.toArray());
return yemEsSalesorder;
}
private DataSet yemPlaceexamine() {
QFilter qFilter = getBaseQFilter(new String[]{"B","C"});
List<String> selectfields = new ArrayList<>();
selectfields.add("yem_sourcebillid yem_sourcebillid");
selectfields.add("billstatus billstatus");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_placeexamine", String.join(",", selectfields), qFilter.toArray());
return yemEsSalesorder;
}
/**
* 外销合同
*
* @return
*/
private DataSet yemEsSalesorders() {
QFilter qFilter = getBaseQFilter();
qFilter.and("yem_es_materialinfo.yem_businesssort", QCP.equals, "P");
List<String> selectfields = new ArrayList<>();
selectfields.add("id Noticeid");
selectfields.add("yem_es_materialinfo.yem_qty yem_qty");
DataSet yemEsSalesorder = ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
yemEsSalesorder = yemEsSalesorder.groupBy(new String[]{"Noticeid"}).sum("yem_qty").finish();
return yemEsSalesorder;
}
}

View File

@ -0,0 +1,53 @@
package com.yem.rf.task;
import com.yem.wm.utils.ContactSignUtils;
import com.yem.wm.utils.DynamicObjectUtil;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.exception.KDException;
import kd.bos.schedule.executor.AbstractTask;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
* @Description: TODO
* @Date: 2024/9/5 9:38
* @Created: by ZZSLL
*/
public class ExportDeclarationDataFIxTask extends AbstractTask {
private static final Logger logger = LoggerFactory.getLogger(ExportDeclarationDataFIxTask.class);
@Override
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
String selectfields = DynamicObjectUtil.getSelectfields("yem_es_declaredocx");
selectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_declaredocx", "yem_es_materialinfo");
selectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_declaredocx", "yem_es_declare_ecd");
DynamicObject[] load = BusinessDataServiceHelper.load("yem_es_declaredocx", selectfields, null);
for (DynamicObject b : load) {
DynamicObjectCollection relation = b.getDynamicObjectCollection("yem_es_declare_ecd");
DynamicObjectCollection m = b.getDynamicObjectCollection("yem_es_materialinfo");
for (DynamicObject r : relation) {
int i = relation.indexOf(r);
String decsourceentryidtext = r.getString("yem_decsourceentryidtext");
if ("0".equals(decsourceentryidtext)) {
logger.info("修复-{}-{}行", b.getString("billno"), i);
int fgseq = r.getInt("yem_fgseq");
if (fgseq - 1 <= m.size()) {
DynamicObject detail = m.get(fgseq - 1);
long id = detail.getLong("id");
r.set("yem_decsourceentryidtext", String.valueOf(id));
logger.info("new Id: {}", id);
}
}
}
}
SaveServiceHelper.save(load);
}
}

View File

@ -1,10 +1,12 @@
package com.yem.rf.utils;
import com.yem.wm.utils.YEM;
import kd.bos.algo.DataSet;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.IDataEntityProperty;
import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
import kd.bos.entity.report.FilterInfo;
import kd.bos.orm.ORM;
import kd.bos.orm.query.QFilter;
@ -87,4 +89,35 @@ public class RFUtils {
}
return list;
}
public static List<Long> getFBaseDataIds(FilterInfo filter, String propName) {
List<Long> ids = new ArrayList<>();
DynamicObjectCollection collection = filter.getDynamicObjectCollection(propName);
if (collection != null) {
for (DynamicObject d : collection) {
long id = d.getLong("id");
ids.add(id);
}
}
return ids;
}
public static String concatFBaseDataFilter(List<Long> ids, String propName) {
StringBuilder sb = new StringBuilder();
if (YEM.isNotEmpty(ids)) {
sb.append(" AND ").append(propName).append(" IN (");
for (Long i : ids) {
int idx = ids.indexOf(i);
if (idx == ids.size() - 1) {
sb.append(i);
} else {
sb.append(i).append(",");
}
}
sb.append(")");
}
return sb.toString();
}
}

View File

@ -26,7 +26,7 @@ public class ContactBookSubmitOp extends AbstractOperationServicePlugIn
public void onAddValidators(AddValidatorsEventArgs e)
{
super.onAddValidators(e);
// e.addValidator(new ContactBookSubmitValidator());
e.addValidator(new ContactBookSubmitValidator());
}
@Override

View File

@ -820,6 +820,8 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
@Override
public void beforeDeleteRow(BeforeDeleteRowEventArgs e) {
super.beforeDeleteRow(e);
IDataModel model = this.getModel();
IFormView view = this.getView();
String name = e.getEntryProp().getName();
int[] rowIndexs = e.getRowIndexs();
// switch (name) {
@ -830,6 +832,17 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
// deleteMaterialInfo(e, rowIndexs);
// break;
// }
if ("yem_sumpartspack".equals(name)) {
if (rowIndexs != null) {
for (int rowIndex : rowIndexs) {
BigDecimal stuffingpiece = (BigDecimal) model.getValue("yem_stuffingpiece", rowIndex);
if (stuffingpiece.compareTo(BigDecimal.ZERO) > 0) {
e.setCancel(true);
view.showErrorNotification("已装柜数量大于0不允许删除");
}
}
}
}
}

View File

@ -829,7 +829,6 @@ public class SalesOrderEdit extends AbstractBillPlugIn implements Plugin, Before
}
}
if (key.equals("revokeplan")) {
revokeplan();
}
@ -942,13 +941,15 @@ public class SalesOrderEdit extends AbstractBillPlugIn implements Plugin, Before
}
//作废
if ("exportisvoid".equals(key)) {
FormShowParameter showParameter = new FormShowParameter();
showParameter.setFormId("yem_voidreason");
showParameter.setCloseCallBack(null);
showParameter.getOpenStyle().setShowType(ShowType.Modal);
CloseCallBack callBack = new CloseCallBack(this, "exportisvoid");
showParameter.setCloseCallBack(callBack);
this.getView().showForm(showParameter);
boolean success = operationResult.isSuccess();
if (success) {
FormShowParameter showParameter = new FormShowParameter();
showParameter.setFormId("yem_voidreason");
showParameter.getOpenStyle().setShowType(ShowType.Modal);
CloseCallBack callBack = new CloseCallBack(this, "exportisvoid");
showParameter.setCloseCallBack(callBack);
this.getView().showForm(showParameter);
}
}
}

View File

@ -298,6 +298,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.countAfterFrontPrice(model, rowIndex);//折扣后销售单价
syncDeductionGifts(model, rowIndex);
ClientUtils.addSaAmountTkZJ(model, rowIndex);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatAmountZJ(model, rowIndex);//整机合同整机非赠品行实际整车金额
break;
case "yem_saamtpriceclause"://销售金额价格条款
ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_saamtpriceclause", "yem_offeramount");//销售金额价格条款汇总表头 金额价格条款
@ -350,6 +352,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
// ClientUtils.totalSaFobAmount(model, "yem_es_materialinfo", "yem_ifgift", "yem_onecarsum", "yem_sumcost");//单车总费用 汇总表头 总费用
// ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价价格条款
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, rowIndex);//整机合同整机非赠品行实际整车单价
break;
case "yem_unitsetamount"://单台加价金额
ClientUtils.addSaPrice(model, materialInfo);//销售FOB单价结算币别
@ -357,6 +361,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
case "yem_sapricepriceclause"://销售单价价格条款结算币别
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.addSaAmountTkZJ(model, rowIndex);//整机合同整机非赠品行销售单价价格条款
break;
case "yem_sapriceclausebase"://销售单价价格条款人民币
// ClientUtils.countRealCatPrice(model, rowIndex);//实际整车单价
@ -366,6 +371,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
break;
case "yem_truecarprice"://实际整车单价
// ClientUtils.countRealCatAmount(model, rowIndex);//实际整车金额
ClientUtils.countRealCatAmountZJ(model, rowIndex);//整机合同整机非赠品行实际整车金额
ClientUtils.countRealCatPriceRMB(model, rowIndex);//实际整车单价人民币
break;
case "yem_reccondition":
@ -378,6 +384,7 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
// ClientUtils.countRealCatPrice(model, rowIndex);
ClientUtils.countFrontDisPrice(model, rowIndex);//折扣前单价
ClientUtils.addSaAmountTk(model, rowIndex);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价价格条款
break;
case "yem_ticketprice":
case "yem_bigcabinetprice":
@ -434,6 +441,8 @@ public class SalesOrderZJEdit extends AbstractBillPlugIn implements Plugin, Befo
break;
case "yem_afterfrontdisprice"://折扣后销售单价
// ClientUtils.countSaPricePriceClause(model, rowIndex);//计算销售单价价格条款
ClientUtils.countSaPricePriceClauseZJ(model, rowIndex);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, rowIndex);//整机合同整机非赠品行实际整车单价
break;
case "yem_accamtusetype"://配件资金使用方式
ClientUtils.countDisAmt(model, "yem_es_materialinfo", rowIndex, view);//计算折扣金额

View File

@ -60,7 +60,11 @@ public class SalesOrderAuditOp extends AbstractOperationServicePlugIn {
for(DynamicObject dataEntitie : dataEntities){
dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(),dataEntitie.getDynamicObjectType().getName());
frameworkContract(dataEntitie);
giftAmount(dataEntitie);
//是否礼品赠送 =
String yem_isgiftgive = dataEntitie.getString("yem_isgiftgive");
if(yem_isgiftgive.equals("A")){
giftAmount(dataEntitie);
}
giftSpecialAmount(dataEntitie);
}
@ -157,8 +161,8 @@ public class SalesOrderAuditOp extends AbstractOperationServicePlugIn {
DynamicObjectCollection giveamounts = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_l");
DynamicObject giftamountss = BusinessDataServiceHelper.loadSingle("yem_im_giftamount",
new QFilter[]{new QFilter("yem_groupcusfields", QCP.equals,customer),
new QFilter("org", QCP.equals,org),
new QFilter("yem_bd_products", QCP.equals,products)});
new QFilter("org", QCP.equals,org),
new QFilter("yem_bd_products", QCP.equals,products)});
if (giveamounts!=null){

View File

@ -208,7 +208,7 @@ public class SaleOrdeExportisVoidValidator extends AbstractValidator {
List list = new ArrayList<>();
String billno = dataEntity.getString("billno");
Object pkValue = dataEntity.getPkValue();
QFilter qFilter = new QFilter("billno", QCP.equals, billno);
QFilter qFilter = new QFilter("yem_billnopact", QCP.equals, billno);
DynamicObjectCollection yem_shippingdetails = QueryServiceHelper.query("yem_im_intauditbusa", "id,billno", new QFilter[]{qFilter}, null);
if (yem_shippingdetails.size() > 0) {
for (DynamicObject shippingdetails : yem_shippingdetails) {

View File

@ -2,8 +2,9 @@ package com.yem.wm.es.storagetrans.list;
import kd.bos.form.events.SetFilterEvent;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.orm.query.QCP;
/**
* @author ljw
* @date 2024/7/6 15:25
@ -15,7 +16,7 @@ public class StorageTransKDListFilter extends AbstractListPlugin {
public void setFilter(SetFilterEvent e)
{
super.setFilter(e);
e.addCustomQFilter(new QFilter("yem_transportstyle.name", QFilter.equals,"快递"));
// e.addCustomQFilter(new QFilter("yem_transportstyle.name", QFilter.equals,"快递"));
e.addCustomQFilter(new QFilter("yem_quicknotentry.yem_isbankdocument", QCP.equals, "0"));
}
}

View File

@ -134,6 +134,7 @@ public class StorageTransAuditOp extends AbstractOperationServicePlugIn {
}
}
dataEntitie.set("yem_whether",true);
}
}

View File

@ -39,6 +39,7 @@ public class StorageTransUnAuditOp extends AbstractOperationServicePlugIn implem
backFillCsrCreditLine(dataEntitie);
giftAmount(dataEntitie);
giftSpecialAmount(dataEntitie);
dataEntitie.set("yem_whether",false);
}
}

View File

@ -390,6 +390,8 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countAfterFrontPrice(model, row);//折扣后销售单价
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
break;
case "yem_frontdisprice"://折扣前单价
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
@ -505,6 +507,7 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
// break;
case "yem_sapricepriceclause":
// ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价价格条款
break;
case "yem_sapriceclausebase":
// ClientUtils.countRealCatPrice(model, row);
@ -514,6 +517,7 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
break;
case "yem_truecarprice":
// ClientUtils.countRealCatAmount(model, row);
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
ClientUtils.countRealCatPriceRMB(model, row);
break;
case "yem_truecarpriceba":
@ -575,6 +579,8 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
ClientUtils.totalSaFobAmount(model, "yem_im_detailedinfor", "yem_ifgift", "yem_totalamount", "yem_sumcost");//总费用 汇总表头 总费用
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
break;
case "yem_lenghtunit"://长度单位
case "yem_vol"://体积
@ -585,10 +591,13 @@ public class ClientDemandZJFormPlugin extends AbstractBillPlugIn implements Befo
// ClientUtils.countRealCatPrice(model, row);
ClientUtils.countFrontDisPrice(model, row);//折扣前单价
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
break;
case "yem_afterfrontdisprice"://折扣后销售单价
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
break;
case "yem_accamtusetype"://配件资金使用方式
ClientUtils.countDisAmt(model, "yem_im_detailedinfor", row, view);//计算折扣金额

View File

@ -342,6 +342,8 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countAfterFrontPrice(model, row);//折扣后销售单价
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
break;
case "yem_frontdisprice"://折扣前单价
ClientUtils.countFrontDisAmt(model, row);//折扣前销售金额
@ -457,6 +459,7 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
// break;
case "yem_sapricepriceclause":
// ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.addSaAmountTkZJ(model, row);//整机合同整机非赠品行销售单价价格条款
break;
case "yem_sapriceclausebase":
// ClientUtils.countRealCatPrice(model, row);
@ -466,6 +469,7 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
break;
case "yem_truecarprice":
// ClientUtils.countRealCatAmount(model, row);
ClientUtils.countRealCatAmountZJ(model, row);//整机合同整机非赠品行实际整车金额
ClientUtils.countRealCatPriceRMB(model, row);
break;
case "yem_truecarpriceba":
@ -527,6 +531,8 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
ClientUtils.totalSaFobAmount(model, "yem_im_detailedinfor", "yem_ifgift", "yem_totalamount", "yem_sumcost");//总费用 汇总表头 总费用
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
break;
case "yem_lenghtunit"://长度单位
case "yem_vol"://体积
@ -537,11 +543,13 @@ public class InClientDemandZJFormPlugin extends AbstractBillPlugIn implements Be
// ClientUtils.countRealCatPrice(model, row);
ClientUtils.countFrontDisPrice(model, row);//折扣前单价
ClientUtils.addSaAmountTk(model, row);//销售金额价格条款结算币别
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
break;
case "yem_afterfrontdisprice"://折扣后销售单价
// ClientUtils.countSaPricePriceClause(model, row);//计算销售单价价格条款
ClientUtils.countSaPricePriceClauseZJ(model, row);//整机合同整机非赠品行销售单价价格条款
ClientUtils.countRealCatPriceZJ(model, row);//整机合同整机非赠品行实际整车单价
break;
case "yem_accamtusetype"://配件资金使用方式
ClientUtils.countDisAmt(model, "yem_im_detailedinfor", row, view);//计算折扣金额

View File

@ -16,6 +16,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import static com.yem.wm.es.salesorder.from.SalesOrderEdit.isZJ;
/**
* @author 张立攀
* @version 1.0
@ -511,6 +513,11 @@ public class ClientUtils {
*/
public static void countRealCatPrice(IDataModel model, int rowNow) {
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
//整机合同整机行非配件行不计算
return;
}
if (!ifgift) {
// BigDecimal sapriceclausebase = (BigDecimal) model.getValue("yem_sapricepriceclause", rowNow);
// BigDecimal pricefieldacc = (BigDecimal) model.getValue("yem_pricefieldaccba", rowNow);
@ -530,6 +537,11 @@ public class ClientUtils {
public static void countRealCatAmount(IDataModel model, int rowNow) {
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
//整机合同整机行非配件行不计算
return;
}
if (!ifgift) {
BigDecimal saamtpriceclause = (BigDecimal) model.getValue("yem_saamtpriceclause", rowNow); // 销售金额价格条款
BigDecimal pricefieldaccamt = (BigDecimal) model.getValue("yem_pricefieldaccamt", rowNow); // 资源配件金额
@ -1184,6 +1196,11 @@ public class ClientUtils {
public static void countSaPricePriceClause(IDataModel model, int row) {
BigDecimal afterFrontDisPrice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row); // 折扣后销售单价
boolean ifgift = (boolean) model.getValue("yem_ifgift", row);
String businesssort = (String) model.getValue("yem_businesssort", row);
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
//整机合同整机行非配件行不计算
return;
}
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);//数量
if (!ifgift) {
BigDecimal priceFieldAccBa = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配置单价
@ -1219,6 +1236,11 @@ public class ClientUtils {
*/
public static void addSaAmountTk(IDataModel model, int rowNow) {
boolean ifgift = (boolean) model.getValue("yem_ifgift", rowNow);
String businesssort = (String) model.getValue("yem_businesssort", rowNow);
if (isZJ(model) && "Z".equals(businesssort) && !ifgift) {
//整机合同整机行非配件行不计算
return;
}
String[] roundArr = {
"yem_es_salesorder_ZJ",
"yem_es_salesorder_nmzj",
@ -1257,6 +1279,58 @@ public class ClientUtils {
// calculateInsurancePremiums(rowNow, model);
}
/**
* 整机计算 销售单价价格条款=折扣后销售单价+单车总费用+资源配件单价
* @param model
* @param row
*/
public static void countSaPricePriceClauseZJ(IDataModel model, int row) {
BigDecimal afterfrontdisprice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row);//折扣后销售单价
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);//单车总费用
BigDecimal pricefieldaccba = (BigDecimal) model.getValue("yem_pricefieldaccba", row);//资源配件单价
BigDecimal add = afterfrontdisprice.add(onecarsum).add(pricefieldaccba);
add = add.setScale(0, RoundingMode.UP);
model.setValue("yem_sapricepriceclause", add, row);
}
/**
* 整机 销售金额价格条款=销售单价价格条款*数量
* @param model
* @param row
*/
public static void addSaAmountTkZJ(IDataModel model, int row) {
BigDecimal sapricepriceclause = (BigDecimal) model.getValue("yem_sapricepriceclause", row);//销售单价价格条款
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);//数量
BigDecimal multiply = sapricepriceclause.multiply(qty);
model.setValue("yem_saamtpriceclause", multiply, row);
}
/**
* 整机 实际整车单价=折扣后销售单价+单车总费用
* @param model
* @param row
*/
public static void countRealCatPriceZJ(IDataModel model, int row) {
BigDecimal afterfrontdisprice = (BigDecimal) model.getValue("yem_afterfrontdisprice", row);
BigDecimal onecarsum = (BigDecimal) model.getValue("yem_onecarsum", row);
BigDecimal add = afterfrontdisprice.add(onecarsum);
add = add.setScale(0, RoundingMode.UP);
model.setValue("yem_truecarprice", add, row);
}
/**
* 整机 实际整车金额=实际整车单价*数量
* @param model
* @param row
*/
public static void countRealCatAmountZJ(IDataModel model, int row) {
BigDecimal truecarprice = (BigDecimal) model.getValue("yem_truecarprice", row);
BigDecimal qty = (BigDecimal) model.getValue("yem_qty", row);
BigDecimal multiply = truecarprice.multiply(qty);
model.setValue("yem_truecaramt", multiply, row);
}
/**
* 计算保险费
* 保险费=FOB单价+海运费*保险加成率*运保费率/100

View File

@ -3,6 +3,7 @@ package com.yem.wm.im.debcrednotenew.op;
import com.yem.wm.im.debcrednotenew.utils.DebCredUtils;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.operate.result.IOperateInfo;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
@ -38,38 +39,54 @@ public class PlaceexaMineNewAuditOp extends AbstractOperationServicePlugIn {
qFilter.and(new QFilter("billno", QCP.equals, yem_contractnumber));
DynamicObject yem_es_salesorder = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", "id,billno,yem_partscredit,yem_isgiftgiveparts", new QFilter[]{qFilter});
if (yem_es_salesorder != null) {
//配件贷记额度生效节点
String yem_partscredit = yem_es_salesorder.getString("yem_partscredit");
//是否配件赠送
String yem_isgiftgiveparts = yem_es_salesorder.getString("yem_isgiftgiveparts");
if (yem_partscredit.equals("A") && yem_isgiftgiveparts.equals("A")) {
DynamicObject object = BusinessDataServiceHelper.loadSingle(yem_es_salesorder.getLong("id"), "yem_es_salesorder");
DynamicObject debcrednote = DebCredUtils.AddQXGenerate(object, temp);
OperationResult Operate = OperationServiceHelper.executeOperate("save", debcrednote.getDynamicObjectType().getName(), new DynamicObject[]{debcrednote}, OperateOption.create());
if (Operate.isSuccess()) {
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
if (submitResult.isSuccess()) {
OperationResult auditResult = OperationServiceHelper.executeOperate("audit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
if (auditResult.isSuccess()) {
//只有整机行生成贷记单
Boolean isbusinesssort = false;
DynamicObjectCollection yem_es_materialinfo = temp.getDynamicObjectCollection("yem_es_materialinfo");
for (int i = 0; i < yem_es_materialinfo.size(); i++) {
DynamicObject dynamicObject = yem_es_materialinfo.get(i);
String yem_businesssort = dynamicObject.getString("yem_businesssort");
if (yem_businesssort.equals("Z")) {
isbusinesssort = true;
break;
}
}
//生成贷记单
if (isbusinesssort) {
DynamicObject debcrednote = DebCredUtils.AddQXGenerate(object, temp);
OperationResult Operate = OperationServiceHelper.executeOperate("save", debcrednote.getDynamicObjectType().getName(), new DynamicObject[]{debcrednote}, OperateOption.create());
if (Operate.isSuccess()) {
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
if (submitResult.isSuccess()) {
OperationResult auditResult = OperationServiceHelper.executeOperate("audit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
if (auditResult.isSuccess()) {
// //切换正式需去掉
// OperationResult estimatedResult = OperationServiceHelper.executeOperate("zyestimated", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
// if (estimatedResult.isSuccess()) {
temp.set("yem_debcreditno", debcrednote.getString("billno"));
temp.set("yem_debcreditid", debcrednote.getString("id"));
SaveServiceHelper.update(temp);
temp.set("yem_debcreditno", debcrednote.getString("billno"));
temp.set("yem_debcreditid", debcrednote.getString("id"));
SaveServiceHelper.update(temp);
// }
} else {
List<IOperateInfo> allErrorOrValidateInfo = auditResult.getAllErrorOrValidateInfo();
String message = auditResult.getMessage();
throw new KDBizException("贷记单审核失败," + message + "" + allErrorOrValidateInfo);
}
} else {
List<IOperateInfo> allErrorOrValidateInfo = auditResult.getAllErrorOrValidateInfo();
String message = auditResult.getMessage();
throw new KDBizException("贷记单审核失败," + message + "" + allErrorOrValidateInfo);
List<IOperateInfo> allErrorOrValidateInfo = submitResult.getAllErrorOrValidateInfo();
String message = submitResult.getMessage();
throw new KDBizException("贷记单提交失败," + message + "" + allErrorOrValidateInfo);
}
} else {
List<IOperateInfo> allErrorOrValidateInfo = submitResult.getAllErrorOrValidateInfo();
String message = submitResult.getMessage();
throw new KDBizException("贷记单提交失败," + message + "" + allErrorOrValidateInfo);
List<IOperateInfo> allErrorOrValidateInfo = Operate.getAllErrorOrValidateInfo();
String message = Operate.getMessage();
throw new KDBizException("贷记单保存失败," + message + "" + allErrorOrValidateInfo);
}
} else {
List<IOperateInfo> allErrorOrValidateInfo = Operate.getAllErrorOrValidateInfo();
String message = Operate.getMessage();
throw new KDBizException("贷记单保存失败," + message + "" + allErrorOrValidateInfo);
}
}
}

View File

@ -0,0 +1,74 @@
package com.yem.wm.im.materialpriceing;
import kd.bos.bill.AbstractBillPlugIn;
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 java.math.BigDecimal;
/**
* @author ljw
* @date 2024/9/6 10:05
* @description materialPriceingPlugin
*/
public class materialPriceingPlugin extends AbstractBillPlugIn {
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
super.propertyChanged(e);
String name = e.getProperty().getName();
ChangeData[] changeSet = e.getChangeSet();
switch (name) {
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();
int parentRowIndex = changeData.getParentRowIndex();
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
DynamicObjectCollection yemBdLogistics = this.getModel().getEntryEntity("yem_entryentity");
BigDecimal bigDecimal = yemBdLogistics.get(parentRowIndex).getDynamicObjectCollection("yem_subentryentity").get(rowIndex).getBigDecimal("yem_from");
if (bigDecimal.compareTo(newValue) >= 0) {
this.getModel().setValue("yem_reach",0,rowIndex,parentRowIndex);
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_entryentity");
BigDecimal bigDecimal = yemBdLogistics.get(parentRowIndex).getDynamicObjectCollection("yem_subentryentity").get(rowIndex - 1).getBigDecimal("yem_reach");
if (bigDecimal.compareTo(newValue) > 0) {
this.getModel().setValue("yem_from",0,rowIndex,parentRowIndex);
this.getView().showMessage("从不能小于前一行的至!!!");
}
}
}

View File

@ -50,10 +50,10 @@ public class VoidReasonEdit extends AbstractFormPlugin {
DynamicObject dataEntity = parentViewModel.getDataEntity();
String name = dataEntity.getDynamicObjectType().getName();
if (name.equals("yem_es_salesorder")) {
parentViewModel.setValue("yem_canceluser",YEM.getCurrentUserId());
parentViewModel.setValue("yem_canceldate",new Date());
// parentViewModel.setValue("yem_canceluser",YEM.getCurrentUserId());
// parentViewModel.setValue("yem_canceldate",new Date());
parentViewModel.setValue("yem_voidreson", voidreson);
parentViewModel.setValue("yem_cancelstatus", "B");
// parentViewModel.setValue("yem_cancelstatus", "B");
} else {
parentViewModel.setValue("yem_voidreson", voidreson);
parentViewModel.setValue("yem_voidstatus", "B");

View File

@ -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());
}
}

View File

@ -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("!!!!");
}
}
}

View File

@ -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,"运输方式+费用项目+港口唯一");
}
}
}
}
}

View File

@ -24,7 +24,6 @@ public class Application {
cosmic.setServerIP("10.64.112.152");
cosmic.setFileServerPathIPAndPort("","");
cosmic.setConfigUrl("10.64.112.152:2181","zookeeper","Cosmic@5092");
cosmic.set("login.type","STANDALONE");
// 134
// cosmic.setClusterNumber("yxzg-prod");