feat: wms - 库存管理 - 库存查询 -库存调整推送逻辑优化
- 推送 OMS 逻辑增加仓库启用状态判定,未启用 OMS 则不推送
This commit is contained in:
+2
@@ -33,4 +33,6 @@ public class WarehousePO implements Serializable {
|
|||||||
@Excel(name = "仓库名称")
|
@Excel(name = "仓库名称")
|
||||||
private String warehouseName;
|
private String warehouseName;
|
||||||
|
|
||||||
|
@Excel(name = "是否启用: 1-否 2-是")
|
||||||
|
private Integer isEnable;
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-3
@@ -1,10 +1,13 @@
|
|||||||
package com.mhd.wms.domain.inventoryAdjustmentRecord.service;
|
package com.mhd.wms.domain.inventoryAdjustmentRecord.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.aliyun.oss.ServiceException;
|
import com.aliyun.oss.ServiceException;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mhd.common.core.constant.SnowFlakeConstants;
|
import com.mhd.common.core.constant.SnowFlakeConstants;
|
||||||
import com.mhd.common.core.domain.po.UserPo;
|
import com.mhd.common.core.domain.po.UserPo;
|
||||||
|
import com.mhd.common.core.domain.po.WarehousePO;
|
||||||
import com.mhd.common.core.utils.OrderSequence;
|
import com.mhd.common.core.utils.OrderSequence;
|
||||||
import com.mhd.common.core.utils.uuid.IdGenerator;
|
import com.mhd.common.core.utils.uuid.IdGenerator;
|
||||||
import com.mhd.common.core.utils.StringUtils;
|
import com.mhd.common.core.utils.StringUtils;
|
||||||
@@ -12,6 +15,7 @@ import com.mhd.common.core.web.domain.AjaxResult;
|
|||||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
import com.mhd.common.security.utils.SecurityUtils;
|
import com.mhd.common.security.utils.SecurityUtils;
|
||||||
import com.mhd.system.api.OmsServiceFeign;
|
import com.mhd.system.api.OmsServiceFeign;
|
||||||
|
import com.mhd.system.api.SystemServiceFeign;
|
||||||
import com.mhd.system.api.domain.*;
|
import com.mhd.system.api.domain.*;
|
||||||
import com.mhd.system.api.model.LoginUser;
|
import com.mhd.system.api.model.LoginUser;
|
||||||
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.facade.IInventoryAdjustmentRecordService;
|
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.facade.IInventoryAdjustmentRecordService;
|
||||||
@@ -58,6 +62,8 @@ public class InventoryAdjustmentRecordDomainService {
|
|||||||
private IdGenerator idGenerator;
|
private IdGenerator idGenerator;
|
||||||
@Autowired
|
@Autowired
|
||||||
private OmsServiceFeign omsServiceFeign;
|
private OmsServiceFeign omsServiceFeign;
|
||||||
|
@Autowired
|
||||||
|
private SystemServiceFeign systemServiceFeign;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -108,6 +114,15 @@ public class InventoryAdjustmentRecordDomainService {
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public Boolean inventoryAdjust(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
public Boolean inventoryAdjust(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||||
|
// 根据仓库ID获取仓库信息,用于后续库存调整的仓库判断
|
||||||
|
AjaxResult warehouseInfoByWarehouseId = systemServiceFeign.getWarehouseInfoByWarehouseId(inventoryAdjustmentRecordDO.getWarehouseId());
|
||||||
|
if (warehouseInfoByWarehouseId == null) {
|
||||||
|
throw new ServiceException("仓库不存在");
|
||||||
|
} else if (!warehouseInfoByWarehouseId.get("code").equals(200)) {
|
||||||
|
throw new ServiceException("网络错误请重试 --- " + warehouseInfoByWarehouseId.get("msg"));
|
||||||
|
}
|
||||||
|
// 获取仓库信息
|
||||||
|
WarehousePO warehousePO = JSON.parseObject(JSONObject.toJSONString(warehouseInfoByWarehouseId.get("data")), WarehousePO.class);
|
||||||
InventoryAdjustmentRecordDO inventoryAdjustmentRecord = new InventoryAdjustmentRecordDO();
|
InventoryAdjustmentRecordDO inventoryAdjustmentRecord = new InventoryAdjustmentRecordDO();
|
||||||
inventoryAdjustmentRecord.setAdjustAction("库存调整");
|
inventoryAdjustmentRecord.setAdjustAction("库存调整");
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
@@ -276,9 +291,12 @@ public class InventoryAdjustmentRecordDomainService {
|
|||||||
Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord);
|
Boolean insert = inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord);
|
||||||
//推送oms库存调整记录
|
//推送oms库存调整记录
|
||||||
try{
|
try{
|
||||||
Boolean pushSuccess = pushOms(materialInventory, inventoryAdjustmentRecordDO);
|
// 当仓库启用 oms 才进行推送
|
||||||
if (!pushSuccess) {
|
if (warehousePO.getIsEnable() == 1) {
|
||||||
throw new ServiceException("库存调整推送OMS失败,请稍后重试");
|
Boolean pushSuccess = pushOms(materialInventory, inventoryAdjustmentRecordDO);
|
||||||
|
if (!pushSuccess) {
|
||||||
|
throw new ServiceException("库存调整推送OMS失败,请稍后重试");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("推送OMS库存调整记录异常,materialBaseInfoId={}, adjustDirection={}",
|
log.error("推送OMS库存调整记录异常,materialBaseInfoId={}, adjustDirection={}",
|
||||||
|
|||||||
Reference in New Issue
Block a user