diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java deleted file mode 100644 index 7dfbfbf..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java +++ /dev/null @@ -1,77 +0,0 @@ - -package org.nl.wms.pdm.rest; - - -import com.alibaba.fastjson.JSONObject; -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.pdm.service.DeviceService; -import org.nl.wms.pdm.service.dto.DeviceDto; -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 geng by -* @date 2022-05-25 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "生产设备管理") -@RequestMapping("/api/device") -@Slf4j -public class DeviceController { - - private final DeviceService deviceService; - - @GetMapping - @Log("查询生产设备") - @ApiOperation("查询生产设备") - //@SaCheckPermission("device:list") - public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ - return new ResponseEntity<>(deviceService.queryAll(whereJson,page),HttpStatus.OK); - } - - @PostMapping - @Log("新增生产设备") - @ApiOperation("新增生产设备") - //@SaCheckPermission("device:add") - public ResponseEntity create(@Validated @RequestBody DeviceDto dto){ - deviceService.create(dto); - return new ResponseEntity<>(HttpStatus.CREATED); - } - - @PutMapping - @Log("修改生产设备") - @ApiOperation("修改生产设备") - //@SaCheckPermission("device:edit") - public ResponseEntity update(@Validated @RequestBody DeviceDto dto){ - deviceService.update(dto); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除生产设备") - @ApiOperation("删除生产设备") - //@SaCheckPermission("device:del") - @DeleteMapping - public ResponseEntity delete(@RequestBody Long[] ids) { - deviceService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - - @PutMapping("/changeActive") - @Log("修改点位启用状态") - @ApiOperation("修改点位启用状态") - public ResponseEntity changeActive(@RequestBody JSONObject json) { - deviceService.changeActive(json); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java deleted file mode 100644 index ed999be..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java +++ /dev/null @@ -1,69 +0,0 @@ - -package org.nl.wms.pdm.service; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import org.nl.wms.pdm.service.dto.DeviceDto; -import org.springframework.data.domain.Pageable; - -import java.util.List; -import java.util.Map; - -/** -* @description 服务接口 -* @author geng by -* @date 2022-05-25 -**/ -public interface DeviceService { - - /** - * 查询数据分页 - * @param whereJson 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(Map whereJson, Pageable page); - - /** - * 查询所有数据不分页 - * @param whereJson 条件参数 - * @return List - */ - List queryAll(Map whereJson); - - /** - * 根据ID查询 - * @param device_id ID - * @return Device - */ - DeviceDto findById(Long device_id); - - /** - * 根据编码查询 - * @param code code - * @return Device - */ - DeviceDto findByCode(String code); - - - /** - * 创建 - * @param dto / - */ - void create(DeviceDto dto); - - /** - * 编辑 - * @param dto / - */ - void update(DeviceDto dto); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Long[] ids); - - - void changeActive(JSONObject json); -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java deleted file mode 100644 index 365a90e..0000000 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.nl.wms.pdm.service.impl; - - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -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.WQL; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.modules.wql.util.WqlUtil; -import org.nl.wms.pdm.service.DeviceService; -import org.nl.wms.pdm.service.dto.DeviceDto; - -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 geng by - * @description 服务实现 - * @date 2022-05-25 - **/ -@Service -@RequiredArgsConstructor -@Slf4j -public class DeviceServiceImpl implements DeviceService { - - @Override - public Map queryAll(Map whereJson, Pageable page) { - String search = MapUtil.getStr(whereJson, "search"); - JSONObject map = new JSONObject(); - map.put("flag", "1"); - if (!StrUtil.isEmpty(search)) { - map.put("search", "%" + search + "%"); - } - JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_model, device.device_code"); - return json; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - JSONArray arr = wo.query().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DeviceDto.class); - return null; - } - - @Override - public DeviceDto findById(Long device_id) { - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - JSONObject json = wo.query("device_id = '" + device_id + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(DeviceDto.class); - } - return null; - } - - @Override - public DeviceDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - JSONObject json = wo.query("device_code ='" + code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)) { - return json.toJavaObject(DeviceDto.class); - } - return null; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void create(DeviceDto dto) { - Long currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - //编码唯一性校验 - String device_code = dto.getDevice_code(); - DeviceDto byCode = this.findByCode(device_code); - if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!"); - dto.setDevice_id(IdUtil.getSnowflake(1, 1).nextId()); - dto.setCreate_id(currentUserId); - dto.setCreate_name(nickName); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.insert(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(DeviceDto dto) { - DeviceDto entity = this.findById(dto.getDevice_id()); - if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - - //编码唯一性校验 - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - String where = "is_delete = '0' and device_code = '" + dto.getDevice_code() + "' and device_id != '" + dto.getDevice_id() + "'"; - - JSONObject jsonObject = wo.query(where).uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonObject)) { - throw new BadRequestException("编码已存在!"); - } - - - JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); - wo.update(json); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - for (Long device_id : ids) { - wo.delete("device_id = '" + device_id + "'"); - } - } - - @Override - public void changeActive(JSONObject json) { - String is_used = "1"; - if (StrUtil.equals("1", json.getString("is_used"))) { - is_used = "0"; - } - json.put("is_used", is_used); - WQLObject.getWQLObject("PDM_BI_Device").update(json); - } - -} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls b/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls index 8f6d60a..0b414ae 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls differ diff --git a/lms/nladmin-ui/src/api/wms/pdm/device.js b/lms/nladmin-ui/src/api/wms/pdm/device.js deleted file mode 100644 index b901755..0000000 --- a/lms/nladmin-ui/src/api/wms/pdm/device.js +++ /dev/null @@ -1,74 +0,0 @@ -import request from '@/utils/request' - -export function add(data) { - return request({ - url: 'api/device', - method: 'post', - data - }) -} - -export function del(ids) { - return request({ - url: 'api/device/', - method: 'delete', - data: ids - }) -} - -export function edit(data) { - return request({ - url: 'api/device', - method: 'put', - data - }) -} - -export function getWorkprocedure() { - return request({ - url: 'api/device/getWorkprocedure', - method: 'get' - }) -} - -export function getItemByDevice(data) { - return request({ - url: 'api/device/getItemByDevice', - method: 'post', - data - }) -} - -export function savaDeviceItem(data) { - return request({ - url: 'api/device/savaDeviceItem', - method: 'post', - data - }) -} - -export function getItemByDeviceId(data) { - return request({ - url: 'api/device/getItemByDeviceId', - method: 'post', - data - }) -} - -export function copyAdd(data) { - return request({ - url: 'api/device/copyAdd', - method: 'post', - data - }) -} - -export function changeActive(data) { - return request({ - url: 'api/device/changeActive', - method: 'put', - data - }) -} - -export default { add, edit, del, getWorkprocedure, getItemByDeviceId, copyAdd, changeActive } diff --git a/lms/nladmin-ui/src/views/wms/pdm/device/index.vue b/lms/nladmin-ui/src/views/wms/pdm/device/index.vue deleted file mode 100644 index 114447e..0000000 --- a/lms/nladmin-ui/src/views/wms/pdm/device/index.vue +++ /dev/null @@ -1,156 +0,0 @@ - - - - -