11个文件已添加
3个文件已修改
1 文件已重命名
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.PltBarcodeLogHandle; |
| | | import com.zy.asrs.task.handler.PltBarcodeLogHandler; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private static final Logger log = LoggerFactory.getLogger(PltBarcodeLogScheduler.class); |
| | | |
| | | @Autowired |
| | | private PltBarcodeLogHandle pltBarcodeLogHandle; |
| | | private PltBarcodeLogHandler pltBarcodeLogHandler; |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | private void execute(){ |
| | | ReturnT<String> returnT = pltBarcodeLogHandle.start(); |
| | | ReturnT<String> returnT = pltBarcodeLogHandler.start(); |
| | | if (!returnT.isSuccess()) { |
| | | log.error(returnT.getMsg()); |
| | | } |
| File was renamed from src/main/java/com/zy/asrs/task/handler/PltBarcodeLogHandle.java |
| | |
| | | * Created by TQS on 2021/9/10 |
| | | */ |
| | | @Service |
| | | public class PltBarcodeLogHandle extends AbstractHandler<String> { |
| | | public class PltBarcodeLogHandler extends AbstractHandler<String> { |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | |
| | | generator.url="192.168.4.208:1433;databasename=xgmasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="asr_plt_barcode"; |
| | | generator.packagePath="com.zy.asrs"; |
| | | generator.table="ints_erpreq_log"; |
| | | generator.packagePath="com.zy.ints"; |
| | | // generator.html=false; |
| | | // generator.js=false; |
| | | // generator.htmlDetail=false; |
| New file |
| | |
| | | package com.zy.ints.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.ints.entity.ErpreqLog; |
| | | import com.zy.ints.service.ErpreqLogService; |
| | | 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 ErpreqLogController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ErpreqLogService erpreqLogService; |
| | | |
| | | @RequestMapping(value = "/erpreqLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(erpreqLogService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLog/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 Map<String, Object> param){ |
| | | EntityWrapper<ErpreqLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(erpreqLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper 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 = "/erpreqLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(ErpreqLog erpreqLog) { |
| | | erpreqLogService.insert(erpreqLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(ErpreqLog erpreqLog){ |
| | | if (Cools.isEmpty(erpreqLog) || null==erpreqLog.getId()){ |
| | | return R.error(); |
| | | } |
| | | erpreqLogService.updateById(erpreqLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | erpreqLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<ErpreqLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("erpreqLog")); |
| | | convert(map, wrapper); |
| | | List<ErpreqLog> list = erpreqLogService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<ErpreqLog> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<ErpreqLog> page = erpreqLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ErpreqLog erpreqLog : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", erpreqLog.getId()); |
| | | map.put("value", erpreqLog.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/erpreqLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<ErpreqLog> wrapper = new EntityWrapper<ErpreqLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != erpreqLogService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(ErpreqLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.entity; |
| | | |
| | | import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @TableName("ints_erpreq_log") |
| | | public class ErpreqLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 日志类型 1: 入库 2: 入库更新 3: 出库 4: 出库更新 5: 盘点 6: 盘点更新 7: 库存同步 |
| | | */ |
| | | @ApiModelProperty(value= "日志类型 1: 入库 2: 入库更新 3: 出库 4: 出库更新 5: 盘点 6: 盘点更新 7: 库存同步 ") |
| | | @TableField("log_type") |
| | | private Integer logType; |
| | | |
| | | /** |
| | | * 请求链接 |
| | | */ |
| | | @ApiModelProperty(value= "请求链接") |
| | | @TableField("req_url") |
| | | private String reqUrl; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("req_params") |
| | | private String reqParams; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("res_params") |
| | | private String resParams; |
| | | |
| | | /** |
| | | * 结果 0: 成功 1: 失败 |
| | | */ |
| | | @ApiModelProperty(value= "结果 0: 成功 1: 失败 ") |
| | | private Short result; |
| | | |
| | | /** |
| | | * 建档时间 |
| | | */ |
| | | @ApiModelProperty(value= "建档时间") |
| | | @TableField("appe_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | public ErpreqLog() {} |
| | | |
| | | public ErpreqLog(Integer logType,String reqUrl,String reqParams,String resParams,Short result,Date appeTime) { |
| | | this.logType = logType; |
| | | this.reqUrl = reqUrl; |
| | | this.reqParams = reqParams; |
| | | this.resParams = resParams; |
| | | this.result = result; |
| | | this.appeTime = appeTime; |
| | | } |
| | | |
| | | // ErpreqLog erpreqLog = new ErpreqLog( |
| | | // null, // 日志类型 |
| | | // null, // 请求链接 |
| | | // null, // |
| | | // null, // |
| | | // null, // 结果 |
| | | // null // 建档时间 |
| | | // ); |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getLogType() { |
| | | return logType; |
| | | } |
| | | |
| | | public String getLogType$(){ |
| | | if (null == this.logType){ return null; } |
| | | switch (this.logType){ |
| | | case 1: |
| | | return "入库"; |
| | | case 2: |
| | | return "入库更新"; |
| | | case 3: |
| | | return "出库"; |
| | | case 4: |
| | | return "出库更新"; |
| | | case 5: |
| | | return "盘点"; |
| | | case 6: |
| | | return "盘点更新"; |
| | | case 7: |
| | | return "库存同步"; |
| | | default: |
| | | return String.valueOf(this.logType); |
| | | } |
| | | } |
| | | |
| | | public void setLogType(Integer logType) { |
| | | this.logType = logType; |
| | | } |
| | | |
| | | public String getReqUrl() { |
| | | return reqUrl; |
| | | } |
| | | |
| | | public void setReqUrl(String reqUrl) { |
| | | this.reqUrl = reqUrl; |
| | | } |
| | | |
| | | public String getReqParams() { |
| | | return reqParams; |
| | | } |
| | | |
| | | public void setReqParams(String reqParams) { |
| | | this.reqParams = reqParams; |
| | | } |
| | | |
| | | public String getResParams() { |
| | | return resParams; |
| | | } |
| | | |
| | | public void setResParams(String resParams) { |
| | | this.resParams = resParams; |
| | | } |
| | | |
| | | public Short getResult() { |
| | | return result; |
| | | } |
| | | |
| | | public String getResult$(){ |
| | | if (null == this.result){ return null; } |
| | | switch (this.result){ |
| | | case 0: |
| | | return "成功"; |
| | | case 1: |
| | | return "失败"; |
| | | default: |
| | | return String.valueOf(this.result); |
| | | } |
| | | } |
| | | |
| | | public void setResult(Short result) { |
| | | this.result = result; |
| | | } |
| | | |
| | | public Date getAppeTime() { |
| | | return appeTime; |
| | | } |
| | | |
| | | public String getAppeTime$(){ |
| | | if (Cools.isEmpty(this.appeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); |
| | | } |
| | | |
| | | public void setAppeTime(Date appeTime) { |
| | | this.appeTime = appeTime; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.mapper; |
| | | |
| | | import com.zy.ints.entity.ErpreqLog; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface ErpreqLogMapper extends BaseMapper<ErpreqLog> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.service; |
| | | |
| | | import com.zy.ints.entity.ErpreqLog; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface ErpreqLogService extends IService<ErpreqLog> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.service.impl; |
| | | |
| | | import com.zy.ints.mapper.ErpreqLogMapper; |
| | | import com.zy.ints.entity.ErpreqLog; |
| | | import com.zy.ints.service.ErpreqLogService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("erpreqLogService") |
| | | public class ErpreqLogServiceImpl extends ServiceImpl<ErpreqLogMapper, ErpreqLog> implements ErpreqLogService { |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.task; |
| | | |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.ints.task.handler.ErpreqLogHandler; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ERP请求日志删除 |
| | | * Created by vincent on 2021/9/19 |
| | | */ |
| | | @Component |
| | | public class ErpreqLogScheduler { |
| | | private static final Logger log = LoggerFactory.getLogger(ErpreqLogScheduler.class); |
| | | |
| | | @Autowired |
| | | private ErpreqLogHandler erpreqLogHandler; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | private void execute(){ |
| | | if(!erpEnabled) return; |
| | | ReturnT<String> returnT = erpreqLogHandler.start(); |
| | | if (!returnT.isSuccess()) { |
| | | log.error(returnT.getMsg()); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.zy.ints.task.handler; |
| | | |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | /** |
| | | * ERP请求日志删除 |
| | | * Created by vincent on 2021/9/19 |
| | | */ |
| | | @Service |
| | | public class ErpreqLogHandler extends AbstractHandler<String> { |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start() { |
| | | try { |
| | | // 删除日期超过10天的请求日志记录 |
| | | int deleteCount = jdbcTemplate.update("delete from ints_erpreq_log where dateadd(day,10,appe_time) <= getdate();"); |
| | | if (deleteCount <= 0) { |
| | | exceptionHandle("删除ERP请求日志超过10天记录错误 ! "); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | } |
| New file |
| | |
| | | -- save erpreqLog record |
| | | -- mysql |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog/erpreqLog.html', 'erpreqLog管理', null , '2', null , '1'); |
| | | |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#view', '查询', '', '3', '0', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#btn-add', '新增', '', '3', '1', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#btn-edit', '编辑', '', '3', '2', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#btn-delete', '删除', '', '3', '3', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#btn-export', '导出', '', '3', '4', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'erpreqLog#btn-into', '导入', '', '3', '5', '1'); |
| | | |
| | | -- sqlserver |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog/erpreqLog.html', N'erpreqLog管理', null, '2', null, '1'); |
| | | |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#view', N'查询', '20383', '3', '0', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#btn-add', N'新增', '20383', '3', '1', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#btn-edit', N'编辑', '20383', '3', '2', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#btn-delete', N'删除', '20383', '3', '3', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#btn-export', N'导出', '20383', '3', '4', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'erpreqLog#btn-into', N'导入', '20383', '3', '5', '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.ints.mapper.ErpreqLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.ints.entity.ErpreqLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="log_type" property="logType" /> |
| | | <result column="req_url" property="reqUrl" /> |
| | | <result column="req_params" property="reqParams" /> |
| | | <result column="res_params" property="resParams" /> |
| | | <result column="result" property="result" /> |
| | | <result column="appe_time" property="appeTime" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | 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: '#erpreqLog', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/erpreqLog/list/auth', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'ID',width:100} |
| | | ,{field: 'logType$', align: 'center',title: '日志类型',width:100} |
| | | ,{field: 'reqUrl', align: 'center',title: '请求链接'} |
| | | ,{field: 'reqParams', align: 'center',title: '请求参数'} |
| | | ,{field: 'resParams', align: 'center',title: '返回参数'} |
| | | ,{field: 'result$', align: 'center',title: '结果',width:100} |
| | | ,{field: 'appeTime$', align: 'center',title: '建档时间',width:150} |
| | | |
| | | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | 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(erpreqLog)', 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(erpreqLog)', 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; |
| | | } |
| | | var ids = checkStatus.map(function (d) { |
| | | return d.id; |
| | | }); |
| | | del(ids); |
| | | 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 = { |
| | | 'erpreqLog': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/erpreqLog/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(erpreqLog)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/erpreqLog/"+(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+"/erpreqLog/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() { |
| | | layDate.render({ |
| | | elem: '#appeTime\\$', |
| | | type: 'datetime' |
| | | }); |
| | | |
| | | } |
| | | 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} |
| | | }); |
| | | } |
| | |
| | | ,{field: 'crnNo$', align: 'center',title: '堆垛机', hide:true} |
| | | ,{field: 'sourceStaNo$', align: 'center',title: '源站', hide:true} |
| | | ,{field: 'staNo$', align: 'center',title: '目标站', hide:true} |
| | | ,{field: 'sourceLocNo$', align: 'center',title: '源库位', hide:true} |
| | | ,{field: 'locNo$', align: 'center',title: '目标库位', hide:true} |
| | | ,{field: 'sourceLocNo$', align: 'center',title: '源库位'} |
| | | ,{field: 'locNo$', align: 'center',title: '目标库位'} |
| | | ,{field: 'barcode', align: 'center',title: '条码', hide:true} |
| | | |
| | | ,{field: 'manuType', align: 'center',title: '处理方式'} |
| | | |
| | | ,{field: 'modiUser$', align: 'center',title: '操作人员'} |
| | | ,{field: 'modiTime$', align: 'center',title: '操作时间'} |
| | | |
| 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"> |
| | | <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="log_type" placeholder="日志类型" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="result" placeholder="执行结果" autocomplete="off"> |
| | | </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" style="width: 300px"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input layui-laydate-range" name="appe_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <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="erpreqLog" lay-filter="erpreqLog"></table> |
| | | </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" id="btn-delete" lay-event="deleteData">删除</button>--> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</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/erpreqLog/erpreqLog.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <form id="detail" lay-filter="detail" class="layui-form admin-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">日志类型: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="logType"> |
| | | <option value="">请选择日志类型</option> |
| | | <option value="1">入库</option> |
| | | <option value="2">入库更新</option> |
| | | <option value="3">出库</option> |
| | | <option value="4">出库更新</option> |
| | | <option value="5">盘点</option> |
| | | <option value="6">盘点更新</option> |
| | | <option value="7">库存同步</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="reqUrl" placeholder="请输入请求链接"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="reqParams" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="resParams" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">结果: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="result"> |
| | | <option value="">请选择结果</option> |
| | | <option value="0">成功</option> |
| | | <option value="1">失败</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="appeTime" id="appeTime$" 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> |
| | | </form> |
| | | </script> |
| | | </html> |
| | | |