库区预警
This commit is contained in:
@@ -82,4 +82,11 @@ public class WarehouseAreaRest {
|
||||
WarehouseAreaAllVo vo = wmsWarehouseAreaService.selectAreaByRackSid(ckSid);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
@ApiOperation("根据区域sid查询所有库区")
|
||||
@GetMapping("/selectAreaAll")
|
||||
public ResultBean<List<WarehouseAreaAllVo>> selectAreaAll(@RequestParam("qySid") String qySid){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<WarehouseAreaAllVo> vo = wmsWarehouseAreaService.selectAreaAll(qySid);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,11 @@ public class WarehouseInventoryRest {
|
||||
public ResultBean<PagerVo<WarehouseInventoryVo>> locationListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
||||
return WarehouseInventoryService.locationListPage(pq);
|
||||
}
|
||||
|
||||
@ApiOperation("库位预警分页列表")
|
||||
@PostMapping("/areaWarningListPage")
|
||||
public ResultBean<PagerVo<WarehouseInventoryVo>> areaWarningListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
||||
return WarehouseInventoryService.areaWarningListPage(pq);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询库位商品数量")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -18,5 +18,7 @@ public class WarehouseArea extends BaseEntity {
|
||||
private String areaTypeSid;//货区类型
|
||||
private String useOrgSid;
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String zoneSid;//区域
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -53,4 +53,5 @@ public class WarehouseAreaAllVo implements Vo {
|
||||
private String areaName;
|
||||
@ApiModelProperty("库位编码")
|
||||
private String areaCode;
|
||||
|
||||
}
|
||||
@@ -28,4 +28,8 @@ public class WarehouseAreaDto implements Dto {
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String userSid;
|
||||
private String orgPath;
|
||||
private String zoneSid;//区域
|
||||
private String zoneName;//区域
|
||||
private String zoneCode;//区域
|
||||
|
||||
}
|
||||
|
||||
@@ -24,5 +24,6 @@ public interface WarehouseAreaMapper extends BaseMapper<WarehouseArea> {
|
||||
List<WarehouseAreaVo> listAll(@Param("orgPath")String orgPath);
|
||||
|
||||
WarehouseAreaAllVo selectAreaByRackSid(String rackSid);
|
||||
|
||||
@Select("select * from warehouse_area where zoneSid = #{qySid} and isDelete = 0 and isEnable = 1")
|
||||
List<WarehouseAreaAllVo> selectAreaAll(String qySid);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
|
||||
<select id="listPage" resultType="com.yxt.warehouse.biz.warehousearea.WarehouseAreaVo">
|
||||
select
|
||||
a.*,b.warehouseName as warehouseName,c.warehouseAreaTypeName as areaTypeName
|
||||
a.*,b.warehouseName as warehouseName,c.warehouseAreaTypeName as areaTypeName,d.sid as zoneSid,d.zoneName ,d.zoneCode
|
||||
from warehouse_area a
|
||||
left join warehouse_info b on b.sid=a.warehouseSid
|
||||
left join warehouse_area_type c on c.sid =a.areaTypeSid
|
||||
left join warehouse_zone d on d.sid=a.zoneSid
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
@@ -26,11 +27,11 @@
|
||||
</select>
|
||||
<select id="initialization" resultType="com.yxt.warehouse.biz.warehousearea.WarehouseAreaVo">
|
||||
select
|
||||
a.*,b.warehouseName as warehouseName,c.warehouseAreaTypeName as areaTypeName
|
||||
a.*,b.warehouseName as warehouseName,c.warehouseAreaTypeName as areaTypeName,d.sid as zoneSid,d.zoneName ,d.zoneCode
|
||||
from warehouse_area a
|
||||
left join warehouse_info b on b.sid=a.warehouseSid
|
||||
left join warehouse_area_type c on c.sid =a.areaTypeSid
|
||||
|
||||
left join warehouse_zone d on d.sid=a.zoneSid
|
||||
where a.sid =#{sid}
|
||||
</select>
|
||||
<select id="selectAreaByRackSid" resultType="com.yxt.warehouse.biz.warehousearea.WarehouseAreaAllVo">
|
||||
|
||||
@@ -147,5 +147,7 @@ public class WarehouseAreaService extends MybatisBaseService<WarehouseAreaMapper
|
||||
public WarehouseAreaAllVo selectAreaByRackSid(String rackSid) {
|
||||
return baseMapper.selectAreaByRackSid(rackSid);
|
||||
}
|
||||
|
||||
public List<WarehouseAreaAllVo> selectAreaAll(String qySid) {
|
||||
return baseMapper.selectAreaAll(qySid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,8 @@ public class WarehouseAreaVo implements Vo {
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String userSid;
|
||||
private String orgPath;
|
||||
private String zoneSid;//区域
|
||||
private String zoneName;//区域
|
||||
private String zoneCode;//区域
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public interface WarehouseInventoryMapper extends BaseMapper<WarehouseInventory>
|
||||
|
||||
IPage<WarehouseInventoryVo> listPage(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
||||
IPage<WarehouseInventoryVo> listPage1(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
||||
IPage<WarehouseInventoryVo> listPage2(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
||||
List<WarehouseInventoryVo> getListBySpuSid(@Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw,@Param("countStart") String countStart,@Param("countEnd") String countEnd);
|
||||
List<WarehouseInventoryVo> getListBySpuSid1(@Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw,@Param("countStart") String countStart,@Param("countEnd") String countEnd);
|
||||
List<WarehouseInventoryRackVo> getRackCountBySid(@Param("sid")String sid,@Param("orgSid") String orgSid);
|
||||
|
||||
@@ -39,6 +39,25 @@
|
||||
</where>
|
||||
group by a.goodsSpuSid
|
||||
</select>
|
||||
<select id="listPage2" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
||||
select
|
||||
a.goodsSpuName,
|
||||
a.goodsSpuSid,
|
||||
a.unit,
|
||||
sum(a.count) as count ,
|
||||
sum(a.count-a.allocateCount) as useCount,
|
||||
c.alertUpperLimit,c.warningLowerLimit,
|
||||
d.sid as warehouseAreaSid,d.areaName as warehouseAreaName
|
||||
from warehouse_inventory a
|
||||
left join warehouse_rack b on b.sid =a.warehouseRackSid
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
left join warehouse_area d on d.sid =b.locationSid
|
||||
LEFT JOIN warehouse_area_warning c ON c.warehouseAreaSid = b.locationSid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
group by a.goodsSpuSid
|
||||
</select>
|
||||
<select id="getListBySpuSid" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
||||
select
|
||||
a.goodsID,
|
||||
|
||||
@@ -21,11 +21,13 @@ public class WarehouseInventoryQuery implements Query {
|
||||
private String warehouseAreaSid;
|
||||
@ApiModelProperty("商品名称")
|
||||
private String goodsSpuSid;
|
||||
private String goodsSpuName;
|
||||
private String brandSid;
|
||||
private String goodsTypeSid;
|
||||
private String spec;
|
||||
private String countStart;
|
||||
private String countEnd;
|
||||
|
||||
private String ifWarning; //0 未设置 1 设置
|
||||
|
||||
@ApiModelProperty("条码")
|
||||
private String barCode;
|
||||
|
||||
@@ -80,12 +80,20 @@ public class WarehouseInventoryService extends MybatisBaseService<WarehouseInven
|
||||
if (StringUtils.isNotBlank(query.getBrandSid())) {
|
||||
qw.eq("a.goodsBrandSid", query.getBrandSid());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getGoodsTypeSid())) {
|
||||
qw.eq("a.goodsTypeSid", query.getGoodsTypeSid());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getIfWarning())) {
|
||||
if(query.getIfWarning().equals("0")){
|
||||
qw.apply("and c.sid is null");
|
||||
}else if(query.getIfWarning().equals("1")){
|
||||
qw.apply("and c.sid is not null");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getSpec())) {
|
||||
qw.like("a.goodsSkuOwnSpec", query.getSpec());
|
||||
}
|
||||
// qw.apply(StringUtils.isNotBlank(query.getCountStart()), "a.count >= " + query.getCountStart()).
|
||||
// apply(StringUtils.isNotBlank(query.getCountEnd()), "a.count <= " + query.getCountEnd()
|
||||
// );
|
||||
|
||||
qw.eq("1",1);
|
||||
return qw;
|
||||
}
|
||||
@@ -183,7 +191,24 @@ public class WarehouseInventoryService extends MybatisBaseService<WarehouseInven
|
||||
PagerVo<WarehouseInventoryVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean<PagerVo<WarehouseInventoryVo>> areaWarningListPage(PagerQuery<WarehouseInventoryQuery> pq) {
|
||||
ResultBean rb =new ResultBean().fail();
|
||||
WarehouseInventoryQuery query = pq.getParams();
|
||||
QueryWrapper<WarehouseInventory> qw = new QueryWrapper<>();
|
||||
if(StringUtils.isBlank(query.getOrgLevelKey())){
|
||||
PagerVo<WarehouseInventoryVo> p = new PagerVo<>();
|
||||
return rb.success().setData(p);
|
||||
}else{
|
||||
qw = createQueryWrapper(pq);
|
||||
}
|
||||
qw.apply(StringUtils.isNotBlank(query.getCountStart()), "a.count >= " + query.getCountStart()).
|
||||
apply(StringUtils.isNotBlank(query.getCountEnd()), "a.count <= " + query.getCountEnd()
|
||||
);
|
||||
IPage<WarehouseInventory> page = PagerUtil.queryToPage(pq);
|
||||
IPage<WarehouseInventoryVo> pagging = baseMapper.listPage2(page, qw);
|
||||
PagerVo<WarehouseInventoryVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
public ResultBean<String> saveInventory(WarehouseInventoryDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
|
||||
@@ -34,6 +34,7 @@ public class WarehouseInventoryVo implements Vo {
|
||||
@ApiModelProperty("仓库名称")
|
||||
private String warehouseName;
|
||||
private String warehouseAreaName;
|
||||
private String warehouseAreaSid;
|
||||
private String warehouseRackSid;
|
||||
@ApiModelProperty("库位名称")
|
||||
private String warehouseRackCode;
|
||||
@@ -69,6 +70,8 @@ public class WarehouseInventoryVo implements Vo {
|
||||
private String serialNumber;
|
||||
private String brandName;
|
||||
private String typeName;
|
||||
private String alertUpperLimit;//上限
|
||||
private String warningLowerLimit;//下限
|
||||
private List<WarehouseInventoryVo> children=new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ public class WarehouseRack extends BaseEntity {
|
||||
private String locationSid;//库位sid
|
||||
private String useOrgSid;//创建组织sid
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String zoneSid;//区域
|
||||
|
||||
}
|
||||
|
||||
@@ -26,4 +26,7 @@ public class WarehouseRackDto implements Dto {
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String userSid;
|
||||
private String orgPath;
|
||||
private String zoneSid;//区域
|
||||
private String zoneName;//区域
|
||||
private String zoneCode;//区域
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
|
||||
<select id="listPage" resultType="com.yxt.warehouse.biz.warehouserack.WarehouseRackVo">
|
||||
select
|
||||
a.*,b.areaName as locationName ,c.warehouseName as warehouseName
|
||||
a.*,b.areaName as locationName ,c.warehouseName as warehouseName,d.sid as zoneSid,d.zoneName ,d.zoneCode
|
||||
from warehouse_rack a
|
||||
left join warehouse_area b on b.sid =a.locationSid
|
||||
left join warehouse_info c on c.sid = a.warehouseSid
|
||||
left join warehouse_zone d on d.sid=a.zoneSid
|
||||
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
@@ -26,10 +27,11 @@
|
||||
</select>
|
||||
<select id="initialization" resultType="com.yxt.warehouse.biz.warehouserack.WarehouseRackVo">
|
||||
select
|
||||
a.*,b.areaName as locationName ,c.warehouseName as warehouseName
|
||||
a.*,b.areaName as locationName ,c.warehouseName as warehouseName,d.sid as zoneSid,d.zoneName ,d.zoneCode
|
||||
from warehouse_rack a
|
||||
left join warehouse_area b on b.sid =a.locationSid
|
||||
left join warehouse_info c on c.sid = a.warehouseSid
|
||||
left join warehouse_zone d on d.sid=a.zoneSid
|
||||
where a.sid =#{sid}
|
||||
</select>
|
||||
<update id="updateBySidIsDelete">
|
||||
|
||||
@@ -25,4 +25,5 @@ public class WarehouseRackQuery implements Query {
|
||||
private String orgPath;
|
||||
@ApiModelProperty("用户sid")
|
||||
private String userSid;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,4 +33,8 @@ public class WarehouseRackVo implements Vo {
|
||||
private String createOrgSid;//创建组织sid
|
||||
private String userSid;
|
||||
private String orgPath;
|
||||
private String zoneSid;//区域
|
||||
private String zoneName;//区域
|
||||
private String zoneCode;//区域
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -12,4 +12,9 @@ public class Rule {
|
||||
String billNo = bill + num;
|
||||
return billNo;
|
||||
}
|
||||
public static String getBillNo3(String bill, int i) {
|
||||
String num = String.format("%03d", i + 1); // 不足4位补0
|
||||
String billNo = bill + num;
|
||||
return billNo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user