Merge remote-tracking branch 'origin/master'

master
郑明梁 2 years ago
commit cc7cde1e29

@ -87,4 +87,20 @@ public interface InvSpaceDao extends BaseMapperPlus<InvSpace, InvSpace, InvSpace
* @return
*/
List<InvSpace> selectByInvCode(@Param("invStorageCode") String invStorageCode, @Param("invWarehouseCode") String invWarehouseCode, @Param("invSpaceCode") String invSpaceCode);
/**
*
*
* @param invSpace
* @return
*/
List<InvSpace> selectExistByName(InvSpace invSpace);
/**
*
*
* @param invCode
* @return
*/
String getMaxSpaceCode(@Param("invCode") String invCode);
}

@ -93,4 +93,9 @@ public class SupCertRemindMsgResponse {
*/
private String certName;
/**
*
*/
private int remindCount;
}

@ -26,7 +26,7 @@ import java.util.List;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao,InvSpace> implements InvSpaceService {
public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao, InvSpace> implements InvSpaceService {
@Resource
private InvSpaceDao invSpaceDao;
@ -54,6 +54,14 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao,InvSpace> imple
if (!"success".equals(result)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, result);
}
//获取当前仓库下的最大货位编码
String maxSpaceCode = invSpaceDao.getMaxSpaceCode(invSpace.getInvWarehouseCode());
if (StrUtil.isBlank(maxSpaceCode)) {
maxSpaceCode = "0000";
}
String spaceCode = getSpaceCode(maxSpaceCode);
invSpace.setCode(spaceCode);
Date date = new Date();
AuthAdmin user = customerService.getUserBean();
invSpace.setCreateTime(date);
@ -72,8 +80,8 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao,InvSpace> imple
*/
private static BaseResponse verifySpaceParams(InvSpace invSpace) {
//校验参数
if (StrUtil.isBlank(invSpace.getCode()) || StrUtil.isBlank(invSpace.getName())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "货位名称和货位号不能为空!");
if (StrUtil.isBlank(invSpace.getName())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "货位名称不能为空!");
}
if (StrUtil.isBlank(invSpace.getInvStorageCode()) || StrUtil.isBlank(invSpace.getInvWarehouseCode())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请指定所属仓库和分库!");
@ -143,22 +151,8 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao,InvSpace> imple
* @return
*/
public String verifyExist(InvSpace invSpace) {
//先检查货位号是否重复
List<InvSpace> invSpaces = invSpaceDao.selectByInvCode(invSpace.getInvStorageCode(), invSpace.getInvWarehouseCode(), invSpace.getCode());
if (CollUtil.isNotEmpty(invSpaces)) {
//判断ID是否为空如果为空表示数据为新增货位是重复添加-
if (null == invSpace.getId()) {
return "货位信息已存在";
}
//此分库下货位号重复判断ID是否与当前货位相同
for (InvSpace space : invSpaces) {
if (!space.getId().equals(invSpace.getId())) {
return "货位信息已存在";
}
}
}
List<InvSpace> list = invSpaceDao.selectExist(invSpace);
//判断此货位名称是否重复
List<InvSpace> list = invSpaceDao.selectExistByName(invSpace);
if (CollUtil.isNotEmpty(list)) {
if (null == invSpace.getId()) {
return "货位信息已存在";
@ -172,4 +166,16 @@ public class InvSpaceServiceImpl extends ServiceImpl<InvSpaceDao,InvSpace> imple
return "success";
}
/**
* +14
*
* @param maxSpaceCode
* @return
*/
public String getSpaceCode(String maxSpaceCode) {
Long l = Long.parseLong(maxSpaceCode) + 1L;
return String.format("%04d", l);
}
}

@ -382,4 +382,30 @@
</if>
</where>
</select>
<select id="selectExistByName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auth_space
<where>
<if test="invStorageCode != null and invStorageCode != ''">
AND invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != null and invWarehouseCode != ''">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
</where>
</select>
<select id="getMaxSpaceCode" resultType="java.lang.String">
select max(code) from auth_space
<where>
<if test="invCode != null and invCode != ''">
and invWarehouseCode = #{invCode}
</if>
</where>
</select>
</mapper>

@ -145,22 +145,23 @@
<insert id="insertInvSubWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.auth.InvWarehouseEntity">
replace
INTO auth_warehouse
( id, code, `name`, parentId, remark, defaultInv, advanceType, parentCode
, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
INTO auth_warehouse
( id, code, `name`, parentId, remark, defaultInv, advanceType, spUse,parentCode
, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
values (#{id},
#{code},
#{name},
#{parentId},
#{remark},
#{defaultInv},
#{advanceType},
#{parentCode},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4})
#{code},
#{name},
#{parentId},
#{remark},
#{defaultInv},
#{advanceType},
#{spUse},
#{parentCode},
#{thirdId},
#{thirdId1},
#{thirdId2},
#{thirdId3},
#{thirdId4})
</insert>

@ -41,9 +41,14 @@
<select id="selectByThrDeptCode" parameterType="com.glxp.api.req.thrsys.FilterThrSubInvWarehouseRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
select * from thr_inv_warehouse where parentId not in (SELECT code FROM thr_dept
where status=#{status} and thirdSysFk=#{thirdSysFk}) and thirdSysFk=#{thirdSysFk}
select * from thr_inv_warehouse
<where>
parentId not in (SELECT code FROM thr_dept
where status=#{status} and thirdSysFk=#{thirdSysFk}) and thirdSysFk=#{thirdSysFk}
<if test=" name != '' and name != null">
and name like concat('%',#{name},'%')
</if>
</where>
</select>
@ -140,4 +145,4 @@
</if>
</where>
</select>
</mapper>
</mapper>

Loading…
Cancel
Save