1.修改第三方仓库添加逻辑

master
MrZhai 3 years ago
parent 7de5d1c9c6
commit 111c1fb990

@ -71,13 +71,33 @@ public class ThrInvWarehouseController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
} }
if (thrInvWarehouseEntity.getPid() == null) { if (thrInvWarehouseEntity.getPid() == null) {//仓库
thrInvWarehouseEntity.setPid(0); // 默认设置 thrInvWarehouseEntity.setPid(0); // 默认设置
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid());
ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest);
thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
} else {//货位
FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest();
filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid());
ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest);
ThrInvWarehouseEntity pEntity = thrInvWarehouseService.selectById(thrInvWarehouseEntity.getPid() + "");
if (codeEntity == null) {
int code = Integer.parseInt(pEntity.getCode()) * 1000;
thrInvWarehouseEntity.setCode(code + "");
} else {
thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
}
thrInvWarehouseEntity.setAdvanceType(pEntity.getAdvanceType());
thrInvWarehouseEntity.setLevel(pEntity.getLevel());
thrInvWarehouseEntity.setPcode(pEntity.getPcode());
} }
boolean b = thrInvWarehouseService.insertInvWarehouse(thrInvWarehouseEntity); boolean b = thrInvWarehouseService.insertInvWarehouse(thrInvWarehouseEntity);
if (!b) { if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK); return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
} }
return ResultVOUtils.success("添加成功!"); return ResultVOUtils.success("添加成功!");
} }

@ -27,4 +27,6 @@ public interface ThrInvWarehouseDao {
* @return * @return
*/ */
ThrInvWarehouseEntity selectByCode(@Param("code") String code); ThrInvWarehouseEntity selectByCode(@Param("code") String code);
ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest);
} }

@ -16,4 +16,6 @@ public class FilterThrInvWarehouseRequest extends ListPageRequest {
private Boolean isDefault; private Boolean isDefault;
private Date updateTime; private Date updateTime;
private String key; private String key;
private String pcode;
private Integer level;
} }

@ -25,4 +25,5 @@ public interface ThrInvWarehouseService {
boolean deleteById(String id); boolean deleteById(String id);
ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest);
} }

@ -83,4 +83,9 @@ public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
public boolean deleteById(String id) { public boolean deleteById(String id) {
return thrInvWarehouseDao.deleteById(id); return thrInvWarehouseDao.deleteById(id);
} }
@Override
public ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest) {
return thrInvWarehouseDao.selectMaxCode(filterThrInvWarehouseRequest);
}
} }

@ -100,4 +100,34 @@
<select id="selectByCode" resultType="com.glxp.sale.admin.entity.thrsys.ThrInvWarehouseEntity"> <select id="selectByCode" resultType="com.glxp.sale.admin.entity.thrsys.ThrInvWarehouseEntity">
select * from thr_inv_warehouse where code = #{code} select * from thr_inv_warehouse where code = #{code}
</select> </select>
<select id="selectMaxCode" resultType="com.glxp.sale.admin.entity.thrsys.ThrInvWarehouseEntity">
select max(code) as code from thr_inv_warehouse
<where>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="pid != '' and pid != null">
AND pid = #{pid}
</if>
<if test="code != '' and code != null">
AND code = #{code}
</if>
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test=" advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
AND isDefault = #{isDefault}
</if>
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="level != null">
AND level = #{level}
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save