feat(asset): 新增资产借用归还管理功能
- 创建借用单新增页面界面,包含基本信息和借用明细表格 - 实现借用单核心数据模型AmsBorrowOrder和明细项AmsBorrowOrderItem - 开发借用单控制器AmsBorrowOrderController,提供完整的CRUD和业务流程接口 - 实现资产选择功能,支持从可用资产中筛选并添加到借用明细 - 添加借用流程管理,包括提交申请、确认借出、申请归还、确认归还等操作 - 集成部门和用户选择功能,支持按部门筛选借用人 - 实现借用单状态管理和数据持久化存储main
parent
0c7cd2b3df
commit
f50c0f9aa3
@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.asset.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 借用单状态常量定义
|
||||||
|
*
|
||||||
|
* @author Yangk
|
||||||
|
*/
|
||||||
|
public final class BorrowOrderStatus
|
||||||
|
{
|
||||||
|
/** 草稿 */
|
||||||
|
public static final String DRAFT = "DRAFT";
|
||||||
|
|
||||||
|
/** 待确认 */
|
||||||
|
public static final String PENDING_CONFIRM = "PENDING_CONFIRM";
|
||||||
|
|
||||||
|
/** 已驳回 */
|
||||||
|
public static final String REJECTED = "REJECTED";
|
||||||
|
|
||||||
|
/** 借用中 */
|
||||||
|
public static final String BORROWING = "BORROWING";
|
||||||
|
|
||||||
|
/** 待归还确认 */
|
||||||
|
public static final String PENDING_RETURN_CONFIRM = "PENDING_RETURN_CONFIRM";
|
||||||
|
|
||||||
|
/** 已归还 */
|
||||||
|
public static final String BORROW_RETURNED = "BORROW_RETURNED";
|
||||||
|
|
||||||
|
private BorrowOrderStatus()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,365 @@
|
|||||||
|
<?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="com.ruoyi.asset.mapper.AmsBorrowOrderMapper">
|
||||||
|
|
||||||
|
<resultMap type="AmsBorrowOrder" id="AmsBorrowOrderResult">
|
||||||
|
<result property="orderId" column="order_id" />
|
||||||
|
<result property="borrowNo" column="borrow_no" />
|
||||||
|
<result property="borrowUserId" column="borrow_user_id" />
|
||||||
|
<result property="borrowUserName" column="borrow_user_name" />
|
||||||
|
<result property="borrowDeptId" column="borrow_dept_id" />
|
||||||
|
<result property="borrowDeptName" column="borrow_dept_name" />
|
||||||
|
<result property="expectedReturnDate" column="expected_return_date" />
|
||||||
|
<result property="confirmUserId" column="confirm_user_id" />
|
||||||
|
<result property="confirmUserName" column="confirm_user_name" />
|
||||||
|
<result property="confirmTime" column="confirm_time" />
|
||||||
|
<result property="rejectReason" column="reject_reason" />
|
||||||
|
<result property="orderStatus" column="order_status" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="AmsBorrowOrderAmsBorrowOrderItemResult" type="AmsBorrowOrder" extends="AmsBorrowOrderResult">
|
||||||
|
<collection property="amsBorrowOrderItemList" ofType="AmsBorrowOrderItem" column="order_id" select="selectAmsBorrowOrderItemList" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="AmsBorrowOrderItem" id="AmsBorrowOrderItemResult">
|
||||||
|
<result property="itemId" column="item_id" />
|
||||||
|
<result property="orderId" column="order_id" />
|
||||||
|
<result property="borrowNo" column="borrow_no" />
|
||||||
|
<result property="assetId" column="asset_id" />
|
||||||
|
<result property="assetCode" column="asset_code" />
|
||||||
|
<result property="assetName" column="asset_name" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="categoryCode" column="category_code" />
|
||||||
|
<result property="categoryName" column="category_name" />
|
||||||
|
<result property="specModel" column="spec_model" />
|
||||||
|
<result property="brand" column="brand" />
|
||||||
|
<result property="beforeWarehouseId" column="before_warehouse_id" />
|
||||||
|
<result property="beforeWarehouseCode" column="before_warehouse_code" />
|
||||||
|
<result property="beforeWarehouseName" column="before_warehouse_name" />
|
||||||
|
<result property="beforeLocationId" column="before_location_id" />
|
||||||
|
<result property="beforeLocationCode" column="before_location_code" />
|
||||||
|
<result property="beforeLocationName" column="before_location_name" />
|
||||||
|
<result property="returnWarehouseId" column="return_warehouse_id" />
|
||||||
|
<result property="returnWarehouseCode" column="return_warehouse_code" />
|
||||||
|
<result property="returnWarehouseName" column="return_warehouse_name" />
|
||||||
|
<result property="returnLocationId" column="return_location_id" />
|
||||||
|
<result property="returnLocationCode" column="return_location_code" />
|
||||||
|
<result property="returnLocationName" column="return_location_name" />
|
||||||
|
<result property="actualReturnDate" column="actual_return_date" />
|
||||||
|
<result property="returnStatus" column="return_status" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="AmsAsset" id="AvailableBorrowAssetResult">
|
||||||
|
<result property="assetId" column="asset_id" />
|
||||||
|
<result property="assetCode" column="asset_code" />
|
||||||
|
<result property="assetName" column="asset_name" />
|
||||||
|
<result property="categoryId" column="category_id" />
|
||||||
|
<result property="categoryCode" column="category_code" />
|
||||||
|
<result property="categoryName" column="category_name" />
|
||||||
|
<result property="specModel" column="spec_model" />
|
||||||
|
<result property="brand" column="brand" />
|
||||||
|
<result property="assetStatus" column="asset_status" />
|
||||||
|
<result property="warehouseId" column="warehouse_id" />
|
||||||
|
<result property="warehouseCode" column="warehouse_code" />
|
||||||
|
<result property="warehouseName" column="warehouse_name" />
|
||||||
|
<result property="locationId" column="location_id" />
|
||||||
|
<result property="locationCode" column="location_code" />
|
||||||
|
<result property="locationName" column="location_name" />
|
||||||
|
<result property="tagCode" column="tag_code" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAmsBorrowOrderVo">
|
||||||
|
select order_id, borrow_no, borrow_user_id, borrow_user_name, borrow_dept_id, borrow_dept_name, expected_return_date, confirm_user_id, confirm_user_name, confirm_time, reject_reason, order_status, create_by, create_time, update_by, update_time, remark, del_flag from ams_borrow_order
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAmsBorrowOrderList" parameterType="AmsBorrowOrder" resultMap="AmsBorrowOrderResult">
|
||||||
|
<include refid="selectAmsBorrowOrderVo"/>
|
||||||
|
<where>
|
||||||
|
del_flag = '0'
|
||||||
|
<if test="borrowNo != null and borrowNo != ''"> and borrow_no like concat(#{borrowNo}, '%')</if>
|
||||||
|
<if test="borrowUserId != null "> and borrow_user_id = #{borrowUserId}</if>
|
||||||
|
<if test="borrowUserName != null and borrowUserName != ''"> and borrow_user_name like concat('%', #{borrowUserName}, '%')</if>
|
||||||
|
<if test="borrowDeptId != null "> and borrow_dept_id = #{borrowDeptId}</if>
|
||||||
|
<if test="borrowDeptName != null and borrowDeptName != ''"> and borrow_dept_name like concat('%', #{borrowDeptName}, '%')</if>
|
||||||
|
<if test="expectedReturnDate != null "> and expected_return_date = #{expectedReturnDate}</if>
|
||||||
|
<if test="confirmUserId != null "> and confirm_user_id = #{confirmUserId}</if>
|
||||||
|
<if test="confirmUserName != null and confirmUserName != ''"> and confirm_user_name like concat('%', #{confirmUserName}, '%')</if>
|
||||||
|
<if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>
|
||||||
|
<if test="rejectReason != null and rejectReason != ''"> and reject_reason = #{rejectReason}</if>
|
||||||
|
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
|
||||||
|
<if test="params.assetCode != null and params.assetCode != ''">
|
||||||
|
and exists (
|
||||||
|
select 1 from ams_borrow_order_item item
|
||||||
|
where item.order_id = ams_borrow_order.order_id
|
||||||
|
and item.del_flag = '0'
|
||||||
|
and item.asset_code like concat(#{params.assetCode}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by create_time desc, order_id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAmsBorrowOrderByOrderId" parameterType="Long" resultMap="AmsBorrowOrderAmsBorrowOrderItemResult">
|
||||||
|
<include refid="selectAmsBorrowOrderVo"/>
|
||||||
|
where order_id = #{orderId} and del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAmsBorrowOrderByOrderIdForUpdate" parameterType="Long" resultMap="AmsBorrowOrderAmsBorrowOrderItemResult">
|
||||||
|
<include refid="selectAmsBorrowOrderVo"/>
|
||||||
|
where order_id = #{orderId} and del_flag = '0'
|
||||||
|
for update
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAmsBorrowOrderItemList" resultMap="AmsBorrowOrderItemResult">
|
||||||
|
select item_id, order_id, borrow_no, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, before_warehouse_id, before_warehouse_code, before_warehouse_name, before_location_id, before_location_code, before_location_name, return_warehouse_id, return_warehouse_code, return_warehouse_name, return_location_id, return_location_code, return_location_name, actual_return_date, return_status, create_by, create_time, update_by, update_time, remark, del_flag
|
||||||
|
from ams_borrow_order_item
|
||||||
|
where order_id = #{order_id} and del_flag = '0'
|
||||||
|
order by item_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAmsBorrowOrderItemByOrderIdAndItemIdForUpdate" resultMap="AmsBorrowOrderItemResult">
|
||||||
|
select item_id, order_id, borrow_no, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, before_warehouse_id, before_warehouse_code, before_warehouse_name, before_location_id, before_location_code, before_location_name, return_warehouse_id, return_warehouse_code, return_warehouse_name, return_location_id, return_location_code, return_location_name, actual_return_date, return_status, create_by, create_time, update_by, update_time, remark, del_flag
|
||||||
|
from ams_borrow_order_item
|
||||||
|
where order_id = #{orderId}
|
||||||
|
and item_id = #{itemId}
|
||||||
|
and del_flag = '0'
|
||||||
|
for update
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAvailableBorrowAssetList" resultMap="AvailableBorrowAssetResult">
|
||||||
|
select asset.asset_id, asset.asset_code, asset.asset_name, asset.category_id,
|
||||||
|
asset.category_code, asset.category_name, asset.spec_model, asset.brand,
|
||||||
|
asset.asset_status, asset.warehouse_id, asset.warehouse_code, asset.warehouse_name,
|
||||||
|
asset.location_id, asset.location_code, asset.location_name, asset.tag_code
|
||||||
|
from ams_asset asset
|
||||||
|
where asset.del_flag = '0'
|
||||||
|
and asset.asset_status = #{stockStatus}
|
||||||
|
and not exists (
|
||||||
|
select 1
|
||||||
|
from ams_borrow_order_item item
|
||||||
|
inner join ams_borrow_order borrow_order on borrow_order.order_id = item.order_id
|
||||||
|
and borrow_order.del_flag = '0'
|
||||||
|
and borrow_order.order_status in (#{draftStatus}, #{pendingStatus})
|
||||||
|
where item.asset_id = asset.asset_id
|
||||||
|
and item.del_flag = '0'
|
||||||
|
<if test="currentOrderId != null">
|
||||||
|
and borrow_order.order_id != #{currentOrderId}
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
<if test="asset.assetCode != null and asset.assetCode != ''">
|
||||||
|
and asset.asset_code like concat('%', #{asset.assetCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="asset.assetName != null and asset.assetName != ''">
|
||||||
|
and asset.asset_name like concat('%', #{asset.assetName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="asset.categoryName != null and asset.categoryName != ''">
|
||||||
|
and asset.category_name like concat('%', #{asset.categoryName}, '%')
|
||||||
|
</if>
|
||||||
|
order by asset.asset_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countOtherActiveBorrowOrderByAssetId" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from ams_borrow_order_item item
|
||||||
|
inner join ams_borrow_order borrow_order on borrow_order.order_id = item.order_id
|
||||||
|
and borrow_order.del_flag = '0'
|
||||||
|
and borrow_order.order_status in (#{draftStatus}, #{pendingStatus})
|
||||||
|
where item.asset_id = #{assetId}
|
||||||
|
and item.del_flag = '0'
|
||||||
|
<if test="currentOrderId != null">
|
||||||
|
and borrow_order.order_id != #{currentOrderId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAmsBorrowOrder" parameterType="AmsBorrowOrder" useGeneratedKeys="true" keyProperty="orderId">
|
||||||
|
insert into ams_borrow_order
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="borrowNo != null and borrowNo != ''">borrow_no,</if>
|
||||||
|
<if test="borrowUserId != null">borrow_user_id,</if>
|
||||||
|
<if test="borrowUserName != null">borrow_user_name,</if>
|
||||||
|
<if test="borrowDeptId != null">borrow_dept_id,</if>
|
||||||
|
<if test="borrowDeptName != null">borrow_dept_name,</if>
|
||||||
|
<if test="expectedReturnDate != null">expected_return_date,</if>
|
||||||
|
<if test="confirmUserId != null">confirm_user_id,</if>
|
||||||
|
<if test="confirmUserName != null">confirm_user_name,</if>
|
||||||
|
<if test="confirmTime != null">confirm_time,</if>
|
||||||
|
<if test="rejectReason != null">reject_reason,</if>
|
||||||
|
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="borrowNo != null and borrowNo != ''">#{borrowNo},</if>
|
||||||
|
<if test="borrowUserId != null">#{borrowUserId},</if>
|
||||||
|
<if test="borrowUserName != null">#{borrowUserName},</if>
|
||||||
|
<if test="borrowDeptId != null">#{borrowDeptId},</if>
|
||||||
|
<if test="borrowDeptName != null">#{borrowDeptName},</if>
|
||||||
|
<if test="expectedReturnDate != null">#{expectedReturnDate},</if>
|
||||||
|
<if test="confirmUserId != null">#{confirmUserId},</if>
|
||||||
|
<if test="confirmUserName != null">#{confirmUserName},</if>
|
||||||
|
<if test="confirmTime != null">#{confirmTime},</if>
|
||||||
|
<if test="rejectReason != null">#{rejectReason},</if>
|
||||||
|
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAmsBorrowOrder" parameterType="AmsBorrowOrder">
|
||||||
|
update ams_borrow_order
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="borrowNo != null and borrowNo != ''">borrow_no = #{borrowNo},</if>
|
||||||
|
<if test="borrowUserId != null">borrow_user_id = #{borrowUserId},</if>
|
||||||
|
<if test="borrowUserName != null">borrow_user_name = #{borrowUserName},</if>
|
||||||
|
<if test="borrowDeptId != null">borrow_dept_id = #{borrowDeptId},</if>
|
||||||
|
<if test="borrowDeptName != null">borrow_dept_name = #{borrowDeptName},</if>
|
||||||
|
<if test="expectedReturnDate != null">expected_return_date = #{expectedReturnDate},</if>
|
||||||
|
<if test="confirmUserId != null">confirm_user_id = #{confirmUserId},</if>
|
||||||
|
<if test="confirmUserName != null">confirm_user_name = #{confirmUserName},</if>
|
||||||
|
<if test="confirmTime != null">confirm_time = #{confirmTime},</if>
|
||||||
|
<if test="rejectReason != null">reject_reason = #{rejectReason},</if>
|
||||||
|
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
where order_id = #{orderId} and del_flag = '0' and order_status = 'DRAFT'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 逻辑删除,仅限草稿单 -->
|
||||||
|
<update id="deleteAmsBorrowOrderByOrderId" parameterType="Long">
|
||||||
|
update ams_borrow_order set del_flag = '1' where order_id = #{orderId} and del_flag = '0' and order_status = 'DRAFT'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteAmsBorrowOrderByOrderIds" parameterType="String">
|
||||||
|
update ams_borrow_order set del_flag = '1' where order_id in
|
||||||
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{orderId}
|
||||||
|
</foreach>
|
||||||
|
and del_flag = '0' and order_status = 'DRAFT'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteAmsBorrowOrderItemByOrderIds" parameterType="String">
|
||||||
|
update ams_borrow_order_item set del_flag = '1' where order_id in
|
||||||
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{orderId}
|
||||||
|
</foreach>
|
||||||
|
and del_flag = '0'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteAmsBorrowOrderItemByOrderId" parameterType="Long">
|
||||||
|
update ams_borrow_order_item set del_flag = '1' where order_id = #{orderId} and del_flag = '0'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="batchAmsBorrowOrderItem">
|
||||||
|
insert into ams_borrow_order_item(
|
||||||
|
order_id, borrow_no, asset_id, asset_code, asset_name, category_id, category_code, category_name,
|
||||||
|
spec_model, brand, before_warehouse_id, before_warehouse_code, before_warehouse_name,
|
||||||
|
before_location_id, before_location_code, before_location_name, return_warehouse_id,
|
||||||
|
return_warehouse_code, return_warehouse_name, return_location_id, return_location_code,
|
||||||
|
return_location_name, actual_return_date, return_status, create_by, create_time,
|
||||||
|
remark, del_flag
|
||||||
|
) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
#{item.orderId}, #{item.borrowNo}, #{item.assetId}, #{item.assetCode}, #{item.assetName},
|
||||||
|
#{item.categoryId}, #{item.categoryCode}, #{item.categoryName}, #{item.specModel}, #{item.brand},
|
||||||
|
#{item.beforeWarehouseId}, #{item.beforeWarehouseCode}, #{item.beforeWarehouseName},
|
||||||
|
#{item.beforeLocationId}, #{item.beforeLocationCode}, #{item.beforeLocationName},
|
||||||
|
#{item.returnWarehouseId}, #{item.returnWarehouseCode}, #{item.returnWarehouseName},
|
||||||
|
#{item.returnLocationId}, #{item.returnLocationCode}, #{item.returnLocationName},
|
||||||
|
#{item.actualReturnDate}, #{item.returnStatus}, #{item.createBy}, #{item.createTime},
|
||||||
|
#{item.remark}, #{item.delFlag}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 提交:仅限草稿状态 -->
|
||||||
|
<update id="submitAmsBorrowOrder" parameterType="AmsBorrowOrder">
|
||||||
|
update ams_borrow_order
|
||||||
|
set order_status = #{orderStatus},
|
||||||
|
reject_reason = null,
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where order_id = #{orderId} and del_flag = '0' and order_status = 'DRAFT'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 确认借出:仅期待确认状态 -->
|
||||||
|
<update id="confirmAmsBorrowOrder" parameterType="AmsBorrowOrder">
|
||||||
|
update ams_borrow_order
|
||||||
|
set order_status = #{orderStatus},
|
||||||
|
confirm_user_id = #{confirmUserId},
|
||||||
|
confirm_user_name = #{confirmUserName},
|
||||||
|
confirm_time = #{confirmTime},
|
||||||
|
reject_reason = null,
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where order_id = #{orderId} and del_flag = '0' and order_status = 'PENDING_CONFIRM'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 驳回借用:仅期待确认状态 -->
|
||||||
|
<update id="rejectAmsBorrowOrder" parameterType="AmsBorrowOrder">
|
||||||
|
update ams_borrow_order
|
||||||
|
set order_status = #{orderStatus},
|
||||||
|
reject_reason = #{rejectReason},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where order_id = #{orderId} and del_flag = '0' and order_status = 'PENDING_CONFIRM'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 更新明细归还状态及信息:必须同时命中主单、明细和期望状态,避免跨单据或并发覆盖 -->
|
||||||
|
<update id="updateAmsBorrowOrderItemReturnStatus">
|
||||||
|
update ams_borrow_order_item
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="item.returnWarehouseId != null">return_warehouse_id = #{item.returnWarehouseId},</if>
|
||||||
|
<if test="item.returnWarehouseCode != null">return_warehouse_code = #{item.returnWarehouseCode},</if>
|
||||||
|
<if test="item.returnWarehouseName != null">return_warehouse_name = #{item.returnWarehouseName},</if>
|
||||||
|
<if test="item.returnLocationId != null">return_location_id = #{item.returnLocationId},</if>
|
||||||
|
<if test="item.returnLocationCode != null">return_location_code = #{item.returnLocationCode},</if>
|
||||||
|
<if test="item.returnLocationName != null">return_location_name = #{item.returnLocationName},</if>
|
||||||
|
<if test="item.actualReturnDate != null">actual_return_date = #{item.actualReturnDate},</if>
|
||||||
|
<if test="item.returnStatus != null and item.returnStatus != ''">return_status = #{item.returnStatus},</if>
|
||||||
|
<if test="item.updateBy != null">update_by = #{item.updateBy},</if>
|
||||||
|
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where order_id = #{item.orderId}
|
||||||
|
and item_id = #{item.itemId}
|
||||||
|
and del_flag = '0'
|
||||||
|
and return_status = #{expectedStatus}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 自定义修改主单状态 -->
|
||||||
|
<update id="updateAmsBorrowOrderStatus">
|
||||||
|
update ams_borrow_order
|
||||||
|
set order_status = #{orderStatus},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where order_id = #{orderId} and del_flag = '0'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('借用归还列表')" />
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
</head>
|
||||||
|
<body class="gray-bg">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="formId">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li><label>借用单号:</label><input type="text" name="borrowNo"/></li>
|
||||||
|
<li><label>借用人:</label><input type="text" name="borrowUserName"/></li>
|
||||||
|
<li>
|
||||||
|
<label>借用部门:</label>
|
||||||
|
<select name="borrowDeptId">
|
||||||
|
<option value="">所有</option>
|
||||||
|
<option th:each="dept : ${deptList}" th:value="${dept.deptId}" th:text="${dept.deptName}"></option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
<li class="select-time">
|
||||||
|
<label>确认时间:</label>
|
||||||
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间"
|
||||||
|
name="params[beginConfirmTime]"/>
|
||||||
|
<span>-</span>
|
||||||
|
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
|
||||||
|
name="params[endConfirmTime]"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>单据状态:</label>
|
||||||
|
<select name="orderStatus" th:with="type=${@dict.getType('ams_borrow_status')}">
|
||||||
|
<option value="">所有</option>
|
||||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
|
||||||
|
th:value="${dict.dictValue}"></option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
<li><label>资产编码:</label><input type="text" name="params[assetCode]"/></li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
|
||||||
|
<i class="fa fa-search"></i> 搜索
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()">
|
||||||
|
<i class="fa fa-refresh"></i> 重置
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="asset:borrow:add">
|
||||||
|
<i class="fa fa-plus"></i> 添加
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="asset:borrow:export">
|
||||||
|
<i class="fa fa-download"></i> 导出
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var editFlag = [[${@permission.hasPermi('asset:borrow:edit')}]];
|
||||||
|
var removeFlag = [[${@permission.hasPermi('asset:borrow:remove')}]];
|
||||||
|
var submitFlag = [[${@permission.hasPermi('asset:borrow:submit')}]];
|
||||||
|
var confirmFlag = [[${@permission.hasPermi('asset:borrow:confirm')}]];
|
||||||
|
var rejectFlag = [[${@permission.hasPermi('asset:borrow:reject')}]];
|
||||||
|
var applyReturnFlag = [[${@permission.hasPermi('asset:borrow:applyReturn')}]];
|
||||||
|
var confirmReturnFlag = [[${@permission.hasPermi('asset:borrow:confirmReturn')}]];
|
||||||
|
var orderStatusDatas = [[${@dict.getType('ams_borrow_status')}]];
|
||||||
|
var prefix = ctx + "asset/borrow";
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$.table.init({
|
||||||
|
url: prefix + "/list",
|
||||||
|
viewUrl: prefix + "/view/{id}",
|
||||||
|
createUrl: prefix + "/add",
|
||||||
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
removeUrl: prefix + "/remove",
|
||||||
|
exportUrl: prefix + "/export",
|
||||||
|
modalName: "借用单",
|
||||||
|
columns: [
|
||||||
|
{ field: "orderId", title: "单据ID", visible: false },
|
||||||
|
{ field: "borrowNo", title: "借用单号" },
|
||||||
|
{ field: "borrowUserName", title: "借用人" },
|
||||||
|
{ field: "borrowDeptName", title: "借用部门" },
|
||||||
|
{ field: "expectedReturnDate", title: "预计归还日期" },
|
||||||
|
{ field: "confirmUserName", title: "确认人" },
|
||||||
|
{ field: "confirmTime", title: "确认时间" },
|
||||||
|
{ field: "orderStatus", title: "单据状态", formatter: function(value) {
|
||||||
|
return $.table.selectDictLabel(orderStatusDatas, value);
|
||||||
|
}},
|
||||||
|
{ field: "rejectReason", title: "驳回原因", visible: false },
|
||||||
|
{ title: "操作", align: "center", formatter: function(value, row) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.view(\'' + row.orderId + '\')"><i class="fa fa-eye"></i>查看</a> ');
|
||||||
|
if (row.orderStatus === "DRAFT") {
|
||||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||||
|
actions.push('<a class="btn btn-primary btn-xs ' + submitFlag + '" href="javascript:void(0)" onclick="submitBorrow(\'' + row.orderId + '\')"><i class="fa fa-upload"></i>提交</a> ');
|
||||||
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
|
} else if (row.orderStatus === "PENDING_CONFIRM") {
|
||||||
|
actions.push('<a class="btn btn-primary btn-xs ' + confirmFlag + '" href="javascript:void(0)" onclick="confirmBorrow(\'' + row.orderId + '\')"><i class="fa fa-check"></i>确认借出</a> ');
|
||||||
|
actions.push('<a class="btn btn-warning btn-xs ' + rejectFlag + '" href="javascript:void(0)" onclick="rejectBorrow(\'' + row.orderId + '\')"><i class="fa fa-reply"></i>驳回</a>');
|
||||||
|
} else if (row.orderStatus === "BORROWING") {
|
||||||
|
actions.push('<a class="btn btn-primary btn-xs ' + applyReturnFlag + '" href="javascript:void(0)" onclick="$.operate.view(\'' + row.orderId + '\')"><i class="fa fa-sign-in"></i>归还申请</a>');
|
||||||
|
} else if (row.orderStatus === "PENDING_RETURN_CONFIRM") {
|
||||||
|
actions.push('<a class="btn btn-primary btn-xs ' + confirmReturnFlag + '" href="javascript:void(0)" onclick="$.operate.view(\'' + row.orderId + '\')"><i class="fa fa-check-square-o"></i>归还确认</a>');
|
||||||
|
}
|
||||||
|
return actions.join("");
|
||||||
|
}}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitBorrow(orderId) {
|
||||||
|
$.modal.confirm("提交后借用单不可再修改或删除,是否继续?", function() {
|
||||||
|
$.operate.post(prefix + "/submit/" + orderId, {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmBorrow(orderId) {
|
||||||
|
$.modal.confirm("确认后资产将借出并清空当前仓位,是否继续?", function() {
|
||||||
|
$.operate.post(prefix + "/confirm/" + orderId, {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function rejectBorrow(orderId) {
|
||||||
|
layer.prompt({ title: "请输入驳回原因", formType: 2, maxlength: 500 }, function(text, index) {
|
||||||
|
layer.close(index);
|
||||||
|
$.operate.post(prefix + "/reject/" + orderId, { rejectReason: text });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,220 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('修改借用单')" />
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
<style type="text/css">
|
||||||
|
table label.error { position: inherit; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-borrow-edit" th:object="${amsBorrowOrder}">
|
||||||
|
<input name="orderId" th:field="*{orderId}" type="hidden">
|
||||||
|
<h4 class="form-header h4">基本信息</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用单号:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input th:value="*{borrowNo}" class="form-control" type="text" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用人:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input th:value="*{borrowUserName}" class="form-control" type="text" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用部门:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input th:value="*{borrowDeptName}" class="form-control" type="text" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label is-required">预计归还:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="expectedReturnDate" th:value="${#dates.format(amsBorrowOrder.expectedReturnDate, 'yyyy-MM-dd')}"
|
||||||
|
class="form-control time-input" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 control-label">备注:</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<textarea name="remark" maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="form-header h4">借用明细</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="selectAssets()">
|
||||||
|
<i class="fa fa-plus"> 选择资产</i>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="removeSelectedAssets()">
|
||||||
|
<i class="fa fa-minus"> 删除</i>
|
||||||
|
</button>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "asset/borrow";
|
||||||
|
var orderId = [[${amsBorrowOrder.orderId}]];
|
||||||
|
var detailData = [[${amsBorrowOrder.amsBorrowOrderItemList}]];
|
||||||
|
|
||||||
|
$("#form-borrow-edit").validate({ focusCleanup: true });
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
initDetailTable(detailData || []);
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($("#bootstrap-table").bootstrapTable("getData").length === 0) {
|
||||||
|
$.modal.alertWarning("请至少保留一条借用明细");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($.validate.form()) {
|
||||||
|
syncDetailRows();
|
||||||
|
$.operate.save(prefix + "/edit", $("#form-borrow-edit").serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initDetailTable(data) {
|
||||||
|
$.table.init({
|
||||||
|
data: data,
|
||||||
|
pagination: false,
|
||||||
|
showSearch: false,
|
||||||
|
showRefresh: false,
|
||||||
|
showToggle: false,
|
||||||
|
showColumns: false,
|
||||||
|
sidePagination: "client",
|
||||||
|
columns: [
|
||||||
|
{ checkbox: true },
|
||||||
|
{ field: "assetId", title: "资产", formatter: function(value, row, index) { return buildAssetCell(row, index); } },
|
||||||
|
{ field: "categoryName", title: "资产类别" },
|
||||||
|
{ field: "beforeWarehouseName", title: "借用前仓位", formatter: function(value, row) {
|
||||||
|
return $("<span>").text((row.beforeWarehouseName || "-") + " / " + (row.beforeLocationName || "-")).prop("outerHTML");
|
||||||
|
}},
|
||||||
|
{ field: "returnStatus", title: "归还状态", formatter: function(value) { return value || "-"; } },
|
||||||
|
{ field: "remark", title: "明细备注", formatter: function(value, row, index) {
|
||||||
|
return buildInput("amsBorrowOrderItemList[" + index + "].remark", value, 500);
|
||||||
|
}},
|
||||||
|
{ title: "操作", align: "center", formatter: function(value, row) {
|
||||||
|
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeAsset(\'' + row.assetId + '\')"><i class="fa fa-remove"></i>删除</a>';
|
||||||
|
}}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectAssets() {
|
||||||
|
syncDetailRows();
|
||||||
|
$.modal.openOptions({
|
||||||
|
title: "选择可借用资产",
|
||||||
|
url: prefix + "/selectAsset?orderId=" + orderId,
|
||||||
|
width: "1200",
|
||||||
|
height: "680",
|
||||||
|
callBack: addSelectedAssets
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSelectedAssets(index, layero) {
|
||||||
|
var selectedAssets = layero.find("iframe")[0].contentWindow.getSelectedAssets();
|
||||||
|
if (!selectedAssets || selectedAssets.length === 0) {
|
||||||
|
$.modal.alertWarning("请至少选择一条资产记录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
syncDetailRows();
|
||||||
|
var existing = {};
|
||||||
|
$.each($("#bootstrap-table").bootstrapTable("getData"), function(i, row) {
|
||||||
|
existing[String(row.assetId)] = true;
|
||||||
|
});
|
||||||
|
$.each(selectedAssets, function(i, asset) {
|
||||||
|
if (!existing[String(asset.assetId)]) {
|
||||||
|
$("#bootstrap-table").bootstrapTable("insertRow", {
|
||||||
|
index: $("#bootstrap-table").bootstrapTable("getData").length,
|
||||||
|
row: buildBorrowItem(asset)
|
||||||
|
});
|
||||||
|
existing[String(asset.assetId)] = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$.modal.close(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildBorrowItem(asset) {
|
||||||
|
return {
|
||||||
|
assetId: asset.assetId,
|
||||||
|
assetCode: asset.assetCode,
|
||||||
|
assetName: asset.assetName,
|
||||||
|
categoryName: asset.categoryName,
|
||||||
|
beforeWarehouseName: asset.warehouseName,
|
||||||
|
beforeLocationName: asset.locationName,
|
||||||
|
returnStatus: "BORROWING",
|
||||||
|
remark: ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeSelectedAssets() {
|
||||||
|
var rows = $("#bootstrap-table").bootstrapTable("getSelections");
|
||||||
|
if (rows.length === 0) {
|
||||||
|
$.modal.alertWarning("请至少选择一条记录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
syncDetailRows();
|
||||||
|
$("#bootstrap-table").bootstrapTable("remove", {
|
||||||
|
field: "assetId",
|
||||||
|
values: $.map(rows, function(row) { return row.assetId; })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAsset(assetId) {
|
||||||
|
syncDetailRows();
|
||||||
|
$("#bootstrap-table").bootstrapTable("remove", { field: "assetId", values: [assetId] });
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncDetailRows() {
|
||||||
|
var rows = $("#bootstrap-table").bootstrapTable("getData");
|
||||||
|
$.each(rows, function(index, row) {
|
||||||
|
var tr = $("#bootstrap-table tbody tr[data-index='" + index + "']");
|
||||||
|
row.remark = tr.find("[name$='.remark']").val() || "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildAssetCell(row, index) {
|
||||||
|
var hidden = $("<input>").attr({
|
||||||
|
type: "hidden",
|
||||||
|
name: "amsBorrowOrderItemList[" + index + "].assetId",
|
||||||
|
value: row.assetId
|
||||||
|
}).prop("outerHTML");
|
||||||
|
return hidden + $("<span>").text(row.assetCode + " - " + row.assetName).prop("outerHTML");
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildInput(name, value, maxLength) {
|
||||||
|
return $("<input>").addClass("form-control").attr({
|
||||||
|
type: "text",
|
||||||
|
name: name,
|
||||||
|
maxlength: maxLength
|
||||||
|
}).val(value || "").prop("outerHTML");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('选择可借用资产')" />
|
||||||
|
</head>
|
||||||
|
<body class="gray-bg">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="formId">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li><label>资产编码:</label><input type="text" name="assetCode"></li>
|
||||||
|
<li><label>资产名称:</label><input type="text" name="assetName"></li>
|
||||||
|
<li><label>资产类别:</label><input type="text" name="categoryName"></li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
|
||||||
|
<i class="fa fa-search"></i> 搜索
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()">
|
||||||
|
<i class="fa fa-refresh"></i> 重置
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "asset/borrow";
|
||||||
|
var orderId = [[${orderId}]];
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var url = prefix + "/availableAssetList";
|
||||||
|
if (orderId) {
|
||||||
|
url += "?orderId=" + orderId;
|
||||||
|
}
|
||||||
|
$.table.init({
|
||||||
|
url: url,
|
||||||
|
showSearch: false,
|
||||||
|
showRefresh: true,
|
||||||
|
showToggle: false,
|
||||||
|
showColumns: false,
|
||||||
|
modalName: "可借用资产",
|
||||||
|
columns: [
|
||||||
|
{ checkbox: true },
|
||||||
|
{ field: "assetCode", title: "资产编码" },
|
||||||
|
{ field: "assetName", title: "资产名称" },
|
||||||
|
{ field: "categoryName", title: "资产类别" },
|
||||||
|
{ field: "warehouseName", title: "当前仓库" },
|
||||||
|
{ field: "locationName", title: "当前位置" },
|
||||||
|
{ field: "tagCode", title: "RFID标签", formatter: function(value) { return value || "-"; } }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function getSelectedAssets() {
|
||||||
|
return $("#bootstrap-table").bootstrapTable("getSelections");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,223 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('借用单详情')" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="main-content">
|
||||||
|
<form class="form-horizontal" th:object="${amsBorrowOrder}">
|
||||||
|
<h4 class="form-header h4">基本信息</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用单号:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{borrowNo}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用人:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{borrowUserName}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">借用部门:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{borrowDeptName}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">预计归还:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<p class="form-control-plaintext" th:text="*{expectedReturnDate == null ? '' : #dates.format(expectedReturnDate, 'yyyy-MM-dd')}"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">单据状态:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{@dict.getLabel('ams_borrow_status', orderStatus)}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">确认人:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{confirmUserName}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">确认时间:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<p class="form-control-plaintext" th:text="*{confirmTime == null ? '' : #dates.format(confirmTime, 'yyyy-MM-dd HH:mm:ss')}"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">驳回原因:</label>
|
||||||
|
<div class="col-sm-8"><p class="form-control-plaintext" th:text="*{rejectReason}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 control-label">备注:</label>
|
||||||
|
<div class="col-sm-10"><p class="form-control-plaintext" th:text="*{remark}"></p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4 class="form-header h4">借用明细</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>资产</th>
|
||||||
|
<th>资产类别</th>
|
||||||
|
<th>借用前仓位</th>
|
||||||
|
<th>归还仓位</th>
|
||||||
|
<th>归还状态</th>
|
||||||
|
<th>实际归还</th>
|
||||||
|
<th>备注</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="item, stat : *{amsBorrowOrderItemList}">
|
||||||
|
<td th:text="${stat.count}"></td>
|
||||||
|
<td th:text="${item.assetCode + ' - ' + item.assetName}"></td>
|
||||||
|
<td th:text="${item.categoryName}"></td>
|
||||||
|
<td th:text="${(item.beforeWarehouseName ?: '-') + ' / ' + (item.beforeLocationName ?: '-')}"></td>
|
||||||
|
<td>
|
||||||
|
<div th:if="${item.returnStatus == 'BORROWING'}">
|
||||||
|
<select class="form-control return-warehouse" th:id="${'returnWarehouseId_' + item.itemId}"
|
||||||
|
th:data-item-id="${item.itemId}" onchange="refreshReturnLocations(this.getAttribute('data-item-id'))">
|
||||||
|
<option value="">请选择归还仓库</option>
|
||||||
|
<option th:each="warehouse : ${warehouseList}" th:value="${warehouse.warehouseId}"
|
||||||
|
th:text="${warehouse.warehouseCode + ' - ' + warehouse.warehouseName}"
|
||||||
|
th:selected="${warehouse.warehouseId == item.beforeWarehouseId}"></option>
|
||||||
|
</select>
|
||||||
|
<select class="form-control return-location" th:id="${'returnLocationId_' + item.itemId}"
|
||||||
|
th:data-default-location-id="${item.beforeLocationId}">
|
||||||
|
<option value="">请选择归还位置</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<span th:if="${item.returnStatus != 'BORROWING'}"
|
||||||
|
th:text="${(item.returnWarehouseName ?: '-') + ' / ' + (item.returnLocationName ?: '-')}"></span>
|
||||||
|
</td>
|
||||||
|
<td th:text="${@dict.getLabel('ams_borrow_status', item.returnStatus)}"></td>
|
||||||
|
<td th:text="${item.actualReturnDate == null ? '' : #dates.format(item.actualReturnDate, 'yyyy-MM-dd')}"></td>
|
||||||
|
<td th:text="${item.remark}"></td>
|
||||||
|
<td>
|
||||||
|
<a th:if="${item.returnStatus == 'BORROWING'}"
|
||||||
|
class="btn btn-primary btn-xs" shiro:hasPermission="asset:borrow:applyReturn"
|
||||||
|
href="javascript:void(0)" th:onclick="'applyReturn(' + ${item.itemId} + ')'">
|
||||||
|
<i class="fa fa-sign-in"></i>申请归还
|
||||||
|
</a>
|
||||||
|
<a th:if="${item.returnStatus == 'PENDING_RETURN_CONFIRM'}"
|
||||||
|
class="btn btn-primary btn-xs" shiro:hasPermission="asset:borrow:confirmReturn"
|
||||||
|
href="javascript:void(0)" th:onclick="'confirmReturn(' + ${item.itemId} + ')'">
|
||||||
|
<i class="fa fa-check"></i>确认归还
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "asset/borrow";
|
||||||
|
var orderId = [[${amsBorrowOrder.orderId}]];
|
||||||
|
var locationList = [[${locationList}]];
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$(".return-location").each(function() {
|
||||||
|
var itemId = this.id.replace("returnLocationId_", "");
|
||||||
|
refreshReturnLocations(itemId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function refreshReturnLocations(itemId) {
|
||||||
|
var warehouseId = $("#returnWarehouseId_" + itemId).val();
|
||||||
|
var locationSelect = $("#returnLocationId_" + itemId);
|
||||||
|
var defaultLocationId = locationSelect.attr("data-default-location-id");
|
||||||
|
locationSelect.empty().append($("<option>").val("").text("请选择归还位置"));
|
||||||
|
$.each(locationList, function(i, location) {
|
||||||
|
if (String(location.warehouseId) === String(warehouseId)) {
|
||||||
|
var option = $("<option>").val(location.locationId).text(location.locationCode + " - " + location.locationName);
|
||||||
|
if (String(location.locationId) === String(defaultLocationId)) {
|
||||||
|
option.attr("selected", "selected");
|
||||||
|
}
|
||||||
|
locationSelect.append(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyReturn(itemId) {
|
||||||
|
var warehouseId = $("#returnWarehouseId_" + itemId).val();
|
||||||
|
var locationId = $("#returnLocationId_" + itemId).val();
|
||||||
|
if (!warehouseId || !locationId) {
|
||||||
|
$.modal.alertWarning("请选择归还仓库和归还位置");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.modal.confirm("提交后该明细将进入待归还确认状态,是否继续?", function() {
|
||||||
|
postJson(prefix + "/applyReturn/" + orderId, [{
|
||||||
|
itemId: itemId,
|
||||||
|
returnWarehouseId: warehouseId,
|
||||||
|
returnLocationId: locationId
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmReturn(itemId) {
|
||||||
|
$.modal.confirm("确认后该资产将重新入库到申请归还时保存的仓位,是否继续?", function() {
|
||||||
|
postJson(prefix + "/confirmReturn/" + orderId, [{ itemId: itemId }]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function postJson(url, payload) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "post",
|
||||||
|
contentType: "application/json",
|
||||||
|
dataType: "json",
|
||||||
|
data: JSON.stringify(payload),
|
||||||
|
beforeSend: function(xhr) {
|
||||||
|
var token = $("meta[name='csrf-token']").attr("content");
|
||||||
|
if (token) {
|
||||||
|
xhr.setRequestHeader("X-CSRF-Token", token);
|
||||||
|
}
|
||||||
|
$.modal.loading("正在处理中,请稍候...");
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$.modal.closeLoading();
|
||||||
|
},
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code === web_status.SUCCESS) {
|
||||||
|
$.modal.msgSuccess(result.msg);
|
||||||
|
if (parent && parent.$ && parent.$.table) {
|
||||||
|
parent.$.table.refresh();
|
||||||
|
}
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
$.modal.alertError(result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue