diff --git a/src/main/java/com/gaotao/modules/production/controller/ProductionWithdrawalController.java b/src/main/java/com/gaotao/modules/production/controller/ProductionWithdrawalController.java
new file mode 100644
index 0000000..7e288a0
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/controller/ProductionWithdrawalController.java
@@ -0,0 +1,107 @@
+package com.gaotao.modules.production.controller;
+
+import com.gaotao.common.utils.R;
+import com.gaotao.common.validator.ValidatorUtils;
+import com.gaotao.modules.production.entity.dto.*;
+import com.gaotao.modules.production.service.ProductionWithdrawalService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 生产退库控制器
+ *
+ *
主要功能:
+ *
+ * - 从IFS获取工单接收历史
+ * - 扫描HU验证合法性
+ * - 提交生产退库
+ *
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+@Slf4j
+@RestController
+@RequestMapping("production/withdrawal")
+public class ProductionWithdrawalController {
+
+ @Autowired
+ private ProductionWithdrawalService productionWithdrawalService;
+
+ /**
+ * @Author System
+ * @Description 从IFS获取工单接收历史
+ * @Date 2025/01/21
+ * @Param [queryDto]
+ * @return com.gaotao.common.utils.R
+ **/
+ @PostMapping("/getShopOrderReceiveHist")
+ public R getShopOrderReceiveHist(@RequestBody ShopOrderQueryDto queryDto) {
+ try {
+ log.info("收到获取工单接收历史请求: {}", queryDto.getIfsOrderNo());
+ List histList = productionWithdrawalService.getShopOrderReceiveHist(queryDto);
+ return R.ok().put("data", histList);
+ } catch (Exception e) {
+ log.error("获取工单接收历史失败: {}", e.getMessage(), e);
+ return R.error(e.getMessage());
+ }
+ }
+
+ /**
+ * @Author System
+ * @Description 扫描HU验证是否可退库
+ * @Date 2025/01/21
+ * @Param [params]
+ * @return com.gaotao.common.utils.R
+ **/
+ @PostMapping("/scanHuForWithdrawal")
+ public R scanHuForWithdrawal(@RequestBody Map params) {
+ try {
+ String unitId = params.get("unitId");
+ String site = params.get("site");
+
+ log.info("收到扫描HU请求: unitId={}, site={}", unitId, site);
+
+ if (unitId == null || unitId.trim().isEmpty()) {
+ return R.error("HU编码不能为空");
+ }
+
+ if (site == null || site.trim().isEmpty()) {
+ return R.error("工厂编码不能为空");
+ }
+
+ ProductionWithdrawalHuDto huDto = productionWithdrawalService.validateHuForWithdrawal(unitId, site);
+ return R.ok().put("data", huDto);
+ } catch (Exception e) {
+ log.error("扫描HU失败: {}", e.getMessage(), e);
+ return R.error(e.getMessage());
+ }
+ }
+
+ /**
+ * @Author System
+ * @Description 提交生产退库
+ * @Date 2025/01/21
+ * @Param [dto]
+ * @return com.gaotao.common.utils.R
+ **/
+ @PostMapping("/submitWithdrawal")
+ public R submitWithdrawal(@RequestBody ShopOrderWithdrawalDto dto) {
+ ValidatorUtils.validateEntity(dto);
+ try {
+ log.info("收到提交生产退库请求: 工单号={}, 料号={}, HU数量={}",
+ dto.getOrderNo(), dto.getPartNo(), dto.getUnitIds().size());
+
+ String transNo = productionWithdrawalService.submitShopOrderWithdrawal(dto);
+ return R.ok("退库成功").put("data", transNo);
+ } catch (Exception e) {
+ log.error("提交生产退库失败: {}", e.getMessage(), e);
+ return R.error(e.getMessage());
+ }
+ }
+}
+
diff --git a/src/main/java/com/gaotao/modules/production/entity/dto/ProductionWithdrawalHuDto.java b/src/main/java/com/gaotao/modules/production/entity/dto/ProductionWithdrawalHuDto.java
new file mode 100644
index 0000000..62db360
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/entity/dto/ProductionWithdrawalHuDto.java
@@ -0,0 +1,114 @@
+package com.gaotao.modules.production.entity.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 生产退库HU信息DTO
+ *
+ * 用途:扫描HU后返回的HU信息和验证结果
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+@Data
+public class ProductionWithdrawalHuDto {
+
+ /**
+ * HU编码
+ */
+ private String unitId;
+
+ /**
+ * 工厂编码
+ */
+ private String site;
+
+ /**
+ * 单元类型
+ */
+ private String unitType;
+
+ /**
+ * 料号
+ */
+ private String partNo;
+
+ /**
+ * 料号描述
+ */
+ private String partDesc;
+
+ /**
+ * 数量
+ */
+ private BigDecimal qty;
+
+ /**
+ * 批次号
+ */
+ private String batchNo;
+
+ /**
+ * 仓库编码
+ */
+ private String warehouseId;
+
+ /**
+ * 库位编码
+ */
+ private String locationId;
+
+ /**
+ * 状态
+ */
+ private String status;
+
+ /**
+ * 在库标记(Y=在库,N=不在库)
+ */
+ private String inStockFlag;
+
+ /**
+ * 工单号
+ */
+ private String orderNo;
+
+ /**
+ * 下达号
+ */
+ private String lineNo;
+
+ /**
+ * 序列号
+ */
+ private String releaseNo;
+
+ /**
+ * WDR号
+ */
+ private String wdr;
+
+ /**
+ * 创建日期
+ */
+ private Date createdDate;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 是否可退库(Y=可以,N=不可以)
+ */
+ private String canWithdraw;
+
+ /**
+ * 不可退库原因
+ */
+ private String cannotWithdrawReason;
+}
+
diff --git a/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderReceiveHistDto.java b/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderReceiveHistDto.java
new file mode 100644
index 0000000..4e68295
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderReceiveHistDto.java
@@ -0,0 +1,104 @@
+package com.gaotao.modules.production.entity.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 工单接收历史DTO
+ *
+ * 用途:从IFS获取的工单接收历史记录
+ * 数据源:IFS ShopOrderReceiveHist接口
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+@Data
+public class ShopOrderReceiveHistDto {
+
+ /**
+ * 工单号
+ */
+ private String sourceRef1;
+
+ /**
+ * 下达号
+ */
+ private String sourceRef2;
+
+ /**
+ * 序列号
+ */
+ private String sourceRef3;
+
+ /**
+ * 行号
+ */
+ private String sourceRef4;
+
+ /**
+ * 事务ID
+ */
+ private Long transactionId;
+
+ /**
+ * 会计ID
+ */
+ private Long accountingId;
+
+ /**
+ * 工厂编码
+ */
+ private String contract;
+
+ /**
+ * 料号
+ */
+ private String partNo;
+
+ /**
+ * 库位编码
+ */
+ private String locationNo;
+
+ /**
+ * 批次号
+ */
+ private String lotBatchNo;
+
+ /**
+ * 序列号(物料)
+ */
+ private String serialNo;
+
+ /**
+ * WDR号
+ */
+ private String waivDevRejNo;
+
+ /**
+ * 活动序列号
+ */
+ private Integer activitySeq;
+
+ /**
+ * 工程变更级别
+ */
+ private String engChgLevel;
+
+ /**
+ * 接收数量
+ */
+ private BigDecimal quantity;
+
+ /**
+ * 已退数量
+ */
+ private BigDecimal qtyReversed;
+
+ /**
+ * 处理单元ID
+ */
+ private Integer handlingUnitId;
+}
+
diff --git a/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderWithdrawalDto.java b/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderWithdrawalDto.java
new file mode 100644
index 0000000..90d8ba3
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/entity/dto/ShopOrderWithdrawalDto.java
@@ -0,0 +1,129 @@
+package com.gaotao.modules.production.entity.dto;
+
+import lombok.Data;
+
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 生产退库提交DTO
+ *
+ * 用途:提交生产退库的请求参数
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+@Data
+public class ShopOrderWithdrawalDto {
+
+ /**
+ * 工厂编码
+ */
+
+ private String site;
+
+ /**
+ * 工单号
+ */
+
+ private String orderNo;
+
+ /**
+ * 下达号
+ */
+
+ private String releaseNo;
+
+ /**
+ * 序列号
+ */
+
+ private String sequenceNo;
+
+ /**
+ * 料号
+ */
+
+ private String partNo;
+
+ /**
+ * 料号描述
+ */
+ private String partDesc;
+
+ /**
+ * 库位编码
+ */
+
+ private String locationNo;
+
+ /**
+ * 批次号
+ */
+
+ private String batchNo;
+
+ /**
+ * 序列号(物料)
+ */
+ private String serialNo;
+
+ /**
+ * 工程变更级别
+ */
+ private String engChgLevel;
+
+ /**
+ * WDR号
+ */
+ private String wdr;
+
+ /**
+ * 退库数量
+ */
+
+ private BigDecimal transQty;
+
+ /**
+ * 已接收数量(从IFS获取)
+ */
+
+ private BigDecimal qtyReceived;
+
+ /**
+ * 会计ID(从IFS获取)
+ */
+
+ private Long accountingId;
+
+ /**
+ * 事务ID(从IFS获取)
+ */
+
+ private Long transactionId;
+
+ /**
+ * 行号
+ */
+
+ private String lineItemNo;
+
+ /**
+ * 仓库编码
+ */
+
+ private String warehouseId;
+
+ /**
+ * HU单元列表
+ */
+
+ private List unitIds;
+
+ /**
+ * 退库原因
+ */
+ private String withdrawalReason;
+}
+
diff --git a/src/main/java/com/gaotao/modules/production/service/ProductionWithdrawalService.java b/src/main/java/com/gaotao/modules/production/service/ProductionWithdrawalService.java
new file mode 100644
index 0000000..11d3853
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/service/ProductionWithdrawalService.java
@@ -0,0 +1,47 @@
+package com.gaotao.modules.production.service;
+
+import com.gaotao.modules.production.entity.dto.*;
+
+import java.util.List;
+
+/**
+ * 生产退库服务接口
+ *
+ * 主要功能:
+ *
+ * - 从IFS获取工单接收历史记录
+ * - 扫描HU验证合法性
+ * - 执行退库操作并同步IFS
+ *
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+public interface ProductionWithdrawalService {
+
+ /**
+ * 从IFS获取工单接收历史记录
+ *
+ * @param queryDto 查询参数(包含工单号、下达号、序列号)
+ * @return 工单接收历史记录列表
+ */
+ List getShopOrderReceiveHist(ShopOrderQueryDto queryDto);
+
+ /**
+ * 扫描HU验证合法性
+ *
+ * @param unitId HU编码
+ * @param site 工厂编码
+ * @return HU信息和验证结果
+ */
+ ProductionWithdrawalHuDto validateHuForWithdrawal(String unitId, String site);
+
+ /**
+ * 提交生产退库
+ *
+ * @param dto 退库参数
+ * @return 事务号
+ */
+ String submitShopOrderWithdrawal(ShopOrderWithdrawalDto dto);
+}
+
diff --git a/src/main/java/com/gaotao/modules/production/service/impl/ProductionWithdrawalServiceImpl.java b/src/main/java/com/gaotao/modules/production/service/impl/ProductionWithdrawalServiceImpl.java
new file mode 100644
index 0000000..7ec7894
--- /dev/null
+++ b/src/main/java/com/gaotao/modules/production/service/impl/ProductionWithdrawalServiceImpl.java
@@ -0,0 +1,442 @@
+package com.gaotao.modules.production.service.impl;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gaotao.common.exception.XJException;
+import com.gaotao.common.utils.HttpUtils;
+import com.gaotao.common.utils.IfsErrorMessageUtils;
+import com.gaotao.modules.handlingunit.entity.HandlingUnit;
+import com.gaotao.modules.handlingunit.service.HandlingUnitService;
+import com.gaotao.modules.production.entity.dto.*;
+import com.gaotao.modules.production.service.ProductionWithdrawalService;
+import com.gaotao.modules.sys.entity.SysUserEntity;
+import com.gaotao.modules.trans.entity.*;
+import com.gaotao.modules.trans.service.TransDetailService;
+import com.gaotao.modules.trans.service.TransDetailSubService;
+import com.gaotao.modules.trans.service.TransHeaderService;
+import com.gaotao.modules.trans.service.TransNoControlService;
+import com.gaotao.modules.warehouse.service.InventoryStockService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 生产退库服务实现类
+ *
+ * 主要功能:
+ *
+ * - 从IFS获取工单接收历史记录
+ * - 扫描HU验证合法性
+ * - 执行退库操作并同步IFS
+ *
+ *
+ * 关键业务规则:
+ *
+ * - 只能退库inStockFlag='Y'的HU
+ * - HU必须是生产入库创建的(sourceType='SHOP_ORDER_RECEIVE')
+ * - 退库后需要同步更新IFS系统
+ * - 退库后HU状态变更为N,库存扣减
+ *
+ *
+ * @author System
+ * @since 2025-01-21
+ */
+@Slf4j
+@Service("productionWithdrawalService")
+public class ProductionWithdrawalServiceImpl implements ProductionWithdrawalService {
+
+ @Autowired
+ private HandlingUnitService handlingUnitService;
+
+ @Autowired
+ private TransHeaderService transHeaderService;
+
+ @Autowired
+ private TransDetailService transDetailService;
+
+ @Autowired
+ private TransDetailSubService transDetailSubService;
+
+ @Autowired
+ private InventoryStockService inventoryStockService;
+
+ @Autowired
+ private TransNoControlService transNoService;
+
+ @Value("${custom.ifs-url}")
+ private String ifsUrl;
+
+ @Value("${custom.ifs-ifsDBName}")
+ private String ifsDBName;
+
+ @Value("${custom.ifs-domainUserID}")
+ private String domainUserID;
+
+ /**
+ * @Author System
+ * @Description 从IFS获取工单接收历史记录
+ * @Date 2025/01/21
+ * @Param [queryDto]
+ * @return List
+ **/
+ @Override
+ public List getShopOrderReceiveHist(ShopOrderQueryDto queryDto) {
+ try {
+ log.info("=== 开始从IFS获取工单接收历史 ===");
+ log.info("工单号: {}, 下达号: {}, 序列号: {}",
+ queryDto.getIfsOrderNo(), queryDto.getIfsReleaseNo(), queryDto.getIfsSequenceNo());
+
+ // 构建IFS接口参数
+ Map params = new HashMap<>();
+ params.put("ifsDBName", queryDto.getIfsDBName() != null ? queryDto.getIfsDBName() : ifsDBName);
+ params.put("domainUserID", queryDto.getDomainUserID() != null ? queryDto.getDomainUserID() : domainUserID);
+ params.put("ifsSiteID", queryDto.getIfsSiteID());
+ params.put("ifsOrderNo", queryDto.getIfsOrderNo());
+ params.put("ifsReleaseNo", queryDto.getIfsReleaseNo());
+ params.put("ifsSequenceNo", queryDto.getIfsSequenceNo());
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ String jsonBody = objectMapper.writeValueAsString(params);
+ log.info("IFS请求参数: {}", jsonBody);
+
+ // 调用IFS接口
+ String ifsResponse = HttpUtils.doGetWithBody(ifsUrl + "ShopOrderReceiveHist", jsonBody, null);
+ log.info("IFS响应: {}", ifsResponse);
+
+ // 解析响应数据
+ List