This commit is contained in:
2022-10-19 10:22:05 +08:00
parent b144709781
commit a8a2d185e8
2 changed files with 33 additions and 26 deletions

View File

@@ -128,15 +128,15 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
BigDecimal canuse_num = NumberUtil.sub(now_ivt - need_qty);
jo1.put(material_id, String.format("%.3f",canuse_num));
//2、排产需求量(未开的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量
JSONObject nedd_mater = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("material_id", material_id).process().uniqueResult(0);
//2、排产需求量(未开的工令重量+排产未生成工令日计划重量)根据bom计算需要多少原料库存重量
JSONObject nedd_mater = WQL.getWO("statistical_report_query_01").addParam("flag", "6").addParam("material_id", material_id).addParam("begin_time",begin_time).addParam("end_time",end_time).process().uniqueResult(0);
double bom_qty = 0;
if (ObjectUtil.isNotEmpty(nedd_mater)) {
bom_qty = nedd_mater.getDoubleValue("qty");
}
jo2.put(material_id, String.format("%.3f",bom_qty));
//3、待检入库量已经到货还未入库+待检重量
//3、待检入库量sum(此物料未确认的到货单的单据数-入库数)
JSONObject num_jo = WQL.getWO("statistical_report_query_01").addParam("flag", "7").addParam("material_id", material_id).process().uniqueResult(0);
//订单数量
double proc_qty = 0;
@@ -208,7 +208,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
String begin_time = MapUtil.getStr(whereJson, "begin_time");
String end_time = MapUtil.getStr(whereJson, "end_time");
//查询日期内的排产日计划物料信息
JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "9").addParam("begin_time",begin_time).addParam("end_time",end_time).process().getResultJSONArray(0);
JSONArray jsonArr = WQL.getWO("statistical_report_query_01").addParam("flag", "3").addParam("begin_time",begin_time).addParam("end_time",end_time).process().getResultJSONArray(0);
JSONArray rows = new JSONArray();
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject row = jsonArr.getJSONObject(i);
@@ -241,7 +241,7 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
JSONArray jonsResuftArr = new JSONArray();
JSONObject jsonResuft1 = new JSONObject();
jsonResuft1.put("prop", "1");
jsonResuft1.put("label", "原料编码");
jsonResuft1.put("label", "统计项点");
jonsResuftArr.add(jsonResuft1);
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);

View File

@@ -197,13 +197,26 @@
pdm_bi_workorder wo
WHERE
wo.is_delete = '0'
AND wo.`status` IN ( '10', '20', '30', '40' ) UNION
AND wo.`status` IN ( '10', '20', '30', '40' )
OPTION 输入.begin_time <> ""
wo.planstart_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
wo.planstart_time <= 输入.end_time
ENDOPTION
UNION
SELECT
plan.material_id
FROM
mps_bd_productdailyplan plan
WHERE
plan.`status` = '01'
OPTION 输入.begin_time <> ""
plan.planstart_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
plan.planstart_date <= 输入.end_time
ENDOPTION
) a
LEFT JOIN md_pd_productbom bom ON bom.material_id = a.material_id
LEFT JOIN md_pd_productbomdtl dtl ON dtl.bom_id = dtl.bom_id
@@ -221,7 +234,7 @@
FROM
st_ivt_structivt
WHERE
1=1
quality_scode = '01'
OPTION 输入.material_id <> ""
material_id = 输入.material_id
ENDOPTION
@@ -263,7 +276,7 @@
QUERY
SELECT
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
(
SELECT
@@ -280,10 +293,10 @@
wo.`status` < 50
AND is_delete = '0'
OPTION 输入.begin_time <> ""
wo.planstart_date >= 输入.begin_time
wo.planstart_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
wo.planstart_date <= 输入.end_time
wo.planstart_time <= 输入.end_time
ENDOPTION
UNION ALL
SELECT
@@ -310,6 +323,8 @@
OPTION 输入.material_id <> ""
dtl.material_id = 输入.material_id
ENDOPTION
GROUP BY
dtl.material_id
ENDSELECT
ENDQUERY
ENDIF
@@ -327,8 +342,8 @@
(
SELECT
oder.QTY,
redtl.allqty,
oder.QTY - redtl.allqty AS notqty,
IFNULL(redtl.allqty,0) AS allqty,
oder.QTY - IFNULL(redtl.allqty,0) AS notqty,
redtl.allqty - redtl.instor_qty AS noin_qty,
ivt.ivt_qty,
mater.material_id
@@ -348,6 +363,9 @@
PCS_RC_ReceiveDtl a
LEFT JOIN PCS_IF_PurchaseOrderProc p ON a.source_billdtl_id = p.id
AND a.source_bill_code = p.vbillcode
LEFT JOIN pcs_rc_receivemst mst ON mst.receive_id = a.receive_id
WHERE
mst.is_delete = '0'
GROUP BY
a.source_billdtl_id
) AS redtl ON redtl.source_billdtl_id = oder.id
@@ -366,25 +384,14 @@
t.material_id
) AS ivt ON ivt.material_id = redtl.material_id
AND ivt.pcsn = redtl.pcsn
LEFT JOIN (
SELECT
p.input_time,
p.receive_id,
p.is_delete
FROM
PCS_RC_ReceiveMst p
WHERE
p.is_delete = '0'
ORDER BY
p.input_time DESC
LIMIT 1
) AS remst ON remst.receive_id = redtl.receive_id
WHERE
oder.dr = '0'
AND
oder.proc_status < '09'
) a
WHERE
1=1
OPTION 输入.flag <> ""
OPTION 输入.material_id <> ""
a.material_id = 输入.material_id
ENDOPTION
GROUP BY a.material_id