bug优化

This commit is contained in:
mashuai 2024-06-12 18:17:28 +08:00
parent 39f3988079
commit cf8e5eac70
3 changed files with 19 additions and 4 deletions

View File

@ -3,6 +3,8 @@ package com.bonus.sgzb.material.controller;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.material.domain.PutInStorageBean;
import com.bonus.sgzb.material.domain.SavePutInfoDto;
import com.bonus.sgzb.material.service.InventoryAndWarehousingService;
@ -46,6 +48,7 @@ public class InventoryAndWarehousingController extends BaseController {
*/
@ApiOperation(value = "新增入库盘点")
@PostMapping("/addList")
@Log(title = "盘点入库操作", businessType = BusinessType.MATERIAL)
public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) {
return inventoryAndWarehousingService.savePutInfo(dto);
}

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.config.ExceptionEnum;
@ -88,11 +89,22 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
}
String code = genderBackCode();
List<MachIneDto> machIneDtoList = dto.getMachIneDtoList();
//判断提交表单中是否存在相同编码
for (int i = 0; i < machIneDtoList.size() - 1; i++) {
for (int j = i + 1; j < machIneDtoList.size(); j++) {
if (machIneDtoList.get(i).getMaCode().equals(machIneDtoList.get(j).getMaCode())) {
throw new ServiceException("列表中包含以下相同的设备编码,请修改后重新提交:" + machIneDtoList.get(i).getMaCode());
}
}
}
//判断提交中设备编码是否与库中相同
if (CollectionUtils.isNotEmpty(machIneDtoList)) {
for (MachIneDto machIneDto : machIneDtoList) {
int count = selectByMaCode(machIneDto.getMaCode());
if (count != 0) {
throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode());
if (StringUtils.isNotBlank(machIneDto.getMaCode())) {
int count = selectByMaCode(machIneDto.getMaCode());
if (count != 0) {
throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode());
}
}
}
}

View File

@ -70,7 +70,7 @@
)
values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR},
#{typeId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{jsonResult,jdbcType=VARCHAR},
#{time,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}
now(), #{creator,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}
)
</insert>