Browse Source

优化修改资产单据页面,新增调拨、借用、归还单据功能

LinWuTai 1 year ago
parent
commit
d143914d14

+ 6 - 8
ruoyi-admin/src/main/java/com/ruoyi/asset/domain/TbAssetInformation.java

@@ -2,10 +2,7 @@ package com.ruoyi.asset.domain;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
+import lombok.*;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -17,6 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * @author 原动力
  * @date 2023-05-15
  */
+@EqualsAndHashCode(callSuper = true)
 @AllArgsConstructor
 @NoArgsConstructor
 @Data
@@ -92,7 +90,7 @@ public class TbAssetInformation extends BaseEntity
 
     /** 原值(元) */
     @Excel(name = "原值", readConverterExp = "元=")
-    private String originalValue;
+    private Double originalValue;
 
     /** 使用年限 */
     @Excel(name = "使用年限")
@@ -100,15 +98,15 @@ public class TbAssetInformation extends BaseEntity
 
     /** 净值(元) */
     @Excel(name = "净值", readConverterExp = "元=")
-    private String netValue;
+    private Double netValue;
 
     /** 残值(元) */
     @Excel(name = "残值", readConverterExp = "元=")
-    private String residualValue;
+    private Double residualValue;
 
     /** 累计折旧(元) */
     @Excel(name = "累计折旧", readConverterExp = "元=")
-    private String accumulatedDepreciation;
+    private Double accumulatedDepreciation;
 
     /** 最近折旧日期 */
     @JsonFormat(pattern = "yyyy-MM-dd")

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/asset/mapper/TbAssetInformationMapper.java

@@ -26,7 +26,6 @@ public interface TbAssetInformationMapper
      * @param assetNumber 资产编号
      * @return 资产信息
      */
-    @Select("select * from tb_asset_information where number = #{assetNumber}")
     TbAssetInformation selectTbAssetInformationByAssetNumber(String assetNumber);
 
     /**

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/controller/TbOrderController.java

@@ -3,6 +3,7 @@ package com.ruoyi.order.controller;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
@@ -333,6 +334,14 @@ public class TbOrderController extends BaseController
     private OrderDTO getOrderDTO(TbOrder order) {
         OrderDTO orderDTO = BeanUtil.toBean(order, OrderDTO.class);
         String applicationDepartment = order.getApplicationDepartment();
+        if (!orderDTO.getOrderType().equals(OrderTypeEnum.ADJUSTMENT.getTypeCode())) {
+            Map<String, Double> accounting = tbOrderService.accounting(orderDTO.getOrderNumber());
+            Double assetTotalOriginalValue = accounting.get("assetTotalOriginalValue");
+            Double assetTotalNetValue = accounting.get("assetTotalNetValue");
+
+            orderDTO.setAssetTotalOriginalValue(assetTotalOriginalValue);
+            orderDTO.setAssetTotalNetValue(assetTotalNetValue);
+        }
         if (StrUtil.isNotBlank(applicationDepartment)) {
             SysDept sysDept = sysDeptService.selectDeptById(Long.valueOf(applicationDepartment));
             if (sysDept != null) {

+ 51 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/controller/TbOrderDetailController.java

@@ -1,7 +1,16 @@
 package com.ruoyi.order.controller;
 
+import java.util.Date;
 import java.util.List;
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.util.StrUtil;
+import com.ruoyi.asset.domain.TbAssetInformation;
+import com.ruoyi.asset.service.ITbAssetInformationService;
+import com.ruoyi.order.domain.TbOrder;
+import com.ruoyi.order.domain.dto.OrderTypeEnum;
+import com.ruoyi.order.service.ITbOrderService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -34,6 +43,12 @@ public class TbOrderDetailController extends BaseController
     @Autowired
     private ITbOrderDetailService tbOrderDetailService;
 
+    @Resource
+    private ITbAssetInformationService tbAssetInformationService;
+
+    @Resource
+    private ITbOrderService orderService;
+
     /**
      * 查询单据明细列表
      */
@@ -77,6 +92,42 @@ public class TbOrderDetailController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TbOrderDetail tbOrderDetail)
     {
+        String orderNumber = tbOrderDetail.getOrderNumber();
+        TbOrder tbOrder = orderService.selectTbOrderByOrderNumber(orderNumber);
+        if (tbOrder == null) {
+            return error("单据不存在");
+        }
+        if (tbOrder.getRecordStatus() > 0) {
+            return error("单据已提交/审核");
+        }
+        Long orderType = tbOrder.getOrderType();
+        if (orderType.equals(OrderTypeEnum.ADJUSTMENT.getTypeCode())) {
+            return error("资产调整无需明细");
+        }
+        String assetNumber = tbOrderDetail.getAssetNumber();
+        TbAssetInformation tbAssetInformation = tbAssetInformationService.selectTbAssetAdjustmentByAssetNumber(assetNumber);
+        if (tbAssetInformation == null) {
+            return error("资产不存在");
+        }
+        int count = tbOrderDetailService.countTbOrderDetailByOrderNumberAndAssetNumber(orderNumber, assetNumber);
+        if (count > 0) {
+            return error("单据明细已存在");
+        }
+        if (orderType.equals(OrderTypeEnum.ALLOCATION.getTypeCode())) {
+            TbOrderDetail.allocationOrderDetail(tbOrderDetail);
+            String responsiblePerson = tbAssetInformation.getResponsiblePerson();
+            String locationNumber = tbAssetInformation.getLocationNumber();
+            tbOrderDetail.setAllocationOldResponsiblePerson(responsiblePerson);
+            tbOrderDetail.setAllocationOldLocationNumber(locationNumber);
+        } else if (orderType.equals(OrderTypeEnum.LEND.getTypeCode())) {
+            Date lendReturnDate = tbOrderDetail.getLendReturnDate();
+            if (lendReturnDate == null) {
+                return error("预计归还时间不能为空");
+            }
+            TbOrderDetail.lendOrderDetail(tbOrderDetail);
+        } else {
+            TbOrderDetail.otherOrderDetail(tbOrderDetail);
+        }
         return toAjax(tbOrderDetailService.insertTbOrderDetail(tbOrderDetail));
     }
 

+ 0 - 30
ruoyi-admin/src/main/java/com/ruoyi/order/domain/TbOrder.java

@@ -30,14 +30,6 @@ public class TbOrder extends BaseEntity
     @Excel(name = "单据类型,0:未知:1:调整,2:调拨,3:借出,4:拆分, 5:闲置,6:启用,7:报废,8:变卖")
     private Long orderType;
 
-    /** 资产总原值(元) */
-    @Excel(name = "资产总原值", readConverterExp = "元=")
-    private String assetTotalOriginalValue;
-
-    /** 资产总净值(元) */
-    @Excel(name = "资产总净值", readConverterExp = "元=")
-    private String assetTotalNetValue;
-
     /** 申请日期 */
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd")
@@ -159,8 +151,6 @@ public class TbOrder extends BaseEntity
     private static void setNullAdjustment(TbOrder tbOrder) {
         tbOrder.setAdjustmentOriginalAssetInfo(null);
         tbOrder.setAdjustmentAssetNumber(null);
-        tbOrder.setAssetTotalNetValue(null);
-        tbOrder.setAssetTotalOriginalValue(null);
     }
 
     public void setId(Long id) 
@@ -190,24 +180,6 @@ public class TbOrder extends BaseEntity
     {
         return orderType;
     }
-    public void setAssetTotalOriginalValue(String assetTotalOriginalValue) 
-    {
-        this.assetTotalOriginalValue = assetTotalOriginalValue;
-    }
-
-    public String getAssetTotalOriginalValue() 
-    {
-        return assetTotalOriginalValue;
-    }
-    public void setAssetTotalNetValue(String assetTotalNetValue) 
-    {
-        this.assetTotalNetValue = assetTotalNetValue;
-    }
-
-    public String getAssetTotalNetValue() 
-    {
-        return assetTotalNetValue;
-    }
     public void setApplicationDate(Date applicationDate) 
     {
         this.applicationDate = applicationDate;
@@ -377,8 +349,6 @@ public class TbOrder extends BaseEntity
             .append("id", getId())
             .append("orderNumber", getOrderNumber())
             .append("orderType", getOrderType())
-            .append("assetTotalOriginalValue", getAssetTotalOriginalValue())
-            .append("assetTotalNetValue", getAssetTotalNetValue())
             .append("applicationDate", getApplicationDate())
             .append("applicationDepartment", getApplicationDepartment())
             .append("adjustmentAssetNumber", getAdjustmentAssetNumber())

+ 30 - 1
ruoyi-admin/src/main/java/com/ruoyi/order/domain/TbOrderDetail.java

@@ -58,7 +58,36 @@ public class TbOrderDetail extends BaseEntity
     @Excel(name = "【借出】归还经手人")
     private String lendBySponsor;
 
-    public void setId(Long id) 
+    public TbOrderDetail() {
+    }
+
+    public static void allocationOrderDetail(TbOrderDetail tbOrderDetail) {
+        getNullLendOrderDetail(tbOrderDetail);
+    }
+
+    public static void lendOrderDetail(TbOrderDetail tbOrderDetail) {
+        getNullAllocationOrderDetail(tbOrderDetail);
+    }
+
+    public static void otherOrderDetail(TbOrderDetail tbOrderDetail) {
+        getNullLendOrderDetail(tbOrderDetail);
+        getNullAllocationOrderDetail(tbOrderDetail);
+    }
+
+    public static void getNullLendOrderDetail(TbOrderDetail tbOrderDetail) {
+        tbOrderDetail.setLendActualReturnDate(null);
+        tbOrderDetail.setLendBySponsor(null);
+        tbOrderDetail.setLendReturnDate(null);
+    }
+
+    public static void getNullAllocationOrderDetail(TbOrderDetail tbOrderDetail) {
+        tbOrderDetail.setAllocationOldLocationNumber(null);
+        tbOrderDetail.setAllocationOldResponsiblePerson(null);
+        tbOrderDetail.setAllocationNewLocationNumber(null);
+        tbOrderDetail.setAllocationNewResponsiblePerson(null);
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/domain/dto/OrderDTO.java

@@ -8,6 +8,12 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 @Data
 public class OrderDTO extends TbOrder {
+    /** 资产总原值(元) */
+    private Double assetTotalOriginalValue;
+
+    /** 资产总净值(元) */
+    private Double assetTotalNetValue;
+
     /** 【调整】资产信息 */
     private TbAssetInformation adjustmentAssetInformation;
 

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/mapper/TbOrderDetailMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.order.mapper;
 
 import java.util.List;
 import com.ruoyi.order.domain.TbOrderDetail;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -61,6 +62,14 @@ public interface TbOrderDetailMapper
     public int deleteTbOrderDetailByIds(Long[] ids);
 
     /**
+     * 获取单据详细信息
+     *
+     * @param orderNumber 单据编号
+     * @return 单据信息集合
+     */
+    List<TbOrderDetail> selectTbOrderDetailByOrderNumber(String orderNumber);
+
+    /**
      * 统计单据明细
      *
      * @param orderNumber 单据编号
@@ -68,4 +77,14 @@ public interface TbOrderDetailMapper
      */
     @Select("SELECT COUNT(id) FROM tb_order_detail WHERE order_number = #{orderNumber}")
     int countTbOrderDetailByOrderNumber(String orderNumber);
+
+    /**
+     * 统计单据明细
+     *
+     * @param orderNumber 单据编号
+     * @param assetNumber 资产编号
+     * @return 结果
+     */
+    @Select("SELECT COUNT(id) FROM tb_order_detail WHERE order_number = #{orderNumber} and asset_number = #{assetNumber}")
+    int countTbOrderDetailByOrderNumberAndAssetNumber(@Param("orderNumber") String orderNumber, @Param("assetNumber") String assetNumber);
 }

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/mapper/TbOrderMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.order.mapper;
 
 import java.util.List;
 import com.ruoyi.order.domain.TbOrder;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * 资产单据Mapper接口
@@ -58,4 +59,12 @@ public interface TbOrderMapper
      * @return 结果
      */
     public int deleteTbOrderByIds(Long[] ids);
+
+    /**
+     * 获取单据信息
+     *
+     * @param orderNumber 单据编号
+     * @return 单据信息
+     */
+    TbOrder selectTbOrderByOrderNumber(String orderNumber);
 }

+ 17 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/service/ITbOrderDetailService.java

@@ -60,10 +60,27 @@ public interface ITbOrderDetailService
     public int deleteTbOrderDetailById(Long id);
 
     /**
+     * 获取单据详细信息
+     *
+     * @param orderNumber 单据编号
+     * @return 单据信息集合
+     */
+    List<TbOrderDetail> selectTbOrderDetailByOrderNumber(String orderNumber);
+
+    /**
      * 统计单据明细
      *
      * @param orderNumber 单据编号
      * @return 结果
      */
     int countTbOrderDetailByOrderNumber(String orderNumber);
+
+    /**
+     * 统计单据明细
+     *
+     * @param orderNumber 单据编号
+     * @param assetNumber 资产编号
+     * @return 结果
+     */
+    int countTbOrderDetailByOrderNumberAndAssetNumber(String orderNumber, String assetNumber);
 }

+ 17 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/service/ITbOrderService.java

@@ -1,7 +1,10 @@
 package com.ruoyi.order.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.ruoyi.order.domain.TbOrder;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 资产单据Service接口
@@ -58,4 +61,18 @@ public interface ITbOrderService
      * @return 结果
      */
     public int deleteTbOrderById(Long id);
+
+    /**
+     * 获取单据信息
+     *
+     * @param orderNumber 单据编号
+     * @return 单据信息
+     */
+    TbOrder selectTbOrderByOrderNumber(String orderNumber);
+
+    /**
+     * 资产核算
+     * @param orderNumber 单据编号
+     */
+    Map<String, Double> accounting(String orderNumber);
 }

+ 17 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/service/impl/TbOrderDetailServiceImpl.java

@@ -91,6 +91,11 @@ public class TbOrderDetailServiceImpl implements ITbOrderDetailService
         return tbOrderDetailMapper.deleteTbOrderDetailById(id);
     }
 
+    @Override
+    public List<TbOrderDetail> selectTbOrderDetailByOrderNumber(String orderNumber) {
+        return tbOrderDetailMapper.selectTbOrderDetailByOrderNumber(orderNumber);
+    }
+
     /**
      * 统计单据明细
      *
@@ -101,4 +106,16 @@ public class TbOrderDetailServiceImpl implements ITbOrderDetailService
     public int countTbOrderDetailByOrderNumber(String orderNumber) {
         return tbOrderDetailMapper.countTbOrderDetailByOrderNumber(orderNumber);
     }
+
+    /**
+     * 统计单据明细
+     *
+     * @param orderNumber 单据编号
+     * @param assetNumber 资产编号
+     * @return 结果
+     */
+    @Override
+    public int countTbOrderDetailByOrderNumberAndAssetNumber(String orderNumber, String assetNumber) {
+        return tbOrderDetailMapper.countTbOrderDetailByOrderNumberAndAssetNumber(orderNumber, assetNumber);
+    }
 }

+ 44 - 0
ruoyi-admin/src/main/java/com/ruoyi/order/service/impl/TbOrderServiceImpl.java

@@ -1,6 +1,9 @@
 package com.ruoyi.order.service.impl;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 import cn.hutool.core.lang.func.LambdaUtil;
@@ -10,7 +13,10 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.ruoyi.asset.domain.TbAssetInformation;
 import com.ruoyi.asset.mapper.TbAssetInformationMapper;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.order.domain.TbOrderDetail;
 import com.ruoyi.order.domain.dto.OrderTypeEnum;
+import com.ruoyi.order.mapper.TbOrderDetailMapper;
 import com.ruoyi.system.mapper.SysDeptMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,6 +38,12 @@ public class TbOrderServiceImpl implements ITbOrderService
     @Resource
     private TbOrderMapper tbOrderMapper;
 
+    @Resource
+    private TbOrderDetailMapper tbOrderDetailMapper;
+
+    @Resource
+    private TbAssetInformationMapper tbAssetInformationMapper;
+
     /**
      * 查询资产单据
      * 
@@ -103,4 +115,36 @@ public class TbOrderServiceImpl implements ITbOrderService
     {
         return tbOrderMapper.deleteTbOrderById(id);
     }
+
+    @Override
+    public TbOrder selectTbOrderByOrderNumber(String orderNumber) {
+        return tbOrderMapper.selectTbOrderByOrderNumber(orderNumber);
+    }
+
+    @Override
+    public Map<String, Double> accounting(String orderNumber) {
+        List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectTbOrderDetailByOrderNumber(orderNumber);
+
+        double originalValue = 0;
+        double netValue = 0;
+
+        for (TbOrderDetail tbOrderDetail : tbOrderDetails) {
+            String assetNumber = tbOrderDetail.getAssetNumber();
+            TbAssetInformation tbAssetInformation = tbAssetInformationMapper.selectTbAssetInformationByAssetNumber(assetNumber);
+            Double assetOriginalValue = tbAssetInformation.getOriginalValue();
+            Double assetNetValue = tbAssetInformation.getNetValue();
+            if (assetOriginalValue != null) {
+                originalValue += assetOriginalValue;
+            }
+            if (assetNetValue != null) {
+                netValue += assetNetValue;
+            }
+        }
+
+        HashMap<String, Double> hashMap = new HashMap<>();
+        hashMap.put("assetTotalOriginalValue", originalValue);
+        hashMap.put("assetTotalNetValue", netValue);
+
+        return hashMap;
+    }
 }

+ 5 - 0
ruoyi-admin/src/main/resources/mapper/asset/TbAssetInformationMapper.xml

@@ -111,6 +111,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTbAssetInformationVo"/>
         where id = #{id}
     </select>
+
+    <select id="selectTbAssetInformationByAssetNumber" parameterType="String" resultMap="TbAssetInformationResult">
+        <include refid="selectTbAssetInformationVo"></include>
+        where number = #{assetNumber}
+    </select>
         
     <insert id="insertTbAssetInformation" parameterType="TbAssetInformation" useGeneratedKeys="true" keyProperty="id">
         insert into tb_asset_information

+ 5 - 0
ruoyi-admin/src/main/resources/mapper/order/TbOrderDetailMapper.xml

@@ -36,6 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="lendBySponsor != null  and lendBySponsor != ''"> and lend_by_sponsor = #{lendBySponsor}</if>
         </where>
     </select>
+
+    <select id="selectTbOrderDetailByOrderNumber" parameterType="String" resultMap="TbOrderDetailResult">
+        <include refid="selectTbOrderDetailVo"/>
+        where order_number = #{orderNumber}
+    </select>
     
     <select id="selectTbOrderDetailById" parameterType="Long" resultMap="TbOrderDetailResult">
         <include refid="selectTbOrderDetailVo"/>

+ 9 - 15
ruoyi-admin/src/main/resources/mapper/order/TbOrderMapper.xml

@@ -8,8 +8,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="orderNumber"    column="order_number"    />
         <result property="orderType"    column="order_type"    />
-        <result property="assetTotalOriginalValue"    column="asset_total_original_value"    />
-        <result property="assetTotalNetValue"    column="asset_total_net_value"    />
         <result property="applicationDate"    column="application_date"    />
         <result property="applicationDepartment"    column="application_department"    />
         <result property="adjustmentAssetNumber"    column="adjustment_asset_number"    />
@@ -31,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTbOrderVo">
-        select id, order_number, order_type, asset_total_original_value, asset_total_net_value, application_date, application_department, adjustment_asset_number, adjustment_original_asset_info, allocation_call_out_department, allocation_call_out_by, allocation_call_out_date, allocation_call_in_department, allocation_call_in_by, allocation_call_in_date, lend_department, lend_by_sponsor, lend_passing_unit, reason, prepared_by, prepared_department, corporation, record_status from tb_order
+        select id, order_number, order_type, application_date, application_department, adjustment_asset_number, adjustment_original_asset_info, allocation_call_out_department, allocation_call_out_by, allocation_call_out_date, allocation_call_in_department, allocation_call_in_by, allocation_call_in_date, lend_department, lend_by_sponsor, lend_passing_unit, reason, prepared_by, prepared_department, corporation, record_status from tb_order
     </sql>
 
     <select id="selectTbOrderList" parameterType="TbOrder" resultMap="TbOrderResult">
@@ -63,15 +61,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTbOrderVo"/>
         where id = #{id}
     </select>
+
+    <select id="selectTbOrderByOrderNumber" parameterType="String" resultMap="TbOrderResult">
+        <include refid="selectTbOrderVo"></include>
+        where order_number = #{orderNumber}
+    </select>
         
     <insert id="insertTbOrder" parameterType="TbOrder" useGeneratedKeys="true" keyProperty="id">
         insert into tb_order
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="orderNumber != null and orderNumber != ''">order_number,</if>
-            <if test="orderType != null">order_type,</if>
-            <if test="assetTotalOriginalValue != null and assetTotalOriginalValue != ''">asset_total_original_value,</if>
-            <if test="assetTotalNetValue != null and assetTotalNetValue != ''">asset_total_net_value,</if>
-            <if test="applicationDate != null">application_date,</if>
+            <if test="orderType != null">order_type,</if><if test="applicationDate != null">application_date,</if>
             <if test="applicationDepartment != null">application_department,</if>
             <if test="adjustmentAssetNumber != null">adjustment_asset_number,</if>
             <if test="adjustmentOriginalAssetInfo != null">adjustment_original_asset_info,</if>
@@ -92,10 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderNumber != null and orderNumber != ''">#{orderNumber},</if>
-            <if test="orderType != null">#{orderType},</if>
-            <if test="assetTotalOriginalValue != null and assetTotalOriginalValue != ''">#{assetTotalOriginalValue},</if>
-            <if test="assetTotalNetValue != null and assetTotalNetValue != ''">#{assetTotalNetValue},</if>
-            <if test="applicationDate != null">#{applicationDate},</if>
+            <if test="orderType != null">#{orderType},</if><if test="applicationDate != null">#{applicationDate},</if>
             <if test="applicationDepartment != null">#{applicationDepartment},</if>
             <if test="adjustmentAssetNumber != null">#{adjustmentAssetNumber},</if>
             <if test="adjustmentOriginalAssetInfo != null">#{adjustmentOriginalAssetInfo},</if>
@@ -120,10 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update tb_order
         <trim prefix="SET" suffixOverrides=",">
             <if test="orderNumber != null and orderNumber != ''">order_number = #{orderNumber},</if>
-            <if test="orderType != null">order_type = #{orderType},</if>
-            <if test="assetTotalOriginalValue != null and assetTotalOriginalValue != ''">asset_total_original_value = #{assetTotalOriginalValue},</if>
-            <if test="assetTotalNetValue != null and assetTotalNetValue != ''">asset_total_net_value = #{assetTotalNetValue},</if>
-            <if test="applicationDate != null">application_date = #{applicationDate},</if>
+            <if test="orderType != null">order_type = #{orderType},</if><if test="applicationDate != null">application_date = #{applicationDate},</if>
             <if test="applicationDepartment != null">application_department = #{applicationDepartment},</if>
             <if test="adjustmentAssetNumber != null">adjustment_asset_number = #{adjustmentAssetNumber},</if>
             <if test="adjustmentOriginalAssetInfo != null">adjustment_original_asset_info = #{adjustmentOriginalAssetInfo},</if>

+ 33 - 5
ruoyi-ui/src/views/order/detail/index.vue

@@ -136,7 +136,7 @@
       <el-table-column v-if="orderInfo.orderType === 2" label="【调拨】旧功能位置编号" align="center" prop="allocationOldLocationNumber" />
       <el-table-column v-if="orderInfo.orderType === 2" label="【调拨】新管理人" align="center" prop="allocationNewResponsiblePerson" />
       <el-table-column v-if="orderInfo.orderType === 2" label="【调拨】新功能位置编号" align="center" prop="allocationNewLocationNumber" />
-      <el-table-column v-if="orderInfo.orderType === 2" label="【借出】预计归还时间" align="center" prop="lendReturnDate" width="180">
+      <el-table-column v-if="orderInfo.orderType === 3" label="【借出】预计归还时间" align="center" prop="lendReturnDate" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.lendReturnDate, '{y}-{m}-{d}') }}</span>
         </template>
@@ -151,6 +151,15 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-if="orderInfo.orderType === 3 && orderInfo.recordStatus > 1"
+            size="mini"
+            type="text"
+            icon="el-icon-position"
+            @click="onReturn(scope.row)"
+            v-hasPermi="['order:order:edit']"
+          >归还</el-button>
+          <el-button
+            :disabled="orderInfo.recordStatus > 0"
             size="mini"
             type="text"
             icon="el-icon-edit"
@@ -158,6 +167,7 @@
             v-hasPermi="['order:detail:edit']"
           >修改</el-button>
           <el-button
+            :disabled="orderInfo.recordStatus > 0"
             size="mini"
             type="text"
             icon="el-icon-delete"
@@ -183,13 +193,20 @@
           <el-input v-model="form.orderNumber" placeholder="请输入单据编号" disabled/>
         </el-form-item>
         <el-form-item label="资产编号" prop="assetNumber">
-          <el-input v-model="form.assetNumber" placeholder="请输入资产编号" />
+          <el-input v-model="form.assetNumber" placeholder="请输入资产编号" :disabled="orderInfo.recordStatus > 0"/>
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 2" label="【调拨】旧管理人" prop="allocationOldResponsiblePerson">
           <el-input v-model="form.allocationOldResponsiblePerson" placeholder="系统自动补充" disabled/>
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 2" label="【调拨】旧功能位置" prop="allocationOldLocationNumber">
-          <el-input v-model="form.allocationOldLocationNumber" placeholder="系统自动补充" disabled/>
+          <el-select v-model="form.allocationOldLocationNumber" placeholder="系统自动补充" disabled>
+            <el-option
+              v-for="item in locationList"
+              :key="item.number"
+              :label="item.name"
+              :value="item.number"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 2" label="【调拨】新管理人" prop="allocationNewResponsiblePerson">
           <el-input v-model="form.allocationNewResponsiblePerson" placeholder="请输入【调拨】新管理人" />
@@ -206,6 +223,7 @@
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 3" label="【借出】预计归还时间" prop="lendReturnDate">
           <el-date-picker clearable
+            :disabled="orderInfo.recordStatus > 0"
             v-model="form.lendReturnDate"
             type="date"
             value-format="yyyy-MM-dd"
@@ -214,6 +232,7 @@
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 3" label="【借出】实际归还时间" prop="lendActualReturnDate">
           <el-date-picker clearable
+            :disabled="orderInfo.recordStatus < 2"
             v-model="form.lendActualReturnDate"
             type="date"
             value-format="yyyy-MM-dd"
@@ -221,10 +240,10 @@
           </el-date-picker>
         </el-form-item>
         <el-form-item v-if="orderInfo.orderType === 3" label="【借出】归还经手人" prop="lendBySponsor">
-          <el-input v-model="form.lendBySponsor" placeholder="请输入【借出】归还经手人" />
+          <el-input v-model="form.lendBySponsor" placeholder="请输入【借出】归还经手人" :disabled="orderInfo.recordStatus < 2"/>
         </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" placeholder="请输入备注" />
+          <el-input v-model="form.remark" placeholder="请输入备注" :disabled="orderInfo.recordStatus > 0"/>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -394,6 +413,15 @@ export default {
         this.title = "修改单据明细";
       });
     },
+    onReturn(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getDetail(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "归还单据信息";
+      });
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {

+ 24 - 5
ruoyi-ui/src/views/order/order/index.vue

@@ -209,7 +209,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
+    <el-table ref="table" v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column
         label="序号"
@@ -229,8 +229,16 @@
         </template>
       </el-table-column>
       <el-table-column label="申请部门" align="center" prop="applicationDepartmentName" />
-      <el-table-column v-if="queryParams.orderType !== '1'" label="资产总原值" align="center" prop="assetTotalOriginalValue" />
-      <el-table-column v-if="queryParams.orderType !== '1'" label="资产总净值" align="center" prop="assetTotalNetValue" />
+      <el-table-column v-if="queryParams.orderType !== '1'" label="资产总原值" align="center" prop="assetTotalOriginalValue">
+        <template slot-scope="scope">
+          <div>{{scope.row.assetTotalOriginalValue}}</div>
+        </template>
+      </el-table-column>
+      <el-table-column v-if="queryParams.orderType !== '1'" label="资产总净值" align="center" prop="assetTotalNetValue">
+        <template slot-scope="scope">
+          <div>{{scope.row.assetTotalNetValue}}</div>
+        </template>
+      </el-table-column>
       <el-table-column v-if="queryParams.orderType === '1'" label="【调整】资产编号" align="center" prop="adjustmentAssetNumber" />
       <el-table-column v-if="queryParams.orderType === '1'" label="【调整】资产原信息" align="center" prop="adjustmentOriginalAssetInfo">
         <template slot-scope="scope">
@@ -274,6 +282,7 @@
             v-hasPermi="['order:order:edit']"
           >明细</el-button>
           <el-button
+            :disabled="scope.row.recordStatus > 0"
             size="mini"
             type="text"
             icon="el-icon-edit"
@@ -281,6 +290,7 @@
             v-hasPermi="['order:order:edit']"
           >修改</el-button>
           <el-button
+            :disabled="scope.row.recordStatus > 0"
             size="mini"
             type="text"
             icon="el-icon-delete"
@@ -315,12 +325,12 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item v-if="form.orderType !== 1" label="资产总原值" prop="assetTotalOriginalValue">
+        <!-- <el-form-item v-if="form.orderType !== 1" label="资产总原值" prop="assetTotalOriginalValue">
           <el-input v-model="form.assetTotalOriginalValue" placeholder="资产总原值(系统自动补充)" disabled/>
         </el-form-item>
         <el-form-item v-if="form.orderType !== 1" label="资产总净值" prop="assetTotalNetValue">
           <el-input v-model="form.assetTotalNetValue" placeholder="资产总净值(系统自动补充)" disabled/>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="申请日期" prop="applicationDate">
           <el-date-picker clearable
             v-model="form.applicationDate"
@@ -557,6 +567,7 @@ export default {
       this.loading = true;
       listOrder(this.queryParams).then(response => {
         this.orderList = response.rows;
+        console.log('单据列表', this.orderList)
         this.total = response.total;
         this.loading = false;
       });
@@ -663,6 +674,13 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      selection.forEach(item => {
+        if (item.recordStatus > 0) {
+          this.$modal.msgWarning("已提交单据不可修改/删除")
+          this.$refs.table.toggleRowSelection(item, false)
+        }
+      });
+      selection = selection.filter(item => item.recordStatus < 1)
       this.ids = selection.map(item => item.id)
       this.single = selection.length!==1
       this.multiple = !selection.length
@@ -703,6 +721,7 @@ export default {
               this.getList();
             });
           } else {
+            this.form.recordStatus = recordStatus
             addOrder(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;