库存调整
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
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.inventoryadjustmentdetail.InventoryAdjustmentDetailDto;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailQuery;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailService;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/28 8:53
|
||||||
|
*/
|
||||||
|
@Api(tags = "库存调整明细")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/apiadmin/inventoryadjustmentdetail")
|
||||||
|
public class InventoryAdjustmentDetailRest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InventoryAdjustmentDetailService inventoryAdjustmentDetailService;
|
||||||
|
|
||||||
|
@ApiOperation("分页列表")
|
||||||
|
@PostMapping("/listPage")
|
||||||
|
public ResultBean<PagerVo<InventoryAdjustmentDetailVo>> listPage(@RequestBody PagerQuery<InventoryAdjustmentDetailQuery> pq) {
|
||||||
|
return inventoryAdjustmentDetailService.listPage(pq);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @ApiOperation("保存修改")
|
||||||
|
// @PostMapping("/saveOrUpdate")
|
||||||
|
// public ResultBean<String> saveOrUpdate(@RequestBody InventoryAdjustmentDetailDto dto) {
|
||||||
|
// return inventoryAdjustmentDetailService.saveOrUpdate(dto);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
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.inventoryadjustment.*;
|
||||||
|
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/inventoryadjustment")
|
||||||
|
public class InventoryAdjustmentRest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InventoryAdjustmentService inventoryAdjustmentService;
|
||||||
|
|
||||||
|
@ApiOperation("分页列表")
|
||||||
|
@PostMapping("/listPage")
|
||||||
|
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(@RequestBody PagerQuery<InventoryAdjustmentQuery> pq) {
|
||||||
|
return inventoryAdjustmentService.listPage(pq);
|
||||||
|
}
|
||||||
|
@ApiOperation("查询所有的库区")
|
||||||
|
@PostMapping("/listAll")
|
||||||
|
public ResultBean<InventoryAdjustmentVo> listAll(@RequestBody OrgPathQuery query) {
|
||||||
|
return inventoryAdjustmentService.getAllType( query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("保存修改")
|
||||||
|
@PostMapping("/saveOrUpdate")
|
||||||
|
public ResultBean<String> saveOrUpdate(@RequestBody InventoryAdjustmentDto dto) {
|
||||||
|
return inventoryAdjustmentService.saveOrUpdate(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("初始化")
|
||||||
|
@GetMapping("/initialization/{sid}")
|
||||||
|
public ResultBean<InventoryAdjustmentVo> initialization(@PathVariable("sid") String sid) {
|
||||||
|
return inventoryAdjustmentService.initialization(sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("根据sid批量删除")
|
||||||
|
@DeleteMapping("/delBySids")
|
||||||
|
public ResultBean delBySids(@RequestBody String[] sids){
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
inventoryAdjustmentService.delAll(sids);
|
||||||
|
return rb.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,13 +49,18 @@ public class WarehouseInventoryRest {
|
|||||||
public ResultBean<PagerVo<WarehouseInventoryVo>> locationListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
public ResultBean<PagerVo<WarehouseInventoryVo>> locationListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
||||||
return WarehouseInventoryService.locationListPage(pq);
|
return WarehouseInventoryService.locationListPage(pq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("库位预警分页列表")
|
@ApiOperation("库位预警分页列表")
|
||||||
@PostMapping("/areaWarningListPage")
|
@PostMapping("/areaWarningListPage")
|
||||||
public ResultBean<PagerVo<WarehouseInventoryVo>> areaWarningListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
public ResultBean<PagerVo<WarehouseInventoryVo>> areaWarningListPage(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
||||||
return WarehouseInventoryService.areaWarningListPage(pq);
|
return WarehouseInventoryService.areaWarningListPage(pq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据仓库查询库存详情")
|
||||||
|
@PostMapping("/selInventoryByWareSid")
|
||||||
|
public ResultBean<PagerVo<WarehouseInventoryVo>> selInventoryByWareSid(@RequestBody PagerQuery<WarehouseInventoryQuery> pq) {
|
||||||
|
return WarehouseInventoryService.selInventoryByWareSid(pq);
|
||||||
|
}
|
||||||
@ApiOperation("查询库位商品数量")
|
@ApiOperation("查询库位商品数量")
|
||||||
@PostMapping("/getRackCountBySid")
|
@PostMapping("/getRackCountBySid")
|
||||||
ResultBean getRackCountBySid(@RequestBody WarehouseInventoryRackCountQuery query) {
|
ResultBean getRackCountBySid(@RequestBody WarehouseInventoryRackCountQuery query) {
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public class WarehouseRackRest {
|
|||||||
public ResultBean<WarehouseRackVo> initialization(@PathVariable("sid") String sid) {
|
public ResultBean<WarehouseRackVo> initialization(@PathVariable("sid") String sid) {
|
||||||
return wmsWarehouseRackService.initialization(sid);
|
return wmsWarehouseRackService.initialization(sid);
|
||||||
}
|
}
|
||||||
|
@ApiOperation("根据code查询库位")
|
||||||
|
@GetMapping("/selRackByCode/{code}")
|
||||||
|
public ResultBean<WarehouseRackVo> selRackByCode(@PathVariable("code") String code) {
|
||||||
|
return wmsWarehouseRackService.selRackByCode(code);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@DeleteMapping("/delete/{sid}")
|
@DeleteMapping("/delete/{sid}")
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import com.yxt.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/28 8:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InventoryAdjustment extends BaseEntity {
|
||||||
|
|
||||||
|
private String type;//库位名称
|
||||||
|
private String billNo;//库位编码
|
||||||
|
private String warehouseSid;//仓库sid
|
||||||
|
private String warehouseName;//库位容量
|
||||||
|
private String count;//计量单位
|
||||||
|
private String operator;//货区类型
|
||||||
|
private String operatorSid;
|
||||||
|
private String useOrgSid;
|
||||||
|
private String createOrgSid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*********************************************************
|
||||||
|
*********************************************************
|
||||||
|
******************** *******************
|
||||||
|
************* ************
|
||||||
|
******* _oo0oo_ *******
|
||||||
|
*** o8888888o ***
|
||||||
|
* 88" . "88 *
|
||||||
|
* (| -_- |) *
|
||||||
|
* 0\ = /0 *
|
||||||
|
* ___/`---'\___ *
|
||||||
|
* .' \\| |// '. *
|
||||||
|
* / \\||| : |||// \ *
|
||||||
|
* / _||||| -:- |||||- \ *
|
||||||
|
* | | \\\ - /// | | *
|
||||||
|
* | \_| ''\---/'' |_/ | *
|
||||||
|
* \ .-\__ '-' ___/-. / *
|
||||||
|
* ___'. .' /--.--\ `. .'___ *
|
||||||
|
* ."" '< `.___\_<|>_/___.' >' "". *
|
||||||
|
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
|
||||||
|
* \ \ `_. \_ __\ /__ _/ .-` / / *
|
||||||
|
* =====`-.____`.___ \_____/___.-`___.-'===== *
|
||||||
|
* `=---=' *
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||||
|
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
|
||||||
|
*********************************************************/
|
||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
|
||||||
|
import com.yxt.common.core.vo.Vo;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project: yxt-wms(仓库) <br/>
|
||||||
|
* File: WmsWarehouseAreaVo.java <br/>
|
||||||
|
* Class: com.yxt.wms.api.wmswarehousearea.WmsWarehouseAreaVo <br/>
|
||||||
|
* Description: 库区 视图数据对象. <br/>
|
||||||
|
* Copyright: Copyright (c) 2011 <br/>
|
||||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||||
|
* Makedate: 2024-04-09 14:35:56 <br/>
|
||||||
|
*
|
||||||
|
* @author liupopo
|
||||||
|
* @version 1.0
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "库区 视图数据详情", description = "库区 视图数据详情")
|
||||||
|
public class InventoryAdjustmentAllVo implements Vo {
|
||||||
|
|
||||||
|
private String sid;
|
||||||
|
@ApiModelProperty("库位名称")
|
||||||
|
private String areaName;
|
||||||
|
@ApiModelProperty("库位编码")
|
||||||
|
private String areaCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.yxt.common.core.dto.Dto;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailDto;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/26 13:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InventoryAdjustmentDto implements Dto {
|
||||||
|
private String id;
|
||||||
|
private String sid;
|
||||||
|
private String createTime;
|
||||||
|
private String remarks;
|
||||||
|
private String isEnable;
|
||||||
|
private String type;//库位名称
|
||||||
|
private String billNo;//库位编码
|
||||||
|
private String warehouseSid;//仓库sid
|
||||||
|
private String warehouseName;//库位容量
|
||||||
|
private String operator;//货区类型
|
||||||
|
private String operatorSid;
|
||||||
|
private String useOrgSid;
|
||||||
|
private String createOrgSid;//创建组织sid
|
||||||
|
private String userSid;
|
||||||
|
private String orgPath;
|
||||||
|
private List<InventoryAdjustmentDetailDto> list=new ArrayList<>();
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
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 org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/26 13:40
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface InventoryAdjustmentMapper extends BaseMapper<InventoryAdjustment> {
|
||||||
|
IPage<InventoryAdjustmentVo> listPage(IPage<InventoryAdjustment> page, @Param(Constants.WRAPPER) QueryWrapper<InventoryAdjustment> qw);
|
||||||
|
|
||||||
|
InventoryAdjustmentVo initialization (@Param("sid") String sid);
|
||||||
|
|
||||||
|
int deleteByBillSid(List<String> list);
|
||||||
|
|
||||||
|
List<InventoryAdjustmentVo> listAll(@Param("orgPath")String orgPath);
|
||||||
|
|
||||||
|
String selectNum(String billNo);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?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.inventoryadjustment.InventoryAdjustmentMapper">
|
||||||
|
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||||
|
<!-- ${ew.customSqlSegment} -->
|
||||||
|
|
||||||
|
<select id="listPage" resultType="com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo">
|
||||||
|
select
|
||||||
|
a.*
|
||||||
|
from inventory_adjustment 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.warehousearea.WarehouseAreaVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from warehouse_area 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.inventoryadjustment.InventoryAdjustmentVo">
|
||||||
|
select
|
||||||
|
a.*
|
||||||
|
from inventory_adjustment a
|
||||||
|
where a.sid =#{sid}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="deleteByBillSid">
|
||||||
|
delete inventory_adjustment
|
||||||
|
where sid in
|
||||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
<select id="selectNum" resultType="java.lang.String">
|
||||||
|
select RIGHT (billNo, 4)
|
||||||
|
from inventory_adjustment
|
||||||
|
where billNo LIKE concat(#{billNo}, '%')
|
||||||
|
order by billNo desc
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
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 InventoryAdjustmentQuery implements Query {
|
||||||
|
private String endTime;//结束
|
||||||
|
private String startTime;//开始
|
||||||
|
private String billNo;//单据
|
||||||
|
private String goodsSkuSid;//商品
|
||||||
|
private String type;//类型
|
||||||
|
private String operator;//操作员
|
||||||
|
|
||||||
|
|
||||||
|
private String orgLevelKey;//
|
||||||
|
private int index;//下标
|
||||||
|
@ApiModelProperty("菜单路由")
|
||||||
|
private String menuUrl;
|
||||||
|
@ApiModelProperty("组织全路径sid")
|
||||||
|
private String orgPath;
|
||||||
|
@ApiModelProperty("用户sid")
|
||||||
|
private String userSid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
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.inventoryadjustmentdetail.InventoryAdjustmentDetail;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailDto;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailService;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo;
|
||||||
|
import com.yxt.warehouse.biz.warehouseinfo.WarehouseInfoVo;
|
||||||
|
import com.yxt.warehouse.utils.ExcelUtil;
|
||||||
|
import com.yxt.warehouse.utils.OrgPathQuery;
|
||||||
|
import com.yxt.warehouse.utils.Rule;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/26 13:40
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class InventoryAdjustmentService extends MybatisBaseService<InventoryAdjustmentMapper, InventoryAdjustment> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InventoryAdjustmentDetailService inventoryAdjustmentDetailService;
|
||||||
|
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(PagerQuery<InventoryAdjustmentQuery> pq) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
InventoryAdjustmentQuery query = pq.getParams();
|
||||||
|
QueryWrapper<InventoryAdjustment> 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);
|
||||||
|
// }
|
||||||
|
qw.apply(StringUtils.isNotBlank(query.getStartTime()), "date_format (a.createTime,'%Y-%m-%d') >= date_format('" + query.getStartTime() + "','%Y-%m-%d')").
|
||||||
|
apply(StringUtils.isNotBlank(query.getEndTime()), "date_format (a.createTime,'%Y-%m-%d') <= date_format('" + query.getEndTime() + "','%Y-%m-%d')"
|
||||||
|
);
|
||||||
|
if (StringUtils.isNotBlank(query.getBillNo())) {
|
||||||
|
qw.like("a.areaName", query.getBillNo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
||||||
|
qw.like("a.areaCode", query.getGoodsSkuSid());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getType())) {
|
||||||
|
qw.eq("b.sid", query.getType());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getOperator())) {
|
||||||
|
qw.eq("c.sid", query.getOperator());
|
||||||
|
}
|
||||||
|
qw.ne("a.isDelete", "1");
|
||||||
|
IPage<InventoryAdjustment> page = PagerUtil.queryToPage(pq);
|
||||||
|
IPage<InventoryAdjustmentVo> pagging = baseMapper.listPage(page, qw);
|
||||||
|
PagerVo<InventoryAdjustmentVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
|
return rb.success().setData(p);
|
||||||
|
}
|
||||||
|
public ResultBean<InventoryAdjustmentVo> getAllType(OrgPathQuery query) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
List<InventoryAdjustmentVo> pagging = baseMapper.listAll(query.getOrgPath());
|
||||||
|
return rb.success().setData(pagging);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean<String> saveOrUpdate(InventoryAdjustmentDto dto) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
String sid = "";
|
||||||
|
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||||
|
sid = dto.getSid();
|
||||||
|
InventoryAdjustment inventoryAdjustment = fetchBySid(dto.getSid());
|
||||||
|
BeanUtil.copyProperties(dto, inventoryAdjustment, "id", "sid");
|
||||||
|
inventoryAdjustment.setModifyTime(new Date());
|
||||||
|
baseMapper.updateById(inventoryAdjustment);
|
||||||
|
// dto.getList().stream().forEach(a->{
|
||||||
|
// a.setBillNo(inventoryAdjustment.getBillNo());
|
||||||
|
// a.setBillSid(inventoryAdjustment.getSid());
|
||||||
|
// a.setUserSid(dto.getUserSid());
|
||||||
|
// });
|
||||||
|
inventoryAdjustmentDetailService.saveOrUpdate(dto.getList());
|
||||||
|
} else {
|
||||||
|
InventoryAdjustment inventoryAdjustment = new InventoryAdjustment();
|
||||||
|
sid = inventoryAdjustment.getSid();
|
||||||
|
BeanUtil.copyProperties(dto, inventoryAdjustment, "id", "sid");
|
||||||
|
inventoryAdjustment.setCreateTime(new DateTime());
|
||||||
|
inventoryAdjustment.setCreateBySid(dto.getUserSid());
|
||||||
|
String billNo = "";
|
||||||
|
String date = DateUtil.format(DateUtil.date(), "yyyyMMdd");
|
||||||
|
billNo = "TK" + date;
|
||||||
|
String i = baseMapper.selectNum(billNo);
|
||||||
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(i)) {
|
||||||
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue());
|
||||||
|
} else {
|
||||||
|
billNo = Rule.getBillNo(billNo, 0);
|
||||||
|
}
|
||||||
|
inventoryAdjustment.setBillNo(billNo);
|
||||||
|
dto.getList().stream().forEach(a->{
|
||||||
|
a.setBillNo(inventoryAdjustment.getBillNo());
|
||||||
|
a.setBillSid(inventoryAdjustment.getSid());
|
||||||
|
a.setUserSid(dto.getUserSid());
|
||||||
|
});
|
||||||
|
inventoryAdjustmentDetailService.saveOrUpdate(dto.getList());
|
||||||
|
baseMapper.insert(inventoryAdjustment);
|
||||||
|
}
|
||||||
|
return rb.success().setMsg("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean<InventoryAdjustmentVo> initialization(String sid) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
InventoryAdjustmentVo vo = baseMapper.initialization(sid);
|
||||||
|
vo.setList(inventoryAdjustmentDetailService.selectDetailByBillSid(sid));
|
||||||
|
return rb.success().setData(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delAll(String[] sids) {
|
||||||
|
int count = baseMapper.deleteByBillSid(Arrays.stream(sids).collect(Collectors.toList()));
|
||||||
|
inventoryAdjustmentDetailService.delAll(sids);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustment;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.yxt.common.core.vo.Vo;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/26 13:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InventoryAdjustmentVo implements Vo {
|
||||||
|
private String id;
|
||||||
|
private String sid;
|
||||||
|
private String lockVersion;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date modifyTime;
|
||||||
|
private String remarks;
|
||||||
|
private String isEnable;
|
||||||
|
private String state;
|
||||||
|
private String isDelete;
|
||||||
|
private String type;//库位名称
|
||||||
|
private String billNo;//库位编码
|
||||||
|
private String warehouseSid;//仓库sid
|
||||||
|
private String warehouseName;//库位容量
|
||||||
|
private String count;//计量单位
|
||||||
|
private String operator;//货区类型
|
||||||
|
private String operatorSid;
|
||||||
|
private String useOrgSid;
|
||||||
|
private String createOrgSid;
|
||||||
|
private List<InventoryAdjustmentDetailVo> list=new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
import com.yxt.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/28 8:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InventoryAdjustmentDetail extends BaseEntity {
|
||||||
|
|
||||||
|
private String billNo;//库位名称
|
||||||
|
private String billSid;//库位编码
|
||||||
|
private String warehouseAreaSid;
|
||||||
|
private String warehouseAreaName;
|
||||||
|
private String rackSid;
|
||||||
|
private String rackName;
|
||||||
|
private String rackCode;
|
||||||
|
private String goodsSpuSid;//仓库sid
|
||||||
|
private String goodsSpuName;//库位容量
|
||||||
|
private String goodsSkuSid;//计量单位
|
||||||
|
private String goodsSkuTitle;//货区类型
|
||||||
|
private String count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
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 InventoryAdjustmentDetailDto implements Dto {
|
||||||
|
private String id;
|
||||||
|
private String sid;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
private String remarks;
|
||||||
|
private String isEnable;
|
||||||
|
private String billNo;//库位名称
|
||||||
|
private String billSid;//库位编码
|
||||||
|
private String warehouseAreaSid;
|
||||||
|
private String warehouseAreaName;
|
||||||
|
private String rackSid;
|
||||||
|
private String rackName;
|
||||||
|
private String rackCode;
|
||||||
|
private String goodsSpuSid;//仓库sid
|
||||||
|
private String goodsSpuName;//库位容量
|
||||||
|
private String goodsSkuSid;//计量单位
|
||||||
|
private String goodsSkuTitle;//货区类型
|
||||||
|
private String count;
|
||||||
|
private String userSid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
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 com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentAllVo;
|
||||||
|
import com.yxt.warehouse.biz.inventoryadjustment.InventoryAdjustmentVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/2/26 13:40
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface InventoryAdjustmentDetailMapper extends BaseMapper<InventoryAdjustmentDetail> {
|
||||||
|
IPage<InventoryAdjustmentDetailVo> listPage(IPage<InventoryAdjustmentDetail> page, @Param(Constants.WRAPPER) QueryWrapper<InventoryAdjustmentDetail> qw);
|
||||||
|
|
||||||
|
InventoryAdjustmentDetailVo initialization (@Param("sid") String sid);
|
||||||
|
|
||||||
|
int deleteByBillSid(List<String> list);
|
||||||
|
|
||||||
|
@Select("select * from inventory_adjustment_detail where billSid = #{billSid}")
|
||||||
|
List<InventoryAdjustmentDetailVo> selectDetailByBillSid(String qySid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?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.inventoryadjustmentdetail.InventoryAdjustmentDetailMapper">
|
||||||
|
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||||
|
<!-- ${ew.customSqlSegment} -->
|
||||||
|
|
||||||
|
<select id="listPage" resultType="com.yxt.warehouse.biz.inventoryadjustmentdetail.InventoryAdjustmentDetailVo">
|
||||||
|
SELECT
|
||||||
|
a.*
|
||||||
|
FROM
|
||||||
|
inventory_adjustment_detail a
|
||||||
|
LEFT JOIN inventory_adjustment b ON b.sid = a.billSid
|
||||||
|
LEFT JOIN ss_user.sys_organization AS s ON b.useOrgSid = s.sid
|
||||||
|
<where>
|
||||||
|
${ew.sqlSegment}
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
rackSid,goodsSkuSid
|
||||||
|
</select>
|
||||||
|
<select id="listAll" resultType="com.yxt.warehouse.biz.warehousearea.WarehouseAreaVo">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from warehouse_area 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.warehousearea.WarehouseAreaVo">
|
||||||
|
select
|
||||||
|
a.*
|
||||||
|
from inventory_adjustment a
|
||||||
|
left join warehouse_zone d on d.sid=a.zoneSid
|
||||||
|
where a.sid =#{sid}
|
||||||
|
</select>
|
||||||
|
<update id="deleteByBillSid">
|
||||||
|
delete inventory_adjustment_detail
|
||||||
|
where billSid in
|
||||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
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 InventoryAdjustmentDetailQuery implements Query {
|
||||||
|
private String end;//结束
|
||||||
|
private String start;//开始
|
||||||
|
private String warehouseSid;//单据
|
||||||
|
private String goodsSkuSid;//商品
|
||||||
|
private String typeSid;//类型
|
||||||
|
private String brandSid;//操作员
|
||||||
|
|
||||||
|
|
||||||
|
private String orgLevelKey;//
|
||||||
|
private int index;//下标
|
||||||
|
@ApiModelProperty("菜单路由")
|
||||||
|
private String menuUrl;
|
||||||
|
@ApiModelProperty("组织全路径sid")
|
||||||
|
private String orgPath;
|
||||||
|
@ApiModelProperty("用户sid")
|
||||||
|
private String userSid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
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.inventoryadjustment.InventoryAdjustmentAllVo;
|
||||||
|
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 InventoryAdjustmentDetailService extends MybatisBaseService<InventoryAdjustmentDetailMapper, InventoryAdjustmentDetail> {
|
||||||
|
|
||||||
|
|
||||||
|
public ResultBean<PagerVo<InventoryAdjustmentDetailVo>> listPage(PagerQuery<InventoryAdjustmentDetailQuery> pq) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
InventoryAdjustmentDetailQuery query = pq.getParams();
|
||||||
|
QueryWrapper<InventoryAdjustmentDetail> 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);
|
||||||
|
}
|
||||||
|
qw.apply(StringUtils.isNotBlank(query.getStart()), "count >= " + query.getStart() ) .
|
||||||
|
apply(StringUtils.isNotBlank(query.getEnd()), "count<= " + query.getEnd()
|
||||||
|
);
|
||||||
|
if (StringUtils.isNotBlank(query.getBrandSid())) {
|
||||||
|
qw.like("a.areaName", query.getBrandSid());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getWarehouseSid())) {
|
||||||
|
qw.like("a.areaCode", query.getWarehouseSid());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getGoodsSkuSid())) {
|
||||||
|
qw.eq("b.sid", query.getGoodsSkuSid());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(query.getTypeSid())) {
|
||||||
|
qw.eq("c.sid", query.getTypeSid());
|
||||||
|
}
|
||||||
|
qw.ne("a.isDelete", "1");
|
||||||
|
IPage<InventoryAdjustmentDetail> page = PagerUtil.queryToPage(pq);
|
||||||
|
IPage<InventoryAdjustmentDetailVo> pagging = baseMapper.listPage(page, qw);
|
||||||
|
|
||||||
|
PagerVo<InventoryAdjustmentDetailVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
|
return rb.success().setData(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ResultBean<String> saveOrUpdate(List<InventoryAdjustmentDetailDto> dtos) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
String sid = "";
|
||||||
|
baseMapper.delete(new QueryWrapper<InventoryAdjustmentDetail>().eq("billSid",dtos.get(0).getBillSid()));
|
||||||
|
for (InventoryAdjustmentDetailDto dto : dtos) {
|
||||||
|
InventoryAdjustmentDetail wmsWarehouseArea = new InventoryAdjustmentDetail();
|
||||||
|
sid = wmsWarehouseArea.getSid();
|
||||||
|
BeanUtil.copyProperties(dto, wmsWarehouseArea, "id", "sid");
|
||||||
|
wmsWarehouseArea.setCreateTime(new DateTime());
|
||||||
|
wmsWarehouseArea.setCreateBySid(dto.getUserSid());
|
||||||
|
baseMapper.insert(wmsWarehouseArea);
|
||||||
|
}
|
||||||
|
return rb.success().setMsg("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean<InventoryAdjustmentDetailVo> initialization(String sid) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
InventoryAdjustmentDetailVo vo = baseMapper.initialization(sid);
|
||||||
|
return rb.success().setData(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delAll(String[] sids) {
|
||||||
|
int count = baseMapper.deleteByBillSid(Arrays.stream(sids).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultBean updateIsEnable(String sid,String isEnable) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
InventoryAdjustmentDetail wmsWarehouseArea = fetchBySid(sid);
|
||||||
|
if (null != wmsWarehouseArea) {
|
||||||
|
wmsWarehouseArea.setIsEnable(Integer.parseInt(isEnable));
|
||||||
|
baseMapper.updateById(wmsWarehouseArea);
|
||||||
|
}
|
||||||
|
return rb.success().setMsg("成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<InventoryAdjustmentDetailVo> selectDetailByBillSid(String billSid) {
|
||||||
|
return baseMapper.selectDetailByBillSid(billSid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.yxt.warehouse.biz.inventoryadjustmentdetail;
|
||||||
|
|
||||||
|
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 InventoryAdjustmentDetailVo implements Vo {
|
||||||
|
private String id;
|
||||||
|
private String sid;
|
||||||
|
private String lockVersion;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date modifyTime;
|
||||||
|
private String remarks;
|
||||||
|
private String isEnable;
|
||||||
|
private String state;
|
||||||
|
private String isDelete;
|
||||||
|
private String billNo;//库位名称
|
||||||
|
private String billSid;//库位编码
|
||||||
|
private String warehouseAreaSid;
|
||||||
|
private String warehouseAreaName;
|
||||||
|
private String rackSid;
|
||||||
|
private String rackName;
|
||||||
|
private String rackCode;
|
||||||
|
private String goodsSpuSid;//商品
|
||||||
|
private String goodsSpuName;//
|
||||||
|
private String goodsSkuSid;//
|
||||||
|
private String goodsSkuTitle;//商品名
|
||||||
|
private String barCode;//条码
|
||||||
|
private String goodsSkuCode;//商品编码
|
||||||
|
private String goodsSkuOwnSpec;//商品规格
|
||||||
|
private String count;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ public interface WarehouseInventoryMapper extends BaseMapper<WarehouseInventory>
|
|||||||
IPage<WarehouseInventoryVo> listPage(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
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> listPage1(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
||||||
IPage<WarehouseInventoryVo> listPage2(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
IPage<WarehouseInventoryVo> listPage2(IPage<WarehouseInventory> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseInventory> qw);
|
||||||
|
IPage<WarehouseInventoryVo> listPage3(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> 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<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);
|
List<WarehouseInventoryRackVo> getRackCountBySid(@Param("sid")String sid,@Param("orgSid") String orgSid);
|
||||||
|
|||||||
@@ -58,6 +58,29 @@
|
|||||||
</where>
|
</where>
|
||||||
group by a.goodsSpuSid
|
group by a.goodsSpuSid
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listPage3" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
||||||
|
select
|
||||||
|
a.goodsSpuName,
|
||||||
|
a.goodsSpuSid,
|
||||||
|
a.goodsSkuSid,
|
||||||
|
a.goodsSkuTitle,
|
||||||
|
a.goodsSkuCode,
|
||||||
|
a.goodsSkuOwnSpec,
|
||||||
|
a.unit,
|
||||||
|
d.areaName as warehouseAreaName,
|
||||||
|
d.sid as warehouseAreaSid,
|
||||||
|
b.rackCode as warehouseRackCode,
|
||||||
|
b.sid as warehouseRackSid,
|
||||||
|
b.rackName as warehouseRackName
|
||||||
|
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>
|
||||||
|
</select>
|
||||||
<select id="getListBySpuSid" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
<select id="getListBySpuSid" resultType="com.yxt.warehouse.biz.warehouseinventory.WarehouseInventoryVo">
|
||||||
select
|
select
|
||||||
a.goodsID,
|
a.goodsID,
|
||||||
|
|||||||
@@ -209,6 +209,21 @@ public class WarehouseInventoryService extends MybatisBaseService<WarehouseInven
|
|||||||
PagerVo<WarehouseInventoryVo> p = PagerUtil.pageToVo(pagging, null);
|
PagerVo<WarehouseInventoryVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
return rb.success().setData(p);
|
return rb.success().setData(p);
|
||||||
}
|
}
|
||||||
|
public ResultBean<PagerVo<WarehouseInventoryVo>> selInventoryByWareSid(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);
|
||||||
|
}
|
||||||
|
IPage<WarehouseInventory> page = PagerUtil.queryToPage(pq);
|
||||||
|
IPage<WarehouseInventoryVo> pagging = baseMapper.listPage3(page, qw);
|
||||||
|
PagerVo<WarehouseInventoryVo> p = PagerUtil.pageToVo(pagging, null);
|
||||||
|
return rb.success().setData(p);
|
||||||
|
}
|
||||||
|
|
||||||
public ResultBean<String> saveInventory(WarehouseInventoryDto dto) {
|
public ResultBean<String> saveInventory(WarehouseInventoryDto dto) {
|
||||||
ResultBean rb = ResultBean.fireFail();
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class WarehouseInventoryVo implements Vo {
|
|||||||
private String warehouseRackSid;
|
private String warehouseRackSid;
|
||||||
@ApiModelProperty("库位名称")
|
@ApiModelProperty("库位名称")
|
||||||
private String warehouseRackCode;
|
private String warehouseRackCode;
|
||||||
|
private String warehouseRackName;
|
||||||
@ApiModelProperty("现有库存")
|
@ApiModelProperty("现有库存")
|
||||||
private BigDecimal count=new BigDecimal(0);
|
private BigDecimal count=new BigDecimal(0);
|
||||||
@ApiModelProperty("分配库存")
|
@ApiModelProperty("分配库存")
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.util.List;
|
|||||||
public interface WarehouseRackMapper extends BaseMapper<WarehouseRack> {
|
public interface WarehouseRackMapper extends BaseMapper<WarehouseRack> {
|
||||||
IPage<WarehouseRackVo> listPage(IPage<WarehouseRack> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseRack> qw);
|
IPage<WarehouseRackVo> listPage(IPage<WarehouseRack> page, @Param(Constants.WRAPPER) QueryWrapper<WarehouseRack> qw);
|
||||||
WarehouseRackVo initialization (@Param("sid") String sid);
|
WarehouseRackVo initialization (@Param("sid") String sid);
|
||||||
|
WarehouseRackVo selRackByCode (@Param("code") String code);
|
||||||
int updateBySidIsDelete(List<String> list);
|
int updateBySidIsDelete(List<String> list);
|
||||||
List<WarehouseRackVo> listAll(@Param("orgPath")String orgPath);
|
List<WarehouseRackVo> listAll(@Param("orgPath")String orgPath);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,17 @@
|
|||||||
left join warehouse_zone d on d.sid=a.zoneSid
|
left join warehouse_zone d on d.sid=a.zoneSid
|
||||||
where a.sid =#{sid}
|
where a.sid =#{sid}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selRackByCode" resultType="com.yxt.warehouse.biz.warehouserack.WarehouseRackVo">
|
||||||
|
select
|
||||||
|
a.*
|
||||||
|
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.isDelete !='1' and a.isEnable ='1' and a.rackCode=#{code}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
<update id="updateBySidIsDelete">
|
<update id="updateBySidIsDelete">
|
||||||
UPDATE warehouse_rack
|
UPDATE warehouse_rack
|
||||||
SET isDelete=1
|
SET isDelete=1
|
||||||
|
|||||||
@@ -114,7 +114,11 @@ public class WarehouseRackService extends MybatisBaseService<WarehouseRackMapper
|
|||||||
return rb.success().setData(vo);
|
return rb.success().setData(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResultBean<WarehouseRackVo> selRackByCode(String code) {
|
||||||
|
ResultBean rb = ResultBean.fireFail();
|
||||||
|
WarehouseRackVo vo=baseMapper.selRackByCode(code);
|
||||||
|
return rb.success().setData(vo);
|
||||||
|
}
|
||||||
public ResultBean delete(String sid) {
|
public ResultBean delete(String sid) {
|
||||||
ResultBean rb = ResultBean.fireFail();
|
ResultBean rb = ResultBean.fireFail();
|
||||||
WarehouseRack wmsWarehouseRack = fetchBySid(sid);
|
WarehouseRack wmsWarehouseRack = fetchBySid(sid);
|
||||||
|
|||||||
170
src/main/java/com/yxt/warehouse/utils/ExcelUtil.java
Normal file
170
src/main/java/com/yxt/warehouse/utils/ExcelUtil.java
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
package com.yxt.warehouse.utils;
|
||||||
|
|
||||||
|
|
||||||
|
//import org.apache.log4j.Logger;
|
||||||
|
import com.yxt.common.core.result.ResultBean;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.apache.poi.ss.usermodel.CellType.NUMERIC;
|
||||||
|
import static org.apache.poi.ss.usermodel.CellType.STRING;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wangpengfei
|
||||||
|
* @date 2024/4/23 13:53
|
||||||
|
*/
|
||||||
|
public class ExcelUtil {
|
||||||
|
// private static Logger logger = Logger.getLogger(ExcelUtil.class);
|
||||||
|
private final static String xls = "xls";
|
||||||
|
private final static String xlsx = "xlsx";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读入excel文件,解析后返回
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static List<String[]> readExcel(MultipartFile file) throws IOException {
|
||||||
|
//检查文件
|
||||||
|
checkFile(file);
|
||||||
|
//获得Workbook工作薄对象
|
||||||
|
Workbook workbook = getWorkBook(file);
|
||||||
|
//创建返回对象,把每行中的值作为一个数组,所有行作为一个集合返回
|
||||||
|
List<String[]> list = new ArrayList<String[]>();
|
||||||
|
if (workbook != null) {
|
||||||
|
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
|
||||||
|
//获得当前sheet工作表
|
||||||
|
Sheet sheet = workbook.getSheetAt(sheetNum);
|
||||||
|
if (sheet == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//获得当前sheet的开始行
|
||||||
|
int firstRowNum = sheet.getFirstRowNum();
|
||||||
|
//获得当前sheet的结束行
|
||||||
|
int lastRowNum = sheet.getLastRowNum();
|
||||||
|
int arrLength = sheet.getRow(firstRowNum).getPhysicalNumberOfCells();
|
||||||
|
//循环除了第一行的所有行
|
||||||
|
for (int rowNum = firstRowNum + 1; rowNum <= lastRowNum; rowNum++) {
|
||||||
|
//获得当前行
|
||||||
|
Row row = sheet.getRow(rowNum);
|
||||||
|
if (row == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//获得当前行的开始列
|
||||||
|
int firstCellNum = row.getFirstCellNum();
|
||||||
|
//获得当前行的列数
|
||||||
|
int lastCellNum = row.getPhysicalNumberOfCells();
|
||||||
|
String[] cells = new String[arrLength];
|
||||||
|
//循环当前行
|
||||||
|
for(int i =0 ;i<arrLength;i++){ Cell cell = row.getCell(i);cells[i] = getCellValue(cell); }
|
||||||
|
list.add(cells);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
workbook.close();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查文件
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void checkFile(MultipartFile file) throws IOException {
|
||||||
|
ResultBean rb=new ResultBean().fail();
|
||||||
|
//判断文件是否存在
|
||||||
|
if (null == file) {
|
||||||
|
throw new FileNotFoundException("文件不存在!");
|
||||||
|
}
|
||||||
|
//获得文件名
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
//判断文件是否是excel文件
|
||||||
|
if (!fileName.endsWith(xls) && !fileName.endsWith(xlsx)) {
|
||||||
|
// logger.error(fileName + "不是excel文件");
|
||||||
|
throw new IOException(fileName + "不是excel文件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回工作簿
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Workbook getWorkBook(MultipartFile file) {
|
||||||
|
//获得文件名
|
||||||
|
String fileName = file.getOriginalFilename();
|
||||||
|
//创建Workbook工作薄对象,表示整个excel
|
||||||
|
Workbook workbook = null;
|
||||||
|
try {
|
||||||
|
//获取excel文件的io流
|
||||||
|
InputStream is = file.getInputStream();
|
||||||
|
//根据文件后缀名不同(xls和xlsx)获得不同的Workbook实现类对象
|
||||||
|
if (fileName.endsWith(xls)) {
|
||||||
|
//2003
|
||||||
|
workbook = new HSSFWorkbook(is);
|
||||||
|
} else if (fileName.endsWith(xlsx)) {
|
||||||
|
//2007
|
||||||
|
workbook = new XSSFWorkbook(is);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// logger.info(e.getMessage());
|
||||||
|
}
|
||||||
|
return workbook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理单元格样式 获取数据
|
||||||
|
*
|
||||||
|
* @param cell
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getCellValue(Cell cell) {
|
||||||
|
String cellValue = "";
|
||||||
|
if (cell == null) {
|
||||||
|
return cellValue;
|
||||||
|
}
|
||||||
|
//把数字当成String来读,避免出现1读成1.0的情况
|
||||||
|
if (cell.getCellType() == NUMERIC) {
|
||||||
|
cell.setCellType(STRING);
|
||||||
|
}
|
||||||
|
//判断数据的类型
|
||||||
|
switch (cell.getCellType()) {
|
||||||
|
case NUMERIC: //数字
|
||||||
|
cellValue = String.valueOf(cell.getNumericCellValue());
|
||||||
|
break;
|
||||||
|
case STRING: //字符串
|
||||||
|
cellValue = String.valueOf(cell.getStringCellValue());
|
||||||
|
break;
|
||||||
|
case BOOLEAN: //Boolean
|
||||||
|
cellValue = String.valueOf(cell.getBooleanCellValue());
|
||||||
|
break;
|
||||||
|
case FORMULA: //公式
|
||||||
|
cellValue = String.valueOf(cell.getCellFormula());
|
||||||
|
break;
|
||||||
|
case BLANK: //空值
|
||||||
|
cellValue = "";
|
||||||
|
break;
|
||||||
|
case ERROR: //故障
|
||||||
|
cellValue = "非法字符";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cellValue = "未知类型";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return cellValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user