|
|
|
@ -19,7 +19,13 @@ package com.logpm.basicdata.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
|
|
|
|
//import com.logpm.basic.entity.BasicPrintTemplateEntity;
|
|
|
|
|
//import com.logpm.basic.mapper.BasicPrintTemplateMapper;
|
|
|
|
|
import com.google.zxing.WriterException; |
|
|
|
|
import com.logpm.basic.feign.IBasicTenantCodeClient; |
|
|
|
|
import com.logpm.basicdata.dto.BasicdataGoodsShelfDTO; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataGoodsShelfEntity; |
|
|
|
|
import com.logpm.basicdata.excel.BasicdataGoodsShelfExcel; |
|
|
|
@ -27,17 +33,28 @@ import com.logpm.basicdata.mapper.BasicdataGoodsShelfMapper;
|
|
|
|
|
import com.logpm.basicdata.service.IBasicdataGoodsShelfService; |
|
|
|
|
import com.logpm.basicdata.vo.BasicdataGoodsShelfVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.common.utils.QRCodeUtil; |
|
|
|
|
import org.springblade.common.utils.RedisUtil; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.IoUtil; |
|
|
|
|
import org.springblade.core.tool.utils.WebUtil; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import javax.servlet.ServletContext; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
@ -54,6 +71,10 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
|
|
|
|
|
|
|
|
|
|
private BasicdataGoodsShelfMapper basicdataGoodsShelfMapper; |
|
|
|
|
|
|
|
|
|
private IBasicTenantCodeClient basicTenantCodeClient; |
|
|
|
|
|
|
|
|
|
private RedisUtil redisUtil; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<BasicdataGoodsShelfVO> selectBasicdataGoodsShelfPage(IPage<BasicdataGoodsShelfVO> page, BasicdataGoodsShelfVO basicdataGoodsShelfVO) { |
|
|
|
|
return page.setRecords(baseMapper.selectBasicdataGoodsShelfPage(page, basicdataGoodsShelfVO)); |
|
|
|
@ -70,31 +91,35 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<BasicdataGoodsShelfVO> getGoodsShelfList(IPage<Object> page, Map<String, Object> basicdataGoodsShelf) { |
|
|
|
|
public IPage<BasicdataGoodsShelfVO> getGoodsShelfList(IPage<Object> page, Map<String, Object> basicdataGoodsShelf) { |
|
|
|
|
IPage<BasicdataGoodsShelfVO> basicdataGoodsShelfVOIPage=basicdataGoodsShelfMapper.getGoodsShelfList(page,basicdataGoodsShelf); |
|
|
|
|
|
|
|
|
|
// redisUtil.set("aaa","aaa");
|
|
|
|
|
// WebUtil.getResponseEncodedHtmlEscape()
|
|
|
|
|
return basicdataGoodsShelfVOIPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean insertGoodsshelf(BasicdataGoodsShelfDTO basicdataGoodsShelfDTO) { |
|
|
|
|
//维护仓库、货区数据
|
|
|
|
|
boolean result = false; |
|
|
|
|
//这里新增货架必须有仓库和货区的信息
|
|
|
|
|
//这里新增货架必须有仓库和货区的信息否则视为信息不合法
|
|
|
|
|
if (Func.isEmpty(basicdataGoodsShelfDTO) ){ |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
if (Func.isBlank(basicdataGoodsShelfDTO.getWarehouseId())&Func.isBlank(basicdataGoodsShelfDTO.getGoodsAreaId())){ |
|
|
|
|
log.error("仓库货区信息不合法"); |
|
|
|
|
throw new RuntimeException("请完善货区信息!!!"); |
|
|
|
|
} |
|
|
|
|
BasicdataGoodsShelfEntity basicdataGoodsShelfEntity = new BasicdataGoodsShelfEntity(); |
|
|
|
|
BeanUtils.copyProperties(basicdataGoodsShelfDTO,basicdataGoodsShelfEntity); |
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
Long userId = user.getUserId(); |
|
|
|
|
basicdataGoodsShelfEntity.setCreateTime(new Date()); |
|
|
|
|
basicdataGoodsShelfEntity.setCreateDept( Long.valueOf(user.getDeptId())); |
|
|
|
|
basicdataGoodsShelfEntity.setCreateUser(user.getUserId()); |
|
|
|
|
basicdataGoodsShelfEntity.setUpdateTime(new Date()); |
|
|
|
|
basicdataGoodsShelfEntity.setUpdateUser(user.getUserId()); |
|
|
|
|
basicdataGoodsShelfEntity.setCreateUser(user.getUserId()); |
|
|
|
|
basicdataGoodsShelfEntity.setCreateUser(userId); |
|
|
|
|
//数据状态默认正常
|
|
|
|
|
basicdataGoodsShelfEntity.setStatus(1); |
|
|
|
|
//货架添加删除状态为正常
|
|
|
|
@ -103,8 +128,15 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
|
|
|
|
|
basicdataGoodsShelfEntity.setGoodsShelfStatus(1); |
|
|
|
|
//货架添加默认启用
|
|
|
|
|
basicdataGoodsShelfEntity.setEnableStatus(1); |
|
|
|
|
|
|
|
|
|
//获取租户编码规则
|
|
|
|
|
String code = basicTenantCodeClient.shelfCode(user.getTenantId(),"8"); |
|
|
|
|
//远程feign调用获取租户的货架码编码规则
|
|
|
|
|
String shelfCode = code + "--"+basicdataGoodsShelfEntity.getGoodsShelfName(); |
|
|
|
|
basicdataGoodsShelfEntity.setQrCode(shelfCode); |
|
|
|
|
result = SqlHelper.retBool(basicdataGoodsShelfMapper.insert(basicdataGoodsShelfEntity)); |
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -112,6 +144,7 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
|
|
|
|
|
public boolean updateGoodsShelfInfo(BasicdataGoodsShelfDTO basicdataGoodsShelfDTO) { |
|
|
|
|
boolean result = false; |
|
|
|
|
if (Func.isEmpty(basicdataGoodsShelfDTO) ){ |
|
|
|
|
log.error("参数异常:["+basicdataGoodsShelfDTO+"]"); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
BasicdataGoodsShelfEntity basicdataGoodsShelfEntity = new BasicdataGoodsShelfEntity(); |
|
|
|
@ -136,10 +169,22 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
|
|
|
|
|
for (String id : ids) { |
|
|
|
|
result = SqlHelper.retBool(basicdataGoodsShelfMapper.removeGoodsShelf(id)); |
|
|
|
|
if (!result){ |
|
|
|
|
throw new RuntimeException("选中货架存在待删货位!!!"); |
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean getQRCode(String qrCode, HttpServletResponse response) { |
|
|
|
|
try { |
|
|
|
|
QRCodeUtil.createCodeToOutputStream(qrCode,response); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("二维码生成失败{"+e.getMessage()+"}"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|