Commit 87a18607 authored by hubaoshan's avatar hubaoshan

1.4

parent 8b871ec3
......@@ -13,6 +13,7 @@ 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.addWmsGoodsApply;
import org.rcisoft.core.anno.CyEncryptSm4Anno;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
......@@ -71,6 +72,26 @@ public class WmsGoodsApplyController extends CyPaginationController<WmsGoodsAppl
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApply);
}
@CyOpeLogAnno(title = "system-商品申请表管理-新增商品申请表", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value="添加商品申请表", notes="添加商品申请表")
@PostMapping(value = "/in")
public CyResult batchAdd(@RequestBody addWmsGoodsApply wmsGoodsApply) {
CyPersistModel data = wmsGoodsApplyServiceImpl.batchPersist(wmsGoodsApply);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApply);
}
@CyOpeLogAnno(title = "system-商品申请表管理-新增商品申请表", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value="添加商品申请表", notes="添加商品申请表")
@PostMapping(value = "/Out")
public CyResult batchAddOut(@RequestBody addWmsGoodsApply wmsGoodsApply) {
CyPersistModel data = wmsGoodsApplyServiceImpl.batchOutPersist(wmsGoodsApply);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsApply);
}
@CyOpeLogAnno(title = "获取单号", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="获取单号", notes="获取单号")
@GetMapping(value = "/getCode")
......
......@@ -29,8 +29,6 @@ public interface WmsGoodsApplyRepository extends CyBaseMapper<WmsGoodsApply> {
IPage<WmsGoodsApply> queryWmsGoodsApplysPaged(CyPageInfo cyPageInfo,@Param("entity") WmsGoodsApply wmsGoodsApply);
void batchAdd(@Param("list") List<WmsGoodsApply> list);
ImportGoodsTempDto importGoodsExcel(MultipartFile file);
int getOrderCodeCount(String data);
}
package org.rcisoft.bus.wmsgoodsapply.dto;
import lombok.Data;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import java.util.List;
@Data
public class addWmsGoodsApply {
List<WmsGoodsApply>BoxList;
private String ioType;
private String dealStatus;
private Integer goodsCounts;
private String appCode;
private String shipper;
private String shipperAddress;
private String shipperPhone;
private String goodsCheck;
private String salesman;
private String maker;
private String inGoods;
private String outGoods;
private String goodsNumber;
private Integer goodsId;
private Integer inCounts;
}
......@@ -106,7 +106,10 @@ public class WmsGoodsApply extends CyIdIncreEntity<WmsGoodsApply> {
@Excel(name = "出库", orderNum = "17", width = 20)
private String outGoods;
private String goodsNumber;
// private List<WmsGoods> enterTable;
//private Integer goodsId;
private Integer inCounts;
private Integer outCounts;
private Integer goodsId;
}
......@@ -3,6 +3,7 @@ package org.rcisoft.bus.wmsgoodsapply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoodsapply.dto.ImportGoodsTempDto;
import org.rcisoft.bus.wmsgoodsapply.dto.addWmsGoodsApply;
import org.rcisoft.bus.wmsgoodsapply.entity.WmsGoodsApply;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
......@@ -76,4 +77,6 @@ public interface WmsGoodsApplyService {
*/
List<WmsGoodsApply> export(WmsGoodsApply wmsGoodsApply);
CyPersistModel batchPersist(addWmsGoodsApply wmsGoodsApply);
CyPersistModel batchOutPersist(addWmsGoodsApply wmsGoodsApply);
}
package org.rcisoft.bus.wmsgoodsapply.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alipay.api.domain.Goods;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.bus.wmsgoods.service.WmsGoodsService;
import org.rcisoft.bus.wmsgoodsapply.dto.addWmsGoodsApply;
import org.rcisoft.bus.wmsgoodslog.dto.AddLogList;
import org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog;
import org.rcisoft.bus.wmsgoodslog.service.WmsGoodsLogService;
import org.rcisoft.bus.wmsgoodsstock.entity.WmsGoodsStock;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.bus.wmsgoodsapply.dao.WmsGoodsApplyRepository;
......@@ -23,6 +30,7 @@ import org.rcisoft.core.model.CyPageInfo;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
......@@ -39,6 +47,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
@Autowired
private WmsGoodsStockService wmsGoodsStockRepositoryImpl;
private WmsGoodsLogService wmsGoodsLogRepositoryImpl;
/**
......@@ -52,22 +61,94 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
//增加操作
//1.查库存表有没有对应的code 有则更新数量 没有则向库存表中插入
//2.向日志表中添加对应的信息
WmsGoodsStock wmsGoodsStock=new WmsGoodsStock();
BeanUtils.copyProperties(wmsGoodsApply,wmsGoodsStock);
List<WmsGoodsStock>wmsGoodsStockList=wmsGoodsStockRepositoryImpl.findAll(wmsGoodsStock);
if (CollectionUtil.isEmpty(wmsGoodsStockList)){
wmsGoodsStockRepositoryImpl.updateInCounts(wmsGoodsStock);
}else{
wmsGoodsStockRepositoryImpl.persist(wmsGoodsStock);
}
wmsGoodsApply.setIoType("0");
wmsGoodsApply.setDealStatus("0");
int line = baseMapper.insert(wmsGoodsApply);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
wmsGoodsApply.getBusinessId()+"的商品申请表信息");
return new CyPersistModel(line);
}
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel batchPersist(addWmsGoodsApply addwmsGoodsApply) {
//入库
WmsGoodsApply wmsGoodsApply=new WmsGoodsApply();
BeanUtils.copyProperties(addwmsGoodsApply,wmsGoodsApply);
wmsGoodsApply.setIoType("0");
wmsGoodsApply.setDealStatus("0");
wmsGoodsApply.setGoodsId(addwmsGoodsApply.getGoodsId());
baseMapper.insert(wmsGoodsApply);
//更新商品数量
List<WmsGoodsApply> boxList = addwmsGoodsApply.getBoxList();
for (WmsGoodsApply box : addwmsGoodsApply.getBoxList()) {
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(boxList.get(0).getGoodsId());
if (goodsStock != null) {
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() + box.getInCounts());
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
} else {
WmsGoodsStock newGoodsStock = new WmsGoodsStock();
newGoodsStock.setGoodsId(boxList.get(0).getGoodsId());
newGoodsStock.setGoodsCounts(box.getInCounts());
wmsGoodsStockRepositoryImpl.persist(newGoodsStock);
}
}
//日志
AddLogList addLogList = new AddLogList();
List<WmsGoodsLog> logList = new ArrayList<>();
for (WmsGoodsApply box : addwmsGoodsApply.getBoxList()) {
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(addwmsGoodsApply.getGoodsId());
WmsGoodsLog log = new WmsGoodsLog();
log.setApplyId(wmsGoodsApply.getBusinessId());
log.setGoodsCounts(box.getGoodsCounts());
log.setIoType("0");
assert goodsStock != null;
log.setUpdateCounts(goodsStock.getGoodsCounts());
logList.add(log);
}
addLogList.setBoxList(logList);
wmsGoodsLogRepositoryImpl.batchPersist(addLogList);
return new CyPersistModel(1);
}
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel batchOutPersist(addWmsGoodsApply addwmsGoodsApply) {
// 出库
WmsGoodsApply wmsGoodsApplyOut = new WmsGoodsApply();
BeanUtils.copyProperties(addwmsGoodsApply, wmsGoodsApplyOut);
wmsGoodsApplyOut.setIoType("1");
wmsGoodsApplyOut.setDealStatus("1");
baseMapper.insert(wmsGoodsApplyOut);
// 更新商品数量
WmsGoodsStock goodsStock = wmsGoodsStockRepositoryImpl.findById(addwmsGoodsApply.getGoodsId());
for (WmsGoodsApply box : addwmsGoodsApply.getBoxList()) {
if (goodsStock != null) {
if (box.getGoodsCounts() > goodsStock.getGoodsCounts()) {
throw new CyServiceException(1001,"库存数量不足");
}
goodsStock.setGoodsCounts(goodsStock.getGoodsCounts() - box.getGoodsCounts());
wmsGoodsStockRepositoryImpl.updateCounts(goodsStock);
}
}
// 日志
AddLogList addLogList = new AddLogList();
List<WmsGoodsLog> logList = new ArrayList<>();
for (WmsGoodsApply box : addwmsGoodsApply.getBoxList()) {
WmsGoodsLog log = new WmsGoodsLog();
log.setApplyId(wmsGoodsApplyOut.getBusinessId());
log.setGoodsCounts(box.getGoodsCounts());
log.setIoType("1");
log.setUpdateCounts(goodsStock.getGoodsCounts());
logList.add(log);
}
addLogList.setBoxList(logList);
wmsGoodsLogRepositoryImpl.batchPersist(addLogList);
return new CyPersistModel(1);
}
@Override
public String AppCode() {
// 获取当前时间
......@@ -171,6 +252,7 @@ public class WmsGoodsApplyServiceImpl extends ServiceImpl<WmsGoodsApplyRepositor
}
private String removeSymbol(String source) {
String target = null;
target = source.replaceAll("\\s*|\r|\n|\t","");
......
......@@ -147,7 +147,7 @@ public class WmsGoodsLogServiceImpl extends ServiceImpl<WmsGoodsLogRepository, W
List<WmsGoodsLog> wmsGoodsLogList = baseMapper.queryWmsGoodsLogs(wmsGoodsLog);
return wmsGoodsLogList;
}
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel batchPersist(AddLogList addLogList) {
List<WmsGoodsLog> wmsGoodsLogs = new ArrayList<>();
......
......@@ -95,15 +95,16 @@ public class WmsGoodsStockController extends CyPaginationController<WmsGoodsStoc
@CyOpeLogAnno(title = "system-库存管理表管理-修改库存管理表", businessType = CyLogTypeEnum.UPDATE)
@ApiOperation(value="修改库存管理表", notes="修改库存管理表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/updateCpunts/{businessId:\\w+}")
public CyResult updateInCounts(@PathVariable int businessId, @Valid WmsGoodsStock wmsGoodsStock, BindingResult bindingResult) {
@PutMapping("/updateCounts/{businessId:\\w+}")
public CyResult updateCounts(@PathVariable int businessId, @Valid WmsGoodsStock wmsGoodsStock, BindingResult bindingResult) {
wmsGoodsStock.setBusinessId(businessId);
CyPersistModel data = wmsGoodsStockServiceImpl.updateInCounts(wmsGoodsStock);
CyPersistModel data = wmsGoodsStockServiceImpl.updateCounts(wmsGoodsStock);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsStock);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsStock:query')")
@CyOpeLogAnno(title = "system-库存管理表管理-查询库存管理表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询单一库存管理表", notes="查询单一库存管理表")
......
......@@ -42,7 +42,8 @@ public interface WmsGoodsStockService {
* @return
*/
CyPersistModel merge(WmsGoodsStock wmsGoodsStock);
CyPersistModel updateInCounts(WmsGoodsStock wmsGoodsStock);
CyPersistModel updateCounts(WmsGoodsStock wmsGoodsStock);
/**
* 根据id查询 库存管理表
......
......@@ -92,8 +92,7 @@ public class WmsGoodsStockServiceImpl extends ServiceImpl<WmsGoodsStockRepositor
}
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel updateInCounts(WmsGoodsStock wmsGoodsStock) {
wmsGoodsStock.setGoodsCounts(wmsGoodsStock.getGoodsCounts() + 1);
public CyPersistModel updateCounts(WmsGoodsStock wmsGoodsStock) {
int line = baseMapper.updateById(wmsGoodsStock);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ wmsGoodsStock.getBusinessId()+"的库存管理表信息");
return new CyPersistModel(line);
......
......@@ -3,7 +3,6 @@
<mapper namespace="org.rcisoft.bus.wmsgoodslog.dao.WmsGoodsLogRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.bus.wmsgoodslog.entity.WmsGoodsLog">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
......@@ -12,7 +11,6 @@
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="io_type" jdbcType="CHAR" property="ioType"/>
<result column="goods_id" jdbcType="INTEGER" property="goodsId"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_code" jdbcType="VARCHAR" property="goodsCode"/>
<result column="apply_id" jdbcType="INTEGER" property="applyId"/>
......@@ -24,7 +22,7 @@
wms_goods_log(flag,del_flag,create_by,create_date,update_by,update_date,io_type,goods_name,goods_code,apply_id,goods_counts,update_counts)
values
<foreach collection="list" item="item" separator=",">
(#{item.flag},#{item.delFlag},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.ioType},#{item.goodsName},#{item.goodsCode},#{item.applyId},#{item.goodsCounts},#{item.updateCounts}
(#{item.flag},#{item.delFlag},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.ioType},#{item.goodsName},#{item.goodsCode},#{item.applyId},#{item.goodsCounts},#{item.updateCounts})
</foreach>
</insert>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
......
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