单据类型,仓库编辑修改

master
anthonywj 2 years ago
parent 6d52ad21cf
commit c615867b18

@ -236,14 +236,18 @@ public class InvWarehouseController extends BaseController {
if (invWarehouseEntity.getId() == null) { if (invWarehouseEntity.getId() == null) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }
InvWarehouseEntity originEntity = invWarehouseService.findByInvSubByCode(invWarehouseEntity.getCode());
if (!originEntity.getParentId().equals(invWarehouseEntity.getParentId()) || !originEntity.getParentCode().equals(invWarehouseEntity.getParentCode())) {
Integer userCount = warehouseUserService.countUserBySubInvCode(invWarehouseEntity.getCode()); Integer userCount = warehouseUserService.countUserBySubInvCode(invWarehouseEntity.getCode());
if (userCount > 0) { if (userCount > 0) {
return ResultVOUtils.error(500, "修改失败,请先移除该仓库关联用户!"); return ResultVOUtils.error(500, "修改部门或上级仓库时,请先移除该仓库关联用户!");
} }
}
// 先判断是否有相同名字的仓库 // 先判断是否有相同名字的仓库
boolean checkResult = invWarehouseService.checkDuplicateName(invWarehouseEntity.getParentId(), invWarehouseEntity.getName()); boolean checkResult = invWarehouseService.updateCheckExit(invWarehouseEntity);
if (checkResult) { if (checkResult) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "仓库名称重复!"); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "仓库名称重复!");
} }

@ -66,7 +66,7 @@ public class BasicBusTypeChangeController {
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
boolean result = basicBusTypeChangeService.verifyExists(basicBusTypeChangeEntity); boolean result = basicBusTypeChangeService.insertVerifyExists(basicBusTypeChangeEntity);
if (result) { if (result) {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "重复添加"); return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "重复添加");
} }

@ -1,6 +1,7 @@
package com.glxp.api.controller.basic; package com.glxp.api.controller.basic;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.Log; import com.glxp.api.annotation.Log;
@ -208,6 +209,7 @@ public class BasicBusTypePreController {
InvWarehouseEntity invWarehouse = invWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getInvCode()); InvWarehouseEntity invWarehouse = invWarehouseService.findByInvSubByCode(basicBusTypePreEntity.getInvCode());
basicBusTypePreEntity.setDeptCode(invWarehouse.getParentId()); basicBusTypePreEntity.setDeptCode(invWarehouse.getParentId());
} }
basicBusTypePreEntity.setId(IdUtil.getSnowflakeNextId());
basicBusTypePreService.insertBusChangeType(basicBusTypePreEntity); basicBusTypePreService.insertBusChangeType(basicBusTypePreEntity);
} else { } else {
ResultVOUtils.error(999, "参数错误"); ResultVOUtils.error(999, "参数错误");

@ -57,6 +57,9 @@ public class ioCodeRelController {
if (StrUtil.isNotEmpty(code)) { if (StrUtil.isNotEmpty(code)) {
UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(code); UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(code);
if(udiEntity == null){
return ResultVOUtils.error(500,"UDI码格式错误");
}
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiEntity.getUdi()); UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udiEntity.getUdi());
if (udiProductEntity.getPackLevel() != null) { if (udiProductEntity.getPackLevel() != null) {
if (Integer.valueOf(udiProductEntity.getPackLevel()) > 1) { if (Integer.valueOf(udiProductEntity.getPackLevel()) > 1) {

@ -16,12 +16,11 @@ public interface InvWarehouseService {
InvWarehouseEntity selectByThrCode(String code, String thirdSys); InvWarehouseEntity selectByThrCode(String code, String thirdSys);
InvWarehouseEntity getByWareId( String id); InvWarehouseEntity getByWareId(String id);
List<InvWarehouseEntity> getByWarePcode(@Param("parentCode") String parentCode); List<InvWarehouseEntity> getByWarePcode(@Param("parentCode") String parentCode);
List<InvWarehouseEntity> filterInvSubWarehouse(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest); List<InvWarehouseEntity> filterInvSubWarehouse(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest);
List<InvWarehouseEntity> filterGroupInvSub(FilterInvWarehouseRequest filterInvSubWarehouseRequest); List<InvWarehouseEntity> filterGroupInvSub(FilterInvWarehouseRequest filterInvSubWarehouseRequest);
@ -42,6 +41,8 @@ public interface InvWarehouseService {
public boolean checkDuplicateName(String parentId, String name); public boolean checkDuplicateName(String parentId, String name);
boolean updateCheckExit(InvWarehouseEntity invWarehouseEntity);
/** /**
* *
* *
@ -88,7 +89,8 @@ public interface InvWarehouseService {
* @return * @return
*/ */
List<InvWarehouseEntity> findInvListByUser(FilterInvWarehouseRequest filterInvWarehouseRequest); List<InvWarehouseEntity> findInvListByUser(FilterInvWarehouseRequest filterInvWarehouseRequest);
String selectParentIdByCode( String invCode);
String selectParentIdByCode(String invCode);
List<InvWarehouseEntity> selectInvById(List<String> InvList); List<InvWarehouseEntity> selectInvById(List<String> InvList);

@ -3,6 +3,7 @@ package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.InvWarehouseDao; import com.glxp.api.dao.auth.InvWarehouseDao;
import com.glxp.api.dao.thrsys.ThrSystemDao; import com.glxp.api.dao.thrsys.ThrSystemDao;
@ -142,6 +143,12 @@ public class InvWarehouseServiceImpl implements InvWarehouseService {
return false; return false;
} }
@Override
public boolean updateCheckExit(InvWarehouseEntity invWarehouseEntity) {
return invWarehouseDao.exists(new QueryWrapper<InvWarehouseEntity>().eq("parentId", invWarehouseEntity.getParentId())
.eq("name", invWarehouseEntity.getName()).ne("id", invWarehouseEntity.getId()));
}
@Override @Override
public String getSubInvName(String subInvCode) { public String getSubInvName(String subInvCode) {
if (StrUtil.isBlank(subInvCode)) { if (StrUtil.isBlank(subInvCode)) {

@ -1,6 +1,7 @@
package com.glxp.api.service.auth.impl; package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.WarehouseBussinessTypeDao; import com.glxp.api.dao.auth.WarehouseBussinessTypeDao;
@ -64,6 +65,7 @@ public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessType
entity.setCode(code); entity.setCode(code);
entity.setAction(bussinessTypeEntity.getAction()); entity.setAction(bussinessTypeEntity.getAction());
entity.setName(bussinessTypeEntity.getName()); entity.setName(bussinessTypeEntity.getName());
entity.setId(IdUtil.getSnowflakeNextId());
warehouseBussinessTypeEntities.add(entity); warehouseBussinessTypeEntities.add(entity);
}); });

@ -53,4 +53,7 @@ public interface IBasicBusTypeChangeService extends IService<BasicBusTypeChangeE
* @return * @return
*/ */
boolean verifyExists(BasicBusTypeChangeEntity basicBusTypeChangeEntity); boolean verifyExists(BasicBusTypeChangeEntity basicBusTypeChangeEntity);
boolean insertVerifyExists(BasicBusTypeChangeEntity basicBusTypeChangeEntity);
} }

@ -69,20 +69,18 @@ public class BasicBusTypeChangeServiceImpl extends ServiceImpl<BasicBusTypeChang
QueryWrapper<BasicBusTypeChangeEntity> wrapper = new QueryWrapper<>(); QueryWrapper<BasicBusTypeChangeEntity> wrapper = new QueryWrapper<>();
wrapper.eq("originAction", basicBusTypeChangeEntity.getOriginAction()) wrapper.eq("originAction", basicBusTypeChangeEntity.getOriginAction())
.eq("targetAction", basicBusTypeChangeEntity.getTargetAction()) .eq("targetAction", basicBusTypeChangeEntity.getTargetAction())
.eq("originName", basicBusTypeChangeEntity.getOriginName()); .eq("originName", basicBusTypeChangeEntity.getOriginName()).ne("id", basicBusTypeChangeEntity.getId());
List<BasicBusTypeChangeEntity> list = basicBusTypeChangeDao.selectList(wrapper); return basicBusTypeChangeDao.exists(wrapper);
if (CollUtil.isNotEmpty(list)) {
if (null != basicBusTypeChangeEntity.getId()) {
for (BasicBusTypeChangeEntity busTypeChangeEntity : list) {
if (busTypeChangeEntity.getId() != basicBusTypeChangeEntity.getId()) {
return true;
}
}
} else {
return true;
} }
}
return false;
@Override
public boolean insertVerifyExists(BasicBusTypeChangeEntity basicBusTypeChangeEntity) {
QueryWrapper<BasicBusTypeChangeEntity> wrapper = new QueryWrapper<>();
wrapper.eq("originAction", basicBusTypeChangeEntity.getOriginAction())
.eq("targetAction", basicBusTypeChangeEntity.getTargetAction())
.eq("originName", basicBusTypeChangeEntity.getOriginName());
return basicBusTypeChangeDao.exists(wrapper);
} }
private void setUpdateInfo(BasicBusTypeChangeEntity basicBusTypeChangeEntity) { private void setUpdateInfo(BasicBusTypeChangeEntity basicBusTypeChangeEntity) {

Loading…
Cancel
Save