From 9aaf1e6c251e5808dd28b6a9f7aa9c4fb6c2d602 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Fri, 17 Oct 2025 16:22:18 +0800 Subject: [PATCH] =?UTF-8?q?IFS=E5=BA=93=E5=AD=98=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../factory/dao/PartAttributeMapper.java | 9 ++--- .../modules/factory/entity/PartAttribute.java | 15 +++++++- .../impl/IfsInventoryInitServiceImpl.java | 36 ++++++++++--------- .../mapper/factory/PartAttributeMapper.xml | 4 +-- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/gaotao/modules/factory/dao/PartAttributeMapper.java b/src/main/java/com/gaotao/modules/factory/dao/PartAttributeMapper.java index 8cf8ad7..807fbbb 100644 --- a/src/main/java/com/gaotao/modules/factory/dao/PartAttributeMapper.java +++ b/src/main/java/com/gaotao/modules/factory/dao/PartAttributeMapper.java @@ -8,6 +8,7 @@ import com.gaotao.modules.factory.entity.dto.PartAttributeQueryDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -15,19 +16,19 @@ import java.util.List; */ @Mapper public interface PartAttributeMapper extends BaseMapper { - + /** * 分页查询料件属性列表 */ IPage getPartAttributeList(Page page, @Param("params") PartAttributeQueryDto queryDto); - + /** * 查询料件属性列表(不分页) */ List getPartAttributeList(@Param("params") PartAttributeQueryDto queryDto); - + /** * 根据站点和料号查询料件属性 */ - PartAttribute getPartAttributeByKey(@Param("site") String site, @Param("partNo") String partNo); + PartAttribute getPartAttributeByKey(@Param("site") String site, @Param("partNo") String partNo, @Param("height") BigDecimal height); } diff --git a/src/main/java/com/gaotao/modules/factory/entity/PartAttribute.java b/src/main/java/com/gaotao/modules/factory/entity/PartAttribute.java index 0eb9636..2c0fde8 100644 --- a/src/main/java/com/gaotao/modules/factory/entity/PartAttribute.java +++ b/src/main/java/com/gaotao/modules/factory/entity/PartAttribute.java @@ -57,5 +57,18 @@ public class PartAttribute { */ private BigDecimal diameter; - private String isCommonlyUsed; // 是否常用 + /** + * 是否常用 (Y/N) + */ + private String isCommonlyUsed; + + /** + * HU标志 + */ + private String handlingUnitFlag; + + /** + * 托盘类型 + */ + private String palletType; } diff --git a/src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java b/src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java index 798c58e..b86d69f 100644 --- a/src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java +++ b/src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java @@ -554,7 +554,7 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { *
  • R列: 最大直径max -> diameter(直径mm)
  • *
  • S列: HU -> handling_unit_flag(HU标志)
  • *
  • T列: 密封性 -> is_commonly_used(是否常用)
  • - *
  • U列: A02型号 -> (暂不处理)
  • + *
  • U列: A02型号 -> pallet_type(托盘类型)
  • * *

    默认值:print_qty=0, inventory_stock_ifs.length=0, inventory_stock_ifs.width=0

    *

    注意:

    @@ -617,7 +617,7 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { String diameterStr = getValue(data, 17); // R列: 最大直径max String handlingUnitFlag = getValue(data, 18); // S列: HU String isCommonlyUsed = getValue(data, 19); // T列: 密封性 - // U列(20): A02型号 - 暂不处理 + String palletType = getValue(data, 20); // U列: A02型号(托盘类型) // 检查是否为空行(所有必填字段都为空) if (StringUtils.isBlank(rowSite) && StringUtils.isBlank(partNo) @@ -697,7 +697,9 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { || StringUtils.isNotBlank(widthStr) || StringUtils.isNotBlank(heightStr) || StringUtils.isNotBlank(diameterStr) - || StringUtils.isNotBlank(isCommonlyUsed); + || StringUtils.isNotBlank(handlingUnitFlag) + || StringUtils.isNotBlank(isCommonlyUsed) + || StringUtils.isNotBlank(palletType); if (hasPartAttributeData) { PartAttribute partAttribute = new PartAttribute(); @@ -708,9 +710,11 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { partAttribute.setWeight(parseBigDecimal(weightStr)); partAttribute.setLength(parseBigDecimal(lengthStr)); partAttribute.setWidth(parseBigDecimal(widthStr)); - partAttribute.setHeight(parseBigDecimal(heightStr)); + partAttribute.setHeight(parseBigDecimal(heightStr)!=null ? parseBigDecimal(heightStr) : BigDecimal.ZERO); // 高度不能为空,默认0 partAttribute.setDiameter(parseBigDecimal(diameterStr)); + partAttribute.setHandlingUnitFlag(normalizeYN(handlingUnitFlag)); partAttribute.setIsCommonlyUsed(normalizeYN(isCommonlyUsed)); + partAttribute.setPalletType(palletType); rowData.put("part_attribute", partAttribute); } @@ -823,9 +827,7 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { try { // 检查是否已存在 PartAttribute existing = partAttributeMapper.getPartAttributeByKey( - partAttribute.getSite(), - partAttribute.getPartNo() - ); + partAttribute.getSite(), partAttribute.getPartNo(), partAttribute.getHeight()); if (existing != null) { log.debug("料件属性已存在,跳过: site={}, partNo={}", @@ -887,7 +889,7 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { /** * 批量删除IFS库存数据(真实删除) - * + * * @param items 删除项列表 * @return 删除的记录数 */ @@ -895,9 +897,9 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { @Transactional public int batchDeleteInventory(List> items) { log.info("=== 开始批量删除IFS库存 === 删除项数量: {}", items.size()); - + int deletedCount = 0; - + for (Map item : items) { try { String site = item.get("site"); @@ -906,15 +908,15 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { String batchNo = item.get("batchNo"); String locationId = item.get("locationId"); String wdr = item.get("wdr"); - - log.info("删除记录: site={}, warehouse={}, partNo={}, batchNo={}, location={}, wdr={}", + + log.info("删除记录: site={}, warehouse={}, partNo={}, batchNo={}, location={}, wdr={}", site, warehouseId, partNo, batchNo, locationId, wdr); - + // 执行删除 String deleteSql = "DELETE FROM inventory_stock_ifs " + "WHERE site = ? AND ISNULL(warehouse_id, '') = ISNULL(?, '') AND part_no = ? " + "AND batch_no = ? AND location_id = ? AND ISNULL(wdr, '') = ISNULL(?, '')"; - + int rows = jdbcTemplate.update(deleteSql, site, warehouseId, @@ -923,16 +925,16 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService { locationId, wdr ); - + deletedCount += rows; log.debug("删除成功: 影响行数={}", rows); - + } catch (Exception e) { log.error("删除记录失败: {}", e.getMessage(), e); throw new RuntimeException("删除失败: " + e.getMessage()); } } - + log.info("=== 批量删除完成 === 总删除记录数: {}", deletedCount); return deletedCount; } diff --git a/src/main/resources/mapper/factory/PartAttributeMapper.xml b/src/main/resources/mapper/factory/PartAttributeMapper.xml index e2a93ca..0929c97 100644 --- a/src/main/resources/mapper/factory/PartAttributeMapper.xml +++ b/src/main/resources/mapper/factory/PartAttributeMapper.xml @@ -45,7 +45,7 @@ - - WHERE site = #{site} AND part_no = #{partNo} + WHERE site = #{site} AND part_no = #{partNo} and height=#{height}