PDA提交不显示重量相关

This commit is contained in:
秦鸿展
2026-04-22 17:38:28 +08:00
parent b7d14706d7
commit 5ced64b81b
3 changed files with 116 additions and 6 deletions
@@ -2084,11 +2084,14 @@ public class StockReceiptOrderApplicationService {
continue;
}
ReceiptMaterialDetailDO firstChild = children.get(0);
// 主行已携带本次收货/抄码数据时,不再被 children[0] 覆盖(避免 copyDetails/copyQuantity 被清空)
// 主行已携带本次收货/抄码数据时,不再被 children[0] 整行覆盖(避免 copyDetails/copyQuantity 被清空)
if (!hasPdaSubmittedReceiptOrCopyData(parent)) {
// 将第一条子项的值赋给主项(含批次属性、收货数量等)
BeanUtils.copyProperties(firstChild, parent, "children", "parentUniqueId", "uniqueId", "materialDetailId",
"organizationIdList", "permissionMenuId", "receiptOrderNumberList", "compoundOrQuery");
} else {
// PDA 常把件数挂在主行、把毛净重体面积/批次仅挂在 parent_copy 子行;若此处不合并,assign 后删掉子行会导致装配增量全为 0
mergePdaParentCopyScalarFieldsFromFirstChild(parent, firstChild);
}
// 删除 children 中的第一条
List<ReceiptMaterialDetailDO> newChildren = new ArrayList<>();
@@ -2099,6 +2102,75 @@ public class StockReceiptOrderApplicationService {
}
}
/**
* getInfoByApp 把 parent_copy 挂在 children[0]PDA 常在子行填毛净重体面积/批次,主行只带回件数。
* 若主行已有 receiptQuantity 会跳过整段 {@link BeanUtils#copyProperties},须把子行实绩字段补到主行,否则删掉子行后装配增量为 0。
*/
private static void mergePdaParentCopyScalarFieldsFromFirstChild(ReceiptMaterialDetailDO parent, ReceiptMaterialDetailDO child) {
if (parent == null || child == null) {
return;
}
if (parent.getReceiptNetWeight() == null) {
parent.setReceiptNetWeight(child.getReceiptNetWeight());
}
if (parent.getReceiptGrossWeight() == null) {
parent.setReceiptGrossWeight(child.getReceiptGrossWeight());
}
if (parent.getReceiptVolume() == null) {
parent.setReceiptVolume(child.getReceiptVolume());
}
if (parent.getReceiptArea() == null) {
parent.setReceiptArea(child.getReceiptArea());
}
if (parent.getTotalNetWeight() == null) {
parent.setTotalNetWeight(child.getTotalNetWeight());
}
if (parent.getTotalGrossWeight() == null) {
parent.setTotalGrossWeight(child.getTotalGrossWeight());
}
if (parent.getTotalVolume() == null) {
parent.setTotalVolume(child.getTotalVolume());
}
if (parent.getTotalArea() == null) {
parent.setTotalArea(child.getTotalArea());
}
if (StringUtils.isBlank(parent.getLotNo()) && StringUtils.isNotBlank(child.getLotNo())) {
parent.setLotNo(child.getLotNo());
}
if (StringUtils.isBlank(parent.getBatchNumber()) && StringUtils.isNotBlank(child.getBatchNumber())) {
parent.setBatchNumber(child.getBatchNumber());
}
if (StringUtils.isBlank(parent.getDimensions()) && StringUtils.isNotBlank(child.getDimensions())) {
parent.setDimensions(child.getDimensions());
}
mergeMaterialMoreDetailAttributeValuesFromChild(parent, child);
}
/** 主行与子行 batchDetailId 相同的批次属性:子行有 attributeValue 时补到主行(主行为空时) */
private static void mergeMaterialMoreDetailAttributeValuesFromChild(ReceiptMaterialDetailDO parent, ReceiptMaterialDetailDO child) {
List<MaterialMoreDetailDO> childList = child.getMaterialMoreDetailList();
if (CollectionUtils.isEmpty(childList)) {
return;
}
List<MaterialMoreDetailDO> parentList = parent.getMaterialMoreDetailList();
if (CollectionUtils.isEmpty(parentList)) {
parent.setMaterialMoreDetailList(new ArrayList<>(childList));
return;
}
for (MaterialMoreDetailDO c : childList) {
if (c == null || c.getBatchDetailId() == null || StringUtils.isBlank(c.getAttributeValue())) {
continue;
}
for (MaterialMoreDetailDO p : parentList) {
if (p != null && c.getBatchDetailId().equals(p.getBatchDetailId())
&& StringUtils.isBlank(p.getAttributeValue())) {
p.setAttributeValue(c.getAttributeValue());
break;
}
}
}
}
private static boolean hasPdaSubmittedReceiptOrCopyData(ReceiptMaterialDetailDO line) {
if (line == null) {
return false;
@@ -1301,6 +1301,8 @@ public class StockShelfOrderApplicationService {
shelfMaterialDetailDO.setStorageSectionId(firstChild.getStorageSectionId());
shelfMaterialDetailDO.setStorageLocationId(firstChild.getStorageLocationId());
shelfMaterialDetailDO.setContainerId(firstChild.getContainerId());
// PDA 常把毛净重体面积挂在 parent_copy 子行,主行 total* 为 0;本分支若不合并,assemble 增量全为 0
mergePdaShelfParentCopyMetricsFromFirstChild(shelfMaterialDetailDO, firstChild);
// 不把子行 level 复制到主项;assembleParamByShelf 会以库表主行 level 为准
shelfMaterialDetailDO.setMaterialDetailSerialNumberList(firstChild.getMaterialDetailSerialNumberList());
// 保留其余子项(从索引1开始),统一设为 level 2
@@ -1420,6 +1422,8 @@ public class StockShelfOrderApplicationService {
continue;
}
BeanUtils.copyProperties(firstChild, parent, "children", "parentUniqueId", "uniqueId", "materialDetailId");
// 与收货 merge 一致:主行若仍为 0/空而子行有实绩,补 total* / 尺寸 / 批次,避免 copy 未生效或主行显式 0 盖住子行
mergePdaShelfParentCopyMetricsFromFirstChild(parent, firstChild);
List<ShelfMaterialDetailDO> newChildren = new ArrayList<>();
for (int i = 1; i < children.size(); i++) {
ShelfMaterialDetailDO c = children.get(i);
@@ -1430,6 +1434,41 @@ public class StockShelfOrderApplicationService {
}
}
/**
* getInfoByApp 把 parent_copy 挂在 children[0]PDA 常在子行填毛净重体面积,主行 total* 为 0 或仅占位。
* assign/分支合并库位与数量后,若主行仍为 0/空则必须用子行补全,否则去掉子行或走 inject 后装配增量为 0、回显也为空。
*/
private static void mergePdaShelfParentCopyMetricsFromFirstChild(ShelfMaterialDetailDO parent, ShelfMaterialDetailDO child) {
if (parent == null || child == null) {
return;
}
if (isZeroOrNullBigDecimal(parent.getTotalNetWeight()) && !isZeroOrNullBigDecimal(child.getTotalNetWeight())) {
parent.setTotalNetWeight(child.getTotalNetWeight());
}
if (isZeroOrNullBigDecimal(parent.getTotalGrossWeight()) && !isZeroOrNullBigDecimal(child.getTotalGrossWeight())) {
parent.setTotalGrossWeight(child.getTotalGrossWeight());
}
if (isZeroOrNullBigDecimal(parent.getTotalVolume()) && !isZeroOrNullBigDecimal(child.getTotalVolume())) {
parent.setTotalVolume(child.getTotalVolume());
}
if (isZeroOrNullBigDecimal(parent.getTotalArea()) && !isZeroOrNullBigDecimal(child.getTotalArea())) {
parent.setTotalArea(child.getTotalArea());
}
if (StringUtils.isBlank(parent.getDimensions()) && StringUtils.isNotBlank(child.getDimensions())) {
parent.setDimensions(child.getDimensions());
}
if (StringUtils.isBlank(parent.getBatchNumber()) && StringUtils.isNotBlank(child.getBatchNumber())) {
parent.setBatchNumber(child.getBatchNumber());
}
if (StringUtils.isBlank(parent.getLotNumber()) && StringUtils.isNotBlank(child.getLotNumber())) {
parent.setLotNumber(child.getLotNumber());
}
}
private static boolean isZeroOrNullBigDecimal(BigDecimal v) {
return v == null || v.compareTo(BigDecimal.ZERO) == 0;
}
/**
* 判断第一条子项是否为 parent_copy(主项拷贝)。与主项同 materialDetailId/uniqueId 则为 parent_copy。
*/
@@ -59,7 +59,6 @@ public class StockReceiptOrderAppApi extends BaseController {
startPage();
LoginUser loginUser = SecurityUtils.getLoginUser();
stockReceiptOrderDO.setOperatorsBy(loginUser.getUserPo().getUserId());
// 与 PDA 出库复核列表一致:按当前用户关联仓库过滤(见 StockOutOrderAppApi#list
AssociationWarehouseCacheDO associationWarehouseCacheDO =
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (associationWarehouseCacheDO != null) {
@@ -82,9 +81,9 @@ public class StockReceiptOrderAppApi extends BaseController {
}
/**
* PDA:按收货单行查询是否抄码(与 PC 物料主数据 copyCode 一致)。列表未拉 {@link #getInfoByApp} 时,点击「收货」前调用本接口即可分流抄码页/普通收货页。
* PDA:按收货单行查询是否抄码
*
* @return data 含 copyCode(1-是 2-否)、materialBaseInfoId、materialDetailId
* @return data 含 copyCode(1-是 2-否)
*/
@ApiOperation("按收货明细行查询是否抄码(与PC同源,供跳转抄码收货页)")
@GetMapping("/getCopyCodeForReceiptLine")
@@ -96,7 +95,7 @@ public class StockReceiptOrderAppApi extends BaseController {
}
/**
* PDA:仅已知物料基础信息 ID 时查询是否抄码(与 PC 一致)。列表若已带 materialBaseInfoId 可直调,无需整单详情。
* PDA:仅已知物料基础信息 ID 时查询是否抄码
*/
@ApiOperation("按物料基础信息ID查询是否抄码")
@GetMapping("/getCopyCodeByMaterialBaseInfoId")
@@ -121,7 +120,7 @@ public class StockReceiptOrderAppApi extends BaseController {
}
/**
* 收货(与 PC 同源)。抄码物料请在对应明细上传 copyBatch、palletNumber、copyQuantity、copyDetails
* 收货。抄码物料请在对应明细上传 copyBatch、palletNumber、copyQuantity、copyDetails
* copyDetails 为 JSON:序号 → 单件净重(KG),如 {"1":1.343,"2":1.343};抄码对照表在上架完成入账后写入,非本接口直接写。
*/
@ApiOperation("收货(抄码明细字段见 materialDetailList.copyDetails 等,与 PC 一致)")