Browse Source

refactor(order): 调整订单明细重复检查逻辑

- 移除 countByOrderAndItem 方法中的 item 参数
- 更新 PODetailMapper.xml 中的 SQL 查询条件,移除 item 字段过滤
- 修改 POdetailServiceImpl 中的重复检查逻辑,仅使用订单号和站点进行验证
- 更新重复项提示信息,移除款号显示
- 在查询条件中新增 PO 编号、客户和采购员筛选功能
- 添加 SKU 查询条件支持
master
qiankanghui 2 months ago
parent
commit
a16eea1b37
  1. 4
      src/main/java/com/xujie/modules/order/dao/PODetailMapper.java
  2. 7
      src/main/java/com/xujie/modules/order/service/Impl/PODetailServiceImpl.java
  3. 5
      src/main/resources/mapper/order/PODetailMapper.xml

4
src/main/java/com/xujie/modules/order/dao/PODetailMapper.java

@ -38,10 +38,8 @@ public interface PODetailMapper extends BaseMapper<PODetail> {
* 检查订单明细是否已存在(用于防止重复上传) * 检查订单明细是否已存在(用于防止重复上传)
* @param orderNo 订单号 * @param orderNo 订单号
* @param site 工厂编码 * @param site 工厂编码
* @param item 款号
* @return 存在的记录数 * @return 存在的记录数
*/ */
Integer countByOrderAndItem(@Param("orderNo") String orderNo, Integer countByOrderAndItem(@Param("orderNo") String orderNo,
@Param("site") String site,
@Param("item") String item);
@Param("site") String site);
} }

7
src/main/java/com/xujie/modules/order/service/Impl/PODetailServiceImpl.java

@ -227,12 +227,11 @@ public class PODetailServiceImpl extends ServiceImpl<PODetailMapper, PODetail> i
// ========== 2. 检查是否重复 ========== // ========== 2. 检查是否重复 ==========
String poNo = excelDTO.getPoNo(); String poNo = excelDTO.getPoNo();
String item = excelDTO.getItem();
// 检查数据库中是否已存在相同的订单号+款号使用part_no字段
Integer existCount = baseMapper.countByOrderAndItem(poNo, site, item);
// 检查数据库中是否已存在相同的订单号使用订单号+站点判断
Integer existCount = baseMapper.countByOrderAndItem(poNo, site);
if (existCount != null && existCount > 0) { if (existCount != null && existCount > 0) {
duplicateItems.add("第" + rowNum + "行 - 订单号: " + poNo + ", 款号: " + item);
duplicateItems.add("第" + rowNum + "行 - 订单号: " + poNo);
continue; // 跳过重复数据继续处理下一条 continue; // 跳过重复数据继续处理下一条
} }

5
src/main/resources/mapper/order/PODetailMapper.xml

@ -229,6 +229,9 @@
where pod.site = '${query.site}' where pod.site = '${query.site}'
<if test="query.poHeaderId != null and query.poHeaderId != '' "> and pod.po_header_id like '%${query.poHeaderId}%'</if> <if test="query.poHeaderId != null and query.poHeaderId != '' "> and pod.po_header_id like '%${query.poHeaderId}%'</if>
<if test="query.orderNo != null and query.orderNo != '' "> and pod.order_no like '%${query.orderNo}%'</if> <if test="query.orderNo != null and query.orderNo != '' "> and pod.order_no like '%${query.orderNo}%'</if>
<if test="query.poNo != null and query.poNo != '' "> and poh.po_no like '%${query.poNo}%'</if>
<if test="query.customer != null and query.customer != '' "> and poh.c_customer like '%${query.customer}%'</if>
<if test="query.buyer != null and query.buyer != '' "> and poh.buyer like '%${query.buyer}%'</if>
<if test="query.itemNo != null "> and pod.item_no = '${query.itemNo}'</if> <if test="query.itemNo != null "> and pod.item_no = '${query.itemNo}'</if>
<if test="query.partNo != null and query.partNo != '' "> and pod.part_no like '%${query.partNo}%'</if> <if test="query.partNo != null and query.partNo != '' "> and pod.part_no like '%${query.partNo}%'</if>
<if test="query.status != null and query.status != '' "> and pod.status like '%${query.status}%'</if> <if test="query.status != null and query.status != '' "> and pod.status like '%${query.status}%'</if>
@ -306,6 +309,7 @@
<if test="query.needDate != null and query.needDate != '' "> and pod.need_date like '%${query.needDate}%'</if> <if test="query.needDate != null and query.needDate != '' "> and pod.need_date like '%${query.needDate}%'</if>
<if test="query.inspectMethod != null and query.inspectMethod != '' "> and pod.inspect_method like '%${query.inspectMethod}%'</if> <if test="query.inspectMethod != null and query.inspectMethod != '' "> and pod.inspect_method like '%${query.inspectMethod}%'</if>
<if test="query.invNotifyQty != null and query.invNotifyQty != '' "> and pod.inv_notify_qty like '%${query.invNotifyQty}%'</if> <if test="query.invNotifyQty != null and query.invNotifyQty != '' "> and pod.inv_notify_qty like '%${query.invNotifyQty}%'</if>
<if test="query.sku != null and query.sku != '' "> and p.sku like '%${query.sku}%'</if>
order by pod.id desc order by pod.id desc
</select> </select>
@ -497,7 +501,6 @@
FROM PODetail FROM PODetail
WHERE order_no = #{orderNo} WHERE order_no = #{orderNo}
AND site = #{site} AND site = #{site}
AND item = #{item}
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save