diff --git a/src/main/java/com/glxp/api/constant/DeviceStatus.java b/src/main/java/com/glxp/api/constant/DeviceStatus.java index 18f09ca4..46cac657 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 1bbc14d4..0e7d67b1 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 list = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + + + List 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 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 98049293..73ed84b9 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 870e214b..59fe3536 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 f9a1e354..73af99a2 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 1af7c99b..f249373c 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 12ad5925..9b88b3ee 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 @@ AND t.batchNo like concat('%', #{batchNo}, '%') + + AND t.manager like concat('%', #{manager}, '%') + + + AND t.nameCode like concat('%', #{nameCode}, '%') + + + AND t.manufactory like concat('%', #{manufactory}, '%') + + + AND t.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%') + + + AND t.serialNo = #{serialNo} + + + AND t.productionDate = #{productionDate} + + + AND t.expireDate = #{expireDate} + AND t.status = #{status} diff --git a/src/main/resources/schemas/schema_v2.2.sql b/src/main/resources/schemas/schema_v2.2.sql index fb8434d3..717ffe2c 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);