bug优化

This commit is contained in:
mashuai 2024-06-12 18:20:02 +08:00
parent b19c374c54
commit 2d4c0cb34f
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.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo; 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.PutInStorageBean;
import com.bonus.sgzb.material.domain.SavePutInfoDto; import com.bonus.sgzb.material.domain.SavePutInfoDto;
import com.bonus.sgzb.material.service.InventoryAndWarehousingService; import com.bonus.sgzb.material.service.InventoryAndWarehousingService;
@ -46,6 +48,7 @@ public class InventoryAndWarehousingController extends BaseController {
*/ */
@ApiOperation(value = "新增入库盘点") @ApiOperation(value = "新增入库盘点")
@PostMapping("/addList") @PostMapping("/addList")
@Log(title = "盘点入库操作", businessType = BusinessType.MATERIAL)
public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) { public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) {
return inventoryAndWarehousingService.savePutInfo(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.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.DateUtils; 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.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.config.ExceptionEnum; import com.bonus.sgzb.material.config.ExceptionEnum;
@ -88,14 +89,25 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi
} }
String code = genderBackCode(); String code = genderBackCode();
List<MachIneDto> machIneDtoList = dto.getMachIneDtoList(); 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)) { if (CollectionUtils.isNotEmpty(machIneDtoList)) {
for (MachIneDto machIneDto : machIneDtoList) { for (MachIneDto machIneDto : machIneDtoList) {
if (StringUtils.isNotBlank(machIneDto.getMaCode())) {
int count = selectByMaCode(machIneDto.getMaCode()); int count = selectByMaCode(machIneDto.getMaCode());
if (count != 0) { if (count != 0) {
throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode()); throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode());
} }
} }
} }
}
int res; int res;
try { try {
//1. 判断是数量还是编号入库保存到不同表 //1. 判断是数量还是编号入库保存到不同表

View File

@ -70,7 +70,7 @@
) )
values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR}, values (#{modelTitle,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{task,jdbcType=VARCHAR},
#{typeId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{jsonResult,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> </insert>