Merge branch 'dev' into dev_WMS20260401
# Conflicts: # mhd_wms/src/main/java/com/mhd/wms/domain/shelfMaterialDetail/repository/persistence/ShelfMaterialDetailImpl.java
This commit is contained in:
+4
-1
@@ -460,7 +460,7 @@ public class UserDriverApplicationService {
|
||||
userDO.setAvatar(userDriverDO.getAvatar());
|
||||
userDO.setUserAccount(userDriverDO.getUserAccount()); // 账号通常是手机号
|
||||
userDO.setUserName(userDriverDO.getUserName()); // 真实姓名
|
||||
userDO.setUserPhone(userDriverDO.getUserAccount()); // 手机号
|
||||
userDO.setUserPhone(userDriverDO.getUserPhone()); // 手机号
|
||||
userDO.setBusinessType(userDriverDO.getBusinessType()); // 业务类型已在 determineAndSetBusinessType 中确定
|
||||
|
||||
if (StringUtils.isBlank(userDO.getUserAccount())) {
|
||||
@@ -469,6 +469,9 @@ public class UserDriverApplicationService {
|
||||
if (StringUtils.isBlank(userDO.getUserName())) {
|
||||
throw new ServiceException("用户姓名不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(userDO.getUserPhone())) {
|
||||
throw new ServiceException("用户电话不能为空");
|
||||
}
|
||||
|
||||
UserPo newUserPo = userApplicationService.addDriverUser(userDO);
|
||||
userDriverDO.setUserId(newUserPo.getUserId()); // 回填新生成的userId到userDriverDO
|
||||
|
||||
+1
-1
@@ -612,7 +612,7 @@ public class UserDriverEnterpriseApplicationService {
|
||||
BeanUtils.copyProperties(userDriverEnterpriseDo, userDO, IgnoreNullUtil.getNullPropertyNames(userDriverEnterpriseDo));
|
||||
|
||||
// 关键信息设置
|
||||
userDO.setUserPhone(userDriverEnterpriseDo.getUserAccount()); // 手机号通常作为账号
|
||||
// userDO.setUserPhone(userDriverEnterpriseDo.getUserAccount()); // 手机号通常作为账号
|
||||
// userDO.setUserName(userDriverEnterpriseDo.getEnterpriseName()); // 或其他表示用户名的字段
|
||||
|
||||
if (userDriverEnterpriseDo.getUserId() == null) {
|
||||
|
||||
+29
-1
@@ -322,6 +322,8 @@ public class UserShipperApplicationService {
|
||||
//========================用户注册===========================
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setAvatar(userShipperDO.getAvatar());
|
||||
//账号唯一性检验
|
||||
checkUserAccountUnique(userShipperDO.getUserAccount(),null,configSwitch.getTopOrganizationId());
|
||||
userDO.setUserAccount(userShipperDO.getUserAccount());
|
||||
userDO.setUserName(userShipperDO.getUserName());
|
||||
userDO.setUserId(userShipperDO.getUserId());
|
||||
@@ -333,7 +335,8 @@ public class UserShipperApplicationService {
|
||||
userDO.setRoleName(roleName);
|
||||
}
|
||||
|
||||
userDO.setUserPhone(userShipperDO.getUserAccount());
|
||||
|
||||
userDO.setUserPhone(userShipperDO.getUserPhone());
|
||||
|
||||
userShipperDO.setShipperType(1);
|
||||
userShipperDO.setDelFlag(1);
|
||||
@@ -1182,4 +1185,29 @@ public class UserShipperApplicationService {
|
||||
// 根据userId查询货主信息
|
||||
return userShipperDomainService.selectByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验登录账号唯一性
|
||||
* @param userAccount 登录账号
|
||||
* @param userId 用户ID(编辑时传入,用于排除自身;新增时传null)
|
||||
* @param topOrganizationId 顶级组织ID
|
||||
*/
|
||||
private void checkUserAccountUnique(String userAccount, Long userId, Long topOrganizationId) {
|
||||
if (StringUtils.isBlank(userAccount)) {
|
||||
return; // 账号为空,不校验
|
||||
}
|
||||
|
||||
UserDO checkDO = new UserDO();
|
||||
checkDO.setTopOrganizationId(topOrganizationId);
|
||||
checkDO.setUserAccount(userAccount);
|
||||
checkDO.setUserId(userId);
|
||||
|
||||
UserPo existUser = userDomainService.findByTopOrganizationIdAndUserAccount(checkDO);
|
||||
if (existUser != null) {
|
||||
throw new ServiceException("登录账号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -208,6 +208,8 @@ public class UserDriverDTO extends UserDTO {
|
||||
private String driverAuthByUsername;
|
||||
@ApiModelProperty(name = "司机用户姓名")
|
||||
private String userName;
|
||||
@ApiModelProperty(name = "司机手机号")
|
||||
private String userPhone;
|
||||
|
||||
@ApiModelProperty(name = "司机审核时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
+2
-2
@@ -230,6 +230,7 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean executeAndIssue(List<Long> ids,Long organizationId) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();//获取登录人
|
||||
String orgName = executeOrderMapper.getOrgNameByOrgId(organizationId);
|
||||
try {
|
||||
for (Long id:ids){
|
||||
BusinessDocumentOrder businessDocumentOrder=businessDocumentOrderMapper.selectById(id);
|
||||
@@ -283,6 +284,7 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
executeOrder.setIssueName(loginUser.getWlhyLoginUser().getRealname());
|
||||
executeOrder.setUpdateByName(loginUser.getWlhyLoginUser().getRealname());
|
||||
executeOrder.setOrderStatus(1L);
|
||||
executeOrder.setBusinessUnit(orgName);
|
||||
executeOrderMapper.updateById(executeOrder);
|
||||
|
||||
//下发到tms
|
||||
@@ -360,8 +362,6 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
tmsOrderAddDTO.setOrderSource("0");
|
||||
tmsOrderAddDTO.setOrganizationId(organizationId);
|
||||
tmsOrderAddDTO.setLoginUser(loginUser);
|
||||
String orgName = executeOrderMapper.getOrgNameByOrgId(organizationId);
|
||||
|
||||
tmsOrderAddDTO.setOrganizationName(orgName);
|
||||
|
||||
AjaxResult ajaxResult=wlhyServiceFeign.add(tmsOrderAddDTO);
|
||||
|
||||
@@ -140,5 +140,8 @@ public class ExecuteOrder extends BaseVOEntity{
|
||||
@ApiModelProperty("备注")
|
||||
private String shippingNote;
|
||||
|
||||
@ApiModelProperty("业务单元")
|
||||
private String businessUnit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -119,6 +119,7 @@ public class ExecuteOrderImpl extends ServiceImpl<ExecuteOrderMapper, ExecuteOrd
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean issueDocuments(List<Long> ids,Long organizationId) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();//获取登录人
|
||||
String orgName = executeOrderMapper.getOrgNameByOrgId(organizationId);
|
||||
for (Long id:ids){
|
||||
ExecuteOrder executeOrder=executeOrderMapper.selectById(id);
|
||||
if (ObjectUtil.isNotNull(executeOrder)){
|
||||
@@ -128,6 +129,7 @@ public class ExecuteOrderImpl extends ServiceImpl<ExecuteOrderMapper, ExecuteOrd
|
||||
executeOrder.setIssueName(loginUser.getWlhyLoginUser().getRealname());
|
||||
executeOrder.setUpdateByName(loginUser.getWlhyLoginUser().getRealname());
|
||||
executeOrder.setOrderStatus(1L);
|
||||
executeOrder.setBusinessUnit(orgName);
|
||||
executeOrderMapper.updateById(executeOrder);
|
||||
//下发到tms
|
||||
TmsOrderAddDTO tmsOrderAddDTO=new TmsOrderAddDTO();
|
||||
@@ -205,7 +207,7 @@ public class ExecuteOrderImpl extends ServiceImpl<ExecuteOrderMapper, ExecuteOrd
|
||||
tmsOrderAddDTO.setOrderSource("0");
|
||||
tmsOrderAddDTO.setOrganizationId(organizationId);
|
||||
tmsOrderAddDTO.setLoginUser(loginUser);
|
||||
String orgName = executeOrderMapper.getOrgNameByOrgId(organizationId);
|
||||
|
||||
|
||||
tmsOrderAddDTO.setOrganizationName(orgName);
|
||||
|
||||
|
||||
+3
@@ -197,6 +197,9 @@ public class ExecuteOrderPO extends BaseVOEntity{
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String salesmanName;
|
||||
|
||||
@ApiModelProperty("业务单元")
|
||||
private String businessUnit;
|
||||
|
||||
@ApiModelProperty("业务单货物集合")
|
||||
private List<BusinessDocumentCargoMulti> businessDocumentCargoMultiList;
|
||||
|
||||
|
||||
+3
@@ -141,4 +141,7 @@ public class ExecuteOrderDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String shippingNote;
|
||||
|
||||
@ApiModelProperty("业务单元")
|
||||
private String businessUnit;
|
||||
}
|
||||
|
||||
+4
-4
@@ -498,10 +498,10 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.add(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity);
|
||||
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ public class ReservationMaterialInventoryImpl extends ServiceImpl<ReservationMat
|
||||
BigDecimal newNetWeight = oldNetWeight.add(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
|
||||
@@ -134,4 +134,7 @@ public class ExecuteOrderDTO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("预计出发日期")
|
||||
private Date layDate;
|
||||
|
||||
@ApiModelProperty("业务单元")
|
||||
private String businessUnit;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="goodsNumber != null and goodsNumber != ''">
|
||||
and GOODS_NUMBER like concat('%', #{goodsNumber}, '%')
|
||||
</if>
|
||||
<if test="businessUnit != null and businessUnit != ''">
|
||||
and BUSINESS_UNIT like concat('%', #{businessUnit}, '%')
|
||||
</if>
|
||||
<if test="orgName != null and orgName != ''">
|
||||
and ORG_NAME like concat('%', #{orgName}, '%')
|
||||
</if>
|
||||
|
||||
+65
-3
@@ -23,6 +23,8 @@ import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoSe
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.service.MaterialBaseInfoDomainService;
|
||||
import com.mhd.wms.domain.materialCommon.repository.facade.IMaterialCommonService;
|
||||
import com.mhd.wms.domain.materialCommon.repository.po.MaterialCommonPO;
|
||||
import com.mhd.wms.domain.materialCommon.repository.todo.MaterialCommonDO;
|
||||
import com.mhd.wms.domain.materialCommon.service.MaterialCommonDomainService;
|
||||
import com.mhd.wms.domain.materialGoodsRule.entity.MaterialGoodsRule;
|
||||
@@ -33,6 +35,8 @@ import com.mhd.wms.domain.materialGoodsRule.service.MaterialGoodsRuleDomainServi
|
||||
import com.mhd.wms.domain.materialInventoryWarning.repository.facade.IMaterialInventoryWarningService;
|
||||
import com.mhd.wms.domain.materialInventoryWarning.repository.po.MaterialInventoryWarningPO;
|
||||
import com.mhd.wms.domain.materialInventoryWarning.service.MaterialInventoryWarningDomainService;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.repository.facade.IMaterialWarehouseControlService;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.repository.po.MaterialWarehouseControlPO;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.repository.todo.MaterialWarehouseControlDO;
|
||||
import com.mhd.wms.domain.materialWarehouseControl.service.MaterialWarehouseControlDomainService;
|
||||
import com.mhd.wms.interfaces.dto.materialBaseInfo.MaterialBaseInfoDTO;
|
||||
@@ -88,6 +92,10 @@ public class MaterialBaseInfoApplicationService {
|
||||
private UserServiceFeign userServiceFeign;
|
||||
@Autowired
|
||||
private IMaterialBaseInfoService materialBaseInfoService;
|
||||
@Autowired
|
||||
private IMaterialCommonService materialCommonService;
|
||||
@Autowired
|
||||
private IMaterialWarehouseControlService materialWarehouseControlService;
|
||||
|
||||
/**
|
||||
* 分页查询物料基础信息列表
|
||||
@@ -268,20 +276,38 @@ public class MaterialBaseInfoApplicationService {
|
||||
*/
|
||||
public Boolean update(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
materialBaseInfoDomainService.update(materialBaseInfoDO);
|
||||
Long materialBaseInfoId = materialBaseInfoDO.getMaterialBaseInfoId();
|
||||
// 商品/公共/仓控 子表:Feign/前端常只带业务字段、未带子表主键,需按 material_base_info_id 补全后再 update,否则 WHERE xxx_id=? 为 null 导致 Updates: 0
|
||||
mergeSubEntityPrimaryKeysForMaterialUpdate(materialBaseInfoDO);
|
||||
//商品规则
|
||||
MaterialGoodsRuleDO materialGoodsRuleDO = materialBaseInfoDO.getMaterialGoodsRule();
|
||||
if (materialGoodsRuleDO != null) {
|
||||
materialGoodsRuleDomainService.update(materialGoodsRuleDO);
|
||||
if (materialGoodsRuleDO.getMaterialGoodsRuleId() == null && materialBaseInfoId != null) {
|
||||
materialGoodsRuleDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialGoodsRuleDomainService.insert(materialGoodsRuleDO);
|
||||
} else {
|
||||
materialGoodsRuleDomainService.update(materialGoodsRuleDO);
|
||||
}
|
||||
}
|
||||
//公共信息
|
||||
MaterialCommonDO materialCommonDO = materialBaseInfoDO.getMaterialCommon();
|
||||
if (materialCommonDO != null) {
|
||||
materialCommonDomainService.update(materialCommonDO);
|
||||
if (materialCommonDO.getMaterialCommonId() == null && materialBaseInfoId != null) {
|
||||
materialCommonDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialCommonDomainService.insert(materialCommonDO);
|
||||
} else {
|
||||
materialCommonDomainService.update(materialCommonDO);
|
||||
}
|
||||
}
|
||||
//仓库控制信息
|
||||
MaterialWarehouseControlDO materialWarehouseControlDO = materialBaseInfoDO.getMaterialWarehouseControl();
|
||||
if (materialWarehouseControlDO != null) {
|
||||
materialWarehouseControlDomainService.update(materialWarehouseControlDO);
|
||||
if (materialWarehouseControlDO.getMaterialWarehouseControlId() == null && materialBaseInfoId != null) {
|
||||
materialWarehouseControlDO.setMaterialBaseInfoId(materialBaseInfoId);
|
||||
materialWarehouseControlDomainService.insert(materialWarehouseControlDO);
|
||||
} else {
|
||||
materialWarehouseControlDomainService.update(materialWarehouseControlDO);
|
||||
}
|
||||
}
|
||||
//库存预警
|
||||
materialInventoryWarningDomainService.batchInsertOrUpdate(materialBaseInfoDO);
|
||||
@@ -290,6 +316,42 @@ public class MaterialBaseInfoApplicationService {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑物料时从库中反查子表主键,避免仅传 batchId 等字段时子表主键为 null 无法 UPDATE。
|
||||
*/
|
||||
private void mergeSubEntityPrimaryKeysForMaterialUpdate(MaterialBaseInfoDO materialBaseInfoDO) {
|
||||
if (materialBaseInfoDO == null) {
|
||||
return;
|
||||
}
|
||||
Long mid = materialBaseInfoDO.getMaterialBaseInfoId();
|
||||
if (mid == null) {
|
||||
return;
|
||||
}
|
||||
MaterialGoodsRuleDO gr = materialBaseInfoDO.getMaterialGoodsRule();
|
||||
if (gr != null && gr.getMaterialGoodsRuleId() == null) {
|
||||
MaterialGoodsRule one = materialGoodsRuleMapper.selectOne(new LambdaQueryWrapper<MaterialGoodsRule>()
|
||||
.eq(MaterialGoodsRule::getMaterialBaseInfoId, mid)
|
||||
.eq(MaterialGoodsRule::getDelFlag, 1));
|
||||
if (one != null) {
|
||||
gr.setMaterialGoodsRuleId(one.getMaterialGoodsRuleId());
|
||||
}
|
||||
}
|
||||
MaterialCommonDO common = materialBaseInfoDO.getMaterialCommon();
|
||||
if (common != null && common.getMaterialCommonId() == null) {
|
||||
MaterialCommonPO ex = materialCommonService.getInfoByMaterialBaseInfoIds(mid);
|
||||
if (ex != null) {
|
||||
common.setMaterialCommonId(ex.getMaterialCommonId());
|
||||
}
|
||||
}
|
||||
MaterialWarehouseControlDO wh = materialBaseInfoDO.getMaterialWarehouseControl();
|
||||
if (wh != null && wh.getMaterialWarehouseControlId() == null) {
|
||||
MaterialWarehouseControlPO ex = materialWarehouseControlService.getInfoByMaterialBaseInfoIds(mid);
|
||||
if (ex != null) {
|
||||
wh.setMaterialWarehouseControlId(ex.getMaterialWarehouseControlId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除物料基础信息
|
||||
*/
|
||||
|
||||
+6
-1
@@ -46,6 +46,7 @@ import com.mhd.wms.domain.stockReceiptOrder.repository.todo.NoReceiptOrderDO;
|
||||
import com.mhd.wms.domain.stockReceiptOrder.repository.todo.StockReceiptOrderDO;
|
||||
import com.mhd.wms.domain.stockReceiptOrder.service.StockReceiptOrderDomainService;
|
||||
import com.mhd.wms.interfaces.dto.stockReceiptOrder.StockReceiptOrderDTO;
|
||||
import com.mhd.wms.util.ReceiptBatchDetailFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -224,6 +225,9 @@ public class StockReceiptOrderApplicationService {
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
// 与物料商品规则中的 batchId 对齐,避免多批次模板的 isDisplay=1 行全部合并成几十条
|
||||
batchDetailFeignPOList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(
|
||||
materialBaseInfoId, batchDetailFeignPOList, materialGoodsRuleService);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
@@ -346,7 +350,8 @@ public class StockReceiptOrderApplicationService {
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
|
||||
batchDetailFeignPOList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(
|
||||
materialBaseInfoId, batchDetailFeignPOList, materialGoodsRuleService);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
batchDetailFeignPOList.stream()
|
||||
|
||||
+4
@@ -49,6 +49,7 @@ import com.mhd.wms.domain.shiftMaterialDetail.repository.todo.ShiftMaterialDetai
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.po.StockShelfOrderPO;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO;
|
||||
import com.mhd.wms.domain.stockShelfOrder.service.StockShelfOrderDomainService;
|
||||
import com.mhd.wms.util.ReceiptBatchDetailFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -232,6 +233,9 @@ public class StockShelfOrderApplicationService {
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
// 与物料商品规则中的 batchId 对齐,同收货单详情,避免多批次 isDisplay=1 并集
|
||||
batchDetailFeignPOList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(
|
||||
materialBaseInfoId, batchDetailFeignPOList, materialGoodsRuleService);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
// 过滤isDisplay=1的属性
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
|
||||
+4
-4
@@ -871,10 +871,10 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||
//扣减后库存数量
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.add(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity);
|
||||
|
||||
|
||||
|
||||
@@ -895,7 +895,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
BigDecimal newNetWeight = oldNetWeight.add(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
|
||||
+5
@@ -17,6 +17,8 @@ import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
|
||||
import com.mhd.wms.util.ReceiptBatchDetailFilter;
|
||||
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
|
||||
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
|
||||
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
|
||||
@@ -83,6 +85,8 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private IMaterialGoodsRuleService materialGoodsRuleService;
|
||||
@Autowired
|
||||
private IMaterialInventoryService materialInventoryService;
|
||||
@Autowired
|
||||
private com.mhd.wms.domain.stockInOrder.repository.facade.IStockInOrderService stockInOrderService;
|
||||
@@ -259,6 +263,7 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
|
||||
return result;
|
||||
}
|
||||
List<BatchDetailFeignPO> batchList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
batchList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(materialBaseInfoId, batchList, materialGoodsRuleService);
|
||||
result = filterAndConvertToMaterialMoreDetail(batchList);
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return result;
|
||||
|
||||
+59
-4
@@ -1,8 +1,12 @@
|
||||
package com.mhd.wms.domain.shelfMaterialDetail.repository.persistence;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.inMaterialDetailSerialNumber.entity.InMaterialDetailSerialNumber;
|
||||
import com.mhd.wms.domain.inMaterialDetailSerialNumber.repository.facade.IInMaterialDetailSerialNumberService;
|
||||
@@ -15,16 +19,20 @@ import com.mhd.wms.domain.shelfMaterialDetail.repository.facade.IShelfMaterialDe
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.mapper.ShelfMaterialDetailMapper;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.po.ShelfMaterialDetailPO;
|
||||
import com.mhd.wms.domain.shelfMaterialDetail.repository.todo.ShelfMaterialDetailDO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
|
||||
import com.mhd.wms.util.ReceiptBatchDetailFilter;
|
||||
import com.mhd.wms.domain.stockInOrder.repository.facade.IStockInOrderService;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.facade.IStockShelfOrderService;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -45,6 +53,10 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
private ShelfMaterialDetailMapper shelfMaterialDetailMapper;
|
||||
@Autowired
|
||||
private IInMaterialDetailSerialNumberService inMaterialDetailSerialNumberService;
|
||||
@Resource
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
@Autowired
|
||||
private IMaterialGoodsRuleService materialGoodsRuleService;
|
||||
@Autowired
|
||||
private IMaterialMoreDetailService IMaterialMoreDetailService;
|
||||
|
||||
@@ -72,8 +84,8 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
? shelfMaterialDetailPO.getReceiptUniqueId() : shelfMaterialDetailPO.getUniqueId();
|
||||
materialMoreDetailDO.setMaterialDetailUniqueId(materialDetailUniqueIdForQuery);
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = IMaterialMoreDetailService.queryList(materialMoreDetailDO);
|
||||
if (materialMoreDetailList == null) {
|
||||
materialMoreDetailList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(materialMoreDetailList)) {
|
||||
materialMoreDetailList = loadTemplateMoreFromSystem(shelfMaterialDetailPO.getMaterialBaseInfoId());
|
||||
}
|
||||
fillAttributeValueFromShelfMaterialDetail(shelfMaterialDetailPO, materialMoreDetailList);
|
||||
shelfMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
@@ -100,8 +112,8 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
? childrenDetailPO.getReceiptUniqueId() : childrenDetailPO.getUniqueId();
|
||||
materialMoreDetailDO.setMaterialDetailUniqueId(materialDetailUniqueIdForQuery);
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = IMaterialMoreDetailService.queryList(materialMoreDetailDO);
|
||||
if (materialMoreDetailList == null) {
|
||||
materialMoreDetailList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(materialMoreDetailList)) {
|
||||
materialMoreDetailList = loadTemplateMoreFromSystem(childrenDetailPO.getMaterialBaseInfoId());
|
||||
}
|
||||
fillAttributeValueFromShelfMaterialDetail(childrenDetailPO, materialMoreDetailList);
|
||||
childrenDetailPO.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
@@ -194,6 +206,9 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
? row.getReceiptUniqueId() : row.getUniqueId();
|
||||
materialMoreDetailDO.setMaterialDetailUniqueId(materialDetailUniqueIdForQuery);
|
||||
List<MaterialMoreDetailPO> materialMoreDetailList = IMaterialMoreDetailService.queryList(materialMoreDetailDO);
|
||||
if (CollectionUtils.isEmpty(materialMoreDetailList)) {
|
||||
materialMoreDetailList = loadTemplateMoreFromSystem(row.getMaterialBaseInfoId());
|
||||
}
|
||||
if (materialMoreDetailList == null) {
|
||||
materialMoreDetailList = new ArrayList<>();
|
||||
}
|
||||
@@ -201,6 +216,46 @@ public class ShelfMaterialDetailImpl extends ServiceImpl<ShelfMaterialDetailMapp
|
||||
row.setMaterialMoreDetailList(materialMoreDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无 material_more_detail 时按物料商品规则单一批次拉模板,同收货单 {@link com.mhd.wms.util.ReceiptBatchDetailFilter}
|
||||
*/
|
||||
private List<MaterialMoreDetailPO> loadTemplateMoreFromSystem(Long materialBaseInfoId) {
|
||||
if (materialBaseInfoId == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<BatchDetailFeignPO> batchList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
batchList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(materialBaseInfoId, batchList, materialGoodsRuleService);
|
||||
return filterAndConvertToMaterialMoreDetail(batchList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤 isDisplay=1 的批次属性并转换为 MaterialMoreDetailPO,与收货/PC 端一致
|
||||
*/
|
||||
private List<MaterialMoreDetailPO> filterAndConvertToMaterialMoreDetail(List<BatchDetailFeignPO> batchList) {
|
||||
List<MaterialMoreDetailPO> result = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(batchList)) {
|
||||
return result;
|
||||
}
|
||||
for (BatchDetailFeignPO po : batchList) {
|
||||
if (po.getIsDisplay() == null || po.getIsDisplay() != 1) {
|
||||
continue;
|
||||
}
|
||||
MaterialMoreDetailPO mpo = new MaterialMoreDetailPO();
|
||||
mpo.setBatchId(po.getBatchId());
|
||||
mpo.setBatchDetailId(po.getBatchDetailId());
|
||||
mpo.setBatchLabels(po.getBatchLabels());
|
||||
mpo.setInputControl(po.getInputControl());
|
||||
mpo.setAttributeFormat(po.getAttributeFormat());
|
||||
mpo.setAttributeOption(po.getAttributeOption());
|
||||
result.add(mpo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从上架明细中获取收货数量、重量、体积、面积、批次属性值并填充到 materialMoreDetailList 的 attributeValue
|
||||
*/
|
||||
|
||||
+3
@@ -46,6 +46,7 @@ import com.mhd.wms.domain.materialMoreDetail.repository.facade.IMaterialMoreDeta
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.todo.MaterialMoreDetailDO;
|
||||
import com.mhd.wms.domain.qualityInspection.repository.facade.IQualityInspectionService;
|
||||
import com.mhd.wms.util.ReceiptBatchDetailFilter;
|
||||
import com.mhd.wms.domain.qualityInspection.repository.todo.QualityInspectionDO;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.entity.ReceiptMaterialDetail;
|
||||
import com.mhd.wms.domain.receiptMaterialDetail.repository.facade.IReceiptMaterialDetailService;
|
||||
@@ -319,6 +320,8 @@ public class StockReceiptOrderDomainService {
|
||||
return materialMoreDetailPOList;
|
||||
}
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
batchDetailFeignPOList = ReceiptBatchDetailFilter.filterByMaterialGoodsRule(
|
||||
materialBaseInfoId, batchDetailFeignPOList, materialGoodsRuleService);
|
||||
if (CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
return materialMoreDetailPOList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.mhd.wms.util;
|
||||
|
||||
import com.mhd.system.api.domain.BatchDetailFeignPO;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
|
||||
import com.mhd.wms.domain.materialGoodsRule.repository.po.MaterialGoodsRulePO;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 收货单明细「批次更多属性」与物料商品规则对齐:只展示 material_goods_rule 中绑定的 batchId 下的批次属性,避免多批次模板并集导致几十条空壳。
|
||||
*/
|
||||
public final class ReceiptBatchDetailFilter {
|
||||
|
||||
private ReceiptBatchDetailFilter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 按物料商品规则中的 batchId 过滤 system 返回的批次属性行。
|
||||
* 无商品规则或规则未绑定 batchId 时返回空列表(不展示跨批次模板的并集)。
|
||||
*/
|
||||
public static List<BatchDetailFeignPO> filterByMaterialGoodsRule(
|
||||
Long materialBaseInfoId,
|
||||
List<BatchDetailFeignPO> fromSystem,
|
||||
IMaterialGoodsRuleService materialGoodsRuleService) {
|
||||
if (materialBaseInfoId == null) {
|
||||
return fromSystem == null ? new ArrayList<>() : fromSystem;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(fromSystem)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
MaterialGoodsRulePO rule = materialGoodsRuleService.getInfoByMaterialBaseInfoIds(materialBaseInfoId);
|
||||
if (rule == null || rule.getBatchId() == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
final Long targetBatchId = rule.getBatchId();
|
||||
return fromSystem.stream()
|
||||
.filter(b -> b.getBatchId() != null && targetBatchId.equals(b.getBatchId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user