自动化立体仓库 - WMS系统
zjj
2023-09-01 a801b6c075becb1a8660d451cbfb31ddf782a89d
#库存预警
3个文件已添加
14个文件已修改
725 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/LocDetlController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ManLocDetlController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/LocDetlService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/ManLocDetlService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocDetlMapper.xml 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ManLocDetlMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locDetlWarning/locDetlWarning.js 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/index.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/locDetlWarning/locDetlWarning.html 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/report/locDetl.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -43,6 +43,30 @@
    @Autowired
    private ManLocDetlService manLocDetlService;
    @RequestMapping(value = "/locDetl/selectAllWarning/auth")
    @ManagerAuth(memo = "库存预警")
    public Map<String,Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1")Integer curr,
                                                           @RequestParam(defaultValue = "10")Integer limit,
                                                           @RequestParam Map<String, Object> param){
        LocDetlWarningDTO locDetlWarningDTO = new LocDetlWarningDTO();
        locDetlWarningDTO.setPageSize(limit);
        locDetlWarningDTO.setPageNumber(curr);
        String locNo = String.valueOf(param.get("locNo"));
        String matnr = String.valueOf(param.get("matnr"));
        if (!Cools.isEmpty(locNo) && !locNo.equals("null")) {
            locDetlWarningDTO.setLocNo(locNo);
        }
        if (!Cools.isEmpty(matnr) && !matnr.equals("null")) {
            locDetlWarningDTO.setMatnr(matnr);
        }
        List<LocDetlWarningDTO> list = locDetlService.selectAllWarning(locDetlWarningDTO);
        int count = locDetlService.getAllWarningCount(locDetlWarningDTO);
        Page<LocDetlWarningDTO> page = new Page<>();
        page.setRecords(list);
        page.setTotal(count);
        return R.ok(page);
    }
    @RequestMapping(value = "/locDetl/update")
    public R update1() {
        if (!locDetlService.updateLocNo("0402805", "0402804")) {
src/main/java/com/zy/asrs/controller/ManLocDetlController.java
@@ -1,5 +1,7 @@
package com.zy.asrs.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
@@ -7,9 +9,13 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.ManLocDetlService;
import com.zy.asrs.service.MatService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@@ -17,6 +23,10 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
@RestController
@@ -24,6 +34,12 @@
    @Autowired
    private ManLocDetlService manLocDetlService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private MatService matService;
    @RequestMapping(value = "/manLocDetl/list/auth")
    @ManagerAuth
@@ -110,7 +126,23 @@
        }
    }
    @RequestMapping(value = "/manlocDetl/statis/export")
//    @ManagerAuth
    public void statisExport(HttpServletResponse response) throws IOException {
        List<LocDetlWarningDTO> list = manLocDetlService.selectAllWarning();
        for (LocDetlWarningDTO locDetl : list) {
            Mat mat = matService.selectByMatnr(locDetl.getMatnr());
            if (mat != null) {
                locDetl.sync(mat);
            }
        }
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        String fileName = URLEncoder.encode("库存预警明细", "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
        EasyExcel.write(response.getOutputStream(), LocDetlWarningDTO.class)
                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .sheet("表1")
                .doWrite(list);
    }
}
src/main/java/com/zy/asrs/entity/LocDetlWarningDTO.java
New file
@@ -0,0 +1,55 @@
package com.zy.asrs.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotations.TableField;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.common.utils.Synchro;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@ExcelIgnoreUnannotated
public class LocDetlWarningDTO {
    private int pageNumber;
    private int pageSize;
    private Integer row;
    @ExcelProperty("库位号")
    private String locNo;
    @ExcelProperty("物料码")
    private String matnr;
    @ExcelProperty("物料名")
    private String maktx;
    @ExcelProperty("入库时间")
    private Date createTime;
    @ExcelProperty("规格")
    private String specs;
    @ExcelProperty("库存上限")
    private String inventoryMax;
    @ExcelProperty("库存下限")
    private String inventoryMin;
    @ExcelProperty("库龄上限")
    private String inventoryAgeMax;
    @ExcelProperty("库存总数量")
    private Integer countAnfme;
    @ExcelProperty("在库天数")
    private Integer diffTime;
    public String getcreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public void sync(Object source) {
        Synchro.Copy(source, this);
    }
}
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -94,4 +95,8 @@
    int selectAllPymentcount(LocDetlDTO locDetlDTO);
    Double sumAll();
    List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO);
    int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO);
}
src/main/java/com/zy/asrs/mapper/ManLocDetlMapper.java
@@ -1,6 +1,7 @@
package com.zy.asrs.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.result.StockVo;
import org.apache.ibatis.annotations.Mapper;
@@ -89,4 +90,6 @@
    int deleteDatailed (String locNo, String matnr,String batch);
    int increase(Double anfme,String locNo, String matnr,String batch,Double weight);
    List<LocDetlWarningDTO> selectAllWarning();
}
src/main/java/com/zy/asrs/service/LocDetlService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -74,4 +75,8 @@
    int selectAllCount(LocDetlDTO locDetlDTO);
    int selectAllPymentcount(LocDetlDTO locDetlDTO);
    List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO);
    int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO);
}
src/main/java/com/zy/asrs/service/ManLocDetlService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.entity.result.StockVo;
@@ -69,4 +70,5 @@
    int increase(Double anfme,String locNo, String matnr,String batch,Double weight);
    List<LocDetlWarningDTO> selectAllWarning();
}
src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocDetlWarningDTO;
import com.zy.asrs.entity.result.LocDetlAll;
import com.zy.asrs.entity.result.LocDetlDTO;
import com.zy.asrs.entity.result.StockVo;
@@ -183,4 +184,14 @@
    public int selectAllPymentcount(LocDetlDTO locDetlDTO) {
        return this.baseMapper.selectAllPymentcount(locDetlDTO);
    }
    @Override
    public List<LocDetlWarningDTO> selectAllWarning(LocDetlWarningDTO locDetlWarningDTO) {
        return this.baseMapper.selectAllWarning(locDetlWarningDTO);
    }
    @Override
    public int getAllWarningCount(LocDetlWarningDTO locDetlWarningDTO) {
        return this.baseMapper.getAllWarningCount(locDetlWarningDTO);
    }
}
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java
@@ -192,5 +192,10 @@
        return baseMapper.increase(anfme,locNo,matnr,batch,weight);
    }
    @Override
    public List<LocDetlWarningDTO> selectAllWarning() {
        return baseMapper.selectAllWarning();
    }
}
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -557,8 +557,8 @@
                return R.error("入库数量大于可入数量");
            }
            //查询平库中是否有一样的物料号,有的话直接增加数量
            ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch());
            if (checkManLocDetl == null) {
//            ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch());
//            if (checkManLocDetl == null) {
                ManLocDetl manLocDetl = new ManLocDetl();
                Synchro.Copy(orderDetl, manLocDetl);
@@ -576,23 +576,24 @@
                if(!manLocDetlService.insert(manLocDetl)){
                    return R.error("插入平库物料失败!");
                }
            } else {
                  if (checkManLocDetl.getWeight() == null){
                      checkManLocDetl.setWeight(0.0);
                  }
                  if (jsonOrderDetl.getWeight() == null){
                      jsonOrderDetl.setWeight(0.0);
                  }
                if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(),
                        node.getName(),
                        jsonOrderDetl.getMatnr(),
                        jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight()
                        )<=0
                        ){
                    return R.error("修改平库物料失败!");
                }
            }
//            }
//            else {
//                  if (checkManLocDetl.getWeight() == null){
//                      checkManLocDetl.setWeight(0.0);
//                  }
//                  if (jsonOrderDetl.getWeight() == null){
//                      jsonOrderDetl.setWeight(0.0);
//                  }
//                if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(),
//                        node.getName(),
//                        jsonOrderDetl.getMatnr(),
//                        jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight()
//                        )<=0
//                        ){
//                    return R.error("修改平库物料失败!");
//                }
//
//            }
            orderDetl.setQty(orderDetl.getQty() + jsonOrderDetl.getAnfme());
            orderDetl.setWorkQty(orderDetl.getWorkQty() + jsonOrderDetl.getAnfme());
            orderDetl.setUpdateTime(date);
src/main/resources/mapper/LocDetlMapper.xml
@@ -49,6 +49,22 @@
    </resultMap>
    <resultMap id="WarningResultMap" type="com.zy.asrs.entity.LocDetlWarningDTO">
        <result column="loc_no" property="locNo" />
        <result column="matnr" property="matnr" />
        <result column="maktx" property="maktx" />
        <result column="create_time" property="createTime" />
        <result column="specs" property="specs" />
        <result column="inventory_max" property="inventoryMax" />
        <result column="inventory_min" property="inventoryMin" />
        <result column="inventory_age_max" property="inventoryAgeMax" />
        <result column="count_anfme" property="countAnfme" />
        <result column="diff_time" property="diffTime" />
        <result column="pageNumber" property="pageNumber" />
        <result column="pageSize" property="pageSize" />
        <result column="row" property="row" />
    </resultMap>
    <sql id="batchSeq">
        <choose>
            <when test="batch != null">
@@ -586,6 +602,117 @@
    <select id="sumAll" resultType="java.lang.Double">
        SELECT SUM(anfme) FROM asr_loc_detl_all
    </select>
    <!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
    <sql id="selectAllWarningSql">
        <if test="locNo!=null and locNo!='' ">
            and t.loc_no like '%' + #{locNo} + '%'
        </if>
        <if test="matnr != null and matnr !='' ">
            and t.matnr like '%' + #{matnr} + '%'
        </if>
    </sql>
    <select id="selectAllWarning" resultMap="WarningResultMap" parameterType="com.zy.asrs.entity.LocDetlWarningDTO">
        SELECT
        *
        FROM
        (
        SELECT
        ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
        FROM
        (
        SELECT
        loc_no,
        locd.matnr,
        locd.maktx,
        create_time,
        locd.specs,
        locd.unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme,
        DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
        FROM
        man_loc_detl locd
        LEFT JOIN (
        SELECT
        man_mat.matnr,
        maktx,
        specs,
        unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme
        FROM
        man_mat
        RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
        ) warn ON locd.matnr = warn.matnr
        WHERE
        DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
        OR count_anfme > inventory_max
        OR count_anfme &lt; inventory_min
        ) t
        WHERE
        1 = 1
        <include refid="selectAllWarningSql"></include>
        ) a
        WHERE a.row BETWEEN ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
    <select id="getAllWarningCount" resultType="java.lang.Integer">
        SELECT
        COUNT(1)
        FROM
        (
        SELECT
        ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
        FROM
        (
        SELECT
        loc_no,
        locd.matnr,
        locd.maktx,
        create_time,
        locd.specs,
        locd.unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme,
        DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
        FROM
        man_loc_detl locd
        LEFT JOIN (
        SELECT
        man_mat.matnr,
        maktx,
        specs,
        unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme
        FROM
        man_mat
        RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
        ) warn ON locd.matnr = warn.matnr
        WHERE
        DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
        OR count_anfme > inventory_max
        OR count_anfme &lt; inventory_min
        ) t
        WHERE
        1 = 1
        <include refid="selectAllWarningSql"></include>
        ) a
    </select>
</mapper>
src/main/resources/mapper/ManLocDetlMapper.xml
@@ -36,6 +36,22 @@
        <result column="order_no" property="orderNo" />
    </resultMap>
    <resultMap id="WarningResultMap" type="com.zy.asrs.entity.LocDetlWarningDTO">
        <result column="loc_no" property="locNo" />
        <result column="matnr" property="matnr" />
        <result column="maktx" property="maktx" />
        <result column="create_time" property="createTime" />
        <result column="specs" property="specs" />
        <result column="inventory_max" property="inventoryMax" />
        <result column="inventory_min" property="inventoryMin" />
        <result column="inventory_age_max" property="inventoryAgeMax" />
        <result column="count_anfme" property="countAnfme" />
        <result column="diff_time" property="diffTime" />
        <result column="pageNumber" property="pageNumber" />
        <result column="pageSize" property="pageSize" />
        <result column="row" property="row" />
    </resultMap>
    <sql id="locDetlCondition">
        <if test="host_id != null and host_id != ''">
            and mld.host_id = #{host_id}
@@ -342,6 +358,64 @@
            </otherwise>
        </choose>
    </select>
    <sql id="selectAllWarningSql">
        <if test="locNo!=null and locNo!='' ">
            and t.loc_no like '%' + #{locNo} + '%'
        </if>
        <if test="matnr != null and matnr !='' ">
            and t.matnr like '%' + #{matnr} + '%'
        </if>
    </sql>
    <select id="selectAllWarning" resultMap="WarningResultMap" parameterType="com.zy.asrs.entity.LocDetlWarningDTO">
        SELECT
        *
        FROM
        (
        SELECT
        ROW_NUMBER ( ) OVER ( ORDER BY matnr ) AS row,*
        FROM
        (
        SELECT
        loc_no,
        locd.matnr,
        locd.maktx,
        create_time,
        locd.specs,
        locd.unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme,
        DATEDIFF( DAY, create_time, GETDATE( ) ) AS [diff_time]
        FROM
        man_loc_detl locd
        LEFT JOIN (
        SELECT
        man_mat.matnr,
        maktx,
        specs,
        unit,
        inventory_max,
        inventory_min,
        inventory_age_max,
        count_anfme
        FROM
        man_mat
        RIGHT JOIN ( SELECT matnr, SUM ( anfme ) AS count_anfme FROM man_loc_detl loc GROUP BY matnr ) aa ON aa.matnr = man_mat.matnr
        ) warn ON locd.matnr = warn.matnr
        WHERE
        DATEDIFF( DAY, create_time, GETDATE( ) ) > inventory_age_max
        OR count_anfme > inventory_max
        OR count_anfme &lt; inventory_min
        ) t
        WHERE
        1 = 1
        <include refid="selectAllWarningSql"></include>
        ) a
    </select>
    <delete id="deleteDatailed">
        delete from man_loc_detl
        where loc_no = #{locNo}
src/main/webapp/static/js/common.js
@@ -273,8 +273,6 @@
    ,{field: 'source$', align: 'center',title: '制购', hide: true}
    ,{field: 'check$', align: 'center',title: '要求检验', hide: true}
    ,{field: 'danger$', align: 'center',title: '危险品', hide: true}
    ,{field: 'owner$', align: 'center',title: '货主', hide: false}
    ,{field: 'payment$', align: 'center',title: '货物形态', hide: false}
]
function getQueryVariable(variable)
src/main/webapp/static/js/locDetlWarning/locDetlWarning.js
New file
@@ -0,0 +1,269 @@
var pageCurr;
function getCol() {
    var cols = [
        {field: 'countAnfme', align: 'center',title: '库存数量', style: 'font-weight: bold'}
    ];
    arrRemove(detlCols, "field", "anfme")
    arrRemove(detlCols, "field", "zpallet")
    cols.push.apply(cols, detlCols);
    // cols.push({field: 'anfme', align: 'center',title: '数量', style: 'font-weight: bold'}
    // )
    return cols;
}
layui.use(['table','laydate', 'form'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    // 数据渲染
    tableIns = table.render({
        elem: '#locDetlWarning',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/locDetl/selectAllWarning/auth',
        page: true,
        limit: 20,
        limits: [20, 30, 50, 100, 200, 500],
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[
            {field: 'locNo', align: 'center',title: '库位'}
            ,{field: 'countAnfme', align: 'center',title: '库存数量'}
            ,{field: 'matnr', align: 'center',title: '库存标号'}
            ,{field: 'maktx', align: 'center',title: '库存名称'}
            ,{field: 'createTime$', align: 'center',title: '入库时间'}
            ,{field: 'specs', align: 'center',title: '规格'}
            ,{field: 'inventoryMax', align: 'center',title: '最大库存数量'}
            ,{field: 'inventoryMin', align: 'center',title: '最小库存数量'}
            ,{field: 'inventoryAgeMax', align: 'center',title: '最大在库时间(天)'}
            ,{field: 'diffTime', align: 'center',title: '当前在库时间(天)'}
        ]
        ],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
        },
        parseData: function (res) {
            return {
                'code': res.code,
                'msg': res.msg,
                'count': res.data.total,
                'data': res.data.records
            }
        },
        response: {
            statusCode: 200
        },
        done: function(res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            limit();
            form.on('checkbox(tableCheckbox)', function (data) {
                var _index = $(data.elem).attr('table-index')||0;
                if(data.elem.checked){
                    res.data[_index][data.value] = 'Y';
                }else{
                    res.data[_index][data.value] = 'N';
                }
            });
            /**
             * 显示库存总数量
             */
            $.ajax({
                url: baseUrl+"/locDetl/count",
                headers: {'token': localStorage.getItem('token')},
                contentType:'application/json;charset=UTF-8',
                method: 'POST',
                success: function (res) {
                    $("#countNum").text(res.data + '个');
                }
            });
        }
    });
    // 监听排序事件
    table.on('sort(locDetlStatis)', function (obj) {
        var searchData = {};
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        searchData['orderByField'] = obj.field;
        searchData['orderByType'] = obj.type;
        tableIns.reload({
            where: searchData,
            page: {
                curr: 1
            },
            done: function (res, curr, count) {
                if (res.code === 403) {
                    top.location.href = baseUrl+"/";
                }
                pageCurr=curr;
                limit();
            }
        });
    });
    // 监听头工具栏事件
    table.on('toolbar(locDetlWarning)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch(obj.event) {
            case 'exportAll':
                layer.closeAll();
                layer.load(1, {shade: [0.1,'#fff']});
                location.href = baseUrl + "/manlocDetl/statis/export";
                console.log("1");
                layer.closeAll('loading');
                break;
            case 'exportData':
                layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){
                    var titles=[];
                    var fields=[];
                    obj.config.cols[0].map(function (col) {
                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
                            titles.push(col.title);
                            fields.push(col.field);
                        }
                    });
                    var exportData = {};
                    $.each($('#search-box [name]').serializeArray(), function() {
                        exportData[this.name] = this.value;
                    });
                    var param = {
                        'locDetl': exportData,
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/locDetl/export/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: JSON.stringify(param),
                        dataType:'json',
                        contentType:'application/json;charset=UTF-8',
                        method: 'POST',
                        success: function (res) {
                            layer.closeAll();
                            if (res.code === 200) {
                                table.exportFile(titles,res.data,'xls');
                            } else if (res.code === 403) {
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    });
                });
                break;
        }
    });
    // 监听行工具事件
    table.on('tool(locDetlStatis)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            // 详情
            case 'detail':
                layer.open({
                    type: 2,
                    title: '详情',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: false,
                    content: 'locDetl_detail.html',
                    success: function(layero, index){
                        setFormVal(layer.getChildFrame('#detail', index), data, true);
                        top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
                        layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
                    }
                });
                break;
        }
    });
    // 搜索栏搜索事件
    form.on('submit(search)', function (data) {
        pageCurr = 1;
        tableReload(false);
    });
    // 搜索栏重置事件
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        tableReload(false);
    });
    // 时间选择器
    layDate.render({
        elem: '#modiTime\\$',
        type: 'datetime'
    });
    layDate.render({
        elem: '#appeTime\\$',
        type: 'datetime'
    });
});
// 关闭动作
$(document).on('click','#data-detail-close', function () {
    parent.layer.closeAll();
});
function tableReload(child) {
    var searchData = {};
    $.each($('#search-box [name]').serializeArray(), function() {
        searchData[this.name] = this.value;
    });
    (child ? parent.tableIns : tableIns).reload({
        where: searchData,
        page: {
            curr: pageCurr
        },
        done: function (res, curr, count) {
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
            }
            pageCurr=curr;
            if (res.data.length === 0 && count !== 0) {
                tableIns.reload({
                    where: searchData,
                    page: {
                        curr: pageCurr-1
                    }
                });
                pageCurr -= 1;
            }
            limit(child);
        }
    });
}
function detailScreen(index) {
    var detail = layer.getChildFrame('#data-detail', index);
    var height = detail.height()+60;
    if (height > ($(window).height()*0.9)) {
        height = ($(window).height()*0.8);
    }
    layer.style(index, {
//        top: (($(window).height()-height)/3)+"px",
        height: height+'px'
    });
}
$('body').keydown(function () {
    if (event.keyCode === 13) {
        $("#search").click();
    }
});
src/main/webapp/views/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>速腾 - 自动化立体仓库 - AS / RS</title>
  <title>健志 - 自动化立体仓库 - AS / RS</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
src/main/webapp/views/locDetlWarning/locDetlWarning.html
New file
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../static/css/cool.css" media="all">
  <link rel="stylesheet" href="../../static/css/common.css" media="all">
</head>
<body>
<!-- 搜索栏 -->
<div id="search-box" class="layui-form layui-card-header">
  <div class="layui-inline">
    <div class="layui-input-inline">
      <input class="layui-input" type="text" name="matnr" placeholder="商品编号" autocomplete="off">
    </div>
  </div>
  <!-- 待添加 -->
  <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
    <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索
    </button>
    <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置
    </button>
  </div>
</div>
<!-- 表格 -->
<div class="layui-form">
  <table class="layui-hide" id="locDetlWarning" lay-filter="locDetlWarning"></table>
</div>
<script type="text/html" id="toolbar">
  <div class="layui-btn-container layui-col-md1">
    <button class="layui-btn" lay-event="exportAll" style="margin-top: -0px">导出全部</button>
  </div>
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/locDetlWarning/locDetlWarning.js" charset="utf-8"></script>
</body>
</html>
src/main/webapp/views/report/locDetl.html
@@ -54,14 +54,22 @@
        tableIns = table.render({
            elem: '#locDetlByMap',
            headers: {token: localStorage.getItem('token')},
            url: baseUrl+'/locDetl/list/auth',
            url: baseUrl+'/manLocDetl/list/auth',
            page: true,
            limit: 20,
            skin: 'line',
            where: {loc_no: locNo},
            even: true,
            cellMinWidth: 50,
            cols: [getCol()],
            cols: [[
                {field: 'locNo', align: 'center',title: '库位号'},
                {field: 'matnr', align: 'center',title: '商品编号'},
                {field: 'maktx', align: 'center',title: '商品名称'},
                {field: 'anfme', align: 'center',title: '数量'},
                {field: 'orderNo', align: 'center',title: '订单号'},
                {field: 'createTime$', align: 'center',title: '入库时间'},
                {field: 'specs', align: 'center',title: '规格'}
            ]],
            request: {
                pageName: 'curr',
                pageSize: 'limit'