提价bug

This commit is contained in:
zds
2022-07-01 11:05:38 +08:00
parent 8c86db4f8f
commit d4b87da946
2 changed files with 22 additions and 12 deletions

View File

@@ -195,20 +195,30 @@ public class InitformulaServiceImpl implements InitformulaService {
if(bom==null){
throw new BadRequestException("当前成品未查询到相关bom");
}
String bom_id = bom.getString("bom_id");
double workorder_qty = Double.valueOf(map.get("workorder_qty"));
map.put("bom_id", bom.getString("bom_id"));
map.put("material_ids", MaterOptTypeEnum.TJJ_AND_OTHER.getClass_idStr());
JSONArray json = WQL.getWO("QPF_INITFORMULA01").addParamMap(map).process().getResultJSONArray(0);
// JSONArray ja = new JSONArray();
// for(int i=0;i<json.size();i++){
// JSONObject jo = json.getJSONObject(i);
// if(StrUtil.isNotEmpty(jo.getString("mater_standard_rate"))){
// double mater_standard_rate = jo.getDouble("mater_standard_rate");
// //需配总量
// jo.put("need_sum_qty",workorder_qty*mater_standard_rate/100.0);
// }
// ja.add(jo);
// }
JSONArray ja = new JSONArray();
WQLObject md_pd_productbomdtl = WQLObject.getWQLObject("md_pd_productbomdtl");
for(int i=0;i<json.size();i++){
JSONObject jo = json.getJSONObject(i);
String jo_material_id = jo.getString("material_id");
JSONObject bomdtl = md_pd_productbomdtl.query("bom_id='"+bom_id+"' and material_id='"+jo_material_id+"'").uniqueResult(0);
if(bomdtl!=null){
double mater_standard_rate = bomdtl.getDouble("standard_rate");
//需配总量
jo.put("need_sum_qty",workorder_qty*mater_standard_rate/100.0);
jo.put("mater_standard_rate",mater_standard_rate);
}else{
//需配总量
jo.put("need_sum_qty","0");
//需配总量
jo.put("mater_standard_rate","0");
}
ja.add(jo);
}
return json;
}
@Override