Merge branch 'fix-report-zzs'

This commit is contained in:
zzs01@yunemao.com 2024-09-06 14:02:36 +08:00
commit 3a8c70150c
6 changed files with 146 additions and 17 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,6 +70,14 @@ 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());
@ -107,6 +116,10 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
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");

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
@ -107,6 +106,10 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
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());
@ -168,16 +171,8 @@ 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");
DataSet dataSet = ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
DataSet proReqBill = queryOrderProReqBill(param);
dataSet = dataSet.leftJoin(proReqBill)
.on("order_plan_id", "order_req_main_detail_fk")
.select(RptUtil.getDataSetFiledAlias(dataSet), RptUtil.getDataSetFiledAlias(proReqBill))
.finish();
return dataSet;
return ORM.create().queryDataSet(algoKey, "yem_es_salesorder", String.join(",", selectfields), qFilter.toArray());
}
private DataSet queryOrderProReqBill(ReportQueryParam param) {
@ -237,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_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;
}
/**

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
@ -116,6 +115,10 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
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;

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

@ -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

@ -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("从不能小于前一行的至!!!");
}
}
}