New file |
| | |
| | | package com.zy.asrs.common.wms.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.common.wms.entity.LocMast; |
| | | import com.zy.asrs.common.wms.service.LocMastService; |
| | | import com.zy.asrs.framework.annotations.ManagerAuth; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.domain.KeyValueVo; |
| | | import com.zy.asrs.framework.common.DateUtils; |
| | | import com.zy.asrs.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class LocMastController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @RequestMapping(value = "/locMast/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(locMastService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/page/auth") |
| | | @ManagerAuth |
| | | public R page(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam(required = false) String timeRange, |
| | | @RequestParam Map<String, Object> param) { |
| | | LambdaQueryWrapper<LocMast> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocMast::getLocNo, condition); |
| | | } |
| | | if (!Cools.isEmpty(timeRange)) { |
| | | String[] range = timeRange.split(RANGE_TIME_LINK); |
| | | wrapper.ge(LocMast::getAppeTime, DateUtils.convert(range[0])); |
| | | wrapper.le(LocMast::getAppeTime, DateUtils.convert(range[1])); |
| | | } |
| | | return R.ok(locMastService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/locMast/add/auth") |
| | | @ManagerAuth |
| | | public R add(LocMast locMast) { |
| | | locMastService.save(locMast); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/update/auth") |
| | | @ManagerAuth |
| | | public R update(LocMast locMast){ |
| | | if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ |
| | | return R.error(); |
| | | } |
| | | locMastService.updateById(locMast); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | locMastService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMastQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | LambdaQueryWrapper<LocMast> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(LocMast::getLocNo, condition); |
| | | Page<LocMast> page = locMastService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (LocMast locMast : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", locMast.getLocNo()); |
| | | map.put("value", locMast.getLocNo()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping("/locMast/all/get/kv") |
| | | @ManagerAuth |
| | | public R getDataKV(@RequestParam(required = false) String condition) { |
| | | List<KeyValueVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<LocMast> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocMast::getLocNo, condition); |
| | | } |
| | | locMastService.page(new Page<>(1, 30), wrapper).getRecords().forEach(item -> vos.add(new KeyValueVo(String.valueOf(item.getLocNo()), Long.parseLong(item.getLocNo())))); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.entity; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.common.wms.service.BasLocStsService; |
| | | import com.zy.asrs.common.wms.service.BasWhsService; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.common.sys.entity.User; |
| | | import com.zy.asrs.common.sys.entity.Host; |
| | | import com.zy.asrs.common.sys.service.UserService; |
| | | import com.zy.asrs.common.sys.service.HostService; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("wms_loc_mast") |
| | | public class LocMast implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 库位号 |
| | | */ |
| | | @ApiModelProperty(value= "库位号") |
| | | @TableId(value = "loc_no", type = IdType.INPUT) |
| | | private String locNo; |
| | | |
| | | /** |
| | | * 库位类型 |
| | | */ |
| | | @ApiModelProperty(value= "库位类型") |
| | | private Long whsType; |
| | | |
| | | /** |
| | | * 库位状态 |
| | | */ |
| | | @ApiModelProperty(value= "库位状态") |
| | | private String locSts; |
| | | |
| | | /** |
| | | * 堆垛机号 |
| | | */ |
| | | @ApiModelProperty(value= "堆垛机号") |
| | | private Integer crnNo; |
| | | |
| | | /** |
| | | * 排 |
| | | */ |
| | | @ApiModelProperty(value= "排") |
| | | private Integer row1; |
| | | |
| | | /** |
| | | * 列 |
| | | */ |
| | | @ApiModelProperty(value= "列") |
| | | private Integer bay1; |
| | | |
| | | /** |
| | | * 层 |
| | | */ |
| | | @ApiModelProperty(value= "层") |
| | | private Integer lev1; |
| | | |
| | | /** |
| | | * 满板(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "满板(checkBox)") |
| | | private String fullPlt; |
| | | |
| | | /** |
| | | * 高低类型 0: 未知 1: 低库位 2: 高库位 |
| | | */ |
| | | @ApiModelProperty(value= "高低类型 0: 未知 1: 低库位 2: 高库位 ") |
| | | private Short locType1; |
| | | |
| | | /** |
| | | * 宽窄类型 0: 未知 1: 窄库位 2: 宽库位 |
| | | */ |
| | | @ApiModelProperty(value= "宽窄类型 0: 未知 1: 窄库位 2: 宽库位 ") |
| | | private Short locType2; |
| | | |
| | | /** |
| | | * 轻重类型 0: 未知 1: 轻库位 2: 重库位 |
| | | */ |
| | | @ApiModelProperty(value= "轻重类型 0: 未知 1: 轻库位 2: 重库位 ") |
| | | private Short locType3; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date ioTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date firstTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long modiUser; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @ApiModelProperty(value= "创建者") |
| | | private Long appeUser; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date errorTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String errorMemo; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String mk; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String barcode; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String memo; |
| | | |
| | | public LocMast() {} |
| | | |
| | | public LocMast(String locNo,Long whsType,String locSts,Integer crnNo,Integer row1,Integer bay1,Integer lev1,String fullPlt,Short locType1,Short locType2,Short locType3,Date ioTime,Date firstTime,Long modiUser,Date modiTime,Long appeUser,Date appeTime,Date errorTime,String errorMemo,String mk,String barcode,String memo) { |
| | | this.locNo = locNo; |
| | | this.whsType = whsType; |
| | | this.locSts = locSts; |
| | | this.crnNo = crnNo; |
| | | this.row1 = row1; |
| | | this.bay1 = bay1; |
| | | this.lev1 = lev1; |
| | | this.fullPlt = fullPlt; |
| | | this.locType1 = locType1; |
| | | this.locType2 = locType2; |
| | | this.locType3 = locType3; |
| | | this.ioTime = ioTime; |
| | | this.firstTime = firstTime; |
| | | this.modiUser = modiUser; |
| | | this.modiTime = modiTime; |
| | | this.appeUser = appeUser; |
| | | this.appeTime = appeTime; |
| | | this.errorTime = errorTime; |
| | | this.errorMemo = errorMemo; |
| | | this.mk = mk; |
| | | this.barcode = barcode; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // LocMast locMast = new LocMast( |
| | | // null, // 库位号[非空] |
| | | // null, // 库位类型 |
| | | // null, // 库位状态[非空] |
| | | // null, // 堆垛机号 |
| | | // null, // 排 |
| | | // null, // 列 |
| | | // null, // 层 |
| | | // null, // 满板(checkBox) |
| | | // null, // 高低类型 |
| | | // null, // 宽窄类型 |
| | | // null, // 轻重类型 |
| | | // null, // |
| | | // null, // |
| | | // null, // 修改人员 |
| | | // null, // 修改时间 |
| | | // null, // 创建者 |
| | | // null, // 添加时间 |
| | | // null, // |
| | | // null, // |
| | | // null, // |
| | | // null, // |
| | | // null // |
| | | // ); |
| | | |
| | | public String getWhsType$(){ |
| | | BasWhsService service = SpringUtils.getBean(BasWhsService.class); |
| | | BasWhs basWhs = service.getById(this.whsType); |
| | | if (!Cools.isEmpty(basWhs)){ |
| | | return String.valueOf(basWhs.getWhsDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getLocSts$(){ |
| | | BasLocStsService service = SpringUtils.getBean(BasLocStsService.class); |
| | | BasLocSts basLocSts = service.getById(this.locSts); |
| | | if (!Cools.isEmpty(basLocSts)){ |
| | | return String.valueOf(basLocSts.getLocDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getLocType1$(){ |
| | | if (null == this.locType1){ return null; } |
| | | switch (this.locType1){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "低库位"; |
| | | case 2: |
| | | return "高库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| | | } |
| | | |
| | | public String getLocType2$(){ |
| | | if (null == this.locType2){ return null; } |
| | | switch (this.locType2){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "窄库位"; |
| | | case 2: |
| | | return "宽库位"; |
| | | default: |
| | | return String.valueOf(this.locType2); |
| | | } |
| | | } |
| | | |
| | | public String getLocType3$(){ |
| | | if (null == this.locType3){ return null; } |
| | | switch (this.locType3){ |
| | | case 0: |
| | | return "未知"; |
| | | case 1: |
| | | return "轻库位"; |
| | | case 2: |
| | | return "重库位"; |
| | | default: |
| | | return String.valueOf(this.locType3); |
| | | } |
| | | } |
| | | |
| | | public String getIoTime$(){ |
| | | if (Cools.isEmpty(this.ioTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime); |
| | | } |
| | | |
| | | public String getFirstTime$(){ |
| | | if (Cools.isEmpty(this.firstTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.firstTime); |
| | | } |
| | | |
| | | public String getModiUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.modiUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getModiTime$(){ |
| | | if (Cools.isEmpty(this.modiTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); |
| | | } |
| | | |
| | | public String getAppeUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.appeUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getAppeTime$(){ |
| | | if (Cools.isEmpty(this.appeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); |
| | | } |
| | | |
| | | public String getErrorTime$(){ |
| | | if (Cools.isEmpty(this.errorTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.errorTime); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.mapper; |
| | | |
| | | import com.zy.asrs.common.wms.entity.LocMast; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocMastMapper extends BaseMapper<LocMast> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.common.wms.entity.LocMast; |
| | | |
| | | public interface LocMastService extends IService<LocMast> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.service.impl; |
| | | |
| | | import com.zy.asrs.common.wms.mapper.LocMastMapper; |
| | | import com.zy.asrs.common.wms.entity.LocMast; |
| | | import com.zy.asrs.common.wms.service.LocMastService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | | } |
New file |
| | |
| | | -- save locMast record |
| | | -- mysql |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast/locMast.html', 'locMast管理', null , '2', null , '1'); |
| | | |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast#view', '查询', '', '3', '0', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast#btn-add', '新增', '', '3', '1', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast#btn-edit', '编辑', '', '3', '2', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast#btn-delete', '删除', '', '3', '3', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'locMast#btn-export', '导出', '', '3', '4', '1'); |
| | | |
| | | -- sqlserver |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast/locMast.html', N'locMast管理', null, '2', null, '1'); |
| | | |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast#view', N'查询', '', '3', '0', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast#btn-add', N'新增', '', '3', '1', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast#btn-edit', N'编辑', '', '3', '2', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast#btn-delete', N'删除', '', '3', '3', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'locMast#btn-export', N'导出', '', '3', '4', '1'); |
New file |
| | |
| | | <?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.common.wms.mapper.LocMastMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | var pageCurr; |
| | | var pageCount = 0; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin', 'xmSelect'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#locMast', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/locMast/page/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'locNo', align: 'center',title: '库位号'} |
| | | ,{field: 'whsType$', align: 'center',title: '库位类型'} |
| | | ,{field: 'locSts$', align: 'center',title: '库位状态'} |
| | | ,{field: 'crnNo', align: 'center',title: '堆垛机号'} |
| | | ,{field: 'row1', align: 'center',title: '排'} |
| | | ,{field: 'bay1', align: 'center',title: '列'} |
| | | ,{field: 'lev1', align: 'center',title: '层'} |
| | | ,{field: 'fullPlt', align: 'center',title: '满板(checkBox)'} |
| | | ,{field: 'locType1$', align: 'center',title: '高低类型'} |
| | | ,{field: 'locType2$', align: 'center',title: '宽窄类型'} |
| | | ,{field: 'locType3$', align: 'center',title: '轻重类型'} |
| | | ,{field: 'ioTime$', align: 'center',title: ''} |
| | | ,{field: 'firstTime$', align: 'center',title: ''} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员'} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'appeUser$', align: 'center',title: '创建者'} |
| | | ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | ,{field: 'errorTime$', align: 'center',title: ''} |
| | | ,{field: 'errorMemo', align: 'center',title: ''} |
| | | ,{field: 'mk', align: 'center',title: ''} |
| | | ,{field: 'barcode', align: 'center',title: ''} |
| | | ,{field: 'memo', 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;pageCount=count; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(locMast)', 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(locMast)', 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.locNo; |
| | | })); |
| | | 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 = { |
| | | 'locMast': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/locMast/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(locMast)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.locNo]); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | form.val('detail', mData); |
| | | layDateRender(mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/locMast/"+(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+"/locMast/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(true); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(true); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | layDate.render({ |
| | | elem: '#ioTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['ioTime$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#firstTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['firstTime$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#modiTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['modiTime$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#appeTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['appeTime$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#errorTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['errorTime$']:null |
| | | }); |
| | | |
| | | }, 100); |
| | | } |
| | | layDateRender(); |
| | | |
| | | window.loadBasWhsSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#basWhsXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/basWhs/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadBasLocStsSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#basLocStsXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/basLocSts/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadUserSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#userXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/user/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | window.loadUserSel = function () { |
| | | return xmSelect.render({ |
| | | el: '#userXmlSel', |
| | | autoRow: true, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | radio: true, |
| | | remoteMethod: function (val, cb, show) { |
| | | $.ajax({ |
| | | url: baseUrl + "/user/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(search) { |
| | | if (pageCount === 0 || search) { |
| | | let searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } else { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | } |
| | | } |
New file |
| | |
| | | <!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="condition" 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="timeRange" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline">  |
| | | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> |
| | | <i class="layui-icon"></i>重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table class="layui-hide" id="locMast" lay-filter="locMast"></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/locMast/locMast.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <div 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">库位号: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="locNo" placeholder="请输入库位号" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">库位类型: </label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="whsType" placeholder="请输入库位类型" style="display: none"> |
| | | <input id="whsType$" name="whsType$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入库位类型" onfocus=this.blur()> |
| | | <div class="cool-auto-complete-window"> |
| | | <input class="cool-auto-complete-window-input" data-key="basWhsQueryBywhsType" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="basWhsQueryBywhsTypeSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">库位状态: </label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="locSts" placeholder="请输入库位状态" lay-vertype="tips" lay-verify="required" style="display: none"> |
| | | <input id="locSts$" name="locSts$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入库位状态" onfocus=this.blur()> |
| | | <div class="cool-auto-complete-window"> |
| | | <input class="cool-auto-complete-window-input" data-key="basLocStsQueryBylocSts" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="basLocStsQueryBylocStsSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">堆垛机号: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="crnNo" placeholder="请输入堆垛机号"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">排: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="row1" placeholder="请输入排"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">列: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="bay1" placeholder="请输入列"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">层: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="lev1" placeholder="请输入层"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">满板(checkBox): </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="fullPlt" placeholder="请输入满板(checkBox)"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">高低类型: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="locType1"> |
| | | <option value="">请选择高低类型</option> |
| | | <option value="0">未知</option> |
| | | <option value="1">低库位</option> |
| | | <option value="2">高库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">宽窄类型: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="locType2"> |
| | | <option value="">请选择宽窄类型</option> |
| | | <option value="0">未知</option> |
| | | <option value="1">窄库位</option> |
| | | <option value="2">宽库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">轻重类型: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="locType3"> |
| | | <option value="">请选择轻重类型</option> |
| | | <option value="0">未知</option> |
| | | <option value="1">轻库位</option> |
| | | <option value="2">重库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="ioTime" id="ioTime$" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="firstTime" id="firstTime$" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">修改人员: </label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="modiUser" placeholder="请输入修改人员" style="display: none"> |
| | | <input id="modiUser$" name="modiUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入修改人员" onfocus=this.blur()> |
| | | <div class="cool-auto-complete-window"> |
| | | <input class="cool-auto-complete-window-input" data-key="userQueryBymodiUser" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="userQueryBymodiUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">修改时间: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="modiTime" id="modiTime$" placeholder="请输入修改时间"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">创建者: </label> |
| | | <div class="layui-input-block cool-auto-complete"> |
| | | <input class="layui-input" name="appeUser" placeholder="请输入创建者" style="display: none"> |
| | | <input id="appeUser$" name="appeUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请输入创建者" onfocus=this.blur()> |
| | | <div class="cool-auto-complete-window"> |
| | | <input class="cool-auto-complete-window-input" data-key="userQueryByappeUser" onkeyup="autoLoad(this.getAttribute('data-key'))"> |
| | | <select class="cool-auto-complete-window-select" data-key="userQueryByappeUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">添加时间: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="appeTime" id="appeTime$" placeholder="请输入添加时间"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="errorTime" id="errorTime$" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="errorMemo" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="mk" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="barcode" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="memo" placeholder="请输入"> |
| | | </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> |
| | | </div> |
| | | </script> |
| | | </html> |
| | | |