Browse Source

2025-10-15

销售发货装箱的盒清单和箱清单新增删除时更新ori_parent_roll_no和ori_parent_roll_type
master
fengyuan_yang 3 months ago
parent
commit
392b71766f
  1. 7
      src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java
  2. 17
      src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java
  3. 19
      src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

7
src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java

@ -46,9 +46,10 @@ public interface BoxForNotificationMapper {
// 盒清单相关方法
List<SoReceiveCasesData> searchSoReceiveCasesData(SoReceiveCasesData data);
void deleteSoReceiveCasesData(SoReceiveCasesData data);
List<SoReceiveCasesData> validateCaseRoll(@Param("site") String site, @Param("partNo") String partNo, @Param("rollNo") String rollNo, @Param("casesNo") String casesNo);
void saveSoReceiveCases(SoReceiveCasesData data);
void updateStockParentRollType(@Param("rollNo") String rollNo, @Param("parentRollNo") String parentRollNo, @Param("parentRollType") String parentRollType, @Param("site") String site, @Param("buNo") String buNo);
List<SoReceiveCasesData> validateCaseRoll(@Param("site") String site, @Param("partNo") String partNo, @Param("rollNo") String rollNo, @Param("casesNo") String casesNo);
void saveSoReceiveCases(SoReceiveCasesData data);
void updateStockParentRollType(@Param("rollNo") String rollNo, @Param("parentRollNo") String parentRollNo, @Param("parentRollType") String parentRollType, @Param("site") String site, @Param("buNo") String buNo);
void restoreStockParentRollType(@Param("rollNo") String rollNo, @Param("site") String site, @Param("buNo") String buNo);
/**
* 查询出库通知单主记录关联明细

17
src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java

@ -132,15 +132,16 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService
}
List<OutboundNotificationDetailEntity> checkPartNo=boxForNotificationMapper.searchOutboundNotificationDetail(box.getSite(),box.getBuNo(),box.getOrderNo());
// 添加校验逻辑检查checkPartNo中是否至少有一行记录的partNo与卷的partNo相同
boolean partNoMatch = checkPartNo.stream()
.anyMatch(detail -> detail.getPartNo() != null && detail.getPartNo().equals(stock.getPartNo()));
boolean partNoMatch = checkPartNo.stream().anyMatch(detail -> detail.getPartNo() != null && detail.getPartNo().equals(stock.getPartNo()));
if (!partNoMatch) {
throw new RuntimeException("该卷的物料编号与销售发货单中的物料编号不匹配");
}
if(stock.getBatchNo()==null||"".equals(stock.getBatchNo())){
throw new RuntimeException("该卷的批次号为空,无法操作");
}
//---*批号的物料可以通吃
if(!"*".equals(stock.getBatchNo())) {
// 校验批次号只要有一行partNo和batchNo都匹配即可
@ -212,8 +213,8 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService
throw new RuntimeException("该卷不在指定的箱子内,无法删除");
}
// 3. 删除卷的上级标签
boxForNotificationMapper.updateStockParentRollNo(data.getFinalRollNo(), data.getFinalRollNo(), data.getSite(), data.getBuNo());
// 3. 恢复卷的原始上级标签 ori_parent_roll_no ori_parent_roll_type 的值赋回给 parent_roll_no parent_roll_type
boxForNotificationMapper.restoreStockParentRollType(data.getFinalRollNo(), data.getSite(), data.getBuNo());
// 4. 删除箱子中的卷记录
boxForNotificationMapper.deleteBoxRoll(data);
boxForNotificationMapper.updateBoxRollQty(data.getSite(),data.getBuNo(),data.getBoxNo());
@ -242,18 +243,16 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService
throw new RuntimeException("参数不完整");
}
// 删除记录前需要将对应的库存卷的上级标签恢复为自己的卷号
// 删除记录前需要将对应的库存卷的上级标签 ori_parent_roll_no ori_parent_roll_type 恢复
SoReceiveCasesData caseData = boxForNotificationMapper.searchSoReceiveCasesData(data).stream()
.filter(item -> item.getId().equals(data.getId()))
.findFirst()
.orElse(null);
if (caseData != null) {
// 恢复库存的上级标签
boxForNotificationMapper.updateStockParentRollType(
caseData.getRollNo(),
// 恢复库存的原始上级标签 ori_parent_roll_no ori_parent_roll_type 的值赋回给 parent_roll_no parent_roll_type
boxForNotificationMapper.restoreStockParentRollType(
caseData.getRollNo(),
null,
data.getSite(),
data.getBuNo()
);

19
src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

@ -106,7 +106,10 @@
<update id="updateStockParentRollNo">
UPDATE inventory_stock
SET parent_roll_no = #{parentRollNo} , parent_roll_type = '箱标签'
SET ori_parent_roll_no = parent_roll_no,
ori_parent_roll_type = parent_roll_type,
parent_roll_no = #{parentRollNo},
parent_roll_type = '箱标签'
WHERE roll_no = #{rollNo}
AND site = #{site}
AND bu_no = #{buNo}
@ -256,13 +259,25 @@
<update id="updateStockParentRollType">
UPDATE inventory_stock
SET parent_roll_no = #{parentRollNo},
SET ori_parent_roll_no = parent_roll_no,
ori_parent_roll_type = parent_roll_type,
parent_roll_no = #{parentRollNo},
parent_roll_type = #{parentRollType}
WHERE roll_no = #{rollNo}
AND site = #{site}
AND bu_no = #{buNo}
</update>
<!-- 恢复库存的原始上级标签 -->
<update id="restoreStockParentRollType">
UPDATE inventory_stock
SET parent_roll_no = ori_parent_roll_no,
parent_roll_type = ori_parent_roll_type
WHERE roll_no = #{rollNo}
AND site = #{site}
AND bu_no = #{buNo}
</update>
<!-- 查询出库通知单主记录(关联明细) -->
<select id="searchOutboundNotificationWithDetail" resultType="com.gaotao.modules.outboundNotification.entity.vo.OutboundNotificationHeadVo">
SELECT

Loading…
Cancel
Save