This commit is contained in:
2022-10-21 10:54:44 +08:00
parent 88e0fded15
commit e8022958e7
2 changed files with 27 additions and 23 deletions

View File

@@ -125,7 +125,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
if (ObjectUtil.isNotEmpty(form_qty)) { if (ObjectUtil.isNotEmpty(form_qty)) {
need_qty = form_qty.getDoubleValue("qty"); need_qty = form_qty.getDoubleValue("qty");
} }
BigDecimal canuse_num = NumberUtil.sub(now_ivt - need_qty); double canuse_num = NumberUtil.sub(now_ivt - need_qty).doubleValue();
jo1.put(material_id, String.format("%.3f", canuse_num)); jo1.put(material_id, String.format("%.3f", canuse_num));
//2、排产需求量(未开单的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量 //2、排产需求量(未开单的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量
@@ -164,7 +164,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
jo6.put(material_id, String.format("%.3f", notqty)); jo6.put(material_id, String.format("%.3f", notqty));
//5、库/需差额量 :库存现存量-排产需求量 //5、库/需差额量 :库存现存量-排产需求量
jo3.put(material_id, String.format("%.3f", (Double.parseDouble(canuse_num + "") - bom_qty))); jo3.put(material_id, String.format("%.3f", (canuse_num - bom_qty)));
//7、最低储备定额物料的安全库存量下限 //7、最低储备定额物料的安全库存量下限
JSONObject safe_jo = WQLObject.getWQLObject("ST_IVT_MaterialSafeIvt").query("material_id = '" + material_id + "'").uniqueResult(0); JSONObject safe_jo = WQLObject.getWQLObject("ST_IVT_MaterialSafeIvt").query("material_id = '" + material_id + "'").uniqueResult(0);
@@ -175,26 +175,30 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
jo7.put(material_id, String.format("%.3f", safe_qty)); jo7.put(material_id, String.format("%.3f", safe_qty));
//8、采购缺口库存+待检+在途+最低储备-排产量 //8、采购缺口库存+待检+在途+最低储备-排产量
double buy_qty = bom_qty + safe_qty - (canuse_num.doubleValue() + noin_qty + notqty); double buy_qty = bom_qty + safe_qty - (canuse_num + noin_qty + notqty);
jo8.put(material_id, String.format("%.3f", buy_qty)); jo8.put(material_id, String.format("%.3f", buy_qty));
//6、覆盖日期物料库存可坚持到哪一天库存现存量减每天需求量哪天<0,取前一天 //6、覆盖日期物料库存可坚持到哪一天库存现存量减每天需求量哪天<0,取前一天
for (int j = 1; j <= betweenDay; j++) { if (canuse_num<0){
DateTime newDate = DateUtil.offsetDay(date1, j); jo5.put(material_id, DateUtil.offsetDay(date1, -1).toString().substring(0, 10));
//查询该物料当天的需求量 }else {
JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time", newDate.toString().substring(0, 10) + "%").process().uniqueResult(0); for (int j = 1; j <= betweenDay; j++) {
double need_weight = 0; DateTime newDate = DateUtil.offsetDay(date1, j);
if (ObjectUtil.isNotEmpty(today_qty)) { //查询该物料当天的需求量
need_weight = today_qty.getDoubleValue("qty"); JSONObject today_qty = WQL.getWO("statistical_report_query_01").addParam("flag", "8").addParam("material_id", material_id).addParam("begin_time", newDate.toString().substring(0, 10) + "%").process().uniqueResult(0);
} double need_weight = 0;
if (now_ivt < need_weight) { if (ObjectUtil.isNotEmpty(today_qty)) {
jo5.put(material_id, DateUtil.offsetDay(newDate, -1).toString().substring(0, 10)); need_weight = today_qty.getDoubleValue("qty");
break; }
} else { if (canuse_num < need_weight) {
now_ivt -= need_weight; jo5.put(material_id, DateUtil.offsetDay(newDate, -1).toString().substring(0, 10));
} break;
if (j == betweenDay) { } else {
jo5.put(material_id, end_time.substring(0, 10)); canuse_num -= need_weight;
}
if (j == betweenDay) {
jo5.put(material_id, end_time.substring(0, 10));
}
} }
} }
} }

View File

@@ -196,7 +196,7 @@
pdm_bi_workorder wo pdm_bi_workorder wo
WHERE WHERE
wo.is_delete = '0' wo.is_delete = '0'
AND wo.`status` IN ( '10', '20', '30', '40' ) AND wo.`status` IN ( '10', '20', '30' )
OPTION 输入.begin_time <> "" OPTION 输入.begin_time <> ""
wo.planstart_time >= 输入.begin_time wo.planstart_time >= 输入.begin_time
ENDOPTION ENDOPTION
@@ -304,7 +304,7 @@
FROM FROM
pdm_bi_workorder wo pdm_bi_workorder wo
WHERE WHERE
wo.`status` < 50 wo.`status` < 40
AND is_delete = '0' AND is_delete = '0'
OPTION 输入.begin_time <> "" OPTION 输入.begin_time <> ""
wo.planstart_time >= 输入.begin_time wo.planstart_time >= 输入.begin_time
@@ -417,7 +417,7 @@
QUERY QUERY
SELECT SELECT
dtl.material_id, dtl.material_id,
ROUND((b.qty*dtl.standard_rate*0.01),3) AS qty SUM(ROUND(( b.qty * dtl.standard_rate * 0.01 ),3 )) AS qty
FROM FROM
( (
SELECT SELECT
@@ -502,7 +502,7 @@
LEFT JOIN md_me_materialbase mb ON mb.material_id = wo.material_id LEFT JOIN md_me_materialbase mb ON mb.material_id = wo.material_id
LEFT JOIN md_me_producmaterialext ext ON ext.material_id = wo.material_id LEFT JOIN md_me_producmaterialext ext ON ext.material_id = wo.material_id
WHERE WHERE
wo.`status` < 50 wo.`status` < 40
AND AND
wo.is_delete = '0' wo.is_delete = '0'
OPTION 输入.begin_time <> "" OPTION 输入.begin_time <> ""