代码更新

This commit is contained in:
2022-10-24 18:34:58 +08:00
parent 1c1f525000
commit 837a8a665f
2 changed files with 15 additions and 3 deletions

View File

@@ -162,6 +162,14 @@ public class WastecchangeServiceImpl implements WastecchangeService {
for (int i = 0; i < rf_arr.size(); i++) {
JSONObject json_rf_type = rf_arr.getJSONObject(i);
// 校验修正值必须为 -0.5 ~ 0.5 之间 或者为 99
double value = json_rf_type.getDoubleValue("value");
if (value != 99) {
if (!(-0.5 <= value && value <= 0.5)) {
throw new BadRequestException("修正值必须为-0.5~0.5的小时若无此软废修正值填为99");
}
}
HashMap<String, String> map = new HashMap<>();
map.put("flag", "2");
map.put("material_id", whereJson.getString("material_id"));
@@ -194,7 +202,12 @@ public class WastecchangeServiceImpl implements WastecchangeService {
JSONObject jsonExt_rf = extTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonExt_rf))
throw new BadRequestException("软废扩展属性不存在" + jsonExt_rf.getString("material_code"));
jsonExt_rf.put("c_balance", rf_c_balance);
if (value == 99) {
jsonExt_rf.put("c_balance", -1);
} else {
jsonExt_rf.put("c_balance", rf_c_balance);
}
extTab.update(jsonExt_rf);
}
}