自动化立体仓库 - WMS系统
*
lsh
1 天以前 b6891f956cd63d4a334e28540b0feab66cd230a7
*
2个文件已修改
11个文件已添加
929 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/BasArmRulesController.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasArmRules.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/ArmPrecomputeParam.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/BasArmRulesMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/BasArmRulesService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/BasArmRulesServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/ArmRulesScheduler.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/ArmRulesHandler.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/CodeBuilder.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BasArmRulesMapper.xml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/basArmRules/basArmRules.js 252 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/basArmRules/basArmRules.html 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/BasArmRulesController.java
New file
@@ -0,0 +1,125 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.entity.BasArmRules;
import com.zy.asrs.service.BasArmRulesService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
public class BasArmRulesController extends BaseController {
    @Autowired
    private BasArmRulesService basArmRulesService;
    @RequestMapping(value = "/basArmRules/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(basArmRulesService.selectById(String.valueOf(id)));
    }
    @RequestMapping(value = "/basArmRules/list/auth")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<BasArmRules> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(BasArmRules.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(basArmRulesService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), val);
            }
        }
    }
    @RequestMapping(value = "/basArmRules/add/auth")
    @ManagerAuth
    public R add(BasArmRules basArmRules) {
        basArmRulesService.insert(basArmRules);
        return R.ok();
    }
    @RequestMapping(value = "/basArmRules/update/auth")
    @ManagerAuth
    public R update(BasArmRules basArmRules){
        if (Cools.isEmpty(basArmRules) || null==basArmRules.getId()){
            return R.error();
        }
        basArmRulesService.updateById(basArmRules);
        return R.ok();
    }
    @RequestMapping(value = "/basArmRules/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
         for (Long id : ids){
            basArmRulesService.deleteById(id);
        }
        return R.ok();
    }
    @RequestMapping(value = "/basArmRules/export/auth")
    @ManagerAuth
    public R export(@RequestBody JSONObject param){
        EntityWrapper<BasArmRules> wrapper = new EntityWrapper<>();
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        Map<String, Object> map = excludeTrash(param.getJSONObject("basArmRules"));
        convert(map, wrapper);
        List<BasArmRules> list = basArmRulesService.selectList(wrapper);
        return R.ok(exportSupport(list, fields));
    }
    @RequestMapping(value = "/basArmRulesQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<BasArmRules> wrapper = new EntityWrapper<>();
        wrapper.like("id", condition);
        Page<BasArmRules> page = basArmRulesService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (BasArmRules basArmRules : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", basArmRules.getId());
            map.put("value", basArmRules.getId());
            result.add(map);
        }
        return R.ok(result);
    }
    @RequestMapping(value = "/basArmRules/check/column/auth")
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<BasArmRules> wrapper = new EntityWrapper<BasArmRules>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != basArmRulesService.selectOne(wrapper)){
            return R.parse(BaseRes.REPEAT).add(getComment(BasArmRules.class, String.valueOf(param.get("key"))));
        }
        return R.ok();
    }
}
src/main/java/com/zy/asrs/entity/BasArmRules.java
New file
@@ -0,0 +1,96 @@
package com.zy.asrs.entity;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
@Data
@TableName("asr_bas_arm_rules")
public class BasArmRules implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 长度.单位:mm
     */
    @ApiModelProperty(value= "长度.单位:mm")
    @TableField("material_length")
    private Double materialLength;
    /**
     * 宽度.单位:mm
     */
    @ApiModelProperty(value= "宽度.单位:mm")
    @TableField("material_width")
    private Double materialWidth;
    /**
     * 高度.单位:mm
     */
    @ApiModelProperty(value= "高度.单位:mm")
    @TableField("material_height")
    private Double materialHeight;
    /**
     * 重量.单位:kg
     */
    @ApiModelProperty(value= "重量.单位:kg")
    @TableField("material_weight")
    private Double materialWeight;
    /**
     * 体积(立方毫米)
     */
    @ApiModelProperty(value= "体积(立方毫米)")
    @TableField("material_volume")
    private Double materialVolume;
    /**
     * 满托数量
     */
    @ApiModelProperty(value= "满托数量")
    @TableField("material_number")
    private Integer materialNumber;
    /**
     * 是否需要更新
     */
    @ApiModelProperty(value= "是否需要更新")//0:需要更新  1:正常  2:异常
    private Integer status;
    public BasArmRules() {}
    public BasArmRules(Double materialLength,Double materialWidth,Double materialHeight,Double materialWeight,Double materialVolume,Integer materialNumber,Integer status) {
        this.materialLength = materialLength;
        this.materialWidth = materialWidth;
        this.materialHeight = materialHeight;
        this.materialWeight = materialWeight;
        this.materialVolume = materialVolume;
        this.materialNumber = materialNumber;
        this.status = status;
    }
//    BasArmRules basArmRules = new BasArmRules(
//            null,    // 长度.单位:mm[非空]
//            null,    // 宽度.单位:mm[非空]
//            null,    // 高度.单位:mm[非空]
//            null,    // 重量.单位:kg[非空]
//            null,    // 体积(立方毫米)[非空]
//            null,    // 满托数量[非空]
//            null    // 是否需要更新[非空]
//    );
}
src/main/java/com/zy/asrs/entity/param/ArmPrecomputeParam.java
New file
@@ -0,0 +1,52 @@
package com.zy.asrs.entity.param;
import com.zy.asrs.entity.BasArmRules;
import lombok.Data;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import java.util.ArrayList;
import java.util.List;
/*
 *  Created by Monkey D. Luffy on 2025.09.09
 * */
@Data
public class ArmPrecomputeParam {
    private List<CombMat> matList = new ArrayList<>();
    @Data
    public static class CombMat {
        // 长度
        private Double material_length;
        // 宽度
        private Double material_width;
        // 高度
        private Double material_height;
        // 重量
        private Double material_weight;
        // 数量
        private Double material_number = 10.0;
        public CombMat() {}
        public CombMat(BasArmRules basArmRules) {
            this.material_height = basArmRules.getMaterialHeight();
            this.material_width = basArmRules.getMaterialWidth();
            this.material_height = basArmRules.getMaterialHeight();
            this.material_weight = basArmRules.getMaterialWeight();
        }
    }
    public ArmPrecomputeParam() {}
    public ArmPrecomputeParam(BasArmRules basArmRules) {
        this.matList.add(new CombMat(basArmRules));
    }
}
src/main/java/com/zy/asrs/mapper/BasArmRulesMapper.java
New file
@@ -0,0 +1,27 @@
package com.zy.asrs.mapper;
import com.zy.asrs.entity.BasArmRules;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface BasArmRulesMapper extends BaseMapper<BasArmRules> {
    @Select("select top 10 from asr_bas_arm_rules where 1=1 and status = #{status}")
    List<BasArmRules> AllStatusSatisfyBasArmRules(int status);
    boolean updateStatus(@Param("materialLength") Double materialLength,
                         @Param("materialWidth") Double materialWidth,
                         @Param("materialHeight") Double materialHeight,
                         @Param("materialWeight") Double materialWeight,
                         @Param("materialNumber") Double materialNumber,
                         @Param("status") int status);
}
src/main/java/com/zy/asrs/service/BasArmRulesService.java
New file
@@ -0,0 +1,15 @@
package com.zy.asrs.service;
import com.zy.asrs.entity.BasArmRules;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.param.ArmPrecomputeParam;
import java.util.List;
public interface BasArmRulesService extends IService<BasArmRules> {
    List<BasArmRules> AllStatusSatisfyBasArmRules(int status);
    boolean updateStatus(Double materialLength,Double materialWidth,Double materialHeight,Double materialWeight,Double materialNumber,int status);
    boolean updateStatus(ArmPrecomputeParam.CombMat combMat);
}
src/main/java/com/zy/asrs/service/impl/BasArmRulesServiceImpl.java
New file
@@ -0,0 +1,36 @@
package com.zy.asrs.service.impl;
import com.zy.asrs.entity.param.ArmPrecomputeParam;
import com.zy.asrs.mapper.BasArmRulesMapper;
import com.zy.asrs.entity.BasArmRules;
import com.zy.asrs.service.BasArmRulesService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("basArmRulesService")
public class BasArmRulesServiceImpl extends ServiceImpl<BasArmRulesMapper, BasArmRules> implements BasArmRulesService {
    @Override
    public List<BasArmRules> AllStatusSatisfyBasArmRules(int status){
        return this.baseMapper.AllStatusSatisfyBasArmRules(status);
    }
    @Override
    public boolean updateStatus(ArmPrecomputeParam.CombMat combMat){
        return this.baseMapper.updateStatus(
                combMat.getMaterial_length(),
                combMat.getMaterial_width(),
                combMat.getMaterial_height(),
                combMat.getMaterial_weight(),
                combMat.getMaterial_number(),
                1);
    }
    @Override
    public boolean updateStatus(Double materialLength,Double materialWidth,Double materialHeight,Double materialWeight,Double materialNumber,int status){
        return this.baseMapper.updateStatus(materialLength,materialWidth,materialHeight,materialWeight,materialNumber,status);
    }
}
src/main/java/com/zy/asrs/task/ArmRulesScheduler.java
New file
@@ -0,0 +1,56 @@
package com.zy.asrs.task;
import com.alibaba.fastjson.JSON;
import com.zy.asrs.entity.BasArmRules;
import com.zy.asrs.entity.param.ArmPrecomputeParam;
import com.zy.asrs.service.BasArmRulesService;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.ArmRulesHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * Created by vincent on 2020/7/7
 */
@Component
public class ArmRulesScheduler {
    private static final Logger log = LoggerFactory.getLogger(ArmRulesScheduler.class);
    @Autowired
    private BasArmRulesService basArmRulesService;
    @Autowired
    private ArmRulesHandler armRulesHandler;
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute(){
        List<BasArmRules> basArmRules = basArmRulesService.AllStatusSatisfyBasArmRules(0);
        if (basArmRules.isEmpty()) {
            return;
        }
        for (BasArmRules  basArmRule: basArmRules) {
            try{
                if (basArmRule.getMaterialHeight()>0 && basArmRule.getMaterialLength()>0 && basArmRule.getMaterialWeight()>0 && basArmRule.getMaterialWidth()>0){
                    ArmPrecomputeParam armPrecomputeParam = new ArmPrecomputeParam(basArmRule);
                    ReturnT<String> returnT = armRulesHandler.start(armPrecomputeParam);
                    if (!returnT.isSuccess()) {
                        log.error("获取码垛数量失败===>"+JSON.toJSON(basArmRule));
                    }
                } else {
                    basArmRule.setStatus(2);
                    basArmRulesService.updateById(basArmRule);
                }
            } catch (Exception e){
                log.error("获取码垛数量异常===>"+e.getMessage());
            }
        }
    }
}
src/main/java/com/zy/asrs/task/handler/ArmRulesHandler.java
New file
@@ -0,0 +1,96 @@
package com.zy.asrs.task.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasArmRules;
import com.zy.asrs.entity.DocType;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.param.ArmPrecomputeParam;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.BasArmRulesService;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.common.constant.MesConstant;
import com.zy.common.model.MesPakinParam;
import com.zy.common.model.MesPakoutParam;
import com.zy.common.model.StartupDto;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
 * Created by vincent on 2020/7/4
 */
@Slf4j
@Service
@Transactional
public class ArmRulesHandler extends AbstractHandler<String> {
    @Autowired
    private ApiLogService apiLogService;
    @Autowired
    private BasArmRulesService basArmRulesService;
    @Value("${arm.address.URL}")
    //端口
    private String URL;
    @Value("${arm.address.QuantityOfPalletizing}")
    //审核地址
    private String QuantityOfPalletizing;
    public ReturnT<String> start(ArmPrecomputeParam armPrecomputeParam) {
        try{
            String response = "";
            boolean success = false;
            try {
                response = new HttpHandler.Builder()
                        .setUri(URL)
                        .setPath(QuantityOfPalletizing)
                        .setJson(JSON.toJSONString(armPrecomputeParam))
                        .build()
                        .doPost();
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getInteger("code").equals(200)) {
                    success = true;
                    ArmPrecomputeParam jsonObjectObject = jsonObject.getObject("data", ArmPrecomputeParam.class);
                    for (ArmPrecomputeParam.CombMat combMat : jsonObjectObject.getMatList()){
                        basArmRulesService.updateStatus(combMat);
                    }
                } else {
                    log.error("获取码垛数量!!!url:{};request:{};response:{}", URL+QuantityOfPalletizing, JSON.toJSONString(armPrecomputeParam), response);
                    throw new CoolException("获取码垛数量失败");
                }
            } catch (Exception e) {
                log.error("fail", e);
                return FAIL.setMsg(e.getMessage());
            } finally {
                try {
                    // 保存接口日志
                    apiLogService.save(
                            "获取码垛数量",
                            URL + QuantityOfPalletizing,
                            null,
                            "127.0.0.1",
                            JSON.toJSONString(armPrecomputeParam),
                            response,
                            success
                    );
                } catch (Exception e) { log.error("", e); }
            }
        }catch (Exception e){
        }
        return SUCCESS;
    }
}
src/main/java/com/zy/common/CodeBuilder.java
@@ -17,10 +17,10 @@
//        generator.table="sys_host";
        // sqlserver
        generator.sqlOsType = SqlOsType.SQL_SERVER;
        generator.url="192.168.4.15:1433;databasename=source";
        generator.url="192.168.4.191:50948;databasename=jshdasrs";
        generator.username="sa";
        generator.password="sa@123";
        generator.table="asr_wrk_mast_four_war_vehicle_log";
        generator.table="asr_bas_arm_rules";
        generator.packagePath="com.zy.asrs";
        generator.build();
    }
src/main/resources/application.yml
@@ -72,6 +72,14 @@
comb:
  limit: 5000
#arm对接
arm:
  #  地址
  address:
    URL: http://58.210.10.90:28090
    #根据参数获取码垛数量
    QuantityOfPalletizing: api
#erp对接
erp:
  #  开关
src/main/resources/mapper/BasArmRulesMapper.xml
New file
@@ -0,0 +1,34 @@
<?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.zy.asrs.mapper.BasArmRulesMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.BasArmRules">
        <id column="id" property="id" />
        <result column="material_length" property="materialLength" />
        <result column="material_width" property="materialWidth" />
        <result column="material_height" property="materialHeight" />
        <result column="material_weight" property="materialWeight" />
        <result column="material_volume" property="materialVolume" />
        <result column="material_number" property="materialNumber" />
        <result column="status" property="status" />
    </resultMap>
    <select id="AllStatusSatisfyBasArmRules" resultMap="BaseResultMap">
        select top 10 from asr_bas_arm_rules where 1=1 and status = #{status}
    </select>
    <update id="updateStatus">
        update asr_bas_arm_rules
        set status = #{status}
        , material_number = #{materialNumber}
        where 1=1
        and material_length = #{materialLength}
        and material_width = #{materialWidth}
        and material_height = #{materialHeight}
        and material_weight = #{materialWeight}
    </update>
</mapper>
src/main/webapp/static/js/basArmRules/basArmRules.js
New file
@@ -0,0 +1,252 @@
var pageCurr;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var admin = layui.admin;
    // 数据渲染
    tableIns = table.render({
        elem: '#basArmRules',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/basArmRules/list/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#toolbar',
        cellMinWidth: 50,
        height: 'full-120',
        cols: [[
            {type: 'checkbox'}
            ,{field: 'id', align: 'center',title: 'ID'}
            ,{field: 'materialLength', align: 'center',title: '长度.单位:mm'}
            ,{field: 'materialWidth', align: 'center',title: '宽度.单位:mm'}
            ,{field: 'materialHeight', align: 'center',title: '高度.单位:mm'}
            ,{field: 'materialWeight', align: 'center',title: '重量.单位:kg'}
            ,{field: 'materialVolume', align: 'center',title: '体积(立方毫米)'}
            ,{field: 'materialNumber', align: 'center',title: '满托数量'}
            ,{field: 'status', align: 'center',title: '是否需要更新'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
        ]],
        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();
        }
    });
    // 监听排序事件
    table.on('sort(basArmRules)', 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}
        });
    });
    // 监听头工具栏事件
    table.on('toolbar(basArmRules)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id).data;
        switch(obj.event) {
            case 'addData':
                showEditModel();
                break;
            case 'deleteData':
               if (checkStatus.length === 0) {
                   layer.msg('请选择要删除的数据', {icon: 2});
                   return;
               }
               del(checkStatus.map(function (d) {
                   return d.id;
               }));
               break;
            case 'exportData':
                admin.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 = {
                        'basArmRules': exportData,
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/basArmRules/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, {icon: 2})
                            }
                        }
                    });
                });
                break;
        }
    });
    // 监听行工具事件
    table.on('tool(basArmRules)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'edit':
                showEditModel(data);
                break;
            case "del":
                del([data.id]);
                break;
        }
    });
    /* 弹窗 - 新增、修改 */
    function showEditModel(mData) {
        admin.open({
            type: 1,
            area: '600px',
            title: (mData ? '修改' : '添加') + '订单状态',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                layDateRender(mData);
                form.val('detail', mData);
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl+"/basArmRules/"+(mData?'update':'add')+"/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: data.field,
                        method: 'POST',
                        success: function (res) {
                            layer.close(loadIndex);
                            if (res.code === 200){
                                layer.close(dIndex);
                                layer.msg(res.msg, {icon: 1});
                                tableReload();
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            }else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }
                    })
                    return false;
                });
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                layui.form.render('select');
            }
        });
    }
    /* 删除 */
    function del(ids) {
        layer.confirm('确定要删除选中数据吗?', {
            skin: 'layui-layer-admin',
            shade: .1
        }, function (i) {
            layer.close(i);
            var loadIndex = layer.load(2);
            $.ajax({
                url: baseUrl+"/basArmRules/delete/auth",
                headers: {'token': localStorage.getItem('token')},
                data: {ids: ids},
                method: 'POST',
                success: function (res) {
                    layer.close(loadIndex);
                    if (res.code === 200){
                        layer.msg(res.msg, {icon: 1});
                        tableReload();
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });
    }
    // 搜索
    form.on('submit(search)', function (data) {
        pageCurr = 1;
        tableReload(false);
    });
    // 重置
    form.on('submit(reset)', function (data) {
        pageCurr = 1;
        clearFormVal($('#search-box'));
        tableReload(false);
    });
    // 时间选择器
    function layDateRender(data) {
        setTimeout(function () {
            layDate.render({
                elem: '.layui-laydate-range'
                ,type: 'datetime'
                ,range: true
            });
        }, 300);
    }
    layDateRender();
});
// 关闭动作
$(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;
    });
    tableIns.reload({
        where: searchData,
        page: {curr: pageCurr}
     });
}
src/main/webapp/views/basArmRules/basArmRules.html
New file
@@ -0,0 +1,128 @@
<!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/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form toolbar" id="search-box">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off">
                        </div>
                    </div>
                     <div class="layui-inline" style="width: 300px">
                        <div class="layui-input-inline">
                            <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="search" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
                            <i class="layui-icon">&#xe666;</i>重置
                        </button>
                    </div>
                </div>
            </div>
            <table class="layui-hide" id="basArmRules" lay-filter="basArmRules"></table>
        </div>
    </div>
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a>
</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/basArmRules/basArmRules.js" charset="utf-8"></script>
</body>
<!-- 表单弹窗 -->
<script type="text/html" id="editDialog">
    <form id="detail" lay-filter="detail" class="layui-form admin-form model-form">
        <input name="id" type="hidden">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">长度.单位:mm: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialLength" placeholder="请输入长度.单位:mm" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">宽度.单位:mm: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialWidth" placeholder="请输入宽度.单位:mm" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">高度.单位:mm: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialHeight" placeholder="请输入高度.单位:mm" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">重量.单位:kg: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialWeight" placeholder="请输入重量.单位:kg" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">体积(立方毫米): </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialVolume" placeholder="请输入体积(立方毫米)" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">满托数量: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="materialNumber" placeholder="请输入满托数量" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">是否需要更新: </label>
                    <div class="layui-input-block">
                        <input class="layui-input" name="status" placeholder="请输入是否需要更新" lay-vertype="tips" lay-verify="required">
                    </div>
                </div>
             </div>
        </div>
        <hr class="layui-bg-gray">
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
</html>