代码更新

This commit is contained in:
2022-11-30 15:37:14 +08:00
parent 4164a58727
commit 1bcf3bd93f

View File

@@ -85,10 +85,11 @@ public class SectattrServiceImpl implements SectattrService {
@Transactional(rollbackFor = Exception.class)
public void create(SectattrDto dto) {
String sect_code = dto.getSect_code();
SectattrDto sectattrDto = this.findByCode(sect_code);
if (sectattrDto != null && sectattrDto.getIs_delete().equals("0")) {
throw new BadRequestException("存在相同的库区编号");
}
WQLObject tab = WQLObject.getWQLObject("st_ivt_sectattr");
JSONObject json2 = tab.query("sect_code = '" + sect_code + "' and stor_id = '" + dto.getStor_id() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json2)) throw new BadRequestException("存在相同仓库的库区编号");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
@@ -116,11 +117,14 @@ public class SectattrServiceImpl implements SectattrService {
throw new BadRequestException("被删除或无权限,操作失败!");
}
String sect_code = dto.getSect_code();
/* String sect_code = dto.getSect_code();
SectattrDto sectattrDto = this.findByCode(sect_code);
if (sectattrDto != null && !dto.getSect_id().equals(sectattrDto.getSect_id()) && sectattrDto.getIs_delete().equals("0")) {
throw new BadRequestException("存在相同的库区编号");
}
}*/
String sect_code = dto.getSect_code();
WQLObject tab = WQLObject.getWQLObject("st_ivt_sectattr");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -135,6 +139,9 @@ public class SectattrServiceImpl implements SectattrService {
WQLObject wo = WQLObject.getWQLObject("st_ivt_sectattr");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
JSONArray resultJSONArray = tab.query("sect_code = '" + sect_code + "' and stor_id = '" + dto.getStor_id() + "'").getResultJSONArray(0);
if (resultJSONArray.size() > 1) throw new BadRequestException("存在相同仓库的库区编号");
}
@Override