fix:
1.总需求计算,库存差计算
This commit is contained in:
parent
87931e6398
commit
3af4c1ff5d
@ -11,13 +11,12 @@ import kd.bos.dataentity.metadata.dynamicobject.DynamicProperty;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.exception.KDBizException;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.bos.form.control.AttachmentPanel;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.events.*;
|
||||
import kd.bos.form.control.events.RowClickEvent;
|
||||
import kd.bos.form.control.events.RowClickEventListener;
|
||||
import kd.bos.form.events.*;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
|
@ -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(yem_tolreqqty);
|
||||
model.setValue("yem_qtysub", yem_qtysub, i);
|
||||
@ -281,8 +286,54 @@ 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
|
||||
@ -492,7 +543,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