27 changed files with 896 additions and 0 deletions
@ -0,0 +1,75 @@ |
|||
package com.yxt.wms.apiadmin.aggregation; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentDto; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentQuery; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentService; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentVo; |
|||
import com.yxt.wms.utils.OrgPathQuery; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* @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(); |
|||
} |
|||
@ApiOperation("导入excel") |
|||
@PostMapping(value ="/importExcel" ,consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|||
public ResultBean importExcel(@RequestParam("file") MultipartFile file) throws IOException { |
|||
return inventoryAdjustmentService.importExcel(file); |
|||
} |
|||
@ApiOperation("下载模版") |
|||
@PostMapping("/download") |
|||
public void download(HttpServletRequest request, HttpServletResponse response) { |
|||
inventoryAdjustmentService.download(request, response); |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.wms.biz.func.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.wms.biz.func.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,35 @@ |
|||
package com.yxt.wms.biz.func.inventoryadjustment; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.wms.biz.func.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; |
|||
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
|||
private String createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
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;//创建组织sid
|
|||
private String userSid; |
|||
private String orgPath; |
|||
private List<InventoryAdjustmentDetailDto> list=new ArrayList<>();} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.wms.biz.func.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 updateBySidIsDelete(List<String> list); |
|||
@Select("select * from warehouse_area where warehouseSid = #{ckSid} and isDelete!='1' and isEnable='1'") |
|||
List<InventoryAdjustmentAllVo> selectAll(String ckSid); |
|||
List<InventoryAdjustmentVo> listAll(@Param("orgPath")String orgPath); |
|||
|
|||
InventoryAdjustmentAllVo selectAreaByRackSid(String rackSid); |
|||
@Select("select * from warehouse_area where zoneSid = #{qySid} and isDelete = 0 and isEnable = 1") |
|||
List<InventoryAdjustmentAllVo> selectAreaAll(String qySid); |
|||
} |
@ -0,0 +1,8 @@ |
|||
<?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.wms.biz.func.inventoryadjustment.InventoryAdjustmentMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,30 @@ |
|||
package com.yxt.wms.biz.func.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,186 @@ |
|||
package com.yxt.wms.biz.func.inventoryadjustment; |
|||
|
|||
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.wms.biz.func.basegoodssku.BaseGoodsSku; |
|||
import com.yxt.wms.biz.func.basegoodsspu.BaseGoodsSpuVo; |
|||
import com.yxt.wms.biz.func.inventoryadjustmentdetail.InventoryAdjustmentDetailVo; |
|||
import com.yxt.wms.biz.func.warehouseinfo.WarehouseInfoVo; |
|||
import com.yxt.wms.biz.func.warehouserack.WarehouseRackVo; |
|||
import com.yxt.wms.feign.base.basegoodssku.BaseGoodsSkuFeign; |
|||
import com.yxt.wms.feign.base.basegoodsspu.BaseGoodsSpuFeign; |
|||
import com.yxt.wms.feign.warehouse.inventoryadjustment.InventoryAdjustmentFeign; |
|||
import com.yxt.wms.feign.warehouse.wmswarehouserack.WarehouseRackFeign; |
|||
import com.yxt.wms.utils.ExcelUtil; |
|||
import com.yxt.wms.utils.OrgPathQuery; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.*; |
|||
import java.net.URLEncoder; |
|||
import java.util.ArrayList; |
|||
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 InventoryAdjustmentService extends MybatisBaseService<InventoryAdjustmentMapper, InventoryAdjustment> { |
|||
@Autowired |
|||
InventoryAdjustmentFeign inventoryAdjustmentFeign; |
|||
@Value("${image.upload.path:http://127.0.0.1:8080/upload/}") |
|||
String path; |
|||
@Autowired |
|||
BaseGoodsSkuFeign baseGoodsSkuFeign; |
|||
@Autowired |
|||
BaseGoodsSpuFeign baseGoodsSpuFeign; |
|||
@Autowired |
|||
WarehouseRackFeign warehouseRackFeign; |
|||
|
|||
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(PagerQuery<InventoryAdjustmentQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
InventoryAdjustmentQuery query = pq.getParams(); |
|||
QueryWrapper<InventoryAdjustment> qw = new QueryWrapper<>(); |
|||
return inventoryAdjustmentFeign.listPage(pq); |
|||
} |
|||
public ResultBean<InventoryAdjustmentVo> getAllType(OrgPathQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return inventoryAdjustmentFeign.listAll(query); |
|||
} |
|||
|
|||
public ResultBean<String> saveOrUpdate(InventoryAdjustmentDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
inventoryAdjustmentFeign.saveOrUpdate(dto); |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<InventoryAdjustmentVo> initialization(String sid) { |
|||
return inventoryAdjustmentFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
public void delAll(String[] sids) { |
|||
inventoryAdjustmentFeign.delBySids(sids); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
InventoryAdjustment wmsWarehouseArea = fetchBySid(sid); |
|||
if (null != wmsWarehouseArea) { |
|||
wmsWarehouseArea.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsWarehouseArea); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public List<InventoryAdjustmentAllVo> selectAll(String ckSid) { |
|||
return baseMapper.selectAll(ckSid); |
|||
} |
|||
|
|||
public void download(HttpServletRequest request, HttpServletResponse response) { |
|||
|
|||
// 指定要下载的文件路径
|
|||
String filePath = path + "库存调整导入模版.xlsx"; |
|||
String fileName = new File(filePath).getName(); |
|||
String encodedFileName = null; |
|||
try { |
|||
encodedFileName = URLEncoder.encode(fileName, "UTF-8"); |
|||
} catch (UnsupportedEncodingException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
// 设置响应头信息
|
|||
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\""); |
|||
// 获取文件名
|
|||
response.setContentType("application/octet-stream"); |
|||
// 读取文件并将其写入响应输出流
|
|||
try (InputStream in = new FileInputStream(filePath); |
|||
OutputStream out = response.getOutputStream()) { |
|||
byte[] buffer = new byte[4096]; |
|||
int bytesRead; |
|||
while ((bytesRead = in.read(buffer)) != -1) { |
|||
out.write(buffer, 0, bytesRead); |
|||
} |
|||
} catch (FileNotFoundException e) { |
|||
throw new RuntimeException(e); |
|||
} catch (IOException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
} |
|||
public ResultBean importExcel(MultipartFile file) throws IOException { |
|||
ResultBean rb=new ResultBean().fail(); |
|||
//檢查excel
|
|||
ExcelUtil.checkFile(file); |
|||
//解析excel
|
|||
List<String[]> list = ExcelUtil.readExcel(file); |
|||
if (!list.isEmpty()) { |
|||
List tt = new ArrayList(); |
|||
List<InventoryAdjustmentDetailVo> tt1 = new ArrayList(); |
|||
for (int i = 0; i < list.size(); i++) { |
|||
InventoryAdjustmentDetailVo dto =new InventoryAdjustmentDetailVo(); |
|||
System.out.println(list.get(i)); |
|||
dto = this.packaging(list.get(i),dto); |
|||
if (null == dto) { |
|||
return rb.setMsg("导入失败,第" + (i + 1) + "行数据错误!"); |
|||
} else { |
|||
tt.add(dto); |
|||
} |
|||
} |
|||
return rb.success().setMsg("导入成功").setData(tt); |
|||
|
|||
} else { |
|||
return rb.setMsg("导入文件没有有效数据"); |
|||
} |
|||
} |
|||
|
|||
private InventoryAdjustmentDetailVo packaging(String[] arr, InventoryAdjustmentDetailVo vo) { |
|||
InventoryAdjustmentDetailVo vo2=new InventoryAdjustmentDetailVo(); |
|||
try { |
|||
String barCode = StringUtils.isEmpty(arr[0]) ? null : arr[0];//
|
|||
String goodsSpuCode = StringUtils.isEmpty(arr[1]) ? null : arr[1];//
|
|||
String goodsSkuTitle = StringUtils.isEmpty(arr[2]) ? null : arr[2];//
|
|||
String spec = StringUtils.isEmpty(arr[3]) ? null : arr[3]; |
|||
String count = StringUtils.isEmpty(arr[4]) ? null: arr[4]; |
|||
String rackCode = StringUtils.isEmpty(arr[5]) ? null :arr[5]; |
|||
String remarks = StringUtils.isEmpty(arr[6]) ? null : arr[6]; |
|||
BaseGoodsSku sku=baseGoodsSkuFeign.getSkuByCode(goodsSpuCode,goodsSkuTitle).getData(); |
|||
BaseGoodsSpuVo vo1=baseGoodsSpuFeign.initialization(sku.getGoodsSpuSid()).getData(); |
|||
WarehouseRackVo vo3=warehouseRackFeign.selRackByCode(rackCode).getData(); |
|||
vo2.setWarehouseAreaName(vo3.getLocationName()); |
|||
vo2.setWarehouseAreaSid(vo3.getLocationSid()); |
|||
vo2.setRackSid(vo3.getSid()); |
|||
vo2.setRackName(vo3.getRackName()); |
|||
vo2.setRackCode(vo3.getRackCode()); |
|||
vo2.setGoodsSpuSid(vo1.getSid()); |
|||
vo2.setGoodsSpuName(vo1.getGoodsName()); |
|||
vo2.setBarCode(barCode); |
|||
vo2.setGoodsSkuCode(goodsSpuCode); |
|||
vo2.setGoodsSkuTitle(goodsSkuTitle); |
|||
vo2.setGoodsSkuOwnSpec(spec); |
|||
vo2.setCount(count); |
|||
vo2.setRackCode(rackCode); |
|||
vo2.setGoodsSkuSid(sku.getSid()); |
|||
vo2.setRemarks(remarks); |
|||
vo2.setUnit(vo1.getGoodsUnitName()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return null; |
|||
} |
|||
return vo2; |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.yxt.wms.biz.func.inventoryadjustment; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.wms.biz.func.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,26 @@ |
|||
package com.yxt.wms.biz.func.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; |
|||
private String unit; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.wms.biz.func.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; |
|||
private String unit; |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.wms.biz.func.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 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); |
|||
|
|||
|
|||
List<InventoryAdjustmentDetailVo> listAll(@Param("orgPath")String orgPath); |
|||
|
|||
|
|||
@Select("select * from inventory_adjustment_detail where billSid = #{billSid}") |
|||
List<InventoryAdjustmentDetailVo> selectDetailByBillSid(String qySid); |
|||
} |
@ -0,0 +1,9 @@ |
|||
<?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.wms.biz.func.inventoryadjustmentdetail.InventoryAdjustmentDetailMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,30 @@ |
|||
package com.yxt.wms.biz.func.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 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,132 @@ |
|||
package com.yxt.wms.biz.func.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.wms.utils.OrgPathQuery; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
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<InventoryAdjustmentDetailVo> p = new PagerVo<>(); |
|||
return rb.success().setData(p); |
|||
} |
|||
} else { |
|||
PagerVo<InventoryAdjustmentDetailVo> 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<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<InventoryAdjustmentDetailVo> getAllType(OrgPathQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<InventoryAdjustmentDetailVo> pagging = baseMapper.listAll(query.getOrgPath()); |
|||
return rb.success().setData(pagging); |
|||
} |
|||
|
|||
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 ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
InventoryAdjustmentDetail wmsWarehouseArea = fetchBySid(sid); |
|||
if (null != wmsWarehouseArea) { |
|||
baseMapper.deleteById(wmsWarehouseArea.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
|
|||
|
|||
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,43 @@ |
|||
package com.yxt.wms.biz.func.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; |
|||
private String unit; |
|||
|
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.yxt.wms.feign.warehouse.inventoryadjustment; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentDto; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentQuery; |
|||
import com.yxt.wms.biz.func.inventoryadjustment.InventoryAdjustmentVo; |
|||
import com.yxt.wms.biz.func.warehousearea.*; |
|||
import com.yxt.wms.feign.warehouse.warehousearea.WarehouseAreaFeignFallback; |
|||
import com.yxt.wms.utils.OrgPathQuery; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Project: anrui_portal(门户建设) <br/> |
|||
* File: SysRoleFeign.java <br/> |
|||
* Class: com.yxt.anrui.portal.api.sysrole.SysRoleFeign <br/> |
|||
* Description: 角色. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2021-08-03 00:24:29 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Api(tags = "库存调整") |
|||
@FeignClient( |
|||
contextId = "ss-common-warehouse-InventoryAdjustment", |
|||
name = "ss-common-warehouse", |
|||
path = "/apiadmin/inventoryadjustment" |
|||
) |
|||
public interface InventoryAdjustmentFeign { |
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<InventoryAdjustmentVo>> listPage(@RequestBody PagerQuery<InventoryAdjustmentQuery> pq); |
|||
@ApiOperation("查询所有") |
|||
@PostMapping("/listAll") |
|||
public ResultBean<InventoryAdjustmentVo> listAll(@RequestBody OrgPathQuery query); |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody InventoryAdjustmentDto dto); |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<InventoryAdjustmentVo> initialization(@PathVariable("sid") String sid); |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid); |
|||
@ApiOperation("根据sid批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
public ResultBean delBySids(@RequestBody String[] sids); |
|||
} |
Loading…
Reference in new issue