Revert "fix:"

This reverts commit 6291ed8b21.
This commit is contained in:
25655 2025-03-22 17:27:27 +08:00
parent 6291ed8b21
commit c2b81b8385

View File

@ -38,7 +38,6 @@ 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.*;
@ -80,7 +79,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")) {
@ -189,7 +188,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});
@ -205,12 +204,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);
@ -230,13 +229,12 @@ 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.isEmpty()) {
if (yem_accreserveapply != null && yem_accreserveapply.size() > 0) {
model.setValue("yem_accreserveqty", yem_accreserveapply.get(0).getBigDecimal("yem_detailinfo.yem_qty"), i);
}
//VMI-eas数量+CMMP数量
@ -256,12 +254,9 @@ 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);
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);
model.setValue("yem_tolreqqty", tolreqqty, i);
//处理库存差
BigDecimal yem_qtysub = easyem_gmpjqty.add(cmmpyem_gmpjqty).add(yem_buyfromcmmp).subtract(yem_tolreqqty);
BigDecimal yem_qtysub = easyem_gmpjqty.add(cmmpyem_gmpjqty).add(yem_buyfromcmmp).subtract(tolreqqty);
model.setValue("yem_qtysub", yem_qtysub, i);
}
this.getView().showMessage("查询库存成功!");
@ -286,54 +281,8 @@ 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);
//获取仓库分类为国贸各事业部仓库id集合
DynamicObjectCollection whColl = QueryServiceHelper.query("yem_warehouse", "id",
new QFilter[]{new QFilter("yem_sort", QCP.equals, "D"),
new QFilter("enable", QCP.equals, "1")});
ArrayList<Long> whids = new ArrayList<>();
for (DynamicObject wh : whColl) {
whids.add(wh.getLong("id"));
}
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);
qFilter.and("yem_es_materialinfo.yem_warehouse.yem_sort.id", QCP.in, whids);
//调出仓库的仓库分类为国贸各事业部仓库
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
@ -543,7 +492,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");