李永德
5 months ago
6 changed files with 513 additions and 0 deletions
@ -0,0 +1,67 @@ |
|||
|
|||
package org.nl.wms.das.rest; |
|||
|
|||
|
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.das.service.GroupUpdateRecordService; |
|||
import org.nl.wms.das.service.dto.GroupUpdateRecordDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @date 2024-06-23 |
|||
**/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "组盘信息修改记录表管理") |
|||
@RequestMapping("/api/groupUpdateRecord") |
|||
@Slf4j |
|||
public class GroupUpdateRecordController { |
|||
|
|||
private final GroupUpdateRecordService groupUpdateRecordService; |
|||
|
|||
@GetMapping |
|||
@Log("查询组盘信息修改记录表") |
|||
@ApiOperation("查询组盘信息修改记录表") |
|||
//@SaCheckPermission("@el.check('groupUpdateRecord:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){ |
|||
return new ResponseEntity<>(groupUpdateRecordService.queryAll(whereJson,page),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增组盘信息修改记录表") |
|||
@ApiOperation("新增组盘信息修改记录表") |
|||
//@SaCheckPermission("@el.check('groupUpdateRecord:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody GroupUpdateRecordDto dto){ |
|||
groupUpdateRecordService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改组盘信息修改记录表") |
|||
@ApiOperation("修改组盘信息修改记录表") |
|||
//@SaCheckPermission("@el.check('groupUpdateRecord:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody GroupUpdateRecordDto dto){ |
|||
groupUpdateRecordService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除组盘信息修改记录表") |
|||
@ApiOperation("删除组盘信息修改记录表") |
|||
//@SaCheckPermission("@el.check('groupUpdateRecord:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) { |
|||
groupUpdateRecordService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,71 @@ |
|||
|
|||
package org.nl.wms.das.service; |
|||
|
|||
import org.nl.wms.das.service.dto.GroupUpdateRecordDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @description 服务接口 |
|||
* @date 2024-06-23 |
|||
**/ |
|||
public interface GroupUpdateRecordService { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
Map<String, Object> queryAll(Map whereJson, Pageable page); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<GroupUpdateRecordDto> |
|||
*/ |
|||
List<GroupUpdateRecordDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param data_id ID |
|||
* @return GroupUpdateRecord |
|||
*/ |
|||
GroupUpdateRecordDto findById(Long data_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return GroupUpdateRecord |
|||
*/ |
|||
GroupUpdateRecordDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(GroupUpdateRecordDto dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(GroupUpdateRecordDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Long[] ids); |
|||
} |
@ -0,0 +1,78 @@ |
|||
package org.nl.wms.das.service.dto; |
|||
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @description / |
|||
* @date 2024-06-23 |
|||
**/ |
|||
@Data |
|||
public class GroupUpdateRecordDto implements Serializable { |
|||
|
|||
/** 数据标识 */ |
|||
/** |
|||
* 防止精度丢失 |
|||
*/ |
|||
@JsonSerialize(using = ToStringSerializer.class) |
|||
private Long data_id; |
|||
|
|||
/** |
|||
* 组盘id |
|||
*/ |
|||
private String group_id; |
|||
|
|||
/** |
|||
* 载具编码 |
|||
*/ |
|||
private String vehicle_code; |
|||
|
|||
/** |
|||
* 载具类型 |
|||
*/ |
|||
private String vehicle_type; |
|||
|
|||
/** |
|||
* 修改内容 |
|||
*/ |
|||
private String update_type; |
|||
|
|||
/** |
|||
* 原重量 |
|||
*/ |
|||
private String orign_weight; |
|||
|
|||
/** |
|||
* 新重量 |
|||
*/ |
|||
private String current_weight; |
|||
|
|||
/** |
|||
* 原数量 |
|||
*/ |
|||
private String orign_qty; |
|||
|
|||
/** |
|||
* 新数量 |
|||
*/ |
|||
private String current_qty; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private Long update_optid; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optname; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
} |
@ -0,0 +1,127 @@ |
|||
|
|||
package org.nl.wms.das.service.impl; |
|||
|
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.modules.common.utils.SecurityUtils; |
|||
import org.nl.modules.wql.core.bean.ResultBean; |
|||
import org.nl.modules.wql.core.bean.WQLObject; |
|||
import org.nl.modules.wql.util.WqlUtil; |
|||
import org.nl.wms.das.service.GroupUpdateRecordService; |
|||
import org.nl.wms.das.service.dto.GroupUpdateRecordDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @description 服务实现 |
|||
* @date 2024-06-23 |
|||
**/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class GroupUpdateRecordServiceImpl implements GroupUpdateRecordService { |
|||
|
|||
@Override |
|||
public Map<String, Object> queryAll(Map whereJson, Pageable page) { |
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc"); |
|||
final JSONObject json = rb.pageResult(); |
|||
return json; |
|||
} |
|||
|
|||
@Override |
|||
public List<GroupUpdateRecordDto> queryAll(Map whereJson) { |
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
JSONArray arr = wo.query().getResultJSONArray(0); |
|||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(GroupUpdateRecordDto.class); |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public GroupUpdateRecordDto findById(Long data_id) { |
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
JSONObject json = wo.query("data_id = '" + data_id + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)) { |
|||
return json.toJavaObject(GroupUpdateRecordDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public GroupUpdateRecordDto findByCode(String code) { |
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); |
|||
if (ObjectUtil.isNotEmpty(json)) { |
|||
return json.toJavaObject(GroupUpdateRecordDto.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void create(GroupUpdateRecordDto dto) { |
|||
Long currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
dto.setData_id(IdUtil.getSnowflake(1, 1).nextId()); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
dto.setUpdate_time(now); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.insert(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GroupUpdateRecordDto dto) { |
|||
GroupUpdateRecordDto entity = this.findById(dto.getData_id()); |
|||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
|
|||
Long currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
|
|||
String now = DateUtil.now(); |
|||
dto.setUpdate_time(now); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); |
|||
wo.update(json); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(Long[] ids) { |
|||
Long currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
WQLObject wo = WQLObject.getWQLObject("das_group_update_record"); |
|||
for (Long data_id : ids) { |
|||
JSONObject param = new JSONObject(); |
|||
param.put("data_id", String.valueOf(data_id)); |
|||
param.put("is_delete", "1"); |
|||
param.put("update_optid", currentUserId); |
|||
param.put("update_optname", nickName); |
|||
param.put("update_time", now); |
|||
wo.update(param); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/groupUpdateRecord', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/groupUpdateRecord/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/groupUpdateRecord', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
@ -0,0 +1,143 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<crudOperation :permission="permission"/> |
|||
<!--表单组件--> |
|||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" |
|||
:title="crud.status.title" width="500px"> |
|||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px"> |
|||
<el-form-item label="组盘id"> |
|||
<el-input v-model="form.group_id" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="载具编码"> |
|||
<el-input v-model="form.vehicle_code" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="载具类型"> |
|||
<el-input v-model="form.vehicle_type" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="修改内容"> |
|||
<el-input v-model="form.update_type" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="原重量"> |
|||
<el-input v-model="form.orign_weight" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="新重量"> |
|||
<el-input v-model="form.current_weight" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="原数量"> |
|||
<el-input v-model="form.orign_qty" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="新数量"> |
|||
<el-input v-model="form.current_qty" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="修改人"> |
|||
<el-input v-model="form.update_optid" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="修改人"> |
|||
<el-input v-model="form.update_optname" style="width: 370px;"/> |
|||
</el-form-item> |
|||
<el-form-item label="修改时间"> |
|||
<el-input v-model="form.update_time" style="width: 370px;"/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="text" @click="crud.cancelCU">取消</el-button> |
|||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!--表格渲染--> |
|||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler"> |
|||
<el-table-column type="selection" width="55"/> |
|||
<el-table-column prop="group_id" label="组盘id" :min-width="flexWidth('group_id',crud.data,'组盘id')"/> |
|||
<el-table-column prop="vehicle_code" label="载具编码" |
|||
:min-width="flexWidth('vehicle_code',crud.data,'载具编码')"/> |
|||
<el-table-column prop="vehicle_type" label="载具类型" |
|||
:min-width="flexWidth('vehicle_type',crud.data,'载具类型')"/> |
|||
<el-table-column prop="update_type" label="修改内容" |
|||
:min-width="flexWidth('update_type',crud.data,'修改内容')"/> |
|||
<el-table-column prop="orign_weight" label="原重量" :min-width="flexWidth('orign_weight',crud.data,'原重量')"/> |
|||
<el-table-column prop="current_weight" label="新重量" |
|||
:min-width="flexWidth('current_weight',crud.data,'新重量')"/> |
|||
<el-table-column prop="orign_qty" label="原数量" :min-width="flexWidth('orign_qty',crud.data,'原数量')"/> |
|||
<el-table-column prop="current_qty" label="新数量" :min-width="flexWidth('current_qty',crud.data,'新数量')"/> |
|||
<el-table-column prop="update_optid" label="修改人" :min-width="flexWidth('update_optid',crud.data,'修改人')"/> |
|||
<el-table-column prop="update_optname" label="修改人" |
|||
:min-width="flexWidth('update_optname',crud.data,'修改人')"/> |
|||
<el-table-column prop="update_time" label="修改时间" |
|||
:min-width="flexWidth('update_time',crud.data,'修改时间')"/> |
|||
<!-- <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">--> |
|||
<!-- <template slot-scope="scope">--> |
|||
<!-- <udOperation--> |
|||
<!-- :data="scope.row"--> |
|||
<!-- :permission="permission"--> |
|||
<!-- />--> |
|||
<!-- </template>--> |
|||
<!-- </el-table-column>--> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination/> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CRUD, {crud, form, header, presenter} from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import udOperation from '@crud/UD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import crudGroupUpdateRecord from '@/api/groupUpdateRecord' |
|||
|
|||
const defaultForm = { |
|||
data_id: null, |
|||
group_id: null, |
|||
vehicle_code: null, |
|||
vehicle_type: null, |
|||
update_type: null, |
|||
orign_weight: null, |
|||
current_weight: null, |
|||
orign_qty: null, |
|||
current_qty: null, |
|||
update_optid: null, |
|||
update_optname: null, |
|||
update_time: null |
|||
} |
|||
export default { |
|||
name: 'GroupUpdateRecord', |
|||
components: {pagination, crudOperation, rrOperation, udOperation}, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '组盘信息修改记录表', |
|||
url: 'api/groupUpdateRecord', |
|||
idField: 'data_id', |
|||
sort: 'data_id,desc', |
|||
crudMethod: {...crudGroupUpdateRecord}, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
permission: {}, |
|||
rules: {} |
|||
} |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
Loading…
Reference in new issue