1.调整设备领用接口,优化逻辑,修复部分bug

feature-order-fix
x_z 2 years ago
parent 526bb57f63
commit d6d4cc27f6

@ -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);
}

@ -24,5 +24,9 @@ public class FilterDeviceCollectOrderRequest extends ListPageRequest {
*/
private Integer status;
/**
*
*/
private String deptCode;
}

@ -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;
}

@ -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<DeviceCollectOrderDetailResponse> 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<DeviceCollectOrderDetailResponse> 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<DeviceCollectOrderDetailResponse> 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("删除成功!");

@ -140,16 +140,27 @@
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceCollectOrderResponse">
select dco.id,
orderId,
deptCode,
createUser,
auditUser,
createTime,
updateTime,
status,
dco.orderId,
dco.deptCode,
dco.createUser,
dco.auditUser,
dco.createTime,
dco.updateTime,
dco.status,
auth_dept.name deptName
from device_collect_order dco
left join auth_dept on dco.deptCode = auth_dept.code
<where>
<if test="status != null">
AND dco.status = #{status}
</if>
<if test="orderId != null and orderId != ''">
AND dco.orderId like concat('%', #{orderId}, '%')
</if>
<if test="deptCode != null and deptCode != ''">
AND dco.deptCode = #{deptCode}
</if>
</where>
</select>
<select id="selectOrderIdById" resultType="java.lang.String">

@ -55,32 +55,31 @@
from device_collect_order_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity">
insert into device_collect_order_detail (id, orderIdFk, originCode,
code, productId, nameCode,
batchNo, produceDate, expireDate,
serialNo, createTime, updateTime,
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},
#{receiveStorageCode,jdbcType=VARCHAR}
#{receiveWarehouseCode,jdbcType=VARCHAR},
#{receiveSpaceCode,jdbcType=VARCHAR})
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity" useGeneratedKeys="true">
insert into device_collect_order_detail (orderIdFk, originCode,
code, productId, nameCode,
batchNo, produceDate, expireDate,
serialNo, createTime, updateTime,
invStorageCode,
invWarehouseCode, invSpaceCode, receiveStorageCode,
receiveWarehouseCode,
receiveSpaceCode)
values (#{orderIdFk,jdbcType=VARCHAR}, #{originCode,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{nameCode,jdbcType=VARCHAR},
#{batchNo,jdbcType=VARCHAR}, #{produceDate,jdbcType=VARCHAR}, #{expireDate,jdbcType=VARCHAR},
#{serialNo,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updateTime,jdbcType=VARCHAR},
#{invStorageCode,jdbcType=VARCHAR},#{invWarehouseCode,jdbcType=VARCHAR}, #{invSpaceCode,jdbcType=VARCHAR},
#{receiveStorageCode,jdbcType=VARCHAR},
#{receiveWarehouseCode,jdbcType=VARCHAR},
#{receiveSpaceCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity">
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.DeviceCollectOrderDetailEntity" useGeneratedKeys="true">
insert into device_collect_order_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="orderIdFk != null">
orderIdFk,
</if>
@ -134,9 +133,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="orderIdFk != null">
#{orderIdFk,jdbcType=VARCHAR},
</if>
@ -281,35 +277,41 @@
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceCollectOrderDetailResponse">
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
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="code != null and code != ''">
AND dcod.originCode = #{code}
</if>
</where>
</select>

@ -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;

Loading…
Cancel
Save