diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/DeviceCollectDetailController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/DeviceCollectDetailController.java index d5d63a25..a8ba051e 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/DeviceCollectDetailController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/DeviceCollectDetailController.java @@ -109,9 +109,6 @@ public class DeviceCollectDetailController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - if (null == detailRequest) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); - } return detailService.deleteOrderDetail(detailRequest); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderRequest.java index d968164d..066c88c6 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderRequest.java @@ -24,5 +24,9 @@ public class FilterDeviceCollectOrderRequest extends ListPageRequest { */ private Integer status; + /** + * 部门编码 + */ + private String deptCode; } diff --git a/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceCollectOrderDetailResponse.java b/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceCollectOrderDetailResponse.java index ba458fa0..53ae48e8 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceCollectOrderDetailResponse.java +++ b/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceCollectOrderDetailResponse.java @@ -8,4 +8,45 @@ import lombok.Data; */ @Data public class DeviceCollectOrderDetailResponse extends DeviceCollectOrderDetailEntity { + + /** + * 产品名称 + */ + private String productName; + + /** + * 分库名称 + */ + private String invWarehouseName; + + /** + * 货位名称 + */ + private String invSpaceName; + + /** + * 货位名称 + */ + private String invSpaceCode; + + /** + * 注册/备案凭证号 + */ + private String zczbhhzbapzbh; + + /** + * 生产厂家 + */ + private String ylqxzcrbarmc; + + /** + * 规格型号 + */ + private String ggxh; + + /** + * 是否可以自定义序列号 + */ + private Boolean editSerialNo; + } diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceCollectOrderDetailServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceCollectOrderDetailServiceImpl.java index 1ce4b1b0..b2620d6f 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceCollectOrderDetailServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceCollectOrderDetailServiceImpl.java @@ -1,5 +1,6 @@ package com.glxp.api.admin.service.inventory.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageHelper; @@ -8,6 +9,7 @@ import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao; import com.glxp.api.admin.dao.inventory.InvProductDao; import com.glxp.api.admin.dao.inventory.InvProductDetailDao; import com.glxp.api.admin.entity.basic.UdiEntity; +import com.glxp.api.admin.entity.inout.WarehouseEntity; import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity; import com.glxp.api.admin.entity.inventory.InvProductDetailEntity; import com.glxp.api.admin.entity.inventory.InvProductEntity; @@ -49,10 +51,15 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe if (null == detailRequest) { return Collections.emptyList(); } - if (null == detailRequest.getPage() && null == detailRequest.getLimit()) { + if (null != detailRequest.getPage() && null != detailRequest.getLimit()) { PageHelper.offsetPage((detailRequest.getPage() - 1) * detailRequest.getLimit(), detailRequest.getLimit()); } - return deviceCollectOrderDetailDao.filterList(detailRequest); + List list = deviceCollectOrderDetailDao.filterList(detailRequest); + //设置是否可以自定义序列号标识 + list.forEach(item -> { + item.setEditSerialNo(StrUtil.isBlank(item.getCode()) ? true : false); + }); + return list; } @Override @@ -60,11 +67,24 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe if (null == addDetailRequest || StrUtil.isBlank(addDetailRequest.getOrderIdFk())) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - if (StrUtil.isBlank(addDetailRequest.getCode()) || CollUtil.isEmpty(addDetailRequest.getInvProductIds())) { + if (StrUtil.isBlank(addDetailRequest.getCode()) && CollUtil.isEmpty(addDetailRequest.getInvProductIds())) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!"); } if (StrUtil.isNotBlank(addDetailRequest.getCode())) { //通过条码添加 + //解析此条码,判断此条码是否已经存在 + UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode()); + if (StrUtil.isNotBlank(udi.getSerialNo())) { + //条码为完整码,查询此条码在当前领用记录中是否存在,如果存在则无法添加 + FilterDeviceCollectOrderDetailRequest detailRequest = new FilterDeviceCollectOrderDetailRequest(); + detailRequest.setOrderIdFk(addDetailRequest.getOrderIdFk()); + detailRequest.setCode(addDetailRequest.getCode()); + List list = deviceCollectOrderDetailDao.filterList(detailRequest); + if (CollUtil.isNotEmpty(list)) { + return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "条码重复!"); + } + } + //设置库存详情查询参数 FilterInvProductDetailRequest invProductDetailRequest = new FilterInvProductDetailRequest(); invProductDetailRequest.setCode(addDetailRequest.getCode()); @@ -132,7 +152,8 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe deviceCollectOrderDetailDao.insert(orderDetail); } } else { - getDeviceCollectOrderDetailEntity(addDetailRequest.getOrderIdFk(), code, invProductDetailEntity); + DeviceCollectOrderDetailEntity orderDetail = getDeviceCollectOrderDetailEntity(addDetailRequest.getOrderIdFk(), code, invProductDetailEntity); + deviceCollectOrderDetailDao.insert(orderDetail); } } } @@ -179,6 +200,17 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe if (null == detailEntity || null == detailEntity.getId()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } + //判断新的条码是否重复 + WarehouseEntity warehouseEntity = new WarehouseEntity(); + BeanUtil.copyProperties(detailEntity, warehouseEntity); + String code = FilterUdiUtils.transGlxpHasSerStr(warehouseEntity); + FilterDeviceCollectOrderDetailRequest detailRequest = new FilterDeviceCollectOrderDetailRequest(); + detailRequest.setOrderIdFk(detailEntity.getOrderIdFk()); + detailRequest.setCode(code); + List list = deviceCollectOrderDetailDao.filterList(detailRequest); + if (CollUtil.isNotEmpty(list)) { + return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "条码重复!"); + } deviceCollectOrderDetailDao.updateByPrimaryKey(detailEntity); return ResultVOUtils.success("更新成功!"); } @@ -188,9 +220,9 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe if (null == detailRequest.getId() && StrUtil.isBlank(detailRequest.getOrderIdFk())) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - if (null == detailRequest.getId()) { + if (null != detailRequest.getId()) { deviceCollectOrderDetailDao.deleteByPrimaryKey(detailRequest.getId()); - } else if (null == detailRequest.getOrderIdFk()) { + } else if (StrUtil.isNotBlank(detailRequest.getOrderIdFk())) { deviceCollectOrderDetailDao.deleteByOrderId(detailRequest.getOrderIdFk()); } return ResultVOUtils.success("删除成功!"); diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDao.xml index 7101c97c..6351b0ff 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDao.xml @@ -140,16 +140,27 @@ select dcod.id, - dcod.orderIdFk, - dcod.originCode, - dcod.code, - dcod.productId, - dcod.nameCode, - dcod.batchNo, - dcod.produceDate, - dcod.expireDate, - dcod.serialNo, - dcod.createTime, - dcod.updateTime, - dcod.invStorageCode, - dcod.invWarehouseCode, - dcod.invSpaceCode, - dcod.receiveStorageCode, - dcod.receiveWarehouseCode, - dcod.receiveSpaceCode, - bp.cpmctymc productName, - iws.name invWarehouseName, - isp.name invSpaceName + dcod.orderIdFk, + dcod.originCode, + dcod.code, + dcod.productId, + dcod.nameCode, + dcod.batchNo, + dcod.produceDate, + dcod.expireDate, + dcod.serialNo, + dcod.createTime, + dcod.updateTime, + dcod.invStorageCode, + dcod.invWarehouseCode, + dcod.invSpaceCode, + dcod.receiveStorageCode, + dcod.receiveWarehouseCode, + dcod.receiveSpaceCode, + bp.cpmctymc productName, + bp.zczbhhzbapzbh, + bp.ylqxzcrbarmc, + bp.ggxh, + iws.name invWarehouseName, + isp.name invSpaceName from device_collect_order_detail dcod - left join basic_udirel bu on bu.id = dcod.productId - left join basic_products bp on bu.uuid = bp.uuid - left join inv_warehouse_sub iws on iws.code = dcod.invWarehouseCode - left join inv_space isp on isp.code = dcod.invSpaceCode + left join basic_udirel bu on bu.id = dcod.productId + left join basic_products bp on bu.uuid = bp.uuid + left join inv_warehouse_sub iws on iws.code = dcod.invWarehouseCode + left join inv_space isp on isp.code = dcod.invSpaceCode AND orderIdFk = #{orderIdFk} + + AND dcod.originCode = #{code} + diff --git a/scripts/设备领用养护功能表.sql b/scripts/设备领用养护功能表.sql index 422665b8..1598b144 100644 --- a/scripts/设备领用养护功能表.sql +++ b/scripts/设备领用养护功能表.sql @@ -15,7 +15,7 @@ CREATE TABLE `device_collect_order` ( # 设备领用记录详情表 DROP TABLE IF EXISTS `device_collect_order_detail`; CREATE TABLE `device_collect_order_detail` ( - `id` int NOT NULL COMMENT 'id', + `id` int NOT NULL AUTO_INCREMENT COMMENT 'id', `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '设备领用记录号', `originCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '原始码', `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '码', @@ -27,9 +27,11 @@ CREATE TABLE `device_collect_order_detail` ( `serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号', `createTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用时间', `updateTime` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新时间', - `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用仓库', + `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用分库', + `invStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用仓库', `invSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用货位', - `receiveWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收仓库', + `receiveWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收分库', + `receiveStorageCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收仓库', `receiveSpaceCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收货位', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备领用记录详情' ROW_FORMAT = Dynamic;