fix:
1.跟单任务控制台-配件,总需求现有逻辑是合同已审核数量减去调拨已审核数量,需要再减去其他领料审核的数量,再减去跟单任务控制台上的取消数量
This commit is contained in:
parent
3590bcdb35
commit
902ffd9b94
@ -38,6 +38,7 @@ import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@ -79,7 +80,7 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
map.put("现产", "A");
|
||||
map.put("改制", "B");
|
||||
map.put("外购", "D");
|
||||
map.put("库存车","G");
|
||||
map.put("库存车", "G");
|
||||
fillEntityCombo(map);
|
||||
}
|
||||
if (billtype.equals("yem_tracktaskconsole_pj")) {
|
||||
@ -188,7 +189,7 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
if (yemMateriel != null) {
|
||||
String number = yemMateriel.getString("number");
|
||||
QFilter qFilter = new QFilter("yem_materialentry.yem_materiel.number", QCP.equals, number);
|
||||
qFilter.and(new QFilter("enable",QCP.equals,"1"));
|
||||
qFilter.and(new QFilter("enable", QCP.equals, "1"));
|
||||
String selectfield = DynamicObjectUtil.getSelectfields("yem_materialinventoryage", false);
|
||||
String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_materialinventoryage", "yem_materialentry", false);
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("yem_materialinventoryage", selectfields, new QFilter[]{qFilter});
|
||||
@ -204,12 +205,12 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
date = getDate(i, number, dynamicObject, yemBizdate);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
this.getModel().setValue("yem_ageingdata", 0, i);
|
||||
this.getModel().setValue("yem_ageingdate", 0, i);
|
||||
this.getModel().setValue("yem_ageing", 0, i);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
this.getModel().setValue("yem_ageingdata", 0, i);
|
||||
this.getModel().setValue("yem_ageingdate", 0, i);
|
||||
this.getModel().setValue("yem_ageing", 0, i);
|
||||
@ -229,12 +230,13 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
DynamicObject materialEntry = materialEntries.get(i);
|
||||
String materialNum = materialEntry.getString("yem_materiel.number");
|
||||
long materialNumid = materialEntry.getLong("yem_materiel.id");
|
||||
BigDecimal yemCancelNum = materialEntry.getBigDecimal("yem_cancel_num");
|
||||
//已采购
|
||||
BigDecimal yem_buyfromcmmp = getbuyfromcmmp(materialNum, yem_bd_products);
|
||||
model.setValue("yem_buyfromcmmp", yem_buyfromcmmp, i);
|
||||
//储备
|
||||
DynamicObjectCollection yem_accreserveapply = QueryServiceHelper.query("yem_accreserveapply", "yem_detailinfo.yem_qty", new QFilter[]{new QFilter("yem_detailinfo.yem_materiel.id", QCP.equals, materialNumid), new QFilter("status", QCP.equals, "C")}, "yem_audittime desc", 1);
|
||||
if (yem_accreserveapply != null && yem_accreserveapply.size() > 0) {
|
||||
if (yem_accreserveapply != null && !yem_accreserveapply.isEmpty()) {
|
||||
model.setValue("yem_accreserveqty", yem_accreserveapply.get(0).getBigDecimal("yem_detailinfo.yem_qty"), i);
|
||||
}
|
||||
//VMI-eas数量+CMMP数量
|
||||
@ -254,7 +256,10 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
BigDecimal cmmpyem_gmpjqty = getSumCMMPQty(materialNum, "D", yem_bd_products);
|
||||
model.setValue("yem_gmpjqty", easyem_gmpjqty.add(cmmpyem_gmpjqty), i);
|
||||
BigDecimal tolreqqty = gettolreqqty(yem_bd_products, materialNumid);
|
||||
model.setValue("yem_tolreqqty", tolreqqty, i);
|
||||
BigDecimal yemEsDelivernoticeqty = getDelivernoticeqty(yem_bd_products, materialNumid);
|
||||
BigDecimal yem_tolreqqty = tolreqqty.subtract(yemEsDelivernoticeqty);
|
||||
yem_tolreqqty = yem_tolreqqty.subtract(yemCancelNum);
|
||||
model.setValue("yem_tolreqqty", yem_tolreqqty, i);
|
||||
//处理库存差
|
||||
BigDecimal yem_qtysub = easyem_gmpjqty.add(cmmpyem_gmpjqty).add(yem_buyfromcmmp).subtract(tolreqqty);
|
||||
model.setValue("yem_qtysub", yem_qtysub, i);
|
||||
@ -281,8 +286,43 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取销售出库其他出库的已审核数量汇总数据
|
||||
*
|
||||
* @param yem_bd_products 产品分类
|
||||
*
|
||||
* @param materialNumid 物料编码
|
||||
*
|
||||
* @return 数量汇总值
|
||||
*
|
||||
*/
|
||||
@NotNull
|
||||
private static BigDecimal getDelivernoticeqty(DynamicObject yem_bd_products, long materialNumid) {
|
||||
List<Long> productId = getProductId(yem_bd_products);
|
||||
QFilter qFilter = new QFilter("billstatus", QCP.equals, "C");
|
||||
qFilter.and("yem_billtype.number", QCP.equals, "yem_es_delivernotice_o");
|
||||
qFilter.and("yem_es_materialinfo.yem_materiel.id", QCP.equals, materialNumid);
|
||||
qFilter.and("yem_bd_products.id", QCP.in, productId);
|
||||
DynamicObject[] yemEsDelivernotice = BusinessDataServiceHelper.load("yem_es_delivernotice", "id,billno" +
|
||||
",yem_es_materialinfo,yem_es_materialinfo.yem_qty,yem_es_materialinfo.yem_materiel,billstatus,yem_billtype,yem_bd_products"
|
||||
, new QFilter[]{qFilter});
|
||||
BigDecimal yemEsDelivernoticeqty = BigDecimal.ZERO;
|
||||
for (DynamicObject dynamicObject : yemEsDelivernotice) {
|
||||
DynamicObjectCollection yemEsMaterialinfo1 = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
for (DynamicObject object : yemEsMaterialinfo1) {
|
||||
long aLong = object.getLong("yem_materiel.id");
|
||||
BigDecimal yemQty = object.getBigDecimal("yem_qty");
|
||||
if (aLong == materialNumid) {
|
||||
yemEsDelivernoticeqty = yemQty.add(yemEsDelivernoticeqty);
|
||||
}
|
||||
}
|
||||
}
|
||||
return yemEsDelivernoticeqty;
|
||||
}
|
||||
|
||||
/**
|
||||
* 账龄赋值
|
||||
*
|
||||
* @param i
|
||||
* @param number
|
||||
* @param dynamicObject
|
||||
@ -492,7 +532,7 @@ public class tracktaskconsoleFormPlugIn extends AbstractBillPlugIn implements Be
|
||||
"yem_es_materialinfo.yem_qty, yem_es_materialinfo.yem_materiel", new QFilter[]{
|
||||
new QFilter("yem_es_materialinfo.yem_materiel.id", QCP.equals, materialNumid),
|
||||
new QFilter("yem_bd_products.id", QCP.in, productId)
|
||||
});
|
||||
});
|
||||
BigDecimal stockqty = BigDecimal.ZERO;
|
||||
for (DynamicObject yemStockqty : yem_stockqtys) {
|
||||
DynamicObjectCollection collection = yemStockqty.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
|
Loading…
Reference in New Issue
Block a user