From 70483edee8594f4a04ec67117ddf9bd0042f504b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Fri, 25 Aug 2023 17:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/constant/DeviceStatus.java | 18 +++++++++- .../inv/DeptDeviceDetailController.java | 34 ++++++++++++++++++- .../entity/inv/DeptDeviceDetailEntity.java | 3 ++ .../api/req/inv/FilterDeptDeviceRequest.java | 22 ++++++++++++ .../api/res/inv/DeptDeviceDetailResponse.java | 2 ++ .../inv/impl/DeptDeviceDetailServiceImpl.java | 4 ++- .../mapper/inv/DeptDeviceDetailDao.xml | 22 ++++++++++++ src/main/resources/schemas/schema_v2.2.sql | 1 + 8 files changed, 103 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/constant/DeviceStatus.java b/src/main/java/com/glxp/api/constant/DeviceStatus.java index 18f09ca48..46cac6576 100644 --- a/src/main/java/com/glxp/api/constant/DeviceStatus.java +++ b/src/main/java/com/glxp/api/constant/DeviceStatus.java @@ -1,8 +1,9 @@ package com.glxp.api.constant; -//设备任务状态 + public class DeviceStatus { + //设备任务状态 public static final int DEVICE_STATUS_TEMP_SAVE = 0; //草稿 public static final int DEVICE_STATUS_TEMP_UNDISTRIBUTTED = 1; //未分配 @@ -14,5 +15,20 @@ public class DeviceStatus { public static final int DEVICE_STATUS_TEMP_INSPECTED = 4; //已巡检 + //设备状态 + public static final int DEVICE_STATUS_NORMAL = 1; //正常 + + public static final int DEVICE_STATUS_REPAIRS = 2; //报修 + + public static final int DEVICE_STATUS_INSPECTION = 3; //巡检中 + + public static final int DEVICE_STATUS_MAINTAIN = 4; //维修中 + + public static final int DEVICE_STATUS_SCRAP = 5; //报废 + + public static final int DEVICE_STATUS_USE = 6; //使用中 + + public static final int DEVICE_STATUS_LEISURE = 7; //空闲 + } diff --git a/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java b/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java index 1bbc14d47..0e7d67b16 100644 --- a/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java +++ b/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java @@ -1,15 +1,19 @@ package com.glxp.api.controller.inv; import com.github.pagehelper.PageInfo; +import com.github.xiaoymin.knife4j.core.util.StrUtil; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.basic.UdiEntity; import com.glxp.api.entity.inv.DeptDeviceDetailEntity; import com.glxp.api.req.inv.AddDeptDeviceRequest; import com.glxp.api.req.inv.FilterDeptDeviceRequest; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.inv.DeptDeviceDetailResponse; import com.glxp.api.service.inv.DeptDeviceDetailService; +import com.glxp.api.util.CustomUtil; +import com.glxp.api.util.udi.FilterUdiUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -17,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -37,7 +42,34 @@ public class DeptDeviceDetailController { */ @GetMapping("/udiwms/inv/deptDevice/filter") public BaseResponse filterList(FilterDeptDeviceRequest filterDeptDeviceRequest) { - List<DeptDeviceDetailResponse> list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + + + List<DeptDeviceDetailResponse> list = new ArrayList<>(); + if (StrUtil.isNotBlank(filterDeptDeviceRequest.getUdiCode())) { + filterDeptDeviceRequest =new FilterDeptDeviceRequest(); + //用唯一编码查询 + filterDeptDeviceRequest.setCode(filterDeptDeviceRequest.getUdiCode()); + list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + if (CustomUtil.isEmpty(list)) { + //用设备udi码查询 + filterDeptDeviceRequest.setCode(null); + filterDeptDeviceRequest.setOriginCode(filterDeptDeviceRequest.getUdiCode()); + list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + if (CustomUtil.isEmpty(list)) { + //用DI/物资编码查询 + filterDeptDeviceRequest.setOriginCode(null); + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterDeptDeviceRequest.getUdiCode()); + filterDeptDeviceRequest.setNameCode(udiEntity.getUdi()); + filterDeptDeviceRequest.setBatchNo(udiEntity.getBatchNo()); + filterDeptDeviceRequest.setProductionDate(udiEntity.getProduceDate()); + filterDeptDeviceRequest.setExpireDate(udiEntity.getExpireDate()); + filterDeptDeviceRequest.setSerialNo(udiEntity.getSerialNo()); + list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + } + } + } else { + list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + } PageInfo<DeptDeviceDetailResponse> pageInfo = new PageInfo<>(list); return ResultVOUtils.page(pageInfo); } diff --git a/src/main/java/com/glxp/api/entity/inv/DeptDeviceDetailEntity.java b/src/main/java/com/glxp/api/entity/inv/DeptDeviceDetailEntity.java index 98049293f..73ed84b99 100644 --- a/src/main/java/com/glxp/api/entity/inv/DeptDeviceDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/DeptDeviceDetailEntity.java @@ -184,4 +184,7 @@ public class DeptDeviceDetailEntity { @TableField(value = "detailLocation") private String detailLocation; + @TableField(value = "nameCode") + private String nameCode; + } diff --git a/src/main/java/com/glxp/api/req/inv/FilterDeptDeviceRequest.java b/src/main/java/com/glxp/api/req/inv/FilterDeptDeviceRequest.java index 870e214b7..59fe3536e 100644 --- a/src/main/java/com/glxp/api/req/inv/FilterDeptDeviceRequest.java +++ b/src/main/java/com/glxp/api/req/inv/FilterDeptDeviceRequest.java @@ -1,5 +1,6 @@ package com.glxp.api.req.inv; +import com.baomidou.mybatisplus.annotation.TableField; import com.glxp.api.util.page.ListPageRequest; import lombok.Data; @@ -56,4 +57,25 @@ public class FilterDeptDeviceRequest extends ListPageRequest { private Integer id; + private String udiCode; + + private String nameCode; + + private String manufactory; + + private String zczbhhzbapzbh; + + private String supName; + + private String productionDate; + + private String expireDate; + + private String serialNo; + + private String manager; + + + + } diff --git a/src/main/java/com/glxp/api/res/inv/DeptDeviceDetailResponse.java b/src/main/java/com/glxp/api/res/inv/DeptDeviceDetailResponse.java index f9a1e354c..73af99a22 100644 --- a/src/main/java/com/glxp/api/res/inv/DeptDeviceDetailResponse.java +++ b/src/main/java/com/glxp/api/res/inv/DeptDeviceDetailResponse.java @@ -153,4 +153,6 @@ public class DeptDeviceDetailResponse { private String invName; private String orderIdFk; + + private String nameCode; } diff --git a/src/main/java/com/glxp/api/service/inv/impl/DeptDeviceDetailServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/DeptDeviceDetailServiceImpl.java index 1af7c99bd..f249373c9 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/DeptDeviceDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/DeptDeviceDetailServiceImpl.java @@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.constant.DeviceStatus; import com.glxp.api.dao.inv.DeptDeviceDetailDao; import com.glxp.api.dao.inv.DeviceReceiveOrderDao; import com.glxp.api.dao.inv.DeviceReceiveOrderDetailDao; @@ -70,6 +71,7 @@ public class DeptDeviceDetailServiceImpl implements DeptDeviceDetailService { deviceDetail.setRelId(receiveOrderDetailResponse.getRelId()); deviceDetail.setDeviceName(receiveOrderDetailResponse.getProductName()); deviceDetail.setGgxh(receiveOrderDetailResponse.getGgxh()); + deviceDetail.setNameCode(receiveOrderDetailResponse.getNameCode()); deviceDetail.setBatchNo(receiveOrderDetailResponse.getBatchNo()); deviceDetail.setSerialNo(receiveOrderDetailResponse.getSerialNo()); deviceDetail.setProductionDate(receiveOrderDetailResponse.getProductionDate()); @@ -80,7 +82,7 @@ public class DeptDeviceDetailServiceImpl implements DeptDeviceDetailService { deviceDetail.setSupId(receiveOrderDetailResponse.getSupId()); deviceDetail.setSupName(receiveOrderDetailResponse.getSupName()); deviceDetail.setManager(receiveOrderEntity.getReceiveUser()); - deviceDetail.setStatus(1); + deviceDetail.setStatus(DeviceStatus.DEVICE_STATUS_NORMAL); deviceDetail.setAddType(1); deviceDetail.setCreateUser(receiveOrderEntity.getAuditUser()); // deviceDetail.setCreateTime(date); diff --git a/src/main/resources/mybatis/mapper/inv/DeptDeviceDetailDao.xml b/src/main/resources/mybatis/mapper/inv/DeptDeviceDetailDao.xml index 12ad59250..9b88b3ee9 100644 --- a/src/main/resources/mybatis/mapper/inv/DeptDeviceDetailDao.xml +++ b/src/main/resources/mybatis/mapper/inv/DeptDeviceDetailDao.xml @@ -16,6 +16,7 @@ t.deviceName, t.ggxh, t.batchNo, + t.nameCode, t.serialNo, t.productionDate, t.expireDate, @@ -58,6 +59,27 @@ <if test="batchNo != null and batchNo != ''"> AND t.batchNo like concat('%', #{batchNo}, '%') </if> + <if test="manager != null and manager != ''"> + AND t.manager like concat('%', #{manager}, '%') + </if> + <if test="nameCode != null and nameCode != ''"> + AND t.nameCode like concat('%', #{nameCode}, '%') + </if> + <if test="manufactory != null and manufactory != ''"> + AND t.manufactory like concat('%', #{manufactory}, '%') + </if> + <if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''"> + AND t.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%') + </if> + <if test="serialNo != null and serialNo != ''"> + AND t.serialNo = #{serialNo} + </if> + <if test="productionDate != null and productionDate != ''"> + AND t.productionDate = #{productionDate} + </if> + <if test="expireDate != null and expireDate != ''"> + AND t.expireDate = #{expireDate} + </if> <if test="status != null"> AND t.status = #{status} </if> diff --git a/src/main/resources/schemas/schema_v2.2.sql b/src/main/resources/schemas/schema_v2.2.sql index fb8434d3a..717ffe2cd 100644 --- a/src/main/resources/schemas/schema_v2.2.sql +++ b/src/main/resources/schemas/schema_v2.2.sql @@ -260,6 +260,7 @@ CREATE TABLE IF NOT EXISTS `device_asset_usage` CALL Pro_Temp_ColumnWork('dept_device_detail', 'curUser', 'varchar(255)', 1); CALL Pro_Temp_ColumnWork('dept_device_detail', 'location', 'varchar(255)', 1); CALL Pro_Temp_ColumnWork('dept_device_detail', 'detailLocation', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('dept_device_detail', 'nameCode', 'varchar(255)', 1); CALL Pro_Temp_ColumnWork('device_inspect_plan', 'executeCount', 'int', 1); CALL Pro_Temp_ColumnWork('device_inspect_plan', 'useFrequency', 'int', 1);