mdf:粉料开单记录后端优化
This commit is contained in:
@@ -17,6 +17,7 @@ import org.nl.wql.core.bean.WQLObject;
|
|||||||
import org.nl.wql.util.WqlUtil;
|
import org.nl.wql.util.WqlUtil;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -61,15 +62,21 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService {
|
|||||||
String formula_id = json.getString("formula_id");
|
String formula_id = json.getString("formula_id");
|
||||||
// 根据配方主表id查找明细
|
// 根据配方主表id查找明细
|
||||||
JSONArray dtlArr = WQL.getWO("QP_POWDERORDERQUERY01").addParam("flag", "3").addParam("formula_id", formula_id).process().getResultJSONArray(0);
|
JSONArray dtlArr = WQL.getWO("QP_POWDERORDERQUERY01").addParam("flag", "3").addParam("formula_id", formula_id).process().getResultJSONArray(0);
|
||||||
|
JSONArray formulaDtlArrays = WQLObject.getWQLObject("PDM_BI_FormulaDtl").query("formula_id ='" + formula_id+"'").getResultJSONArray(0);
|
||||||
|
Map<String, List<Object>> formulaDtlBymId = formulaDtlArrays.stream().collect(Collectors.groupingBy(a -> {
|
||||||
|
JSONObject object = (JSONObject) a;
|
||||||
|
return object.getString("material_id");
|
||||||
|
}));
|
||||||
for (int j = 0; j < dtlArr.size(); j++) {
|
for (int j = 0; j < dtlArr.size(); j++) {
|
||||||
JSONObject jsonDtl = dtlArr.getJSONObject(j);
|
JSONObject jsonDtl = dtlArr.getJSONObject(j);
|
||||||
JSONArray arr = WQLObject.getWQLObject("PDM_BI_FormulaDtl").query("formula_id ='" + formula_id + "' and material_id ='" + jsonDtl.getString("material_id") + "'").getResultJSONArray(0);
|
// JSONArray arr = WQLObject.getWQLObject("PDM_BI_FormulaDtl").query("formula_id ='" + formula_id + "' and material_id ='" + jsonDtl.getString("material_id") + "'").getResultJSONArray(0);
|
||||||
|
List<Object> mIdFormulaDtl = formulaDtlBymId.get(jsonDtl.getString("material_id"));
|
||||||
jsonResult.put(jsonDtl.getString("material_id")+"",jsonDtl.getString("material_name"));
|
jsonResult.put(jsonDtl.getString("material_id")+"",jsonDtl.getString("material_name"));
|
||||||
if (arr.size() > 1) {
|
if (!CollectionUtils.isEmpty(mIdFormulaDtl)) {
|
||||||
String resPcsn = "";
|
String resPcsn = "";
|
||||||
String formula_qty = "";
|
String formula_qty = "";
|
||||||
for (int k = 0; k < arr.size(); k++) {
|
for (int k = 0; k < mIdFormulaDtl.size(); k++) {
|
||||||
JSONObject jsonObject = arr.getJSONObject(k);
|
JSONObject jsonObject = (JSONObject)mIdFormulaDtl.get(k);
|
||||||
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
|
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
|
||||||
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
|
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user