opt:质检单确认接口优化

This commit is contained in:
zhangzq
2023-12-25 13:59:23 +08:00
parent ec7d09ccfc
commit 8a9628a2d0
3 changed files with 18 additions and 14 deletions

View File

@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import org.nl.annotation.Log;
import org.nl.wms.common.util.RedissonUtils;
import org.nl.wms.ql.service.PhysicalMstService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -81,7 +82,9 @@ public class PhysicalMstController {
@ApiOperation("确认")
@PutMapping("/confirm")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
physicalMstService.confirm(whereJson);
RedissonUtils.lock(a->{
physicalMstService.confirm(whereJson);
},"质检单:"+whereJson.getString("inspection_id"),null);
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@@ -19,6 +19,7 @@ import org.nl.ext.lk.service.impl.WmsToLkServiceImpl;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.system.util.MapOf;
import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
@@ -583,15 +584,14 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService
if (ObjectUtil.isEmpty(redArr)) {
throw new BadRequestException("此物料【" + jsonMst.getString("material_code") + "】没有桶记录表");
}
redTab.update(MapOf.of("quality_scode",jsonDtl.getString("result")
,"ivt_level",jsonDtl.getString("grade"))
,"material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and status = '03'");
for (int k = 0; k < redArr.size(); k++) {
JSONObject json = redArr.getJSONObject(k);
String quality_scode = json.getString("quality_scode"); // 原品质类型
String ivt_level = json.getString("ivt_level"); //原库存
String result_qty = json.getString("storage_qty"); // 原结存数量
json.put("quality_scode", jsonDtl.getString("result"));
json.put("ivt_level", jsonDtl.getString("grade"));
redTab.update(json);
if (StrUtil.equals(jsonDtl.getString("result"), "02")) {
//不合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
@@ -609,7 +609,8 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService
jsonRedFow.put("qty_unit_id", json.getString("qty_unit_id"));
jsonRedFow.put("qty_unit_name", json.getString("qty_unit_name"));
redFlowTab.insert(jsonRedFow);
} else if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
}
else if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) {
// 合格 插入桶物料变动表
JSONObject jsonRedFow = new JSONObject();
jsonRedFow.put("change_id", IdUtil.getSnowflake(1, 1).nextId());

View File

@@ -416,14 +416,14 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
throw new BadRequestException("等级或者结果不能为空");
}
// 判断明细表中的项点值是否为空
JSONArray itemArr = WQL.getWO("QL_TEST_PhysicalMst_02").addParam("flag", "3").addParam("material_id", material_id).process().getResultJSONArray(0);
int num = 0;
for (int i = 0; i < itemArr.size(); i++) {
JSONObject jsonObject = itemArr.getJSONObject(i);
String inspection_item_id = jsonObject.getString("inspection_item_id");
JSONObject JsonValue = phyDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + inspection_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(JsonValue)) num = num + 1;
}
// JSONArray itemArr = WQL.getWO("QL_TEST_PhysicalMst_02").addParam("flag", "3").addParam("material_id", material_id).process().getResultJSONArray(0);
// int num = 0;
// for (int i = 0; i < itemArr.size(); i++) {
// JSONObject jsonObject = itemArr.getJSONObject(i);
// String inspection_item_id = jsonObject.getString("inspection_item_id");
// JSONObject JsonValue = phyDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + inspection_id + "'").uniqueResult(0);
// if (ObjectUtil.isNotEmpty(JsonValue)) num = num + 1;
// }
// if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
/*