diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/das/rest/GroupUpdateRecordController.java b/lms/nladmin-system/src/main/java/org/nl/wms/das/rest/GroupUpdateRecordController.java new file mode 100644 index 0000000..82250e8 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/das/rest/GroupUpdateRecordController.java @@ -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 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 create(@Validated @RequestBody GroupUpdateRecordDto dto){ + groupUpdateRecordService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改组盘信息修改记录表") + @ApiOperation("修改组盘信息修改记录表") + //@SaCheckPermission("@el.check('groupUpdateRecord:edit')") + public ResponseEntity update(@Validated @RequestBody GroupUpdateRecordDto dto){ + groupUpdateRecordService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除组盘信息修改记录表") + @ApiOperation("删除组盘信息修改记录表") + //@SaCheckPermission("@el.check('groupUpdateRecord:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody Long[] ids) { + groupUpdateRecordService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/das/service/GroupUpdateRecordService.java b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/GroupUpdateRecordService.java new file mode 100644 index 0000000..7208c24 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/GroupUpdateRecordService.java @@ -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 + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * + * @param whereJson 条件参数 + * @return List + */ + List 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); +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/das/service/dto/GroupUpdateRecordDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/dto/GroupUpdateRecordDto.java new file mode 100644 index 0000000..472ec80 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/dto/GroupUpdateRecordDto.java @@ -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; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/das/service/impl/GroupUpdateRecordServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/impl/GroupUpdateRecordServiceImpl.java new file mode 100644 index 0000000..48f5833 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/das/service/impl/GroupUpdateRecordServiceImpl.java @@ -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 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 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); + } + } + +} diff --git a/lms/nladmin-ui/src/api/groupUpdateRecord.js b/lms/nladmin-ui/src/api/groupUpdateRecord.js new file mode 100644 index 0000000..72d80ac --- /dev/null +++ b/lms/nladmin-ui/src/api/groupUpdateRecord.js @@ -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 } diff --git a/lms/nladmin-ui/src/views/wms/das/index.vue b/lms/nladmin-ui/src/views/wms/das/index.vue new file mode 100644 index 0000000..4bc1fd4 --- /dev/null +++ b/lms/nladmin-ui/src/views/wms/das/index.vue @@ -0,0 +1,143 @@ + + + + +