Commit 845e0c71 authored by xfxmcy's avatar xfxmcy

wms 模块 更新

parent 80cc7c3d
......@@ -2,31 +2,27 @@ package org.rcisoft.bus.wmsgoods.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import java.util.List;
/**
......@@ -147,4 +143,14 @@ public class WmsGoodsController extends CyPaginationController<WmsGoods> {
List<WmsGoods> wmsGoodsList = wmsGoodsServiceImpl.export(wmsGoods);
CyEpExcelUtil.exportExcel(wmsGoodsList, "商品信息表信息", "商品信息表信息", WmsGoods.class, excelName, response);
}
@CyOpeLogAnno(title = "system-商品信息表管理-查询商品", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询商品", notes="查询商品")
@GetMapping(value = "/detailByCode")
public CyResult detailByCode(WmsGoods wmsGoods) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsServiceImpl.queryWmsGoods(wmsGoods));
}
}
package org.rcisoft.bus.wmsgoods.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import java.util.List;
import java.util.Map;
......
package org.rcisoft.bus.wmsgoods.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2024年5月29日 下午1:21:49.
*/
* Created with cy on 2024年5月29日 下午1:21:49.
*/
@Data
@TableName("wms_goods")
public class WmsGoods extends CyIdIncreEntity<WmsGoods> {
/**
* @desc 品名
* @column goods_name
* @default
*/
@Excel(name = "商品名称", orderNum = "0", width = 20)
private String goodsName;
/**
* @desc 商品编码
* @column goods_code
* @default
*/
@Excel(name = "商品编码", orderNum = "1", width = 20)
* @desc 商品编码
* @column goods_code
* @default
*/
@Excel(name = "商品编码", orderNum = "0", width = 40)
private String goodsCode;
@TableField(exist = false)
@Excel(name="商场条码", orderNum = "1", width = 55)
private String goodsH5;
/**
* @desc 款式
* @column goods_type
* @default
*/
@Excel(name = "款式", orderNum = "2", width = 20,replace = {"立领_50001","修身西装_50002","蕾丝披肩裙_50003"})
private String goodsStyle;
* @desc 品名
* @column goods_name
* @default
*/
@Excel(name = "商品名称", orderNum = "2", width = 20)
private String goodsName;
/**
* @desc 品牌
* @column goods_size
* @default
*/
@Excel(name = "品牌", orderNum = "3", width = 20)
private String goodsBrand;
/**
* @desc 季节
* @column goods_season
* @default
*/
@Excel(name = "季节", orderNum = "4", width = 20)
private String goodsSeason;
@Excel(name = "品名", orderNum = "5", width = 20)
private String goodsDictName;
/**
* @desc 货号
* @column goods_art_number
* @default
*/
@Excel(name = "货号", orderNum = "3", width = 20,replace = {"羊毛_20000001","晴纶_20000002","化纤_20000003"})
* @desc 货号
* @column goods_art_number
* @default
*/
@Excel(name = "货号", orderNum = "6", width = 20)
private String goodsArtNumber;
/**
* @desc 季节
* @column goods_season
* @default
*/
@Excel(name = "季节", orderNum = "4", width = 20,replace = {"24春_401","24夏_402","24秋_403","24冬_404"})
private String goodsSeason;
* @desc 款式
* @column goods_type
* @default
*/
@Excel(name = "款式", orderNum = "7", width = 20)
private String goodsStyle;
/**
* @desc 颜色
* @column goods_colour
* @default
*/
@Excel(name = "颜色", orderNum = "5", width = 20,replace = {"白色_61","黑色_62","灰色_63"})
* @desc 颜色
* @column goods_colour
* @default
*/
@Excel(name = "颜色", orderNum = "8", width = 20)
private String goodsColour;
/**
* @desc 规格
* @column goods_norms
* @default
*/
@Excel(name = "规格", orderNum = "6", width = 20,replace = {"150_701","155_702","160_703"})
* @desc 规格
* @column goods_norms
* @default
*/
@Excel(name = "规格", orderNum = "9", width = 20)
private String goodsNorms;
/**
* @desc 尺码
* @column goods_size
* @default
*/
@Excel(name = "尺码", orderNum = "7", width = 20,replace = {"60A_80","60B_81","60C_82"})
private String goodsSize;
/**
* @desc 品牌
* @desc 尺码
* @column goods_size
* @default
*/
@Excel(name = "品牌", orderNum = "8", width = 20,replace = {"莫兰蒂_31","雅姿_32","菲莉丝_33","卡莉娜_34"})
private String goodsBrand;
@Excel(name = "品名", orderNum = "9", width = 20,replace = {"Nike_01","Adidas_02","Uniqlo_03"})
private String goodsDictName;
@Excel(name = "尺码", orderNum = "10", width = 20)
private String goodsSize;
@TableField(exist = false)
private Integer inCounts;
......@@ -119,5 +120,14 @@ public class WmsGoods extends CyIdIncreEntity<WmsGoods> {
*/
@TableField(exist = false)
private String urlIdList;
// 库位号
@TableField(exist = false)
private String goodsNumber;
// = 查询
@TableField(exist = false)
private String actualGoodsCode;
}
package org.rcisoft.bus.wmsgoods.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import java.util.List;
......@@ -19,74 +15,86 @@ import java.util.List;
public interface WmsGoodsService {
/**
* 保存 商品信息表
* @param wmsGoods
* @return
*/
* 保存 商品信息表
*
* @param wmsGoods
* @return
*/
CyPersistModel persist(WmsGoods wmsGoods);
/**
* 删除 商品信息表
* @param wmsGoods
* @return
*/
* 删除 商品信息表
*
* @param wmsGoods
* @return
*/
CyPersistModel remove(WmsGoods wmsGoods);
CyPersistModel delOss(WmsGoods wmsGoods);
/**
* 逻辑删除 商品信息表
* @param wmsGoods
* @return
*/
* 逻辑删除 商品信息表
*
* @param wmsGoods
* @return
*/
CyPersistModel removeLogical(WmsGoods wmsGoods);
/**
* 修改 商品信息表
* @param wmsGoods
* @return
*/
* 修改 商品信息表
*
* @param wmsGoods
* @return
*/
CyPersistModel merge(WmsGoods wmsGoods);
/**
* 根据id查询 商品信息表
* @param id
* @return
*/
* 根据id查询 商品信息表
*
* @param id
* @return
*/
WmsGoods findById(int id);
/**
* 分页查询 商品信息表
* @param wmsGoods
* @return
*/
* 分页查询 商品信息表
*
* @param wmsGoods
* @return
*/
IPage<WmsGoods> findAllByPagination(CyPageInfo<WmsGoods> paginationUtility,
WmsGoods wmsGoods);
/**
* 查询list 商品信息表
* @param wmsGoods
* @return
*/
* 查询list 商品信息表
*
* @param wmsGoods
* @return
*/
List<WmsGoods> findAll(WmsGoods wmsGoods);
/**
* 导出商品信息表
* @return
*/
* 导出商品信息表
*
* @return
*/
List<WmsGoods> export(WmsGoods wmsGoods);
/**
* 根据申请id 查询
*
* @param wmsGoodsLog
* @return
*/
List<WmsGoods> findByApplyId(WmsGoodsApply wmsGoodsLog);
List<WmsGoods> findByApplyIdOut(WmsGoodsApply wmsGoodsLog);
List<WmsGoods> findByIdGoods(int id);
WmsGoods findByOss (int id);
List<OssInfo> findOss(WmsGoods wmsGoods);
WmsGoods findByOss(int id);
List<OssInfo> findOss(WmsGoods wmsGoods);
WmsGoods queryWmsGoods(WmsGoods wmsGoods);
}
package org.rcisoft.bus.wmsgoods.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.bus.wmsgoods.dao.WmsGoodsRepository;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import org.rcisoft.sys.ossInfo.dao.OssInfoMapper;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodsstock.dao.WmsGoodsStockRepository;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.sys.ossInfo.entity.OssInfo;
import org.rcisoft.sys.ossInfo.service.OssInfoService;
import org.rcisoft.sys.ossInfo.service.impl.OssInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by cy on 2024年5月29日 下午1:21:49.
......@@ -35,6 +38,11 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGoods> implements WmsGoodsService {
@Value("${system.goods_h5}")
private String goodsH5;
@Autowired
private WmsGoodsStockRepository wmsGoodsStockRepository;
/**
* 保存 商品信息表
......@@ -45,28 +53,43 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(WmsGoods wmsGoods) {
WmsGoods existingGoods = baseMapper.selectOne(new QueryWrapper<WmsGoods>().eq("goods_code", wmsGoods.getGoodsCode()));
if (existingGoods != null) {
throw new CyServiceException(1001, "商品已存在");
}
//增加操作
int line = baseMapper.insert(wmsGoods);
//插入图片
if(StringUtils.isNotBlank(wmsGoods.getUrlIdList())){
List<Map<String, String>> params = new ArrayList<>();
String[] oss_ids = wmsGoods.getUrlIdList().split(",");
Map<String, String> param = null;
for (String id : oss_ids) {
param = new HashMap<>();
param.put("gid", wmsGoods.getBusinessId() + "");
param.put("oid" , id);
params.add(param);
// 批量插入
String goodsCode = wmsGoods.getGoodsCode();
String[] goodStr = goodsCode.split(":");
if(goodStr.length < 2)
throw new CyServiceException(1001, "数据不合法");
String[] itemCode = goodStr[1].split(",");
// 循环
for (int i = 0; i < itemCode.length; i++) {
WmsGoods existingGoods = baseMapper.selectOne(new QueryWrapper<WmsGoods>().eq("goods_code",
goodStr[0] + itemCode[i]));
if (existingGoods != null) {
throw new CyServiceException(1001, "商品已存在");
}
baseMapper.insertOss(params);
WmsGoods entity = new WmsGoods();
BeanUtil.copyProperties(wmsGoods, entity);
entity.setGoodsSize(itemCode[i]);
entity.setGoodsCode(goodStr[0] + itemCode[i]);
//增加操作
int line = baseMapper.insert(entity);
//插入图片
if(StringUtils.isNotBlank(wmsGoods.getUrlIdList())){
List<Map<String, String>> params = new ArrayList<>();
String[] oss_ids = wmsGoods.getUrlIdList().split(",");
Map<String, String> param = null;
for (String id : oss_ids) {
param = new HashMap<>();
param.put("gid", entity.getBusinessId() + "");
param.put("oid" , id);
params.add(param);
}
baseMapper.insertOss(params);
}
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
wmsGoods.getBusinessId() + "的商品信息表信息");
}
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
wmsGoods.getBusinessId() + "的商品信息表信息");
return new CyPersistModel(line);
return new CyPersistModel(1);
}
/**
......@@ -118,9 +141,17 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(WmsGoods wmsGoods) {
QueryWrapper<WmsGoods> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("goods_code", wmsGoods.getGoodsCode());
queryWrapper.ne("del_flag", "1");
queryWrapper.ne("business_id", wmsGoods.getBusinessId());
List<WmsGoods> existingGoods = baseMapper.selectList(queryWrapper);
if (existingGoods.size() > 0) {
throw new CyServiceException(1001, "商品已存在");
}
int line = baseMapper.updateById(wmsGoods);
// 删除一下 goods_oss by goods
baseMapper.delOssById(wmsGoods);
baseMapper.delOssById(wmsGoods);
//插入图片
if(StringUtils.isNotBlank(wmsGoods.getUrlIdList())){
List<Map<String, String>> params = new ArrayList<>();
......@@ -190,6 +221,11 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
@Override
public List<WmsGoods> export(WmsGoods wmsGoods) {
List<WmsGoods> wmsGoodsList = baseMapper.queryWmsGoods(wmsGoods);
if(CollectionUtils.isNotEmpty(wmsGoodsList)){
wmsGoodsList.forEach(x->{
x.setGoodsH5(goodsH5 + x.getBusinessId());
});
}
return wmsGoodsList;
}
......@@ -199,12 +235,6 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
return baseMapper.queryWmsGoodsByAppId(wmsGoodsLog);
}
@Override
public List<WmsGoods> findByApplyIdOut(WmsGoodsApply wmsGoodsLog) {
return baseMapper.queryWmsGoodsByAppIdOut(wmsGoodsLog);
}
@Override
public List<WmsGoods> findByIdGoods(int id) {
WmsGoods wmsGoods = new WmsGoods();
......@@ -215,7 +245,8 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
@Override
public WmsGoods findByOss(int id) {
WmsGoods goods = baseMapper.selectById(id);
goods.setOssInfoList(baseMapper.findOss(goods));
if(goods != null)
goods.setOssInfoList(baseMapper.findOss(goods));
return goods;
}
......@@ -223,4 +254,20 @@ public class WmsGoodsServiceImpl extends ServiceImpl<WmsGoodsRepository, WmsGood
public List<OssInfo> findOss(WmsGoods wmsGoods) {
return baseMapper.findOss(wmsGoods);
}
@Override
public WmsGoods queryWmsGoods(WmsGoods wmsGoods) {
WmsGoods param = new WmsGoods();
param.setActualGoodsCode(wmsGoods.getGoodsCode());
// 1. 查询 goodsNumber
List<WmsGoods> result = baseMapper.queryWmsGoods(param);
if(CollectionUtils.isEmpty(result) || result.size() > 1)
throw new CyServiceException(500, "商品不存在!");
WmsGoods goods = result.get(0);
// 2. 查询 kwh
WmsGoodsStock wmsGoodsStock = wmsGoodsStockRepository.selectByIdOut(goods.getBusinessId());
if(wmsGoodsStock != null)
goods.setGoodsNumber(wmsGoodsStock.getGoodsNumber());
return goods;
}
}
......@@ -2,6 +2,7 @@ package org.rcisoft.bus.wmsgoodsapply.controller;
/*固定导入*/
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
......@@ -12,33 +13,30 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.rcisoft.bus.util.ExportExcelUtil;
import org.rcisoft.bus.wmsgoodsapply.dto.ExportEntryDto;
import org.rcisoft.bus.wmsgoodsapply.dto.AddWmsGoodsApplyDTO;
import org.rcisoft.bus.wmsgoodsapply.dto.ExportEntryDto;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodsapply.service.WmsGoodsApplyService;
import org.rcisoft.core.anno.CyEncryptSm4Anno;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.sys.dictionary.dao.DictDataRepository;
import org.rcisoft.sys.dictionary.dto.DictDataDTO;
import org.rcisoft.sys.dictionary.entity.DictData;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodsapply.service.WmsGoodsApplyService;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
......
package org.rcisoft.bus.wmsgoodsapply.dao;
import org.rcisoft.bus.wmsgoodsapply.dto.ImportGoodsTempDto;
import org.rcisoft.core.mapper.CyBaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
......
......@@ -2,7 +2,6 @@ package org.rcisoft.bus.wmsgoodsapply.dto;
import lombok.Data;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import java.util.List;
......@@ -22,5 +21,7 @@ public class AddWmsGoodsApplyDTO {
private String inGoods;
private String outGoods;
private String goodsNumber;
private String remarks;
}
package org.rcisoft.bus.wmsgoodsapply.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.apache.ibatis.type.JdbcType;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
......
......@@ -3,8 +3,8 @@ package org.rcisoft.bus.wmsgoodsapply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.bus.wmsgoodsapply.dto.AddWmsGoodsApplyDTO;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import java.util.List;
......
package org.rcisoft.bus.wmsgoodsapply.service.impl;
import cn.afterturn.easypoi.exception.excel.ExcelImportException;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import org.rcisoft.bus.wmsgoodsapply.dao.WmsGoodsApplyRepository;
import org.rcisoft.bus.wmsgoodsapply.dto.AddWmsGoodsApplyDTO;
import org.rcisoft.bus.wmsgoodslog.dto.AddLogList;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodsapply.service.WmsGoodsApplyService;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodslog.service.WmsGoodsLogService;
import org.rcisoft.bus.wmsgoodsstock.dao.WmsGoodsStockRepository;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.bus.wmsgoodsstock.service.WmsGoodsStockService;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.bus.wmsgoodsapply.dao.WmsGoodsApplyRepository;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.bus.wmsgoodsapply.service.WmsGoodsApplyService;
import org.rcisoft.bus.wmsgoodsstock.service.WmsGoodsStockService;
import org.rcisoft.sys.dictionary.dao.DictDataRepository;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
......@@ -34,9 +33,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
/**
* Created by cy on 2024年5月29日 下午1:21:49.
*/
......@@ -53,6 +49,9 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
@Autowired
private WmsGoodsService wmsGoodsServiceImpl;
@Autowired
private WmsGoodsStockRepository wmsGoodsStockRepository;
/**
* 保存 商品申请表
*
......@@ -74,13 +73,13 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel batchPersist(AddWmsGoodsApplyDTO addwmsGoodsApply) {
//入库
// 入库
WmsGoodsApply wmsGoodsApply = new WmsGoodsApply();
BeanUtils.copyProperties(addwmsGoodsApply, wmsGoodsApply);
wmsGoodsApply.setIoType("0");
wmsGoodsApply.setDealStatus("0");
baseMapper.insert(wmsGoodsApply);
//空
//
if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList())) {
throw new CyServiceException(1001, "出库单为空");
}
......@@ -90,15 +89,19 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
log = new WmsGoodsLog();
log.setGoodsName(box.getGoodsName());
log.setGoodsCode(box.getGoodsCode());
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId());
QueryWrapper<WmsGoodsStock> goodStockWrapper = new QueryWrapper<>();
goodStockWrapper.eq("goods_id", box.getBusinessId());
goodStockWrapper.eq("del_flag", "0");
WmsGoodsStock goodsStock = wmsGoodsStockRepository.selectOne(goodStockWrapper);
if (goodsStock == null) {
WmsGoodsStock newGoodsStock = new WmsGoodsStock();
newGoodsStock.setGoodsId(box.getBusinessId());
newGoodsStock.setGoodsCounts(box.getInCounts());
newGoodsStock.setGoodsNumber(addwmsGoodsApply.getGoodsNumber());
wmsGoodsStockRepositoryImpl.persist(newGoodsStock);
} else {
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getInCounts());
goodsStock.setGoodsNumber(addwmsGoodsApply.getGoodsNumber());
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
}
//日志
......@@ -123,8 +126,6 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
// 3.1 库存不满足 => 异常
// 3.2 库存满足 => 减库存,日志
// 4. 批量插入日志
// 1. 集合空 判断
if (CollectionUtil.isEmpty(addwmsGoodsApply.getBoxList()))
throw new CyServiceException(1001, "入库商品为空!");
......@@ -143,7 +144,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
log.setGoodsName(box.getGoodsName());
log.setGoodsCode(box.getGoodsCode());
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(box.getBusinessId());
WmsGoodsStock goodsStock = wmsGoodsStockRepository.selectById(box.getBusinessId());
// 库存不存在
if (goodsStock == null)
throw new CyServiceException(1001, "库存数量不足");
......@@ -156,7 +157,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
// 日志
log.setApplyId(wmsGoodsApplyOut.getBusinessId());
log.setGoodsId(box.getBusinessId());
log.setGoodsId(box.getGoodsId());
log.setGoodsCounts(box.getOutCounts());
log.setIoType("1");
log.setUpdateCounts(goodsStock.getGoodsCounts());
......@@ -172,9 +173,16 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
public WmsGoodsApply findByIdOut(int id) {
WmsGoodsApply apply = baseMapper.selectById(id);
if (apply == null) {
throw new CyServiceException(1001, "入库申请不存在");
throw new CyServiceException(1001, "申请单不存在!");
}
List<WmsGoods> goods = wmsGoodsServiceImpl.findByApplyId(apply);
if(CollectionUtil.isNotEmpty(goods)){
goods.forEach( x -> {
x.setOutCounts(x.getInCounts());
x.setInCounts(null);
});
apply.setWmsGoods(goods);
}
apply.setWmsGoods(wmsGoodsServiceImpl.findByApplyIdOut(apply));
return apply;
}
......
......@@ -2,32 +2,27 @@ package org.rcisoft.bus.wmsgoodslog.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.bus.wmsgoodslog.dto.AddLogList;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodslog.service.WmsGoodsLogService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodslog.service.WmsGoodsLogService;
import java.util.List;
/**
......
package org.rcisoft.bus.wmsgoodslog.dao;
import org.rcisoft.core.mapper.CyBaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
......
......@@ -2,6 +2,7 @@ package org.rcisoft.bus.wmsgoodslog.dto;
import lombok.Data;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import java.util.List;
@Data
......
package org.rcisoft.bus.wmsgoodslog.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2024年5月29日 下午1:21:49.
......
package org.rcisoft.bus.wmsgoodslog.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoodslog.dto.AddLogList;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import java.util.List;
......
package org.rcisoft.bus.wmsgoodslog.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.bus.wmsgoodsapply.service.WmsGoodsApplyService;
import org.rcisoft.bus.wmsgoodslog.dto.AddLogList;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyEpExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.wmsgoodslog.dao.WmsGoodsLogRepository;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodslog.service.WmsGoodsLogService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.BeanUtils;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2024年5月29日 下午1:21:49.
*/
......
......@@ -2,32 +2,29 @@ package org.rcisoft.bus.wmsgoodsstock.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.bus.wmsgoodsstock.service.WmsGoodsStockService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.bus.wmsgoodsstock.service.WmsGoodsStockService;
import java.util.List;
/**
......@@ -150,4 +147,15 @@ public class WmsGoodsStockController extends CyPaginationController<WmsGoodsStoc
List<WmsGoodsStock> wmsGoodsStockList = wmsGoodsStockServiceImpl.export(wmsGoodsStock);
CyEpExcelUtil.exportExcel(wmsGoodsStockList, "库存管理表信息", "库存管理表信息", WmsGoodsStock.class, excelName, response);
}
@CyOpeLogAnno(title = "system-商品信息表管理-查询商品", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询商品", notes="查询商品")
@GetMapping(value = "/detailByCode")
public CyResult detailByCode(WmsGoods wmsGoods) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsStockServiceImpl.queryWmsGoodsStock(wmsGoods));
}
}
package org.rcisoft.bus.wmsgoodsstock.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
......@@ -26,5 +23,7 @@ public interface WmsGoodsStockRepository extends CyBaseMapper<WmsGoodsStock> {
*
*/
IPage<WmsGoodsStockPageResultsDto> queryWmsGoodsStocksPaged(CyPageInfo cyPageInfo, @Param("entity") WmsGoodsStockPageResultsDto wmsGoodsStock);
WmsGoodsStock selectByIdOut(int id);
}
package org.rcisoft.bus.wmsgoodsstock.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import java.util.WeakHashMap;
/**
* @Author: gy
* @Date: 2024/5/29 23:00
......@@ -29,6 +26,8 @@ public class WmsGoodsStockPageResultsDto extends WmsGoodsStock {
*/
private String goodsCode;
private String goodsNumber;
/**
* @desc 商品类型
* @column goods_style
......
......@@ -3,16 +3,9 @@ package org.rcisoft.bus.wmsgoodsstock.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2024年5月29日 下午1:21:49.
*/
......@@ -26,17 +19,120 @@ public class WmsGoodsStock extends CyIdIncreEntity<WmsGoodsStock> {
* @column goods_id
* @default
*/
@Excel(name = "商品id", orderNum = "0", width = 20)
private Integer goodsId;
/**
* @desc 商品编码
* @column goods_code
* @default
*/
@TableField(exist = false)
@Excel(name = "商品编码", orderNum = "1", width = 40)
private String goodsCode;
@TableField(exist = false)
@Excel(name = "商品名称", orderNum = "2", width = 20)
private String goodsName;
/**
* @desc 商品数量
* @column goods_counts
* @default
*/
@Excel(name = "商品数量", orderNum = "1", width = 20)
@Excel(name = "库存", orderNum = "3", width = 20)
private Integer goodsCounts;
/**
* @desc 商品数量
* @column goods_counts
* @default
*/
@Excel(name = "库位号", orderNum = "3", width = 20)
private String goodsNumber;
/**
* @desc 品牌
* @column goods_brand
* @default
*/
@TableField(exist = false)
@Excel(name = "品牌", orderNum = "4", width = 20)
private String goodsBrand;
@TableField(exist = false)
private Integer inventoryValue;
/**
* @desc 季节
* @column goods_season
* @default
*/
@TableField(exist = false)
@Excel(name = "季节", orderNum = "5", width = 20)
private String goodsSeason;
@TableField(exist = false)
@Excel(name = "品名", orderNum = "6", width = 20)
private String goodsDictName;
/**
* @desc 商品货号
* @column goods_article_number
* @default
*/
@TableField(exist = false)
@Excel(name = "货号", orderNum = "7", width = 20)
private String goodsArtNumber;
/**
* @desc 商品类型
* @column goods_style
* @default
*/
@TableField(exist = false)
@Excel(name = "款式", orderNum = "8", width = 20)
private String goodsStyle;
/**
* @desc 商品颜色
* @column goods_colour
* @default
*/
@TableField(exist = false)
@Excel(name = "颜色", orderNum = "9", width = 20)
private String goodsColour;
/**
* @desc 商品规格
* @column goods_norms
* @default
*/
@TableField(exist = false)
@Excel(name = "规格", orderNum = "10", width = 20)
private String goodsNorms;
/**
* @desc 商品尺码
* @column goods_size
* @default
*/
@TableField(exist = false)
@Excel(name = "尺码", orderNum = "11", width = 20)
private String goodsSize;
// = 查询
@TableField(exist = false)
private String actualGoodsCode;
// >
@TableField(exist = false)
private Integer actualGtGoodsCounts;
}
package org.rcisoft.bus.wmsgoodsstock.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import java.util.List;
......@@ -51,6 +50,7 @@ public interface WmsGoodsStockService {
* @return
*/
WmsGoodsStock findById(int id);
WmsGoodsStock findByIdOut(int id);
/**
* 分页查询 库存管理表
......@@ -75,4 +75,10 @@ public interface WmsGoodsStockService {
*/
List<WmsGoodsStock> export(WmsGoodsStock wmsGoodsStock);
/**
* 查询 stock
* @param wmsGoods
* @return
*/
WmsGoodsStock queryWmsGoodsStock(WmsGoods wmsGoods);
}
package org.rcisoft.bus.wmsgoodsstock.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyEpExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.bus.wmsgoodslog.dao.WmsGoodsLogRepository;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodsstock.dao.WmsGoodsStockRepository;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.bus.wmsgoodsstock.service.WmsGoodsStockService;
import org.rcisoft.core.service.CyBaseService;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2024年5月29日 下午1:21:49.
......@@ -33,6 +31,8 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepository,WmsGoodsStock> implements WmsGoodsStockService {
@Autowired
WmsGoodsLogRepository wmsGoodsLogRepository;
/**
* 保存 库存管理表
......@@ -86,8 +86,17 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(WmsGoodsStock wmsGoodsStock){
WmsGoodsStock wmsOrigin = baseMapper.selectById(wmsGoodsStock.getBusinessId());
int line = baseMapper.updateById(wmsGoodsStock);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ wmsGoodsStock.getBusinessId()+"的库存管理表信息");
WmsGoodsLog wmsGoodsLog = new WmsGoodsLog();
wmsGoodsLog.setGoodsId(wmsGoodsStock.getBusinessId());
wmsGoodsLog.setGoodsCounts(wmsOrigin.getGoodsCounts());
wmsGoodsLog.setGoodsName(wmsOrigin.getGoodsName());
wmsGoodsLog.setGoodsCode(wmsOrigin.getGoodsCode());
wmsGoodsLog.setIoType("3");
wmsGoodsLog.setUpdateCounts(wmsGoodsStock.getGoodsCounts());
wmsGoodsLogRepository.insert(wmsGoodsLog);
return new CyPersistModel(line);
}
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
......@@ -107,7 +116,10 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor
public WmsGoodsStock findById(int id){
return baseMapper.selectById(id);
}
@Override
public WmsGoodsStock findByIdOut(int id){
return baseMapper.selectByIdOut(id);
}
/**
* 分页查询 库存管理表
* @param wmsGoodsStock
......@@ -141,4 +153,16 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor
return wmsGoodsStockList;
}
@Override
public WmsGoodsStock queryWmsGoodsStock(WmsGoods wmsGoods) {
WmsGoodsStock stock = new WmsGoodsStock();
stock.setActualGoodsCode(wmsGoods.getGoodsCode());
stock.setActualGtGoodsCounts(0);
// 1. 查询 goodsNumber
List<WmsGoodsStock> result = baseMapper.queryWmsGoodsStocks(stock);
if(CollectionUtils.isEmpty(result) || result.size() > 1 || result.get(0).getGoodsCounts() < 1)
throw new CyServiceException(500, "商品不存在或库存不足!");
return result.get(0);
}
}
......@@ -26,63 +26,106 @@
</resultMap>
<insert id="insertOss">
insert into
wms_goods_oss(goods_id,oss_id)
wms_goods_oss(goods_id,oss_id)
values
<foreach collection="entity" item="item" separator=",">
(#{item.gid},#{item.oid})
</foreach>
</insert>
<delete id="delOssById">
delete from wms_goods_oss wgo
delete
from wms_goods_oss wgo
where wgo.goods_id = #{entity.businessId}
</delete>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryWmsGoods" resultMap="BaseResultMap">
select * from wms_goods
SELECT
wg.business_id,
wg.goods_name,
wg.goods_code,
sdd_goods_dict_name.dict_label AS goods_dict_name,
sdd_goods_art_number.dict_label AS goods_art_number,
sdd_goods_brand.dict_label AS goods_brand,
sdd_goods_season.dict_label AS goods_season,
sdd_goods_style.dict_label AS goods_style,
sdd_goods_colour.dict_label AS goods_colour,
sdd_goods_norms.dict_label AS goods_norms,
sdd_goods_size.dict_label AS goods_size
FROM
wms_goods wg
LEFT JOIN
sys_dict_data sdd_goods_dict_name ON sdd_goods_dict_name.dict_type = 'GOODS_DICT_NAME' AND
sdd_goods_dict_name.dict_value = wg.goods_dict_name AND sdd_goods_dict_name.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_art_number ON sdd_goods_art_number.dict_type = 'GOODS_ART_NUMBER' AND
sdd_goods_art_number.dict_value = wg.goods_art_number AND sdd_goods_art_number.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_brand ON sdd_goods_brand.dict_type = 'GOODS_BRAND' AND sdd_goods_brand.dict_value =
wg.goods_brand AND sdd_goods_brand.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_season ON sdd_goods_season.dict_type = 'GOODS_SEASON' AND sdd_goods_season.dict_value =
wg.goods_season AND sdd_goods_season.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_style ON sdd_goods_style.dict_type = 'GOODS_STYLE' AND sdd_goods_style.dict_value =
wg.goods_style AND sdd_goods_style.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_colour ON sdd_goods_colour.dict_type = 'GOODS_COLOUR' AND sdd_goods_colour.dict_value =
wg.goods_colour AND sdd_goods_colour.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_norms ON sdd_goods_norms.dict_type = 'GOODS_NORMS' AND sdd_goods_norms.dict_value =
wg.goods_norms AND sdd_goods_norms.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_size ON sdd_goods_size.dict_type = 'GOODS_SIZE' AND sdd_goods_size.dict_value =
wg.goods_size AND sdd_goods_size.del_flag = '0'
where 1=1
and del_flag = '0'
and wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.goodsName !=null and entity.goodsName != '' ">
and goods_name like concat('%',#{entity.goodsName},'%')
and wg.goods_name like concat('%',#{entity.goodsName},'%')
</if>
<if test="entity.goodsDictName !=null and entity.goodsDictName != '' ">
and goods_dict_name like concat('%',#{entity.goodsDictName},'%')
and wg.goods_dict_name like concat('%',#{entity.goodsDictName},'%')
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and goods_code like concat('%',#{entity.goodsCode},'%')
and wg.goods_code like concat('%',#{entity.goodsCode},'%')
</if>
<if test="entity.actualGoodsCode !=null and entity.actualGoodsCode != '' ">
and wg.goods_code = #{entity.actualGoodsCode}
</if>
<if test="entity.goodsStyle !=null and entity.goodsStyle != '' ">
and goods_style like concat('%',#{entity.goods_style},'%')
and wg.goods_style like concat('%',#{entity.goods_style},'%')
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
and wg.goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if>
<if test="entity.goodsSeason !=null and entity.goodsSeason != '' ">
and goods_season like concat('%',#{entity.goodsSeason},'%')
and wg.goods_season like concat('%',#{entity.goodsSeason},'%')
</if>
<if test="entity.goodsColour !=null and entity.goodsColour != '' ">
and goods_colour like concat('%',#{entity.goodsColour},'%')
and wg.goods_colour like concat('%',#{entity.goodsColour},'%')
</if>
<if test="entity.goodsNorms !=null and entity.goodsNorms != '' ">
and goods_norms like concat('%',#{entity.goodsNorms},'%')
and wg.goods_norms like concat('%',#{entity.goodsNorms},'%')
</if>
<if test="entity.goodsSize !=null and entity.goodsSize != '' ">
and goods_size like concat('%',#{entity.goodsSize},'%')
and wg.goods_size like concat('%',#{entity.goodsSize},'%')
</if>
<if test="entity.goodsBrand !=null and entity.goodsBrand != '' ">
and goods_brand like concat('%',#{entity.goodsBrand},'%')
and wg.goods_brand like concat('%',#{entity.goodsBrand},'%')
</if>
ORDER BY business_id DESC
ORDER BY wg.business_id DESC
</select>
<select id="queryWmsGoodssPaged" resultMap="BaseResultMap">
SELECT
wg.*
wg.*,
wgs.goods_counts
FROM
wms_goods wg
LEFT JOIN wms_goods_stock wgs ON wg.business_id = wgs.goods_id
WHERE
wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
......@@ -123,25 +166,44 @@
</select>
<select id="queryWmsGoodsByAppId" resultMap="BaseResultMap">
SELECT
log.goods_counts as inCounts,
goods.*
FROM
wms_goods_log log
LEFT JOIN wms_goods goods ON log.goods_id = goods.business_id
where log.apply_id = #{entity.businessId}
</select>
<select id="queryWmsGoodsByAppIdOut" resultMap="BaseResultMap">
SELECT
log.goods_counts as outCounts,
goods.*
FROM
wms_goods_log log
LEFT JOIN wms_goods goods ON log.goods_id = goods.business_id
SELECT log.goods_counts as inCounts,
wg.business_id,
wg.goods_name,
wg.goods_code,
sdd_goods_dict_name.dict_label AS goods_dict_name,
sdd_goods_art_number.dict_label AS goods_art_number,
sdd_goods_brand.dict_label AS goods_brand,
sdd_goods_season.dict_label AS goods_season,
sdd_goods_style.dict_label AS goods_style,
sdd_goods_colour.dict_label AS goods_colour,
sdd_goods_norms.dict_label AS goods_norms,
sdd_goods_size.dict_label AS goods_size
FROM wms_goods_log log
LEFT JOIN wms_goods wg ON log.goods_id = wg.business_id
LEFT JOIN
sys_dict_data sdd_goods_dict_name ON sdd_goods_dict_name.dict_type = 'GOODS_DICT_NAME' AND
sdd_goods_dict_name.dict_value = wg.goods_dict_name AND sdd_goods_dict_name.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_art_number ON sdd_goods_art_number.dict_type = 'GOODS_ART_NUMBER' AND
sdd_goods_art_number.dict_value = wg.goods_art_number AND sdd_goods_art_number.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_brand ON sdd_goods_brand.dict_type = 'GOODS_BRAND' AND sdd_goods_brand.dict_value =
wg.goods_brand AND sdd_goods_brand.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_season ON sdd_goods_season.dict_type = 'GOODS_SEASON' AND sdd_goods_season.dict_value =
wg.goods_season AND sdd_goods_season.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_style ON sdd_goods_style.dict_type = 'GOODS_STYLE' AND sdd_goods_style.dict_value =
wg.goods_style AND sdd_goods_style.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_colour ON sdd_goods_colour.dict_type = 'GOODS_COLOUR' AND sdd_goods_colour.dict_value =
wg.goods_colour AND sdd_goods_colour.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_norms ON sdd_goods_norms.dict_type = 'GOODS_NORMS' AND sdd_goods_norms.dict_value =
wg.goods_norms AND sdd_goods_norms.del_flag = '0'
LEFT JOIN
sys_dict_data sdd_goods_size ON sdd_goods_size.dict_type = 'GOODS_SIZE' AND sdd_goods_size.dict_value =
wg.goods_size AND sdd_goods_size.del_flag = '0'
where log.apply_id = #{entity.businessId}
......@@ -187,12 +249,14 @@
ORDER BY business_id DESC
</select>
<select id="findOss" resultType="org.rcisoft.sys.ossInfo.entity.OssInfo">
select oi.* from wms_goods_oss wgo
join wms_goods wg on wg.business_id = wgo.goods_id
join oss_info oi on wgo.oss_id = oi.business_id
where 1=1
and wg.del_flag='0' and oi.del_flag='0'
and wgo.goods_id = #{entity.businessId}
select oi.*
from wms_goods_oss wgo
join wms_goods wg on wg.business_id = wgo.goods_id
join oss_info oi on wgo.oss_id = oi.business_id
where 1 = 1
and wg.del_flag = '0'
and oi.del_flag = '0'
and wgo.goods_id = #{entity.businessId}
</select>
</mapper>
......@@ -13,6 +13,7 @@
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_id" jdbcType="INTEGER" property="goodsId"/>
<result column="goods_counts" jdbcType="INTEGER" property="goodsCounts"/>
<result column="goods_number" jdbcType="VARCHAR" property="goodsNumber"/>
</resultMap>
<resultMap id="BasePageResultMap" type="org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto">
......@@ -26,6 +27,7 @@
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_id" jdbcType="INTEGER" property="goodsId"/>
<result column="goods_counts" jdbcType="INTEGER" property="goodsCounts"/>
<result column="goods_number" jdbcType="VARCHAR" property="goodsNumber"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_dict_name" jdbcType="VARCHAR" property="goodsDictName"/>
<result column="goods_code" jdbcType="VARCHAR" property="goodsCode"/>
......@@ -40,21 +42,38 @@
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryWmsGoodsStocks" resultMap="BaseResultMap">
select wgs.*,
wg.goods_name,
wg.goods_dict_name,
wg.goods_code,
wg.goods_style,
wg.goods_art_number,
wg.goods_season,
wg.goods_colour,
wg.goods_norms,
wg.goods_brand,
wg.goods_size
from wms_goods_stock wgs left join wms_goods wg on wg.business_id = wgs.goods_id
where wgs.del_flag = '0'
and wg.del_flag = '0'
<select id="queryWmsGoodsStocks" resultMap="BasePageResultMap">
select
wgs.*,
wg.goods_name,
wg.goods_code,
sdd_goods_dict_name.dict_label AS goods_dict_name,
sdd_goods_art_number.dict_label AS goods_art_number,
sdd_goods_brand.dict_label AS goods_brand,
sdd_goods_season.dict_label AS goods_season,
sdd_goods_style.dict_label AS goods_style,
sdd_goods_colour.dict_label AS goods_colour,
sdd_goods_norms.dict_label AS goods_norms,
sdd_goods_size.dict_label AS goods_size
from wms_goods_stock wgs
left join wms_goods wg on wg.business_id = wgs.goods_id
LEFT JOIN sys_dict_data sdd_goods_dict_name ON sdd_goods_dict_name.dict_type = 'GOODS_DICT_NAME' AND
sdd_goods_dict_name.dict_value = wg.goods_dict_name AND sdd_goods_dict_name.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_art_number ON sdd_goods_art_number.dict_type = 'GOODS_ART_NUMBER' AND
sdd_goods_art_number.dict_value = wg.goods_art_number AND sdd_goods_art_number.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_brand ON sdd_goods_brand.dict_type = 'GOODS_BRAND' AND sdd_goods_brand.dict_value =
wg.goods_brand AND sdd_goods_brand.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_season ON sdd_goods_season.dict_type = 'GOODS_SEASON' AND sdd_goods_season.dict_value =
wg.goods_season AND sdd_goods_season.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_style ON sdd_goods_style.dict_type = 'GOODS_STYLE' AND sdd_goods_style.dict_value =
wg.goods_style AND sdd_goods_style.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_colour ON sdd_goods_colour.dict_type = 'GOODS_COLOUR' AND sdd_goods_colour.dict_value =
wg.goods_colour AND sdd_goods_colour.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_norms ON sdd_goods_norms.dict_type = 'GOODS_NORMS' AND sdd_goods_norms.dict_value =
wg.goods_norms AND sdd_goods_norms.del_flag = '0'
LEFT JOIN sys_dict_data sdd_goods_size ON sdd_goods_size.dict_type = 'GOODS_SIZE' AND sdd_goods_size.dict_value =
wg.goods_size AND sdd_goods_size.del_flag = '0'
where wgs.del_flag = '0' and wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and wgs.flag = #{entity.flag}
</if>
......@@ -64,27 +83,39 @@
<if test="entity.goodsCounts !=null and entity.goodsCounts != '' ">
and wgs.goods_counts = #{entity.goodsCounts}
</if>
<if test="entity.goodsNumber !=null and entity.goodsNumber != '' ">
and wgs.goods_number like concat('%',#{entity.goodsNumber},'%')
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and wg.goods_code like concat('%',#{entity.goodsCode},'%')
</if>
<if test="entity.actualGtGoodsCounts != null and entity.actualGtGoodsCounts != ''">
and wgs.goods_counts &gt; #{entity.actualGtGoodsCounts}
</if>
<if test="entity.actualGoodsCode !=null and entity.actualGoodsCode != '' ">
and wg.goods_code = #{entity.actualGoodsCode}
</if>
ORDER BY wg.business_id DESC
</select>
<select id="queryWmsGoodsStocksPaged" resultMap="BasePageResultMap">
SELECT
wgs.*,
wg.goods_name,
wg.goods_dict_name,
wg.goods_code,
wg.goods_style,
wg.goods_art_number,
wg.goods_season,
wg.goods_colour,
wg.goods_norms,
wg.goods_brand,
wg.goods_size
wgs.*,
wg.goods_name,
wg.goods_dict_name,
wg.goods_code,
wg.goods_style,
wg.goods_art_number,
wg.goods_season,
wg.goods_colour,
wg.goods_norms,
wg.goods_brand,
wg.goods_size
FROM
wms_goods_stock wgs left join wms_goods wg on wg.business_id = wgs.goods_id
wms_goods_stock wgs left join wms_goods wg on wg.business_id = wgs.goods_id
where
wgs.del_flag = '0'
and wg.del_flag = '0'
wgs.del_flag = '0'
and wg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and wgs.flag = #{entity.flag}
</if>
......@@ -101,10 +132,10 @@
and wg.goods_dict_name = #{entity.goodsDictName}
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and wg.goods_code = #{entity.goodsCode}
and wg.goods_code like concat('%',#{entity.goodsCode},'%')
</if>
<if test="entity.goodsStyle !=null and entity.goodsStyle != '' ">
and wg.goods_style = #{entity.goods_style}
and wg.goods_style = #{entity.goodsStyle}
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and wg.goods_art_number = #{entity.goodsArtNumber}
......@@ -127,6 +158,14 @@
<if test="entity.inventoryValue != null and entity.inventoryValue != ''">
and wgs.goods_counts &lt; #{entity.inventoryValue}
</if>
<if test="entity.goodsNumber !=null and entity.goodsNumber != '' ">
and wgs.goods_number like concat('%',#{entity.goodsNumber},'%')
</if>
ORDER BY wgs.business_id ASC
</select>
<select id="selectByIdOut" resultMap="BaseResultMap">
select *
from wms_goods_stock
where goods_id = #{businessId}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment