日常BUG任务修改调整
This commit is contained in:
@@ -218,6 +218,12 @@ public interface SystemServiceFeign {
|
|||||||
@GetMapping("/associationWarehouseApi/getWarehouseInfo/{correlationId}")
|
@GetMapping("/associationWarehouseApi/getWarehouseInfo/{correlationId}")
|
||||||
public AjaxResult getWarehouseInfo(@PathVariable("correlationId") Long correlationId);
|
public AjaxResult getWarehouseInfo(@PathVariable("correlationId") Long correlationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接从数据库获取指定用户设置的仓库(不使用缓存)
|
||||||
|
*/
|
||||||
|
@GetMapping("/associationWarehouseApi/getWarehouseInfoFromDb/{correlationId}")
|
||||||
|
public AjaxResult getWarehouseInfoFromDb(@PathVariable("correlationId") Long correlationId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据warehouseId获取对仓库信息
|
* 根据warehouseId获取对仓库信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
@@ -169,6 +169,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
|||||||
return AjaxResult.error("获取用户当前设置的仓库失败");
|
return AjaxResult.error("获取用户当前设置的仓库失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getWarehouseInfoFromDb(Long correlationId) {
|
||||||
|
return AjaxResult.error("从数据库获取用户当前设置的仓库失败");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getWarehouseInfoByWarehouseId(@PathVariable("warehouseId") Long warehouseId) {
|
public AjaxResult getWarehouseInfoByWarehouseId(@PathVariable("warehouseId") Long warehouseId) {
|
||||||
return AjaxResult.error("根据仓库ID获取仓库信息失败");
|
return AjaxResult.error("根据仓库ID获取仓库信息失败");
|
||||||
|
|||||||
+11
@@ -117,4 +117,15 @@ public class AssociationWarehouseApplicationService {
|
|||||||
public AssociationWarehouseCacheDO getWarehouseInfo(Long correlationId) {
|
public AssociationWarehouseCacheDO getWarehouseInfo(Long correlationId) {
|
||||||
return associationWarehouseDomainService.getWarehouseInfo(correlationId);
|
return associationWarehouseDomainService.getWarehouseInfo(correlationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 直接从数据库查询关联仓库列表根据关联id(不使用缓存)
|
||||||
|
* @author ZhouGY
|
||||||
|
* @date 2024/6/11 15:34
|
||||||
|
* @param correlationId
|
||||||
|
* @return AssociationWarehouseCacheDO
|
||||||
|
*/
|
||||||
|
public AssociationWarehouseCacheDO getWarehouseInfoFromDb(Long correlationId) {
|
||||||
|
return associationWarehouseDomainService.getWarehouseInfoFromDb(correlationId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+33
@@ -146,4 +146,37 @@ public class AssociationWarehouseDomainService {
|
|||||||
return associationWarehouseCacheDO;
|
return associationWarehouseCacheDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 直接从数据库查询关联仓库列表根据关联id(不使用缓存)
|
||||||
|
* @author ZhouGY
|
||||||
|
* @date 2024/6/11 15:34
|
||||||
|
* @param correlationId
|
||||||
|
* @return AssociationWarehouseCacheDO
|
||||||
|
*/
|
||||||
|
public AssociationWarehouseCacheDO getWarehouseInfoFromDb(Long correlationId) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
// 直接从数据库查询,不使用缓存
|
||||||
|
AssociationWarehouse associationWarehouse = associationWarehouseService.getOne(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||||
|
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||||
|
.eq(AssociationWarehouse::getIsDefault, 2)
|
||||||
|
.eq(AssociationWarehouse::getDelFlag, 1));
|
||||||
|
AssociationWarehouseCacheDO associationWarehouseCacheDO = null;
|
||||||
|
if (ObjectUtil.isNotNull(associationWarehouse)){
|
||||||
|
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
|
||||||
|
BeanUtils.copyProperties(associationWarehouse, associationWarehouseCacheDO);
|
||||||
|
}else {
|
||||||
|
//首次 没有查到默认取第一条数据
|
||||||
|
List<AssociationWarehouse> associationWarehouseList = associationWarehouseService.list(new QueryWrapper<AssociationWarehouse>().lambda()
|
||||||
|
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
|
||||||
|
.orderByAsc(AssociationWarehouse::getAssociationWarehouseId));
|
||||||
|
if (CollectionUtils.isEmpty(associationWarehouseList)){
|
||||||
|
return null; // 返回null,不抛异常,允许查询所有仓库
|
||||||
|
}
|
||||||
|
AssociationWarehouse associationWarehouseAsc = associationWarehouseList.get(0);
|
||||||
|
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
|
||||||
|
BeanUtils.copyProperties(associationWarehouseAsc, associationWarehouseCacheDO);
|
||||||
|
}
|
||||||
|
return associationWarehouseCacheDO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
@@ -134,4 +134,14 @@ public class AssociationWarehouseApi extends BaseController{
|
|||||||
return AjaxResult.success(associationWarehouseCacheDO);
|
return AjaxResult.success(associationWarehouseCacheDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接从数据库获取指定用户设置的仓库(不使用缓存)
|
||||||
|
*/
|
||||||
|
@ApiOperation("直接从数据库获取指定用户设置的仓库(不使用缓存)")
|
||||||
|
@GetMapping("/getWarehouseInfoFromDb/{correlationId}")
|
||||||
|
public AjaxResult getWarehouseInfoFromDb(@PathVariable("correlationId") Long correlationId) {
|
||||||
|
AssociationWarehouseCacheDO associationWarehouseCacheDO = associationWarehouseApplicationService.getWarehouseInfoFromDb(correlationId);
|
||||||
|
return AjaxResult.success(associationWarehouseCacheDO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+65
-20
@@ -74,16 +74,22 @@ public class StockInOrderApplicationService {
|
|||||||
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
// 直接从数据库查询当前登录用户选择的仓库,不使用缓存
|
||||||
if (associationWarehouseCacheDO != null) {
|
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoFromDb(loginUser.getUserid());
|
||||||
if (associationWarehouseCacheDO.getWarehouseId() != null) {
|
if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) {
|
||||||
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
AssociationWarehouseCacheDO associationWarehouseCacheDO = JSON.parseObject(
|
||||||
}
|
JSONObject.toJSONString(ajaxResult.get("data")),
|
||||||
if (StringUtils.isNotBlank(associationWarehouseCacheDO.getWarehouseCode())) {
|
AssociationWarehouseCacheDO.class);
|
||||||
stockInOrderDO.setWarehouseCode(associationWarehouseCacheDO.getWarehouseCode());
|
if (associationWarehouseCacheDO != null) {
|
||||||
}
|
if (associationWarehouseCacheDO.getWarehouseId() != null) {
|
||||||
if (StringUtils.isNotBlank(associationWarehouseCacheDO.getWarehouseName())) {
|
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||||
stockInOrderDO.setWarehouseName(associationWarehouseCacheDO.getWarehouseName());
|
}
|
||||||
|
if (StringUtils.isNotBlank(associationWarehouseCacheDO.getWarehouseCode())) {
|
||||||
|
stockInOrderDO.setWarehouseCode(associationWarehouseCacheDO.getWarehouseCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(associationWarehouseCacheDO.getWarehouseName())) {
|
||||||
|
stockInOrderDO.setWarehouseName(associationWarehouseCacheDO.getWarehouseName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -139,11 +145,47 @@ public class StockInOrderApplicationService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除入库单
|
* 批量删除入库单
|
||||||
|
* 只有已创建状态(status = 1)的入库单可以删除
|
||||||
*/
|
*/
|
||||||
public boolean delete(Long[] inOrderIds) {
|
public boolean delete(Long[] inOrderIds) {
|
||||||
|
if (inOrderIds == null || inOrderIds.length == 0) {
|
||||||
|
throw new ServiceException("删除的入库单ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询入库单信息,检查状态
|
||||||
|
for (Long inOrderId : inOrderIds) {
|
||||||
|
StockInOrderPO stockInOrderPO = stockInOrderDomainService.getInfo(inOrderId);
|
||||||
|
if (stockInOrderPO == null) {
|
||||||
|
throw new ServiceException("入库单不存在,入库单ID:" + inOrderId);
|
||||||
|
}
|
||||||
|
// 只有已创建状态(status = 1)的入库单可以删除
|
||||||
|
if (stockInOrderPO.getStatus() == null || !stockInOrderPO.getStatus().equals(1)) {
|
||||||
|
throw new ServiceException("只有已创建状态的入库单可以删除,入库单号:" + stockInOrderPO.getInOrderNumber() + ",当前状态:" + getStatusName(stockInOrderPO.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return stockInOrderDomainService.delete(inOrderIds);
|
return stockInOrderDomainService.delete(inOrderIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取入库状态名称
|
||||||
|
*/
|
||||||
|
private String getStatusName(Integer status) {
|
||||||
|
if (status == null) {
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
|
switch (status) {
|
||||||
|
case 1: return "已创建";
|
||||||
|
case 2: return "已审核";
|
||||||
|
case 3: return "收货中";
|
||||||
|
case 4: return "上架中";
|
||||||
|
case 5: return "已入库";
|
||||||
|
case 6: return "已取消";
|
||||||
|
case 7: return "已关闭";
|
||||||
|
default: return "未知";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取入库单详细信息
|
* 获取入库单详细信息
|
||||||
*/
|
*/
|
||||||
@@ -195,7 +237,7 @@ public class StockInOrderApplicationService {
|
|||||||
* - 第13行:明细表列名
|
* - 第13行:明细表列名
|
||||||
* - 第14行开始:明细数据
|
* - 第14行开始:明细数据
|
||||||
*/
|
*/
|
||||||
public Boolean importData(MultipartFile file) {
|
public Boolean importData(MultipartFile file, Long warehouseId, String warehouseCode, String warehouseName) {
|
||||||
if (file == null || file.isEmpty()) {
|
if (file == null || file.isEmpty()) {
|
||||||
throw new ServiceException("导入文件不能为空");
|
throw new ServiceException("导入文件不能为空");
|
||||||
}
|
}
|
||||||
@@ -1046,13 +1088,16 @@ public class StockInOrderApplicationService {
|
|||||||
List<StockInOrderImportRowDTO> groupRows = entry.getValue();
|
List<StockInOrderImportRowDTO> groupRows = entry.getValue();
|
||||||
StockInOrderImportRowDTO h = groupRows.get(0);
|
StockInOrderImportRowDTO h = groupRows.get(0);
|
||||||
|
|
||||||
// 获取仓库ID(使用登录人当前关联仓库)
|
// 使用传入的仓库信息(与出库单导入保持一致)
|
||||||
Long warehouseId;
|
if (warehouseId == null) {
|
||||||
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
throw new ServiceException("导入失败:仓库ID不能为空");
|
||||||
if (associationWarehouseCacheDO == null || associationWarehouseCacheDO.getWarehouseId() == null) {
|
}
|
||||||
throw new ServiceException("导入失败:未配置用户关联仓库,请先配置仓库");
|
if (StringUtils.isBlank(warehouseCode)) {
|
||||||
|
throw new ServiceException("导入失败:仓库编码不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(warehouseName)) {
|
||||||
|
throw new ServiceException("导入失败:仓库名称不能为空");
|
||||||
}
|
}
|
||||||
warehouseId = associationWarehouseCacheDO.getWarehouseId();
|
|
||||||
|
|
||||||
// 客户名称应该从表头获取(优先使用表头,如果表头为空则使用明细行)
|
// 客户名称应该从表头获取(优先使用表头,如果表头为空则使用明细行)
|
||||||
String customerName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName();
|
String customerName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName();
|
||||||
@@ -1074,10 +1119,10 @@ public class StockInOrderApplicationService {
|
|||||||
// 设置创建时间为当前时间
|
// 设置创建时间为当前时间
|
||||||
order.setCreateTime(new Date());
|
order.setCreateTime(new Date());
|
||||||
|
|
||||||
// 必填/基础字段
|
// 必填/基础字段(使用传入的仓库信息,与出库单导入保持一致)
|
||||||
order.setWarehouseId(warehouseId);
|
order.setWarehouseId(warehouseId);
|
||||||
// 设置仓库完整信息(warehouseCode 和 warehouseName)
|
order.setWarehouseCode(warehouseCode);
|
||||||
setWarehouseInfo(order);
|
order.setWarehouseName(warehouseName);
|
||||||
// 货主信息:优先使用表头,如果表头为空则使用明细行
|
// 货主信息:优先使用表头,如果表头为空则使用明细行
|
||||||
String shipperName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName();
|
String shipperName = StringUtils.isNotBlank(headerInfo.getShipperName()) ? headerInfo.getShipperName() : h.getShipperName();
|
||||||
String shipperCode = StringUtils.isNotBlank(headerInfo.getShipperCode()) ? headerInfo.getShipperCode() : h.getShipperCode();
|
String shipperCode = StringUtils.isNotBlank(headerInfo.getShipperCode()) ? headerInfo.getShipperCode() : h.getShipperCode();
|
||||||
|
|||||||
+14
@@ -11,6 +11,7 @@ import com.mhd.common.core.constant.SnowFlakeConstants;
|
|||||||
import com.mhd.common.core.exception.ServiceException;
|
import com.mhd.common.core.exception.ServiceException;
|
||||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||||
import com.mhd.common.core.utils.OrderSequence;
|
import com.mhd.common.core.utils.OrderSequence;
|
||||||
|
import com.mhd.common.core.utils.StringUtils;
|
||||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||||
import com.mhd.common.core.web.domain.AjaxResult;
|
import com.mhd.common.core.web.domain.AjaxResult;
|
||||||
@@ -471,6 +472,19 @@ public class StockReceiptOrderDomainService {
|
|||||||
//根据收货数量生成上架
|
//根据收货数量生成上架
|
||||||
genStockShelfOrder(stockReceiptOrderPO);
|
genStockShelfOrder(stockReceiptOrderPO);
|
||||||
|
|
||||||
|
//生成上架单后,更新入库单状态为4(上架中)
|
||||||
|
if (StringUtils.isNotBlank(stockReceiptOrderPO.getInOrderNumber())) {
|
||||||
|
StockInOrder stockInOrder = new StockInOrder();
|
||||||
|
stockInOrder.setInOrderNumber(stockReceiptOrderPO.getInOrderNumber());
|
||||||
|
stockInOrder.setStatus(4); // 4-上架中
|
||||||
|
stockInOrder.setUpdateBy(loginUser.getUserid());
|
||||||
|
stockInOrder.setUpdateByName(loginUser.getUsername());
|
||||||
|
stockInOrder.setUpdateTime(new Date());
|
||||||
|
stockInOrderService.update(stockInOrder,
|
||||||
|
new QueryWrapper<StockInOrder>().lambda()
|
||||||
|
.eq(StockInOrder::getInOrderNumber, stockReceiptOrderPO.getInOrderNumber()));
|
||||||
|
}
|
||||||
|
|
||||||
//收货完成后自动生成上架任务
|
//收货完成后自动生成上架任务
|
||||||
try {
|
try {
|
||||||
//查询刚生成的上架单
|
//查询刚生成的上架单
|
||||||
|
|||||||
+6
-2
@@ -88,9 +88,13 @@ public class StockInOrderApi extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("导入入库单")
|
@ApiOperation("导入入库单")
|
||||||
@PostMapping(value = "/importData")
|
@PostMapping(value = "/importData")
|
||||||
public AjaxResult importData(MultipartFile file)
|
public AjaxResult importData(
|
||||||
|
@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam("warehouseId") Long warehouseId,
|
||||||
|
@RequestParam("warehouseCode") String warehouseCode,
|
||||||
|
@RequestParam("warehouseName") String warehouseName)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(stockInOrderApplicationService.importData(file));
|
return AjaxResult.success(stockInOrderApplicationService.importData(file, warehouseId, warehouseCode, warehouseName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user