diff --git a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceCollectOrderDetailDao.java b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceCollectOrderDetailDao.java index e31ce9f0..7103535b 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceCollectOrderDetailDao.java +++ b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceCollectOrderDetailDao.java @@ -36,4 +36,13 @@ public interface DeviceCollectOrderDetailDao { * @param orderIdFk */ void deleteByOrderId(@Param("orderIdFk") String orderIdFk); + + /** + * 查询设备领用记录详情 + * + * @param filterDeviceCollectOrderDetailRequest + * @return + */ + List selectList(FilterDeviceCollectOrderDetailRequest filterDeviceCollectOrderDetailRequest); + } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceMaOrderDao.java b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceMaOrderDao.java index d9990261..acb3fefc 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceMaOrderDao.java +++ b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/DeviceMaOrderDao.java @@ -1,6 +1,10 @@ package com.glxp.api.admin.dao.inventory; import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity; +import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest; +import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse; + +import java.util.List; public interface DeviceMaOrderDao { int deleteByPrimaryKey(Integer id); @@ -14,4 +18,12 @@ public interface DeviceMaOrderDao { int updateByPrimaryKeySelective(DeviceMAOrderEntity record); int updateByPrimaryKey(DeviceMAOrderEntity record); + + /** + * 查询设备养护记录列表 + * + * @param filterDeviceMAOrderRequest + * @return + */ + List filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest); } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceCollectOrderDetailEntity.java b/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceCollectOrderDetailEntity.java index 1f19c303..3e4e41cd 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceCollectOrderDetailEntity.java +++ b/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceCollectOrderDetailEntity.java @@ -68,7 +68,12 @@ public class DeviceCollectOrderDetailEntity { private String updateTime; /** - * 领用仓库 + * 领用仓库 + */ + private String invStorageCode; + + /** + * 领用分库 */ private String invWarehouseCode; @@ -78,7 +83,12 @@ public class DeviceCollectOrderDetailEntity { private String invSpaceCode; /** - * 接收仓库 + * 接收仓库 + */ + private String receiveStorageCode; + + /** + * 接收分库 */ private String receiveWarehouseCode; diff --git a/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceMAOrderEntity.java b/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceMAOrderEntity.java index 0ae0d297..51ad8a1b 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceMAOrderEntity.java +++ b/api-admin/src/main/java/com/glxp/api/admin/entity/inventory/DeviceMAOrderEntity.java @@ -57,12 +57,12 @@ public class DeviceMAOrderEntity { /** * 设备状态 0:异常 1:正常 */ - private Boolean deviceStatus; + private Integer deviceStatus; /** * 养护状态 0:未养护 1:已养护 */ - private Boolean maintenanceStatus; + private Integer maintenanceStatus; /** * 养护人 diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/AddDeviceCollectOrderDetailRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/AddDeviceCollectOrderDetailRequest.java index 635cbc75..59d3f923 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/AddDeviceCollectOrderDetailRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/AddDeviceCollectOrderDetailRequest.java @@ -25,4 +25,19 @@ public class AddDeviceCollectOrderDetailRequest { */ private List invProductIds; + /** + * 仓库码 + */ + private String invStorageCode; + + /** + * 货位码 + */ + private String invWarehouseCode; + + /** + * 货位码 + */ + private String invSpaceCode; + } diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderDetailRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderDetailRequest.java index 2db833ea..6565daaf 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderDetailRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/inventory/FilterDeviceCollectOrderDetailRequest.java @@ -19,4 +19,9 @@ public class FilterDeviceCollectOrderDetailRequest extends ListPageRequest { */ private String orderIdFk; + /** + * 码 + */ + private String code; + } diff --git a/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceMAOrderResponse.java b/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceMAOrderResponse.java index 1a4bf7db..cb1785f1 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceMAOrderResponse.java +++ b/api-admin/src/main/java/com/glxp/api/admin/res/inventory/DeviceMAOrderResponse.java @@ -8,4 +8,10 @@ import lombok.Data; */ @Data public class DeviceMAOrderResponse extends DeviceMAOrderEntity { + + /** + * 产品名称 + */ + private String productName; + } 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 a042dc2d..4970ac66 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 @@ -13,6 +13,7 @@ import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderDetailRequest; import com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest; import com.glxp.api.admin.res.inventory.DeviceCollectOrderDetailResponse; import com.glxp.api.admin.service.inventory.DeviceCollectOrderDetailService; +import com.glxp.api.admin.util.DateUtil; import com.glxp.api.admin.util.FilterUdiUtils; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; @@ -55,14 +56,49 @@ public class DeviceCollectOrderDetailServiceImpl implements DeviceCollectOrderDe return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!"); } if (StrUtil.isNotBlank(addDetailRequest.getCode())) { + //通过条码添加 + + + //设置库存详情查询参数 + FilterInvProductDetailRequest invProductDetailRequest = new FilterInvProductDetailRequest(); + invProductDetailRequest.setCode(addDetailRequest.getCode()); + + //判断是否有选入的仓库信息,如果没有,说明此条码仅存在一条仓库信息,直接使用即可 + if (StrUtil.isNotBlank(addDetailRequest.getInvStorageCode())) { + invProductDetailRequest.setInvStorageCode(addDetailRequest.getInvStorageCode()); + invProductDetailRequest.setInvWarehouseCode(addDetailRequest.getInvWarehouseCode()); + invProductDetailRequest.setInvSpaceCode(addDetailRequest.getInvSpaceCode()); + } + //查询库存详情 + List invProductDetailEntities = invProductDetailDao.filterInvProductDetail(invProductDetailRequest); + InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0); + //解析条码 UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode()); + //构造设备领用详情参数 DeviceCollectOrderDetailEntity orderDetail = new DeviceCollectOrderDetailEntity(); + orderDetail.setOrderIdFk(addDetailRequest.getOrderIdFk()); + orderDetail.setOriginCode(addDetailRequest.getCode()); + orderDetail.setInvStorageCode(invProductDetailEntity.getInvStorageCode()); + orderDetail.setInvWarehouseCode(invProductDetailRequest.getInvWarehouseCode()); + orderDetail.setInvSpaceCode(invProductDetailRequest.getInvSpaceCode()); + orderDetail.setProductId(invProductDetailEntity.getProductIdFk()); + orderDetail.setBatchNo(udi.getBatchNo()); + orderDetail.setProduceDate(udi.getProduceDate()); + orderDetail.setExpireDate(udi.getExpireDate()); + //判断此条码有无序列号,如果有序列号,则直接使用此条码当做此设备的唯一码,没有则留空唯一码,待后续提交审核时再生成 + if (StrUtil.isNotBlank(udi.getSerialNo())) { + orderDetail.setSerialNo(udi.getSerialNo()); + orderDetail.setCode(addDetailRequest.getCode()); + } + orderDetail.setUpdateTime(DateUtil.getDateTime()); + deviceCollectOrderDetailDao.insert(orderDetail); + } else { + //通过选库存添加 } - - return null; + return ResultVOUtils.success("添加成功!"); } @Override diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceMAOrderServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceMAOrderServiceImpl.java index 007a2529..c71507d2 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceMAOrderServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/DeviceMAOrderServiceImpl.java @@ -1,9 +1,21 @@ package com.glxp.api.admin.service.inventory.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageHelper; +import com.glxp.api.admin.constant.Constant; +import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao; +import com.glxp.api.admin.dao.inventory.DeviceMaOrderDao; +import com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity; import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity; +import com.glxp.api.admin.req.inventory.FilterDeviceCollectOrderDetailRequest; import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest; import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse; +import com.glxp.api.admin.service.auth.CustomerService; import com.glxp.api.admin.service.inventory.DeviceMAOrderService; +import com.glxp.api.admin.util.DateUtil; +import com.glxp.api.admin.util.GennerOrderUtils; +import com.glxp.api.admin.util.OrderNoTypeBean; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; @@ -11,6 +23,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.Collections; import java.util.List; @Slf4j @@ -18,10 +32,24 @@ import java.util.List; @Transactional(rollbackFor = Exception.class) public class DeviceMAOrderServiceImpl implements DeviceMAOrderService { + @Resource + private DeviceMaOrderDao deviceMaOrderDao; + @Resource + private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao; + @Resource + private CustomerService customerService; + @Resource + private GennerOrderUtils gennerOrderUtils; @Override public List filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest) { - return null; + if (null == filterDeviceMAOrderRequest) { + return Collections.emptyList(); + } + if (null != filterDeviceMAOrderRequest.getPage() && null != filterDeviceMAOrderRequest.getLimit()) { + PageHelper.offsetPage((filterDeviceMAOrderRequest.getPage() - 1) * filterDeviceMAOrderRequest.getLimit(), filterDeviceMAOrderRequest.getLimit()); + } + return deviceMaOrderDao.filterList(filterDeviceMAOrderRequest); } @Override @@ -29,7 +57,19 @@ public class DeviceMAOrderServiceImpl implements DeviceMAOrderService { if (null == deviceMAOrderEntity) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - return null; + FilterDeviceCollectOrderDetailRequest filterDeviceCollectOrderDetailRequest = new FilterDeviceCollectOrderDetailRequest(); + filterDeviceCollectOrderDetailRequest.setCode(deviceMAOrderEntity.getCode()); + List deviceCollectOrderDetailEntityList = deviceCollectOrderDetailDao.selectList(filterDeviceCollectOrderDetailRequest); + DeviceCollectOrderDetailEntity deviceCollectOrderDetailEntity = deviceCollectOrderDetailEntityList.get(0); + BeanUtil.copyProperties(deviceCollectOrderDetailEntity, deviceMAOrderEntity); + deviceMAOrderEntity.setOrderId(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_MA_ORDER, "yyyyMMdd"))); + deviceMAOrderEntity.setCreateTime(DateUtil.getDateTime()); + deviceMAOrderEntity.setCreateUser(customerService.getUserBean().getUserName()); + deviceMAOrderEntity.setUpdateTime(DateUtil.getDateTime()); + deviceMAOrderEntity.setDeviceStatus(1); + deviceMAOrderEntity.setMaintenanceStatus(0); + deviceMaOrderDao.insert(deviceMAOrderEntity); + return ResultVOUtils.success("添加成功!"); } @Override @@ -37,11 +77,20 @@ public class DeviceMAOrderServiceImpl implements DeviceMAOrderService { if (null == deviceMAOrderEntity) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - return null; + if (null == deviceMAOrderEntity.getId() || StrUtil.isBlank(deviceMAOrderEntity.getOrderId())) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + deviceMaOrderDao.updateByPrimaryKey(deviceMAOrderEntity); + return ResultVOUtils.success("更新成功"); } @Override public BaseResponse deleteDeviceMAOrder(Integer id) { - return null; + if (null == id) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + } + deviceMaOrderDao.deleteByPrimaryKey(id); + return ResultVOUtils.success("删除成功!"); } + } diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDetailDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDetailDao.xml index cae4e91d..6a7b2692 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDetailDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceCollectOrderDetailDao.xml @@ -14,8 +14,10 @@ + + @@ -33,8 +35,10 @@ serialNo, createTime, updateTime, + invStorageCode, invWarehouseCode, invSpaceCode, + receiveStorageCode, receiveWarehouseCode, receiveSpaceCode @@ -56,14 +60,18 @@ code, productId, nameCode, batchNo, produceDate, expireDate, serialNo, createTime, updateTime, - invWarehouseCode, invSpaceCode, receiveWarehouseCode, + invStorageCode, + invWarehouseCode, invSpaceCode, receiveStorageCode, + receiveWarehouseCode, receiveSpaceCode) values (#{id,jdbcType=INTEGER}, #{orderIdFk,jdbcType=VARCHAR}, #{originCode,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{nameCode,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, #{produceDate,jdbcType=VARCHAR}, #{expireDate,jdbcType=VARCHAR}, + #{invStorageCode,jdbcType=VARCHAR}, #{serialNo,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR}, #{invWarehouseCode,jdbcType=VARCHAR}, #{invSpaceCode,jdbcType=VARCHAR}, - #{receiveWarehouseCode,jdbcType=VARCHAR}, + #{receiveStorageCode,jdbcType=VARCHAR} + #{receiveWarehouseCode,jdbcType=VARCHAR}, #{receiveSpaceCode,jdbcType=VARCHAR}) @@ -106,12 +114,18 @@ updateTime, + + invStorageCode, + invWarehouseCode, invSpaceCode, + + receiveStorageCode, + receiveWarehouseCode, @@ -156,12 +170,18 @@ #{updateTime,jdbcType=VARCHAR}, + + #{invStorageCode,jdbcType=VARCHAR}, + #{invWarehouseCode,jdbcType=VARCHAR}, #{invSpaceCode,jdbcType=VARCHAR}, + + #{receiveStorageCode,jdbcType=VARCHAR}, + #{receiveWarehouseCode,jdbcType=VARCHAR}, @@ -208,12 +228,18 @@ updateTime = #{updateTime,jdbcType=VARCHAR}, + + invStorageCode = #{updateTime,jdbcType=VARCHAR}, + invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR}, invSpaceCode = #{invSpaceCode,jdbcType=VARCHAR}, + + receiveStorageCode = #{invSpaceCode,jdbcType=VARCHAR}, + receiveWarehouseCode = #{receiveWarehouseCode,jdbcType=VARCHAR}, @@ -237,8 +263,10 @@ serialNo = #{serialNo,jdbcType=VARCHAR}, createTime = #{createTime,jdbcType=VARCHAR}, updateTime = #{updateTime,jdbcType=VARCHAR}, + invStorageCode = #{invStorageCode,jdbcType=VARCHAR}, invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR}, invSpaceCode = #{invSpaceCode,jdbcType=VARCHAR}, + receiveStorageCode = #{receiveStorageCode,jdbcType=VARCHAR}, receiveWarehouseCode = #{receiveWarehouseCode,jdbcType=VARCHAR}, receiveSpaceCode = #{receiveSpaceCode,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} @@ -264,8 +292,10 @@ dcod.serialNo, dcod.createTime, dcod.updateTime, + dcod.invStorageCode, dcod.invWarehouseCode, dcod.invSpaceCode, + dcod.receiveStorageCode, dcod.receiveWarehouseCode, dcod.receiveSpaceCode, bp.cpmctymc productName, @@ -288,4 +318,18 @@ from device_collect_order_detail where orderIdFk = #{orderIdFk} + + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceMaOrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceMaOrderDao.xml index 63e5e552..a28f8f17 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceMaOrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/DeviceMaOrderDao.xml @@ -224,4 +224,26 @@ `status` = #{status,jdbcType=BOOLEAN} where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/scripts/设备领用养护功能表.sql b/scripts/设备领用养护功能表.sql index 57082263..422665b8 100644 --- a/scripts/设备领用养护功能表.sql +++ b/scripts/设备领用养护功能表.sql @@ -53,4 +53,12 @@ CREATE TABLE `device_ma_order` ( `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '养护说明', `status` tinyint(1) NULL DEFAULT NULL COMMENT '状态', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备养护记录表' ROW_FORMAT = Dynamic; \ No newline at end of file +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备养护记录表' ROW_FORMAT = Dynamic; + +ALTER TABLE `udiwms`.`device_collect_order_detail` + ADD COLUMN `invStorageCode` varchar(255) NULL COMMENT '领用仓库' AFTER `updateTime`, + MODIFY COLUMN `invWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领用分库' AFTER `updateTime`; + +ALTER TABLE `udiwms`.`device_collect_order_detail` + ADD COLUMN `receiveStorageCode` varchar(255) NULL COMMENT '接收仓库' AFTER `invSpaceCode`, + MODIFY COLUMN `receiveWarehouseCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '接收分库' AFTER `invSpaceCode`; \ No newline at end of file