38 changed files with 930 additions and 13 deletions
@ -0,0 +1,63 @@ |
|||
package com.yxt.warehouse.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.warehouse.biz.warehouseareawarning.*; |
|||
import com.yxt.warehouse.utils.OrgPathQuery; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/3/18 14:57 |
|||
*/ |
|||
@Api(tags = "库区预警信息") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/warehouseareawarning") |
|||
public class WarehouseAreaWarningRest { |
|||
|
|||
@Autowired |
|||
WarehouseAreaWarningService warehouseAreaWarningService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<WarehouseAreaWarningVo>> listPage(@RequestBody PagerQuery<WarehouseAreaWarningQuery> pq) { |
|||
return warehouseAreaWarningService.listPage(pq); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody List<WarehouseAreaWarningDto> dtos) { |
|||
return warehouseAreaWarningService.saveOrUpdate(dtos); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<WarehouseAreaWarningVo> initialization(@PathVariable("sid") String sid) { |
|||
return warehouseAreaWarningService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return warehouseAreaWarningService.delete(sid); |
|||
} |
|||
@ApiOperation("根据sid批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
public ResultBean delBySids(@RequestBody String[] sids){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
warehouseAreaWarningService.delAll(sids); |
|||
return rb.success(); |
|||
} |
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return warehouseAreaWarningService.updateIsEnable(sid,isEnable); |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.yxt.warehouse.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.warehouse.biz.warehousezone.*; |
|||
import com.yxt.warehouse.utils.OrgPathQuery; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/28 8:53 |
|||
*/ |
|||
@Api(tags = "区域信息") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/warehousezone") |
|||
public class WarehouseZoneRest { |
|||
|
|||
@Autowired |
|||
private WarehouseZoneService warehouseZoneService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<WarehouseZoneVo>> listPage(@RequestBody PagerQuery<WarehouseZoneQuery> pq) { |
|||
return warehouseZoneService.listPage(pq); |
|||
} |
|||
@ApiOperation("查询所有的库区") |
|||
@PostMapping("/listAll") |
|||
public ResultBean<List<WarehouseZone>> listAll(@RequestBody OrgPathQuery query) { |
|||
return warehouseZoneService.getAllType(query); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody WarehouseZoneDto dto) { |
|||
return warehouseZoneService.saveZone(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<WarehouseZoneInitVo> initialization(@PathVariable("sid") String sid) { |
|||
return warehouseZoneService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return warehouseZoneService.delete(sid); |
|||
} |
|||
|
|||
@ApiOperation("根据sid批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
public ResultBean delBySids(@RequestBody String[] sids){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
warehouseZoneService.delAll(sids); |
|||
return rb.success(); |
|||
} |
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return warehouseZoneService.updateIsEnable(sid,isEnable); |
|||
} |
|||
|
|||
@ApiOperation("根据仓库sid查询所有库位") |
|||
@GetMapping("/selectAll") |
|||
public ResultBean<List<WarehouseZoneAllVo>> selectAll(@RequestParam("ckSid") String ckSid){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<WarehouseZoneAllVo> vo = warehouseZoneService.selectAll(ckSid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/28 8:38 |
|||
*/ |
|||
@Data |
|||
public class WarehouseAreaWarning extends BaseEntity { |
|||
|
|||
private String warehouseAreaSid;//库区sid
|
|||
private String goodsSpuSid;//商品spu
|
|||
private String goodsSpuName;//商品spu
|
|||
private String goodsSpuCode;//
|
|||
private String goodsSkuSid;//sku
|
|||
private String goodsSkuTitle;//创建组织sid
|
|||
private String goodsSkuSpec;//创建组织sid
|
|||
private String alertUpperLimit;//上限
|
|||
private String warningLowerLimit;//下限
|
|||
private String type; |
|||
|
|||
} |
|||
|
@ -0,0 +1,25 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class WarehouseAreaWarningDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
private String warehouseAreaSid;//库区sid
|
|||
private String goodsSpuSid;//商品spu
|
|||
private String goodsSpuName;//商品spu
|
|||
private String goodsSpuCode;//
|
|||
private String alertUpperLimit;//上限
|
|||
private String warningLowerLimit;//下限
|
|||
private String type; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface WarehouseAreaWarningMapper extends BaseMapper<WarehouseAreaWarning> { |
|||
IPage<WarehouseAreaWarningVo> listPage(IPage<WarehouseAreaWarning> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseAreaWarning> qw); |
|||
WarehouseAreaWarningVo initialization (@Param("sid") String sid); |
|||
int updateBySidIsDelete(List<String> list); |
|||
List<WarehouseAreaWarningVo> listAll(@Param("orgPath")String orgPath); |
|||
} |
@ -0,0 +1,39 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.warehouse.biz.warehouseareawarning.WarehouseAreaWarningMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.warehouse.biz.warehouseareatype.WarehouseAreaTypeVo"> |
|||
select |
|||
a.* |
|||
from warehouse_area_type a |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="listAll" resultType="com.yxt.warehouse.biz.warehouseareatype.WarehouseAreaTypeVo"> |
|||
select |
|||
* |
|||
from warehouse_area_type a |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
s.orgSidPath like concat('%',#{orgPath},'%') and a.isDelete !='1' and a.isEnable ='1' |
|||
</where> |
|||
</select> |
|||
<select id="initialization" resultType="com.yxt.warehouse.biz.warehouseareatype.WarehouseAreaTypeVo"> |
|||
select |
|||
a.* |
|||
from warehouse_area_type a |
|||
where a.sid =#{sid} |
|||
</select> |
|||
<update id="updateBySidIsDelete"> |
|||
UPDATE warehouse_area_type |
|||
SET isDelete=1 |
|||
where sid in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
</update> |
|||
</mapper> |
@ -0,0 +1,22 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class WarehouseAreaWarningQuery implements Query { |
|||
private String name; |
|||
private String orgLevelKey;//
|
|||
private int index; |
|||
@ApiModelProperty("菜单路由") |
|||
private String menuUrl; |
|||
@ApiModelProperty("组织全路径sid") |
|||
private String orgPath; |
|||
@ApiModelProperty("用户sid") |
|||
private String userSid; |
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo; |
|||
import com.yxt.warehouse.utils.OrgPathQuery; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class WarehouseAreaWarningService extends MybatisBaseService<WarehouseAreaWarningMapper, WarehouseAreaWarning> { |
|||
|
|||
|
|||
public ResultBean<PagerVo<WarehouseAreaWarningVo>> listPage(PagerQuery<WarehouseAreaWarningQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseAreaWarningQuery query = pq.getParams(); |
|||
QueryWrapper<WarehouseAreaWarning> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getOrgLevelKey())) { |
|||
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
|||
String orgLevelKey=query.getOrgLevelKey(); |
|||
String orgSidPath=query.getOrgPath(); |
|||
int index=query.getIndex(); |
|||
if ("1".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("2".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("3".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.apply("s.orgSidPath like('"+orgSidPath+"')"); |
|||
} else if ("4".equals(orgLevelKey)) { |
|||
qw.eq("a.createBySid", query.getUserSid()); |
|||
} else { |
|||
PagerVo<WarehouseInfoVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
} else { |
|||
PagerVo<WarehouseInfoVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
if(StringUtils.isNotBlank(query.getName())){ |
|||
qw.like("a.WarehouseAreaWarningName",query.getName()); |
|||
} |
|||
qw.ne("a.isDelete","1"); |
|||
IPage<WarehouseAreaWarning> page = PagerUtil.queryToPage(pq); |
|||
IPage<WarehouseAreaWarningVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<WarehouseAreaWarningVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
|
|||
|
|||
public ResultBean<String> saveOrUpdate(List<WarehouseAreaWarningDto> dtos) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
for (WarehouseAreaWarningDto dto : dtos) { |
|||
WarehouseAreaWarning warehouseAreaWarning=baseMapper.selectOne(new QueryWrapper<WarehouseAreaWarning>() |
|||
.eq("warehouseAreaSid",dto.getWarehouseAreaSid()) |
|||
.eq("goodsSpuSid",dto.getGoodsSpuSid())); |
|||
if(null==warehouseAreaWarning){ |
|||
WarehouseAreaWarning warehouseAreaWarning1=new WarehouseAreaWarning(); |
|||
BeanUtil.copyProperties(dto,warehouseAreaWarning1); |
|||
baseMapper.insert(warehouseAreaWarning1); |
|||
}else { |
|||
warehouseAreaWarning.setAlertUpperLimit(dto.getAlertUpperLimit()); |
|||
warehouseAreaWarning.setWarningLowerLimit(dto.getWarningLowerLimit()); |
|||
baseMapper.updateById(warehouseAreaWarning); |
|||
} |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<WarehouseAreaWarningVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseAreaWarningVo vo = baseMapper.initialization(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseAreaWarning wmsWarehouseArea = fetchBySid(sid); |
|||
if (null != wmsWarehouseArea) { |
|||
baseMapper.deleteById(wmsWarehouseArea.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
public void delAll(String[] sids) { |
|||
int count = baseMapper.updateBySidIsDelete(Arrays.stream(sids).collect(Collectors.toList())); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseAreaWarning wmsWarehouseArea = fetchBySid(sid); |
|||
if (null != wmsWarehouseArea) { |
|||
wmsWarehouseArea.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsWarehouseArea); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.warehouse.biz.warehouseareawarning; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class WarehouseAreaWarningVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String warehouseAreaSid;//库区sid
|
|||
private String goodsSpuSid;//商品spu
|
|||
private String goodsSpuName;//商品spu
|
|||
private String goodsSpuCode;//
|
|||
private String goodsSkuSid;//sku
|
|||
private String goodsSkuTitle;//创建组织sid
|
|||
private String goodsSkuSpec;//创建组织sid
|
|||
private String alertUpperLimit;//上限
|
|||
private String warningLowerLimit;//下限
|
|||
private String type; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/28 8:38 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZone extends BaseEntity { |
|||
private String zoneName;//库位名称
|
|||
private String zoneCode;//库位编码
|
|||
private String warehouseSid;//仓库sid
|
|||
private BigDecimal volume;//库位容量
|
|||
private String unit;//计量单位
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:58 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZoneAllVo implements Vo { |
|||
|
|||
private String sid; |
|||
@ApiModelProperty("区域名称") |
|||
private String zoneName; |
|||
@ApiModelProperty("区域编码") |
|||
private String zoneCode; |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:37 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZoneDto implements Dto { |
|||
|
|||
private String sid; |
|||
private String remarks; |
|||
private String zoneName;//区域名称
|
|||
private String zoneCode;//区域编码
|
|||
private String warehouseSid;//仓库sid
|
|||
private String warehouseName;//仓库
|
|||
private String volume;//区域面积
|
|||
private String unit;//计量单位
|
|||
private String useOrgSid;//创建组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
private String userSid; //登录用户sid
|
|||
private String orgPath; //组织全路径
|
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:39 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZoneInitVo { |
|||
|
|||
private String sid; |
|||
private String remarks; |
|||
private String zoneName;//区域名称
|
|||
private String zoneCode;//区域编码
|
|||
private String warehouseSid;//仓库sid
|
|||
private String warehouseName;//仓库
|
|||
private String volume;//区域面积
|
|||
private String unit;//计量单位
|
|||
private String userSid; //用户sid
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
|
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface WarehouseZoneMapper extends BaseMapper<WarehouseZone> { |
|||
|
|||
IPage<WarehouseZoneVo> listPage(IPage<WarehouseZone> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseZone> qw); |
|||
|
|||
List<WarehouseZone> listAll(@Param("useOrgSid") String useOrgSid); |
|||
|
|||
WarehouseZone checkForInsert(@Param("zoneCode") String zoneCode, @Param("warehouseSid") String warehouseSid); |
|||
|
|||
int selectNum(@Param("warehouseCode") String warehouseCode); |
|||
|
|||
WarehouseZone checkForUpdate(@Param("zoneCode") String zoneCode, @Param("warehouseSid")String warehouseSid, @Param("sid") String sid); |
|||
|
|||
WarehouseZoneInitVo initialization(String sid); |
|||
|
|||
int updateBySidIsDelete(List<String> list); |
|||
|
|||
List<WarehouseZoneAllVo> selectAll(String ckSid); |
|||
} |
@ -0,0 +1,64 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.warehouse.biz.warehousezone.WarehouseZoneMapper"> |
|||
<update id="updateBySidIsDelete"> |
|||
UPDATE warehouse_zone |
|||
SET isDelete=1 |
|||
where sid in |
|||
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
</update> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
|
|||
<select id="listPage" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZoneVo"> |
|||
select |
|||
a.*,b.warehouseName as warehouseName |
|||
from warehouse_zone a |
|||
left join warehouse_info b on b.sid=a.warehouseSid |
|||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="listAll" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZone"> |
|||
select a.* |
|||
from warehouse_zone a |
|||
left join warehouse_info b on b.sid = a.warehouseSid |
|||
where b.useOrgSid = #{useOrgSid} |
|||
and a.isDelete = 0 |
|||
</select> |
|||
<select id="checkForInsert" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZone"> |
|||
select * |
|||
from warehouse_zone |
|||
where zoneCode = #{zoneCode} |
|||
and warehouseSid = #{warehouseSid} |
|||
and isDelete = 0 |
|||
</select> |
|||
<select id="selectNum" resultType="java.lang.Integer"> |
|||
select IFNULL(CAST(REPLACE(MAX(zoneCode), #{warehouseCode}, '') AS SIGNED), 0) as code |
|||
from warehouse_zone |
|||
where zoneCode LIKE concat(#{warehouseCode}, '%') |
|||
</select> |
|||
<select id="checkForUpdate" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZone"> |
|||
select * |
|||
from warehouse_zone |
|||
where zoneCode = #{zoneCode} |
|||
and warehouseSid = #{warehouseSid} |
|||
and sid !=#{sid} |
|||
and isDelete=0 |
|||
</select> |
|||
<select id="initialization" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZoneInitVo"> |
|||
select a.*, |
|||
a.createBySid as userSid, |
|||
b.warehouseName as warehouseName |
|||
from warehouse_zone a |
|||
left join warehouse_info b on b.sid = a.warehouseSid |
|||
where a.sid = #{sid} |
|||
</select> |
|||
<select id="selectAll" resultType="com.yxt.warehouse.biz.warehousezone.WarehouseZoneAllVo"> |
|||
select * from warehouse_zone where warehouseSid = #{ckSid} and isDelete = 0 and isEnable = 1 |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,28 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:24 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZoneQuery implements Query { |
|||
|
|||
private String name;//名字
|
|||
private String code;//编码
|
|||
private String warehouseSid;//仓库
|
|||
|
|||
@ApiModelProperty("菜单路由") |
|||
private String menuUrl; |
|||
@ApiModelProperty("组织全路径sid") |
|||
private String orgPath; |
|||
@ApiModelProperty("用户sid") |
|||
private String userSid; |
|||
private String orgLevelKey;//
|
|||
private int index;//下标
|
|||
|
|||
} |
@ -0,0 +1,163 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfo; |
|||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoService; |
|||
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo; |
|||
import com.yxt.warehouse.biz.warehouserack.WarehouseRackVo; |
|||
import com.yxt.warehouse.utils.OrgPathQuery; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.yxt.warehouse.utils.Rule; |
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:19 |
|||
*/ |
|||
@Service |
|||
public class WarehouseZoneService extends MybatisBaseService<WarehouseZoneMapper, WarehouseZone> { |
|||
|
|||
@Autowired |
|||
private WarehouseInfoService warehouseInfoService; |
|||
|
|||
public ResultBean<PagerVo<WarehouseZoneVo>> listPage(PagerQuery<WarehouseZoneQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseZoneQuery query = pq.getParams(); |
|||
QueryWrapper<WarehouseZone> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getOrgLevelKey())) { |
|||
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
|||
String orgLevelKey=query.getOrgLevelKey(); |
|||
String orgSidPath=query.getOrgPath(); |
|||
int index=query.getIndex(); |
|||
if ("1".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("2".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.like("s.orgSidPath", orgSidPath); |
|||
} else if ("3".equals(orgLevelKey)) { |
|||
orgSidPath = orgSidPath.substring(0, index); |
|||
qw.apply("s.orgSidPath like('"+orgSidPath+"')"); |
|||
} else if ("4".equals(orgLevelKey)) { |
|||
qw.eq("a.createBySid", query.getUserSid()); |
|||
} else { |
|||
PagerVo<WarehouseInfoVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
} else { |
|||
PagerVo<WarehouseInfoVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getName())) { |
|||
qw.like("a.zoneName", query.getName()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getCode())) { |
|||
qw.like("a.zoneCode", query.getCode()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getWarehouseSid())) { |
|||
qw.eq("b.sid", query.getWarehouseSid()); |
|||
} |
|||
qw.ne("a.isDelete", "1"); |
|||
IPage<WarehouseZone> page = PagerUtil.queryToPage(pq); |
|||
IPage<WarehouseZoneVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<WarehouseZoneVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
|
|||
public ResultBean<List<WarehouseZone>> getAllType(OrgPathQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<WarehouseZone> pagging = baseMapper.listAll(query.getOrgPath()); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
|
|||
public ResultBean<String> saveZone(WarehouseZoneDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
if (StringUtils.isNotBlank(dto.getSid())) { |
|||
String sid = dto.getSid(); |
|||
WarehouseZone wmsWarehouseZone = fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, wmsWarehouseZone, "id", "sid"); |
|||
if (StringUtils.isNotBlank(dto.getZoneCode()) && !dto.getZoneCode().equals("由系统自动生成")) { |
|||
WarehouseZone zone = baseMapper.checkForUpdate(dto.getZoneCode(), dto.getWarehouseSid(), sid); |
|||
if (null != zone) { |
|||
return rb.setMsg("同一个仓库下的区域编码不能重复。"); |
|||
} |
|||
} else { |
|||
WarehouseInfo warehouseInfo = warehouseInfoService.fetchBySid(dto.getWarehouseSid()); |
|||
if (null != warehouseInfo) { |
|||
String warehouseCode = warehouseInfo.getWarehouseCode(); |
|||
int i = baseMapper.selectNum(warehouseCode); |
|||
String code = Rule.getBillNo3(warehouseCode, i); |
|||
wmsWarehouseZone.setZoneCode(code); |
|||
} |
|||
} |
|||
wmsWarehouseZone.setModifyTime(new Date()); |
|||
baseMapper.updateById(wmsWarehouseZone); |
|||
} else { |
|||
WarehouseZone entity = new WarehouseZone(); |
|||
entity.setCreateBySid(dto.getUserSid()); |
|||
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|||
if (StringUtils.isNotBlank(dto.getZoneCode()) && !dto.getZoneCode().equals("由系统自动生成")) { |
|||
WarehouseZone zone = baseMapper.checkForInsert(dto.getZoneCode(), dto.getWarehouseSid()); |
|||
if (null != zone) { |
|||
return rb.setMsg("同一个仓库下的区域编码不能重复。"); |
|||
} |
|||
} else { |
|||
WarehouseInfo warehouseInfo = warehouseInfoService.fetchBySid(dto.getWarehouseSid()); |
|||
if (null != warehouseInfo) { |
|||
String warehouseCode = warehouseInfo.getWarehouseCode(); |
|||
int i = baseMapper.selectNum(warehouseCode); |
|||
String code = Rule.getBillNo3(warehouseCode, i); |
|||
entity.setZoneCode(code); |
|||
} |
|||
} |
|||
baseMapper.insert(entity); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean<WarehouseZoneInitVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseZoneInitVo vo = baseMapper.initialization(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseZone wmsWarehouseZone = fetchBySid(sid); |
|||
if (null != wmsWarehouseZone) { |
|||
baseMapper.deleteById(wmsWarehouseZone.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public void delAll(String[] sids) { |
|||
int count = baseMapper.updateBySidIsDelete(Arrays.stream(sids).collect(Collectors.toList())); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid, String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
WarehouseZone wmsWarehouseZone = fetchBySid(sid); |
|||
if (null != wmsWarehouseZone) { |
|||
wmsWarehouseZone.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsWarehouseZone); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public List<WarehouseZoneAllVo> selectAll(String ckSid) { |
|||
return baseMapper.selectAll(ckSid); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.warehouse.biz.warehousezone; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Fan |
|||
* @description |
|||
* @date 2024/9/14 14:24 |
|||
*/ |
|||
@Data |
|||
public class WarehouseZoneVo implements Vo { |
|||
|
|||
private String sid; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String isDelete; |
|||
private String zoneName;//区域名称
|
|||
private String zoneCode;//区域编码
|
|||
private String volume;//区域面积
|
|||
private String unit;//计量单位
|
|||
private String warehouseName;//仓库名称
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
Loading…
Reference in new issue