物料值改变事件,获取过去6个月事件内的最低成本单价
This commit is contained in:
parent
7d7139700a
commit
75fb60945e
|
|
@ -1,6 +1,7 @@
|
|||
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import kd.bamp.bastax.common.util.DateUtils;
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
|
|
@ -16,6 +17,7 @@ import kd.bos.logging.LogFactory;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import tqq9.lc123.cloud.app.eip.iscb.LCLogService;
|
||||
import tqq9.lc123.cloud.app.eip.iscb.impl.LCLogServiceImpl;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
|
||||
|
|
@ -23,10 +25,8 @@ import tqq9.lc123.cloud.app.plugin.utils.HttpRequestUtils;
|
|||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 采购订单
|
||||
|
|
@ -430,6 +430,47 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_gz, rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//物料值改变事件,获取过去6个月事件内的最低成本单价
|
||||
Date sixMonthsAgo = DateUtils.addMonth((Date) getModel().getValue("biztime"), -6);
|
||||
QFilter q1 = new QFilter("biztime", ">=", sixMonthsAgo);// 时间 大于等于 六个月
|
||||
QFilter q2 = new QFilter("billentry.material.masterid.id", "=", bd_material.getPkValue());//物料与当前行的物料相同
|
||||
QFilter q3 = new QFilter("billentry.tqq9_disandrefoundprice", "!=", 0);//明细-有优惠有返利单价不等于0
|
||||
QFilter q4 = new QFilter("billentry.tqq9_hfamount", "=", 0);// 明细-的货返金额等于0
|
||||
DynamicObjectCollection dymObjectCollerction = QueryServiceHelper.query("pm_purorderbill",
|
||||
"id,billentry,billentry.tqq9_disandrefoundprice,billentry.tqq9_hfamount,billentry.tqq9_disprice,billentry.material.id",
|
||||
new QFilter[]{q1,q2,q3,q4}, "billentry.tqq9_disprice asc", 1);
|
||||
List<DynamicObject> menuNotes = new ArrayList<>();
|
||||
|
||||
if(dymObjectCollerction != null && dymObjectCollerction.size() > 0){
|
||||
DynamicObject doj = dymObjectCollerction.get(0);
|
||||
BigDecimal tqq9_disprice = doj.getBigDecimal("billentry.tqq9_disprice");
|
||||
getModel().setValue("tqq9_costprice", tqq9_disprice, rowIndex);
|
||||
}
|
||||
|
||||
// for (DynamicObject doj : dymObjectCollerction) {
|
||||
// if (doj.getBigDecimal("billentry.tqq9_disandrefoundprice").compareTo(BigDecimal.ZERO) != 0
|
||||
// && doj.getBigDecimal("billentry.tqq9_hfamount").compareTo(BigDecimal.ZERO) == 0) {
|
||||
// menuNotes.add(doj);
|
||||
// }
|
||||
// }
|
||||
// // 冒泡排序升序排列
|
||||
// for (int i = 0; i < menuNotes.size() - 1; i++) {
|
||||
// for (int j = 0; j < menuNotes.size() - 1 - i; j++) {
|
||||
// BigDecimal price1 = menuNotes.get(j).getBigDecimal("billentry.tqq9_disprice");
|
||||
// BigDecimal price2 = menuNotes.get(j + 1).getBigDecimal("billentry.tqq9_disprice");
|
||||
// if (price1 == null) price1 = BigDecimal.ZERO;
|
||||
// if (price2 == null) price2 = BigDecimal.ZERO;
|
||||
// if (price1.compareTo(price2) > 0) {
|
||||
// // 交换元素
|
||||
// DynamicObject temp = menuNotes.get(j);
|
||||
// menuNotes.set(j, menuNotes.get(j + 1));
|
||||
// menuNotes.set(j + 1, temp);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// DynamicObject minPricesObj = menuNotes.get(0);
|
||||
// getModel().setValue("tqq9_costprice", minPricesObj.getBigDecimal("billentry.tqq9_disprice"), rowIndex);
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals("priceandtax", name)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue