PDA收货调整修改
This commit is contained in:
+16
@@ -75,6 +75,22 @@ public class ReceiptMaterialDetail extends BaseVOEntity {
|
||||
@Excel(name = "已收货数量")
|
||||
private BigDecimal alreadyReceiptQuantity;
|
||||
|
||||
@ApiModelProperty("累计已收货毛重(KG),称重实绩")
|
||||
@TableField("already_receipt_gross_weight")
|
||||
private BigDecimal alreadyReceiptGrossWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货净重(KG),与毛重同口径累加本次净重")
|
||||
@TableField("already_receipt_net_weight")
|
||||
private BigDecimal alreadyReceiptNetWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货体积(CBM)")
|
||||
@TableField("already_receipt_volume")
|
||||
private BigDecimal alreadyReceiptVolume;
|
||||
|
||||
@ApiModelProperty("累计已收货面积(SQM)")
|
||||
@TableField("already_receipt_area")
|
||||
private BigDecimal alreadyReceiptArea;
|
||||
|
||||
@ApiModelProperty("收货数量")
|
||||
@Excel(name = "收货数量")
|
||||
private BigDecimal receiptQuantity;
|
||||
|
||||
+16
@@ -359,6 +359,7 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
|
||||
extractBatchAttributesToReceiptDetail(receiptMaterialDetailDOChild);
|
||||
ReceiptMaterialDetail receiptMaterialDetailChild = new ReceiptMaterialDetail();
|
||||
BeanUtils.copyProperties(receiptMaterialDetailDOChild, receiptMaterialDetailChild);
|
||||
alignPersistedReceiptQuantityToCumulative(receiptMaterialDetailDOChild, receiptMaterialDetailChild);
|
||||
receiptMaterialDetailChild.setCreateBy(loginUser.getUserid());
|
||||
receiptMaterialDetailChild.setCreateByName(loginUser.getUsername());
|
||||
receiptMaterialDetailChild.setCreateTime(new Date());
|
||||
@@ -376,6 +377,7 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
|
||||
}
|
||||
ReceiptMaterialDetail receiptMaterialDetail = new ReceiptMaterialDetail();
|
||||
BeanUtils.copyProperties(receiptMaterialDetailDO, receiptMaterialDetail);
|
||||
alignPersistedReceiptQuantityToCumulative(receiptMaterialDetailDO, receiptMaterialDetail);
|
||||
receiptMaterialDetail.setUpdateBy(loginUser.getUserid());
|
||||
receiptMaterialDetail.setUpdateByName(loginUser.getUsername());
|
||||
receiptMaterialDetail.setUpdateTime(new Date());
|
||||
@@ -412,6 +414,20 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
|
||||
updateInMaterialDetailFromAttributeOption(receiptMaterialDetailDOList);
|
||||
}
|
||||
|
||||
/**
|
||||
* PDA 上传的 receiptQuantity 为「本次收货量」;落库时与累计已收货 already_receipt_quantity 对齐,
|
||||
* 否则多次收货会把 receipt_quantity 覆盖成仅最后一次本次量(如先 1000 再 100 却存成 100)。
|
||||
*/
|
||||
private static void alignPersistedReceiptQuantityToCumulative(ReceiptMaterialDetailDO detailDO,
|
||||
ReceiptMaterialDetail entity) {
|
||||
if (detailDO == null || entity == null) {
|
||||
return;
|
||||
}
|
||||
if (detailDO.getAlreadyReceiptQuantity() != null) {
|
||||
entity.setReceiptQuantity(detailDO.getAlreadyReceiptQuantity());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 从materialMoreDetailList中根据attributeOption提取字段值并更新入库单明细
|
||||
* @author Auto
|
||||
|
||||
+34
@@ -80,6 +80,20 @@ public class ReceiptMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "已收货数量")
|
||||
private BigDecimal alreadyReceiptQuantity;
|
||||
|
||||
@ApiModelProperty("累计已收货毛重(KG),称重实绩")
|
||||
@Excel(name = "累计已收货毛重(KG)")
|
||||
private BigDecimal alreadyReceiptGrossWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货净重(KG)")
|
||||
@Excel(name = "累计已收货净重(KG)")
|
||||
private BigDecimal alreadyReceiptNetWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货体积(CBM)")
|
||||
private BigDecimal alreadyReceiptVolume;
|
||||
|
||||
@ApiModelProperty("累计已收货面积(SQM)")
|
||||
private BigDecimal alreadyReceiptArea;
|
||||
|
||||
@ApiModelProperty("待收货数量")
|
||||
@Excel(name = "待收货数量")
|
||||
private BigDecimal pendingReceiptQuantity;
|
||||
@@ -242,6 +256,26 @@ public class ReceiptMaterialDetailPO extends BaseVOEntity {
|
||||
@Excel(name = "总面积(SQM)")
|
||||
private BigDecimal totalArea;
|
||||
|
||||
/** 计划净重:入库单明细 total(联表 b),与收货单行首次创建时计划 total 同源;不落库,仅查询带出 */
|
||||
@ApiModelProperty("计划净重(KG),入库单口径,不落库")
|
||||
private BigDecimal planNetWeight;
|
||||
@ApiModelProperty("计划毛重(KG),入库单口径,不落库")
|
||||
private BigDecimal planGrossWeight;
|
||||
@ApiModelProperty("计划体积(CBM),入库单口径,不落库")
|
||||
private BigDecimal planVolume;
|
||||
@ApiModelProperty("计划面积(SQM),入库单口径,不落库")
|
||||
private BigDecimal planArea;
|
||||
|
||||
/** 待收 = 计划 − 累计已收货,仅接口计算不落库 */
|
||||
@ApiModelProperty("待收净重=计划净重-累计已收货净重,仅计算不落库")
|
||||
private BigDecimal pendingNetWeight;
|
||||
@ApiModelProperty("待收毛重=计划毛重-累计已收货毛重,仅计算不落库")
|
||||
private BigDecimal pendingGrossWeight;
|
||||
@ApiModelProperty("待收体积=计划体积-累计已收货体积,仅计算不落库")
|
||||
private BigDecimal pendingVolume;
|
||||
@ApiModelProperty("待收面积=计划面积-累计已收货面积,仅计算不落库")
|
||||
private BigDecimal pendingArea;
|
||||
|
||||
@ApiModelProperty("Invoice No.")
|
||||
@Excel(name = "Invoice No.")
|
||||
private String invoiceNo;
|
||||
|
||||
+24
@@ -78,6 +78,30 @@ public class ReceiptMaterialDetailDO extends BaseVOEntity {
|
||||
@Excel(name = "已收货数量")
|
||||
private BigDecimal alreadyReceiptQuantity;
|
||||
|
||||
@ApiModelProperty("累计已收货毛重(KG),称重实绩")
|
||||
private BigDecimal alreadyReceiptGrossWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货净重(KG)")
|
||||
private BigDecimal alreadyReceiptNetWeight;
|
||||
|
||||
@ApiModelProperty("本次称重毛重(KG),仅提交请求使用,不落库")
|
||||
private BigDecimal receiptGrossWeight;
|
||||
|
||||
@ApiModelProperty("本次净重(KG),仅提交请求使用,不落库")
|
||||
private BigDecimal receiptNetWeight;
|
||||
|
||||
@ApiModelProperty("累计已收货体积(CBM)")
|
||||
private BigDecimal alreadyReceiptVolume;
|
||||
|
||||
@ApiModelProperty("累计已收货面积(SQM)")
|
||||
private BigDecimal alreadyReceiptArea;
|
||||
|
||||
@ApiModelProperty("本次体积(CBM),仅提交请求使用,不落库")
|
||||
private BigDecimal receiptVolume;
|
||||
|
||||
@ApiModelProperty("本次面积(SQM),仅提交请求使用,不落库")
|
||||
private BigDecimal receiptArea;
|
||||
|
||||
@ApiModelProperty("收货数量")
|
||||
@Excel(name = "收货数量")
|
||||
private BigDecimal receiptQuantity;
|
||||
|
||||
+30
-30
@@ -259,7 +259,7 @@ public class StockInOrderDomainService {
|
||||
}
|
||||
}
|
||||
|
||||
// 填充入库单明细的收货数量、上架数量,以及更新毛重、净重、面积、体积
|
||||
// 填充入库单明细的收货数量、上架数量;入库单明细 total* 保持计划值不因收货覆盖(原按收货汇总 total* 已注释保留)
|
||||
for (InMaterialDetailPO inMaterialDetail : inMaterialDetailPOList) {
|
||||
Long materialDetailId = inMaterialDetail.getMaterialDetailId();
|
||||
if (materialDetailId != null) {
|
||||
@@ -273,18 +273,18 @@ public class StockInOrderDomainService {
|
||||
|
||||
// 更新毛重、净重、面积、体积(根据收货时所填的明细行数据更新到入库单明细中)
|
||||
// 将收货单明细中填写的数据汇总后更新到入库单明细
|
||||
if (receiptDetail.getTotalGrossWeight() != null) {
|
||||
inMaterialDetail.setTotalGrossWeight(receiptDetail.getTotalGrossWeight());
|
||||
}
|
||||
if (receiptDetail.getTotalNetWeight() != null) {
|
||||
inMaterialDetail.setTotalNetWeight(receiptDetail.getTotalNetWeight());
|
||||
}
|
||||
if (receiptDetail.getTotalArea() != null) {
|
||||
inMaterialDetail.setTotalArea(receiptDetail.getTotalArea());
|
||||
}
|
||||
if (receiptDetail.getTotalVolume() != null) {
|
||||
inMaterialDetail.setTotalVolume(receiptDetail.getTotalVolume());
|
||||
}
|
||||
// if (receiptDetail.getTotalGrossWeight() != null) {
|
||||
// inMaterialDetail.setTotalGrossWeight(receiptDetail.getTotalGrossWeight());
|
||||
// }
|
||||
// if (receiptDetail.getTotalNetWeight() != null) {
|
||||
// inMaterialDetail.setTotalNetWeight(receiptDetail.getTotalNetWeight());
|
||||
// }
|
||||
// if (receiptDetail.getTotalArea() != null) {
|
||||
// inMaterialDetail.setTotalArea(receiptDetail.getTotalArea());
|
||||
// }
|
||||
// if (receiptDetail.getTotalVolume() != null) {
|
||||
// inMaterialDetail.setTotalVolume(receiptDetail.getTotalVolume());
|
||||
// }
|
||||
}
|
||||
|
||||
// 填充上架数量(入库单对应的上架单实际上架数量)
|
||||
@@ -301,7 +301,7 @@ public class StockInOrderDomainService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归处理收货单明细,汇总毛重、净重、面积、体积
|
||||
* 递归处理收货单明细,汇总收货数量;毛重/净重/面积/体积汇总已注释(入库单明细 total* 不因收货覆盖)
|
||||
* @param receiptDetail 收货单明细
|
||||
* @param receiptDetailMap 收货单明细汇总Map
|
||||
*/
|
||||
@@ -323,23 +323,23 @@ public class StockInOrderDomainService {
|
||||
BigDecimal newReceiptQuantity = receiptDetail.getReceiptQuantity() != null ? receiptDetail.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
existing.setReceiptQuantity(receiptQuantity.add(newReceiptQuantity));
|
||||
|
||||
// 汇总毛重、净重、面积、体积(根据收货时填写的数据)
|
||||
// 汇总毛重、净重、面积、体积(根据收货时填写的数据)— 入库单明细 total* 不因收货覆盖,已注释保留
|
||||
// 累加所有收货单明细的毛重、净重、面积、体积
|
||||
BigDecimal existingGrossWeight = existing.getTotalGrossWeight() != null ? existing.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
BigDecimal newGrossWeight = receiptDetail.getTotalGrossWeight() != null ? receiptDetail.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
existing.setTotalGrossWeight(existingGrossWeight.add(newGrossWeight));
|
||||
|
||||
BigDecimal existingNetWeight = existing.getTotalNetWeight() != null ? existing.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
BigDecimal newNetWeight = receiptDetail.getTotalNetWeight() != null ? receiptDetail.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
existing.setTotalNetWeight(existingNetWeight.add(newNetWeight));
|
||||
|
||||
BigDecimal existingArea = existing.getTotalArea() != null ? existing.getTotalArea() : BigDecimal.ZERO;
|
||||
BigDecimal newArea = receiptDetail.getTotalArea() != null ? receiptDetail.getTotalArea() : BigDecimal.ZERO;
|
||||
existing.setTotalArea(existingArea.add(newArea));
|
||||
|
||||
BigDecimal existingVolume = existing.getTotalVolume() != null ? existing.getTotalVolume() : BigDecimal.ZERO;
|
||||
BigDecimal newVolume = receiptDetail.getTotalVolume() != null ? receiptDetail.getTotalVolume() : BigDecimal.ZERO;
|
||||
existing.setTotalVolume(existingVolume.add(newVolume));
|
||||
// BigDecimal existingGrossWeight = existing.getTotalGrossWeight() != null ? existing.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
// BigDecimal newGrossWeight = receiptDetail.getTotalGrossWeight() != null ? receiptDetail.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
// existing.setTotalGrossWeight(existingGrossWeight.add(newGrossWeight));
|
||||
//
|
||||
// BigDecimal existingNetWeight = existing.getTotalNetWeight() != null ? existing.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
// BigDecimal newNetWeight = receiptDetail.getTotalNetWeight() != null ? receiptDetail.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
// existing.setTotalNetWeight(existingNetWeight.add(newNetWeight));
|
||||
//
|
||||
// BigDecimal existingArea = existing.getTotalArea() != null ? existing.getTotalArea() : BigDecimal.ZERO;
|
||||
// BigDecimal newArea = receiptDetail.getTotalArea() != null ? receiptDetail.getTotalArea() : BigDecimal.ZERO;
|
||||
// existing.setTotalArea(existingArea.add(newArea));
|
||||
//
|
||||
// BigDecimal existingVolume = existing.getTotalVolume() != null ? existing.getTotalVolume() : BigDecimal.ZERO;
|
||||
// BigDecimal newVolume = receiptDetail.getTotalVolume() != null ? receiptDetail.getTotalVolume() : BigDecimal.ZERO;
|
||||
// existing.setTotalVolume(existingVolume.add(newVolume));
|
||||
}
|
||||
|
||||
// 递归处理子明细
|
||||
|
||||
+95
-55
@@ -404,7 +404,7 @@ public class StockReceiptOrderDomainService {
|
||||
genInventoryStandingReport(stockReceiptOrderPO, stockReceiptOrderDO);
|
||||
//修改物料明细信息
|
||||
receiptMaterialDetailService.batchReceiptUpdate(stockReceiptOrderDO);
|
||||
//同步更新入库单明细的收货数量、总毛重、总净重、总面积、总体积
|
||||
// 同步更新入库单明细的收货数量(入库单 totalNetWeight/totalGrossWeight/totalVolume/totalArea 不因收货改库,见 sync 内注释)
|
||||
syncUpdateInMaterialDetailFromReceipt(stockReceiptOrderDO, stockReceiptOrderPO);
|
||||
//生成 收货作业单
|
||||
genStockReceiptTaskOrderByReceivingGoods(stockReceiptOrderPO,stockReceiptOrderDO);
|
||||
@@ -419,8 +419,8 @@ public class StockReceiptOrderDomainService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步更新入库单明细的收货数量、总毛重、总净重、总面积、总体积
|
||||
* 根据收货单明细中填写的数据,按materialDetailId分组汇总后更新到入库单明细
|
||||
* 同步更新入库单明细的收货数量(总毛重/总净重/总面积/总体积不再写入入库单明细,逻辑已注释保留)
|
||||
* 根据收货单明细中填写的数据,按 materialDetailId 分组汇总后更新到入库单明细
|
||||
* @param stockReceiptOrderDO 收货单DO
|
||||
* @param stockReceiptOrderPO 收货单PO(可选,如果为null则从DO中获取)
|
||||
*/
|
||||
@@ -511,29 +511,26 @@ public class StockReceiptOrderDomainService {
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
// 更新总毛重
|
||||
if (summary.containsKey("totalGrossWeight") && summary.get("totalGrossWeight") != null) {
|
||||
updateWrapper.set("total_gross_weight", summary.get("totalGrossWeight"));
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
// 更新总净重
|
||||
if (summary.containsKey("totalNetWeight") && summary.get("totalNetWeight") != null) {
|
||||
updateWrapper.set("total_net_weight", summary.get("totalNetWeight"));
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
// 更新总面积
|
||||
if (summary.containsKey("totalArea") && summary.get("totalArea") != null) {
|
||||
updateWrapper.set("total_area", summary.get("totalArea"));
|
||||
hasUpdate = true;
|
||||
}
|
||||
|
||||
// 更新总体积
|
||||
if (summary.containsKey("totalVolume") && summary.get("totalVolume") != null) {
|
||||
updateWrapper.set("total_volume", summary.get("totalVolume"));
|
||||
hasUpdate = true;
|
||||
}
|
||||
// 更新总毛重/总净重/总面积/总体积:入库单明细保持计划值,收货实绩仅在收货单侧,此处不再改库(原逻辑保留如下)
|
||||
// if (summary.containsKey("totalGrossWeight") && summary.get("totalGrossWeight") != null) {
|
||||
// updateWrapper.set("total_gross_weight", summary.get("totalGrossWeight"));
|
||||
// hasUpdate = true;
|
||||
// }
|
||||
//
|
||||
// if (summary.containsKey("totalNetWeight") && summary.get("totalNetWeight") != null) {
|
||||
// updateWrapper.set("total_net_weight", summary.get("totalNetWeight"));
|
||||
// hasUpdate = true;
|
||||
// }
|
||||
//
|
||||
// if (summary.containsKey("totalArea") && summary.get("totalArea") != null) {
|
||||
// updateWrapper.set("total_area", summary.get("totalArea"));
|
||||
// hasUpdate = true;
|
||||
// }
|
||||
//
|
||||
// if (summary.containsKey("totalVolume") && summary.get("totalVolume") != null) {
|
||||
// updateWrapper.set("total_volume", summary.get("totalVolume"));
|
||||
// hasUpdate = true;
|
||||
// }
|
||||
|
||||
if (hasUpdate) {
|
||||
updateWrapper.set("update_by", loginUser.getUserid());
|
||||
@@ -541,13 +538,9 @@ public class StockReceiptOrderDomainService {
|
||||
updateWrapper.set("update_time", updateTime);
|
||||
boolean updateResult = iInMaterialDetailService.update(updateWrapper);
|
||||
if (updateResult) {
|
||||
log.info("成功更新入库单明细,uniqueId: {}, 收货数量: {}, 总毛重: {}, 总净重: {}, 总面积: {}, 总体积: {}",
|
||||
log.info("成功更新入库单明细,uniqueId: {}, 收货数量: {}(入库单 total* 不再随收货同步)",
|
||||
uniqueId,
|
||||
summary.get("receiptQuantity"),
|
||||
summary.get("totalGrossWeight"),
|
||||
summary.get("totalNetWeight"),
|
||||
summary.get("totalArea"),
|
||||
summary.get("totalVolume"));
|
||||
summary.get("receiptQuantity"));
|
||||
} else {
|
||||
log.warn("更新入库单明细失败,uniqueId: {}, inOrderNumber: {}", uniqueId, inOrderNumber);
|
||||
}
|
||||
@@ -562,7 +555,7 @@ public class StockReceiptOrderDomainService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归处理收货单明细,汇总收货数量、总毛重、总净重、总面积、总体积
|
||||
* 递归处理收货单明细,汇总收货数量(总毛重/净重/面积/体积的汇总已注释,不再写入入库单)
|
||||
* @param receiptDetail 收货单明细PO
|
||||
* @param uniqueIdSummaryMap 汇总Map,key为入库单明细的unique_id(即收货单明细的in_unique_id),value为字段汇总Map
|
||||
*/
|
||||
@@ -576,30 +569,36 @@ public class StockReceiptOrderDomainService {
|
||||
Long uniqueId = receiptDetail.getInUniqueId();
|
||||
Map<String, BigDecimal> summary = uniqueIdSummaryMap.computeIfAbsent(uniqueId, k -> new HashMap<>());
|
||||
|
||||
// 汇总收货数量
|
||||
// 汇总收货数量:必须按「累计已收货」汇总。receipt_quantity 字段存的是本次收货量,多次收货会覆盖为最后一次;
|
||||
// 同步入库单明细应使用 already_receipt_quantity,否则会误把最后一次的本次量写入 in_material_detail。
|
||||
BigDecimal receiptQuantity = summary.getOrDefault("receiptQuantity", BigDecimal.ZERO);
|
||||
BigDecimal newReceiptQuantity = receiptDetail.getReceiptQuantity() != null ? receiptDetail.getReceiptQuantity() : BigDecimal.ZERO;
|
||||
summary.put("receiptQuantity", receiptQuantity.add(newReceiptQuantity));
|
||||
BigDecimal alreadyReceipt = receiptDetail.getAlreadyReceiptQuantity() != null ? receiptDetail.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
|
||||
summary.put("receiptQuantity", receiptQuantity.add(alreadyReceipt));
|
||||
|
||||
// 汇总总毛重
|
||||
BigDecimal totalGrossWeight = summary.getOrDefault("totalGrossWeight", BigDecimal.ZERO);
|
||||
BigDecimal newGrossWeight = receiptDetail.getTotalGrossWeight() != null ? receiptDetail.getTotalGrossWeight() : BigDecimal.ZERO;
|
||||
summary.put("totalGrossWeight", totalGrossWeight.add(newGrossWeight));
|
||||
|
||||
// 汇总总净重
|
||||
BigDecimal totalNetWeight = summary.getOrDefault("totalNetWeight", BigDecimal.ZERO);
|
||||
BigDecimal newNetWeight = receiptDetail.getTotalNetWeight() != null ? receiptDetail.getTotalNetWeight() : BigDecimal.ZERO;
|
||||
summary.put("totalNetWeight", totalNetWeight.add(newNetWeight));
|
||||
|
||||
// 汇总总面积
|
||||
BigDecimal totalArea = summary.getOrDefault("totalArea", BigDecimal.ZERO);
|
||||
BigDecimal newArea = receiptDetail.getTotalArea() != null ? receiptDetail.getTotalArea() : BigDecimal.ZERO;
|
||||
summary.put("totalArea", totalArea.add(newArea));
|
||||
|
||||
// 汇总总体积
|
||||
BigDecimal totalVolume = summary.getOrDefault("totalVolume", BigDecimal.ZERO);
|
||||
BigDecimal newVolume = receiptDetail.getTotalVolume() != null ? receiptDetail.getTotalVolume() : BigDecimal.ZERO;
|
||||
summary.put("totalVolume", totalVolume.add(newVolume));
|
||||
// 汇总总毛重/净重/面积/体积:曾用于同步写入入库单明细,现已不再改入库单 total*,汇总逻辑注释保留
|
||||
// BigDecimal totalGrossWeight = summary.getOrDefault("totalGrossWeight", BigDecimal.ZERO);
|
||||
// BigDecimal newGrossWeight = receiptDetail.getAlreadyReceiptGrossWeight() != null
|
||||
// ? receiptDetail.getAlreadyReceiptGrossWeight()
|
||||
// : (receiptDetail.getTotalGrossWeight() != null ? receiptDetail.getTotalGrossWeight() : BigDecimal.ZERO);
|
||||
// summary.put("totalGrossWeight", totalGrossWeight.add(newGrossWeight));
|
||||
//
|
||||
// BigDecimal totalNetWeight = summary.getOrDefault("totalNetWeight", BigDecimal.ZERO);
|
||||
// BigDecimal newNetWeight = receiptDetail.getAlreadyReceiptNetWeight() != null
|
||||
// ? receiptDetail.getAlreadyReceiptNetWeight()
|
||||
// : (receiptDetail.getTotalNetWeight() != null ? receiptDetail.getTotalNetWeight() : BigDecimal.ZERO);
|
||||
// summary.put("totalNetWeight", totalNetWeight.add(newNetWeight));
|
||||
//
|
||||
// BigDecimal totalArea = summary.getOrDefault("totalArea", BigDecimal.ZERO);
|
||||
// BigDecimal newArea = receiptDetail.getAlreadyReceiptArea() != null
|
||||
// ? receiptDetail.getAlreadyReceiptArea()
|
||||
// : (receiptDetail.getTotalArea() != null ? receiptDetail.getTotalArea() : BigDecimal.ZERO);
|
||||
// summary.put("totalArea", totalArea.add(newArea));
|
||||
//
|
||||
// BigDecimal totalVolume = summary.getOrDefault("totalVolume", BigDecimal.ZERO);
|
||||
// BigDecimal newVolume = receiptDetail.getAlreadyReceiptVolume() != null
|
||||
// ? receiptDetail.getAlreadyReceiptVolume()
|
||||
// : (receiptDetail.getTotalVolume() != null ? receiptDetail.getTotalVolume() : BigDecimal.ZERO);
|
||||
// summary.put("totalVolume", totalVolume.add(newVolume));
|
||||
|
||||
// 递归处理子明细
|
||||
if (!CollectionUtils.isEmpty(receiptDetail.getChildren())) {
|
||||
@@ -712,6 +711,8 @@ public class StockReceiptOrderDomainService {
|
||||
if (abnormal == 1){
|
||||
genInOrderAbnormal(stockReceiptOrderPO);
|
||||
}
|
||||
// 完成收货:同步更新本单全部明细收货状态(与整单收货 entireReceipt 一致,否则 PDA/列表仍显示收货中)
|
||||
updateReceiptMaterialDetailReceiptStatusWhenOrderCompleted(stockReceiptOrderPO, loginUser, userRealName);
|
||||
return stockReceiptOrderService.update(null, new UpdateWrapper<StockReceiptOrder>().lambda()
|
||||
.set(StockReceiptOrder::getStatus, 3)
|
||||
.set(StockReceiptOrder::getAbnormal, abnormal)
|
||||
@@ -721,6 +722,45 @@ public class StockReceiptOrderDomainService {
|
||||
.eq(StockReceiptOrder::getReceiptOrderId, receiptOrderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 收货单完成时:按累计已收与计划数量比较,更新明细 receipt_status(3 正常收完 / 4 少收 / 5 超收)
|
||||
*/
|
||||
private void updateReceiptMaterialDetailReceiptStatusWhenOrderCompleted(StockReceiptOrderPO stockReceiptOrderPO,
|
||||
LoginUser loginUser, String userRealName) {
|
||||
if (stockReceiptOrderPO == null || StringUtils.isBlank(stockReceiptOrderPO.getReceiptOrderNumber())) {
|
||||
return;
|
||||
}
|
||||
Date updateTime = new Date();
|
||||
List<ReceiptMaterialDetail> details = receiptMaterialDetailService.list(
|
||||
new QueryWrapper<ReceiptMaterialDetail>().lambda()
|
||||
.eq(ReceiptMaterialDetail::getReceiptOrderNumber, stockReceiptOrderPO.getReceiptOrderNumber())
|
||||
.eq(ReceiptMaterialDetail::getDelFlag, 1));
|
||||
if (CollectionUtils.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
for (ReceiptMaterialDetail d : details) {
|
||||
d.setReceiptStatus(resolveReceiptDetailStatusOnOrderComplete(d.getAlreadyReceiptQuantity(), d.getQuantity()));
|
||||
d.setUpdateBy(loginUser.getUserid());
|
||||
d.setUpdateByName(userRealName);
|
||||
d.setUpdateTime(updateTime);
|
||||
}
|
||||
receiptMaterialDetailService.updateBatchById(details);
|
||||
}
|
||||
|
||||
/** 3=已收足 4=少收 5=超收 */
|
||||
private static Integer resolveReceiptDetailStatusOnOrderComplete(BigDecimal alreadyReceiptQuantity, BigDecimal quantity) {
|
||||
BigDecimal already = alreadyReceiptQuantity != null ? alreadyReceiptQuantity : BigDecimal.ZERO;
|
||||
BigDecimal plan = quantity != null ? quantity : BigDecimal.ZERO;
|
||||
int cmp = already.compareTo(plan);
|
||||
if (cmp > 0) {
|
||||
return 5;
|
||||
}
|
||||
if (cmp < 0) {
|
||||
return 4;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param receiptOrderId
|
||||
* @return Boolean
|
||||
|
||||
Reference in New Issue
Block a user