From 89dcf021bcb3c3393e03e2ebcb4b26e54aa360ad Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期一, 26 五月 2025 16:35:01 +0800
Subject: [PATCH] 工具管理-出库流水代码生成及工具出库接口

---
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutStoreDetailController.java    |  179 ++++++++++++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutBillStatus.java                    |   21 -
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/ToolCirculationStatus.java            |   38 ++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java  |  175 ++++++++++++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutboundOrderController.java     |    9 
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/dto/OutBoundRequestDto.java          |   19 +
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/xml/OutStoreDetailMapper.xml         |   79 +++++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutboundOrderService.java          |    3 
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutStoreDetailServiceImpl.java |   36 ++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutboundDetail.java                  |    6 
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutStoreDetail.java                  |   87 ++++++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutStoreDetailService.java         |   20 +
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/vo/OutStoreDetailVo.java             |   78 +++++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutStorehouseType.java                |   29 ++
 lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/OutStoreDetailMapper.java            |   25 +
 15 files changed, 778 insertions(+), 26 deletions(-)

diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutStoreDetailController.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutStoreDetailController.java
new file mode 100644
index 0000000..11f95c5
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutStoreDetailController.java
@@ -0,0 +1,179 @@
+package org.jeecg.modules.tms.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.tms.entity.OutStoreDetail;
+import org.jeecg.modules.tms.entity.vo.OutStoreDetailVo;
+import org.jeecg.modules.tms.service.IOutStoreDetailService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+
+ /**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Api(tags="宸ュ叿鍑哄簱娴佹按")
+@RestController
+@RequestMapping("/tms/outStoreDetail")
+@Slf4j
+public class OutStoreDetailController extends JeecgController<OutStoreDetail, IOutStoreDetailService> {
+	@Autowired
+	private IOutStoreDetailService outStoreDetailService;
+	
+	/**
+	 * 鍒嗛〉鍒楄〃鏌ヨ
+	 *
+	 * @param outStoreDetail
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-鍒嗛〉鍒楄〃鏌ヨ")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-鍒嗛〉鍒楄〃鏌ヨ", notes="宸ュ叿鍑哄簱娴佹按-鍒嗛〉鍒楄〃鏌ヨ")
+	@GetMapping(value = "/list")
+	public Result<IPage<OutStoreDetailVo>> queryPageList(OutStoreDetail outStoreDetail,
+														 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														 HttpServletRequest req) {
+		Map<String, String[]> parameterMap = req.getParameterMap();
+		QueryWrapper<OutStoreDetail> queryWrapper = QueryGenerator.initQueryWrapper(outStoreDetail, parameterMap);
+		Page<OutStoreDetailVo> page = new Page<>(pageNo, pageSize);
+		IPage<OutStoreDetailVo> pageList = outStoreDetailService.queryPageList(page, parameterMap);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   娣诲姞
+	 *
+	 * @param outStoreDetail
+	 * @return
+	 */
+	@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-娣诲姞")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-娣诲姞", notes="宸ュ叿鍑哄簱娴佹按-娣诲姞")
+	//@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody OutStoreDetail outStoreDetail) {
+		outStoreDetailService.save(outStoreDetail);
+		return Result.OK("娣诲姞鎴愬姛锛�");
+	}
+	
+	/**
+	 *  缂栬緫
+	 *
+	 * @param outStoreDetail
+	 * @return
+	 */
+	@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-缂栬緫")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-缂栬緫", notes="宸ュ叿鍑哄簱娴佹按-缂栬緫")
+	//@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody OutStoreDetail outStoreDetail) {
+		outStoreDetailService.updateById(outStoreDetail);
+		return Result.OK("缂栬緫鎴愬姛!");
+	}
+	
+	/**
+	 *   閫氳繃id鍒犻櫎
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-閫氳繃id鍒犻櫎")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-閫氳繃id鍒犻櫎", notes="宸ュ叿鍑哄簱娴佹按-閫氳繃id鍒犻櫎")
+	//@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		outStoreDetailService.removeById(id);
+		return Result.OK("鍒犻櫎鎴愬姛!");
+	}
+	
+	/**
+	 *  鎵归噺鍒犻櫎
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-鎵归噺鍒犻櫎")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-鎵归噺鍒犻櫎", notes="宸ュ叿鍑哄簱娴佹按-鎵归噺鍒犻櫎")
+	//@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.outStoreDetailService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("鎵归噺鍒犻櫎鎴愬姛!");
+	}
+	
+	/**
+	 * 閫氳繃id鏌ヨ
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "宸ュ叿鍑哄簱娴佹按-閫氳繃id鏌ヨ")
+	@ApiOperation(value="宸ュ叿鍑哄簱娴佹按-閫氳繃id鏌ヨ", notes="宸ュ叿鍑哄簱娴佹按-閫氳繃id鏌ヨ")
+	@GetMapping(value = "/queryById")
+	public Result<OutStoreDetail> queryById(@RequestParam(name="id",required=true) String id) {
+		OutStoreDetail outStoreDetail = outStoreDetailService.getById(id);
+		if(outStoreDetail==null) {
+			return Result.error("鏈壘鍒板搴旀暟鎹�");
+		}
+		return Result.OK(outStoreDetail);
+	}
+
+    /**
+    * 瀵煎嚭excel
+    *
+    * @param request
+    * @param outStoreDetail
+    */
+    //@RequiresPermissions("org.jeecg.modules:tms_out_store_detail:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, OutStoreDetail outStoreDetail) {
+        return super.exportXls(request, outStoreDetail, OutStoreDetail.class, "宸ュ叿鍑哄簱娴佹按");
+    }
+
+    /**
+      * 閫氳繃excel瀵煎叆鏁版嵁
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("tms_out_store_detail:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, OutStoreDetail.class);
+    }
+
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutboundOrderController.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutboundOrderController.java
index bed72c4..cb806cf 100644
--- a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutboundOrderController.java
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/OutboundOrderController.java
@@ -13,6 +13,7 @@
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.TranslateDictTextUtils;
 import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto;
+import org.jeecg.modules.tms.entity.dto.OutBoundRequestDto;
 import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto;
 import org.jeecg.modules.tms.entity.vo.OutboundDetailVo;
 import org.jeecg.modules.tms.enums.OutBillStatus;
@@ -177,6 +178,14 @@
 		return Result.OK("鎿嶄綔鎴愬姛");
 	 }
 
+	 @AutoLog(value = "鐢宠鍗曟柟寮忓嚭搴�")
+	 @ApiOperation(value = "鐢宠鍗曟柟寮忓嚭搴�", notes = "鐢宠鍗曟柟寮忓嚭搴�")
+	 @PostMapping(value = "/outBound")
+	 public Result<?> outBound(@RequestBody List<OutBoundRequestDto> outBoundRequestList) {
+		outboundOrderService.outBound(outBoundRequestList);
+		return Result.OK("鍑哄簱鎴愬姛");
+	 }
+
     /**
      * 閫氳繃id鍒犻櫎
      * @param id
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutStoreDetail.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutStoreDetail.java
new file mode 100644
index 0000000..02d5c01
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutStoreDetail.java
@@ -0,0 +1,87 @@
+package org.jeecg.modules.tms.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Data
+@TableName("tms_out_store_detail")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="tms_out_store_detail瀵硅薄", description="宸ュ叿鍑哄簱娴佹按")
+public class OutStoreDetail implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**涓婚敭*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "涓婚敭")
+    private String id;
+	/**宸ュ叿缂栫爜*/
+	@Excel(name = "宸ュ叿缂栫爜", width = 15)
+    @ApiModelProperty(value = "宸ュ叿缂栫爜")
+    private String toolCode;
+	/**宸ュ叿缂栧彿*/
+	@Excel(name = "宸ュ叿缂栧彿", width = 15)
+    @ApiModelProperty(value = "宸ュ叿缂栧彿")
+    private String toolId;
+	/**鍑哄簱绫诲瀷*/
+	@Excel(name = "鍑哄簱绫诲瀷", width = 15)
+    @ApiModelProperty(value = "鍑哄簱绫诲瀷")
+    private String outStorehouseType;
+	/**搴撲綅鍙�*/
+	@Excel(name = "搴撲綅鍙�", width = 15)
+    @ApiModelProperty(value = "搴撲綅鍙�")
+    private String goodsShelvesCode;
+	/**鍑哄簱鏁伴噺*/
+	@Excel(name = "鍑哄簱鏁伴噺", width = 15)
+    @ApiModelProperty(value = "鍑哄簱鏁伴噺")
+    private BigDecimal outNumber;
+	/**鍑哄簱鐢宠鍗曞彿*/
+	@Excel(name = "鍑哄簱鐢宠鍗曞彿", width = 15)
+    @ApiModelProperty(value = "鍑哄簱鐢宠鍗曞彿")
+    private String outStorehouseId;
+	/**鍑哄簱鎿嶄綔鏂瑰紡;1.鎸夌敵璇峰崟 2.鎵嬪伐鎿嶄綔*/
+	@Excel(name = "鍑哄簱鎿嶄綔鏂瑰紡;1.鎸夌敵璇峰崟 2.鎵嬪伐鎿嶄綔", width = 15)
+    @ApiModelProperty(value = "鍑哄簱鎿嶄綔鏂瑰紡;1.鎸夌敵璇峰崟 2.鎵嬪伐鎿嶄綔")
+    private String operateType;
+	/**绉熸埛鍙�*/
+	@Excel(name = "绉熸埛鍙�", width = 15)
+    @ApiModelProperty(value = "绉熸埛鍙�")
+    private String tenantId;
+	/**鍒涘缓浜�*/
+    @ApiModelProperty(value = "鍒涘缓浜�")
+    private String createBy;
+	/**鍒涘缓鏃堕棿*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    private Date createTime;
+	/**鏇存柊浜�*/
+    @ApiModelProperty(value = "鏇存柊浜�")
+    private String updateBy;
+	/**鏇存柊鏃堕棿*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @ApiModelProperty(value = "鏇存柊鏃堕棿")
+    private Date updateTime;
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutboundDetail.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutboundDetail.java
index 21ca411..23b6d36 100644
--- a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutboundDetail.java
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/OutboundDetail.java
@@ -36,11 +36,11 @@
     private String outStorehouseId;
 	/**鍒�鍏风紪鐮�*/
 	@Excel(name = "鍒�鍏风紪鐮�", width = 15)
-    @ApiModelProperty(value = "鍒�鍏风紪鐮�")
+    @ApiModelProperty(value = "鍒�鍏风紪鐮�(tms_base_tool琛ㄤ富閿甶d)")
     private String toolCode;
 	/**鍒�鍏风紪鍙�*/
 	@Excel(name = "鍒�鍏风紪鍙�", width = 15)
-    @ApiModelProperty(value = "鍒�鍏风紪鍙�")
+    @ApiModelProperty(value = "鍒�鍏风紪鍙�(鍒�鍏峰敮涓�缂栫爜锛岀鍒版妸鐨勫睘鎬�)")
     private String toolId;
 	/**鐢宠鍑哄簱鏁伴噺*/
 	@Excel(name = "鐢宠鍑哄簱鏁伴噺", width = 15)
@@ -69,7 +69,7 @@
 	@Excel(name = "鍑哄簱鐘舵��;1.鏈嚭搴擄紱2.閮ㄥ垎鍑哄簱锛�3.鍑哄簱瀹屾垚", width = 15)
     @ApiModelProperty(value = "鍑哄簱鐘舵��;1.鏈嚭搴擄紱2.閮ㄥ垎鍑哄簱锛�3.鍑哄簱瀹屾垚")
     @Dict(dicCode = "out_storehouse_status")
-    private Integer status;
+    private String status;
 	/**绉熸埛鍙�*/
 	@Excel(name = "绉熸埛鍙�", width = 15)
     @ApiModelProperty(value = "绉熸埛鍙�")
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/dto/OutBoundRequestDto.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/dto/OutBoundRequestDto.java
new file mode 100644
index 0000000..9d5f862
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/dto/OutBoundRequestDto.java
@@ -0,0 +1,19 @@
+package org.jeecg.modules.tms.entity.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class OutBoundRequestDto {
+    //鍑哄簱鐢宠鍗昳d
+    @ApiModelProperty(value = "鍑哄簱鐢宠鍗昳d")
+    private String outBoundOrderId;
+    //鍑哄簱鐢宠鏄庣粏id
+    @ApiModelProperty(value = "鍑哄簱鐢宠鏄庣粏id")
+    private String outboundDetailId;
+    //鍑哄簱鏁伴噺
+    @ApiModelProperty(value = "鍑哄簱鏁伴噺")
+    private BigDecimal outboundQuantity;
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/vo/OutStoreDetailVo.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/vo/OutStoreDetailVo.java
new file mode 100644
index 0000000..0b201b2
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/entity/vo/OutStoreDetailVo.java
@@ -0,0 +1,78 @@
+package org.jeecg.modules.tms.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="宸ュ叿鍑哄簱娴佹按椤甸潰灞曠ず瀵硅薄灏佽", description="宸ュ叿鍑哄簱娴佹按椤甸潰灞曠ず瀵硅薄灏佽")
+public class OutStoreDetailVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**涓婚敭*/
+    @ApiModelProperty(value = "涓婚敭")
+    private String id;
+	/**宸ュ叿缂栫爜*/
+    @ApiModelProperty(value = "宸ュ叿缂栫爜")
+    private String toolCode;
+	/**宸ュ叿缂栧彿*/
+    @ApiModelProperty(value = "宸ュ叿缂栧彿")
+    private String toolId;
+	/**鍑哄簱绫诲瀷*/
+    @Dict(dicCode = "out_storehouse_type")
+    @ApiModelProperty(value = "鍑哄簱绫诲瀷")
+    private String outStorehouseType;
+	/**搴撲綅鍙�*/
+    @ApiModelProperty(value = "搴撲綅鍙�")
+    private String goodsShelvesCode;
+	/**鍑哄簱鏁伴噺*/
+    @ApiModelProperty(value = "鍑哄簱鏁伴噺")
+    private BigDecimal outNumber;
+	/**鍑哄簱鐢宠鍗曞彿*/
+    @ApiModelProperty(value = "鍑哄簱鐢宠鍗曞彿")
+    private String outStorehouseId;
+	/**鍑哄簱鎿嶄綔鏂瑰紡;1.鎸夌敵璇峰崟 2.鎵嬪伐鎿嶄綔*/
+    @ApiModelProperty(value = "鍑哄簱鎿嶄綔鏂瑰紡;1.鎸夌敵璇峰崟 2.鎵嬪伐鎿嶄綔")
+    private String operateType;
+	/**鍒涘缓浜�*/
+    @ApiModelProperty(value = "鍒涘缓浜�")
+    private String createBy;
+	/**鍒涘缓鏃堕棿*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    private Date createTime;
+    /**涓枃鍚嶇О*/
+    @ApiModelProperty(value = "涓枃鍚嶇О")
+    private String chineseName;
+    /**鍨嬪彿/鍥惧彿*/
+    @ApiModelProperty(value = "鍨嬪彿/鍥惧彿")
+    private String toolModel;
+    /**鍒�鍏锋潗鏂�*/
+    @ApiModelProperty(value = "鍒�鍏锋潗鏂�")
+    private String toolMaterial;
+    /**闆朵欢鏉愭枡*/
+    @ApiModelProperty(value = "闆朵欢鏉愭枡")
+    private String partMaterial;
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutBillStatus.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutBillStatus.java
index 7ead9ae..e7be0d2 100644
--- a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutBillStatus.java
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutBillStatus.java
@@ -1,11 +1,14 @@
 package org.jeecg.modules.tms.enums;
 
 
+import lombok.Getter;
+
 import java.util.Objects;
 
 /**
  * 鍑哄簱鍗曠姸鎬佹灇涓剧被
  */
+@Getter
 public enum OutBillStatus {
     /**
      * 鑽夌鐘舵�侊紝鍊间负1
@@ -39,24 +42,6 @@
     OutBillStatus(String value, String description) {
         this.value = value;
         this.description = description;
-    }
-
-    /**
-     * 鑾峰彇鐘舵�佸��
-     *
-     * @return 鐘舵�佸��
-     */
-    public String getValue() {
-        return value;
-    }
-
-    /**
-     * 鑾峰彇鐘舵�佹弿杩�
-     *
-     * @return 鐘舵�佹弿杩�
-     */
-    public String getDescription() {
-        return description;
     }
 
     /**
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutStorehouseType.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutStorehouseType.java
new file mode 100644
index 0000000..e8e8165
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/OutStorehouseType.java
@@ -0,0 +1,29 @@
+package org.jeecg.modules.tms.enums;
+
+import lombok.Getter;
+
+@Getter
+public enum OutStorehouseType {
+
+    TOOL_BORROW("1", "宸ュ叿鍊熺敤"),
+    MAINTENANCE_OUTBOUND("2", "缁翠慨鍑哄簱"),
+    CALIBRATION_OUTBOUND("3", "妫�瀹氬嚭搴�"),
+    GRINDING_OUTBOUND("4", "鍒冪(鍑哄簱");
+
+    private final String value;
+    private final String description;
+
+    OutStorehouseType(String value, String description) {
+        this.value = value;
+        this.description = description;
+    }
+
+    public static OutStorehouseType getByValue(String value) {
+        for (OutStorehouseType type : OutStorehouseType.values()) {
+            if (type.getValue().equals(value)) {
+                return type;
+            }
+        }
+        throw new IllegalArgumentException("Invalid enum value: " + value);
+    }
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/ToolCirculationStatus.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/ToolCirculationStatus.java
new file mode 100644
index 0000000..0370465
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/enums/ToolCirculationStatus.java
@@ -0,0 +1,38 @@
+package org.jeecg.modules.tms.enums;
+
+import lombok.Getter;
+
+/**
+ * 宸ュ叿娴侀�氱姸鎬佹灇涓�
+ */
+@Getter
+public enum ToolCirculationStatus {
+    IN_STOCK("1", "鍦ㄥ簱"),
+    BORROWED("2", "鍦ㄥ��"),
+    REPAIRING("3", "鍦ㄤ慨"),
+    INSPECTING("4", "鍦ㄦ"),
+    GRINDING("5", "鍦ㄧ("),
+    SCRAPPED("6", "鎶ュ簾");
+
+    private final String value;
+    private final String description;
+
+    ToolCirculationStatus(String value, String description) {
+        this.value = value;
+        this.description = description;
+    }
+
+    /**
+     * 鏍规嵁鐘舵�佸�艰幏鍙栨灇涓惧疄渚�
+     * @param status 鐘舵�佸��
+     * @return 鏋氫妇瀹炰緥鎴杗ull
+     */
+    public static ToolCirculationStatus fromStatus(String status) {
+        for (ToolCirculationStatus value : values()) {
+            if (value.getValue().equals(status)) {
+                return value;
+            }
+        }
+        return null;
+    }
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/OutStoreDetailMapper.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/OutStoreDetailMapper.java
new file mode 100644
index 0000000..08a2c06
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/OutStoreDetailMapper.java
@@ -0,0 +1,25 @@
+package org.jeecg.modules.tms.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.tms.entity.OutStoreDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.tms.entity.vo.OutStoreDetailVo;
+
+/**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+public interface OutStoreDetailMapper extends BaseMapper<OutStoreDetail> {
+
+    IPage<OutStoreDetailVo> queryPageList(Page<OutStoreDetailVo> page,
+                                          @Param(Constants.WRAPPER) Wrapper<OutStoreDetailVo> queryWrapper);
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/xml/OutStoreDetailMapper.xml b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/xml/OutStoreDetailMapper.xml
new file mode 100644
index 0000000..4956f45
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/mapper/xml/OutStoreDetailMapper.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.tms.mapper.OutStoreDetailMapper">
+
+    <select id="queryPageList" resultType="org.jeecg.modules.tms.entity.vo.OutStoreDetailVo">
+        SELECT
+            t1.id,
+            t1.tool_code toolCode,
+            t1.tool_id toolId,
+            t1.out_storehouse_type outStorehouseType,
+            t1.goods_shelves_code goodsShelvesCode,
+            t1.out_number outNumber,
+            t1.out_storehouse_id outStorehouseId,
+            t1.operate_type operateType,
+            t1.create_by createBy,
+            t1.create_time createTime,
+            t2.chinese_name chineseName,
+            t2.tool_model toolModel,
+            t2.parama_table_name paramaTableName,
+        <choose>
+            <when test="ew.paramNameValuePairs.paramaTableName == '1'">
+                t4.tool_material toolMaterial,
+                t4.part_material partMaterial
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '2'">
+                t5.tool_material toolMaterial,
+                t5.part_material partMaterial
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '3'">
+                t6.tool_material toolMaterial,
+                t6.part_material partMaterial
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '4'">
+                t7.tool_material toolMaterial,
+                t7.part_material partMaterial
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '5'">
+                t8.tool_material toolMaterial,
+                t8.part_material partMaterial
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '6'">
+                t9.tool_material toolMaterial,
+                t9.part_material partMaterial
+            </when>
+            <otherwise>
+                t10.tool_material toolMaterial,
+                t10.part_material partMaterial
+            </otherwise>
+        </choose>
+        FROM tms_out_store_detail t1
+        LEFT JOIN tms_base_tools t2 on t1.tool_code = t2.id
+        LEFT JOIN tms_tools_config_property t3 on t3.tool_code = t2.id
+        LEFT JOIN tms_tools_classify t11 on t11.id = t2.classify_id
+        <choose>
+            <when test="ew.paramNameValuePairs.paramaTableName == '1'">
+                LEFT JOIN tms_para_common_tool t4 on t4.tool_code = t2.id
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '2'">
+                LEFT JOIN tms_para_hole_tools t5 on t5.tool_code = t2.id
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '3'">
+                LEFT JOIN tms_para_threading_tool t6 on t6.tool_code = t2.id
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '4'">
+                LEFT JOIN tms_para_mill_tool t7 on t7.tool_code = t2.id
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '5'">
+                LEFT JOIN tms_para_turning_tools t8 on t8.tool_code = t2.id
+            </when>
+            <when test="ew.paramNameValuePairs.paramaTableName == '6'">
+                LEFT JOIN tms_para_blade t9 on t9.tool_code = t2.id
+            </when>
+            <otherwise>
+                LEFT JOIN tms_para_common_tool t10 on t10.tool_code = t2.id
+            </otherwise>
+        </choose>
+        ${ew.customSqlSegment}
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutStoreDetailService.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutStoreDetailService.java
new file mode 100644
index 0000000..ef66d57
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutStoreDetailService.java
@@ -0,0 +1,20 @@
+package org.jeecg.modules.tms.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.tms.entity.OutStoreDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.tms.entity.vo.OutStoreDetailVo;
+
+import java.util.Map;
+
+/**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+public interface IOutStoreDetailService extends IService<OutStoreDetail> {
+
+    IPage<OutStoreDetailVo> queryPageList(Page<OutStoreDetailVo> page, Map<String, String[]> parameterMap);
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutboundOrderService.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutboundOrderService.java
index b1171e7..f055c95 100644
--- a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutboundOrderService.java
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/IOutboundOrderService.java
@@ -6,6 +6,7 @@
 import org.jeecg.modules.tms.entity.OutboundOrder;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto;
+import org.jeecg.modules.tms.entity.dto.OutBoundRequestDto;
 import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import java.io.Serializable;
@@ -45,4 +46,6 @@
     void submit(String id);
 
 	void approvalProcess(OutBoundOrderFlowDto outBoundOrderFlowDto);
+
+    void outBound(List<OutBoundRequestDto> outBoundRequestList);
 }
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutStoreDetailServiceImpl.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutStoreDetailServiceImpl.java
new file mode 100644
index 0000000..8087404
--- /dev/null
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutStoreDetailServiceImpl.java
@@ -0,0 +1,36 @@
+package org.jeecg.modules.tms.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.modules.tms.entity.OutStoreDetail;
+import org.jeecg.modules.tms.entity.vo.OutStoreDetailVo;
+import org.jeecg.modules.tms.mapper.OutStoreDetailMapper;
+import org.jeecg.modules.tms.service.IOutStoreDetailService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.Map;
+
+/**
+ * @Description: 宸ュ叿鍑哄簱娴佹按
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Service
+public class OutStoreDetailServiceImpl extends ServiceImpl<OutStoreDetailMapper, OutStoreDetail> implements IOutStoreDetailService {
+
+    @Override
+    public IPage<OutStoreDetailVo> queryPageList(Page<OutStoreDetailVo> page, Map<String, String[]> parameterMap) {
+        QueryWrapper<OutStoreDetailVo> queryWrapper = Wrappers.query();
+        String[] classifyIds = parameterMap.get("classifyId");
+        if (classifyIds != null && classifyIds.length > 0) {
+            queryWrapper.eq("t11.classify_id", classifyIds[0]);
+        }
+        queryWrapper.orderByDesc("create_time");
+        return this.baseMapper.queryPageList(page, queryWrapper);
+    }
+}
diff --git a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java
index d0f5668..f5cdf56 100644
--- a/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java
+++ b/lxzn-module-tms/src/main/java/org/jeecg/modules/tms/service/impl/OutboundOrderServiceImpl.java
@@ -26,22 +26,25 @@
 import org.jeecg.modules.flowable.service.IFlowDefinitionService;
 import org.jeecg.modules.flowable.service.IFlowTaskService;
 import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
-import org.jeecg.modules.tms.entity.OutboundOrder;
-import org.jeecg.modules.tms.entity.OutboundDetail;
+import org.jeecg.modules.tms.entity.*;
 import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto;
+import org.jeecg.modules.tms.entity.dto.OutBoundRequestDto;
 import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto;
 import org.jeecg.modules.tms.enums.OutBillStatus;
 import org.jeecg.modules.tms.enums.OutBoundStatusEnum;
+import org.jeecg.modules.tms.enums.OutStorehouseType;
+import org.jeecg.modules.tms.enums.ToolCirculationStatus;
 import org.jeecg.modules.tms.mapper.OutboundDetailMapper;
 import org.jeecg.modules.tms.mapper.OutboundOrderMapper;
-import org.jeecg.modules.tms.service.IOutboundDetailService;
-import org.jeecg.modules.tms.service.IOutboundOrderService;
+import org.jeecg.modules.tms.service.*;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Description: tms_outbound_order
@@ -55,6 +58,12 @@
 
 	@Autowired
 	private IOutboundDetailService outboundDetailService;
+	@Autowired
+	private IToolLedgerService toolLedgerService;
+	@Autowired
+	private IToolLedgerDetailService toolLedgerDetailService;
+	@Autowired
+	private IOutStoreDetailService outStoreDetailService;
 	@Autowired
 	private ISysBusinessCodeRuleService businessCodeRuleService;
 	@Autowired
@@ -207,9 +216,13 @@
 
 		//鏍规嵁浠诲姟瀹屾垚缁撴灉鏇存柊鐢宠鍗曠姸鎬�
 		if (result.isSuccess()) {
-			outboundOrder.setOrderStatus(outBoundOrderFlowDto.getStatus());
 			if (OutBillStatus.APPROVED.getValue().equals(outBoundOrderFlowDto.getStatus())) {
 				outboundOrder.setOutStatus(OutBoundStatusEnum.NOT_OUTBOUND.getValue());
+				outboundOrder.setOrderStatus(OutBillStatus.APPROVED.getValue());
+			}
+			if (OutBillStatus.REJECTED.getValue().equals(outBoundOrderFlowDto.getStatus())) {
+				//濡傛灉椹冲洖锛屽鎵瑰崟鐘舵�佸洖鍒拌崏绋�
+				outboundOrder.setOrderStatus(OutBillStatus.DRAFT.getValue());
 			}
 			outboundOrder.setAuditDate(new Date());
 			outboundOrder.setApprovalOpinion(outBoundOrderFlowDto.getApprovalOpinion());
@@ -217,6 +230,158 @@
 		}
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void outBound(List<OutBoundRequestDto> outBoundRequestList) {
+		//鏍¢獙鏄惁鏉ヨ嚜涓�涓敵璇峰崟
+		if (!fromOneApply(outBoundRequestList)) {
+			throw new JeecgBootException("鍑哄簱鏄庣粏蹇呴』鏉ヨ嚜鍚屼竴鍑哄簱鐢宠鍗曪紒");
+		}
+		//鏄惁鍙嚭搴撴牎楠�
+		if (!readyToOutbound(outBoundRequestList)) {
+			throw new JeecgBootException("鏈粡瀹℃壒閫氳繃鐨勭敵璇峰崟涓嶈兘鍑哄簱锛�");
+		}
+		//寮�濮嬪嚭搴�
+		OutboundOrder outboundOrder = getById(outBoundRequestList.get(0).getOutBoundOrderId());
+		List<String> detailIds = outBoundRequestList.stream().map(OutBoundRequestDto::getOutboundDetailId).collect(Collectors.toList());
+		List<OutboundDetail> outboundDetailList = outboundDetailService.listByIds(detailIds);
+		List<String> toolIdList = outboundDetailList.stream().map(OutboundDetail::getToolCode).collect(Collectors.toList());
+
+		Map<String, BigDecimal> outBoundRequestMap = outBoundRequestList.stream()
+				.collect(Collectors.toMap(OutBoundRequestDto::getOutboundDetailId, OutBoundRequestDto::getOutboundQuantity));
+		//澶勭悊搴撳瓨鍙拌处鍙婂彴璐︽槑缁�
+		Map<String, ToolLedger> toolLedgerMap = toolLedgerService.list(new LambdaQueryWrapper<ToolLedger>().in(ToolLedger::getToolId, toolIdList)).stream()
+				.collect(Collectors.toMap(ToolLedger::getToolId, item -> item, (k1, k2) -> k1));
+
+		LambdaQueryWrapper<ToolLedgerDetail> queryWrapper = new LambdaQueryWrapper<>();
+		for (int i = 0; i < outboundDetailList.size(); i++) {
+			if (i > 0) {
+				queryWrapper.or();
+			}
+			OutboundDetail detail = outboundDetailList.get(i);
+			queryWrapper.and(wrapper ->
+					wrapper.eq(ToolLedgerDetail::getToolCode, detail.getToolCode())
+							.eq(ToolLedgerDetail::getToolId, detail.getToolId()) //濡傛灉涓嶇鍒版妸锛岃瀛楁涓虹┖
+			);
+		}
+		List<ToolLedgerDetail> toolLedgerDetailList = toolLedgerDetailService.list(queryWrapper);
+		List<ToolLedger> toolLedgerUpdateList = CollectionUtil.newArrayList();
+		List<ToolLedgerDetail> toolLedgerDetailUpdateList = CollectionUtil.newArrayList();
+		List<OutStoreDetail> outStoreAddList = CollectionUtil.newArrayList();
+		List<OutboundDetail> outboundDetailUpdateList = CollectionUtil.newArrayList();
+
+		for (OutboundDetail detail : outboundDetailList) {
+			//鏇存柊搴撳瓨鍙拌处
+			ToolLedger toolLedger = toolLedgerMap.get(detail.getToolCode());
+			BigDecimal outboundQuantity = outBoundRequestMap.get(detail.getId());
+			OutStorehouseType outStorehouseType = OutStorehouseType.getByValue(outboundOrder.getOutStorehouseType());
+			switch (outStorehouseType) {
+				case TOOL_BORROW:
+					toolLedger.setLendCount(toolLedger.getLendCount().add(outboundQuantity));
+					break;
+				case MAINTENANCE_OUTBOUND:
+					toolLedger.setRepairCount(toolLedger.getRepairCount().add(outboundQuantity));
+					break;
+				case CALIBRATION_OUTBOUND:
+					toolLedger.setDetectionCount(toolLedger.getDetectionCount().add(outboundQuantity));
+					break;
+				case GRINDING_OUTBOUND:
+					toolLedger.setSharpeningCount(toolLedger.getSharpeningCount().add(outboundQuantity));
+					break;
+				default:
+					throw new JeecgBootException("鏈煡鐨勫嚭搴撶被鍨嬶紒");
+			}
+			toolLedgerUpdateList.add(toolLedger);
+
+			//鏇存柊鍙拌处鏄庣粏
+			toolLedgerDetailList.stream().filter(item -> item.getToolCode().equals(detail.getToolCode()) && item.getToolId().equals(detail.getToolId()))
+					.findFirst().ifPresent(item -> {
+						if (StrUtil.isNotBlank(item.getToolId())) {
+							item.setQuantity(BigDecimal.ZERO);
+							switch (outStorehouseType) {
+								case TOOL_BORROW:
+									item.setStatus(ToolCirculationStatus.BORROWED.getValue());
+									break;
+								case MAINTENANCE_OUTBOUND:
+									item.setStatus(ToolCirculationStatus.REPAIRING.getValue());
+									break;
+								case CALIBRATION_OUTBOUND:
+									item.setStatus(ToolCirculationStatus.INSPECTING.getValue());
+									break;
+								case GRINDING_OUTBOUND:
+									item.setStatus(ToolCirculationStatus.GRINDING.getValue());
+									break;
+								default:
+									throw new JeecgBootException("鏈煡鐨勫嚭搴撶被鍨嬶紒");
+							}
+						} else {
+							item.setQuantity(item.getQuantity().subtract(outboundQuantity));
+						}
+						toolLedgerDetailUpdateList.add(item);
+					});
+
+			//璁板綍鍑哄簱娴佹按
+			OutStoreDetail outStoreDetail = new OutStoreDetail()
+					.setToolCode(detail.getToolCode())
+					.setToolId(detail.getToolId())
+					.setOutStorehouseType(outboundOrder.getOutStorehouseType())
+					.setGoodsShelvesCode(detail.getOutboundLocation())
+					.setOutNumber(outboundQuantity)
+					.setOutStorehouseId(outboundOrder.getId())
+					.setOperateType("1");//1锛氭寜鐢宠鍗�
+			outStoreAddList.add(outStoreDetail);
+
+			//鏇存柊鐢宠鍗曟槑缁�
+			detail.setOutActualCount(detail.getOutActualCount().add(outboundQuantity));
+			detail.setOutboundTime(new Date());
+			if (detail.getOutActualCount().compareTo(detail.getOutboundQuantity()) == 0) {
+				detail.setStatus(OutBoundStatusEnum.COMPLETED.getValue());
+			} else {
+				detail.setStatus(OutBoundStatusEnum.PARTIAL_OUTBOUND.getValue());
+			}
+			outboundDetailUpdateList.add(detail);
+		}
+		toolLedgerService.updateBatchById(toolLedgerUpdateList);
+		toolLedgerDetailService.updateBatchById(toolLedgerDetailUpdateList);
+		outStoreDetailService.saveBatch(outStoreAddList);
+		outboundDetailService.updateBatchById(outboundDetailUpdateList);
+
+		//鏇存柊鐢宠鍗�
+		boolean allMatch = outboundDetailService.list(new LambdaQueryWrapper<OutboundDetail>()
+						.eq(OutboundDetail::getOutStorehouseId, outboundOrder.getId()))
+				.stream().filter(i -> !detailIds.contains(i.getId()))
+				.allMatch(i -> i.getStatus().equals(OutBoundStatusEnum.COMPLETED.getValue()));
+		List<OutboundDetail> partialOutboundList = outboundDetailUpdateList.stream()
+				.filter(i -> !i.getStatus().equals(OutBoundStatusEnum.COMPLETED.getValue())).collect(Collectors.toList());
+		if (allMatch && partialOutboundList.isEmpty()) {
+			outboundOrder.setOutStatus(OutBoundStatusEnum.COMPLETED.getValue());
+		} else {
+			outboundOrder.setOutStatus(OutBoundStatusEnum.PARTIAL_OUTBOUND.getValue());
+		}
+		outboundOrder.setOutboundTime(new Date());
+		updateById(outboundOrder);
+	}
+
+	private boolean fromOneApply(List<OutBoundRequestDto> outBoundRequestList) {
+		long count = outBoundRequestList.stream().map(OutBoundRequestDto::getOutBoundOrderId).distinct().count();
+		if (count > 1) {
+			return false;
+		}
+		List<String> outDetailIds = outBoundRequestList.stream().map(OutBoundRequestDto::getOutboundDetailId).collect(Collectors.toList());
+		String outboundDetailId = outBoundRequestList.get(0).getOutboundDetailId();
+		OutboundDetail outboundDetail = outboundDetailService.getById(outboundDetailId);
+		List<String> detailIds = outboundDetailService.list(new LambdaQueryWrapper<OutboundDetail>()
+				.eq(OutboundDetail::getOutStorehouseId, outboundDetail.getOutStorehouseId())).stream()
+				.map(OutboundDetail::getId).collect(Collectors.toList());
+        return new HashSet<>(detailIds).containsAll(outDetailIds);
+    }
+
+	private boolean readyToOutbound(List<OutBoundRequestDto> outBoundRequestList) {
+		String outBoundOrderId = outBoundRequestList.get(0).getOutBoundOrderId();
+		OutboundOrder outboundOrder = getById(outBoundOrderId);
+        return OutBillStatus.APPROVED.getValue().equals(outboundOrder.getOrderStatus());
+    }
+
 	public boolean triggerProcess(OutboundOrder outboundOrder) {
 		flowCommonService.initActBusiness("鍗曞彿涓猴細" + outboundOrder.getOutNum() + " 鐨勫嚭搴撶敵璇凤紝寮�濮嬭繘琛屽鎵�",
 				outboundOrder.getId(), "outboundOrderServiceImpl", "tool_out_storage", null);

--
Gitblit v1.9.3