1.添加设备养护记录相关接口逻辑代码

feature-order-fix
x_z 2 years ago
parent b11e8fdd57
commit f10b0f29c1

@ -36,4 +36,13 @@ public interface DeviceCollectOrderDetailDao {
* @param orderIdFk
*/
void deleteByOrderId(@Param("orderIdFk") String orderIdFk);
/**
*
*
* @param filterDeviceCollectOrderDetailRequest
* @return
*/
List<DeviceCollectOrderDetailEntity> selectList(FilterDeviceCollectOrderDetailRequest filterDeviceCollectOrderDetailRequest);
}

@ -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<DeviceMAOrderResponse> filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest);
}

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

@ -57,12 +57,12 @@ public class DeviceMAOrderEntity {
/**
* 0 1
*/
private Boolean deviceStatus;
private Integer deviceStatus;
/**
* 0 1
*/
private Boolean maintenanceStatus;
private Integer maintenanceStatus;
/**
*

@ -25,4 +25,19 @@ public class AddDeviceCollectOrderDetailRequest {
*/
private List<String> invProductIds;
/**
*
*/
private String invStorageCode;
/**
*
*/
private String invWarehouseCode;
/**
*
*/
private String invSpaceCode;
}

@ -19,4 +19,9 @@ public class FilterDeviceCollectOrderDetailRequest extends ListPageRequest {
*/
private String orderIdFk;
/**
*
*/
private String code;
}

@ -8,4 +8,10 @@ import lombok.Data;
*/
@Data
public class DeviceMAOrderResponse extends DeviceMAOrderEntity {
/**
*
*/
private String productName;
}

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

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

@ -14,8 +14,10 @@
<result column="serialNo" jdbcType="VARCHAR" property="serialNo"/>
<result column="createTime" jdbcType="VARCHAR" property="createTime"/>
<result column="updateTime" jdbcType="VARCHAR" property="updateTime"/>
<result column="invStorageCode" jdbcType="VARCHAR" property="invStorageCode"/>
<result column="invWarehouseCode" jdbcType="VARCHAR" property="invWarehouseCode"/>
<result column="invSpaceCode" jdbcType="VARCHAR" property="invSpaceCode"/>
<result column="receiveStorageCode" jdbcType="VARCHAR" property="receiveStorageCode"/>
<result column="receiveWarehouseCode" jdbcType="VARCHAR" property="receiveWarehouseCode"/>
<result column="receiveSpaceCode" jdbcType="VARCHAR" property="receiveSpaceCode"/>
</resultMap>
@ -33,8 +35,10 @@
serialNo,
createTime,
updateTime,
invStorageCode,
invWarehouseCode,
invSpaceCode,
receiveStorageCode,
receiveWarehouseCode,
receiveSpaceCode
</sql>
@ -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})
</insert>
@ -106,12 +114,18 @@
<if test="updateTime != null">
updateTime,
</if>
<if test="invStorageCode != null">
invStorageCode,
</if>
<if test="invWarehouseCode != null">
invWarehouseCode,
</if>
<if test="invSpaceCode != null">
invSpaceCode,
</if>
<if test="receiveStorageCode != null">
receiveStorageCode,
</if>
<if test="receiveWarehouseCode != null">
receiveWarehouseCode,
</if>
@ -156,12 +170,18 @@
<if test="updateTime != null">
#{updateTime,jdbcType=VARCHAR},
</if>
<if test="invStorageCode != null">
#{invStorageCode,jdbcType=VARCHAR},
</if>
<if test="invWarehouseCode != null">
#{invWarehouseCode,jdbcType=VARCHAR},
</if>
<if test="invSpaceCode != null">
#{invSpaceCode,jdbcType=VARCHAR},
</if>
<if test="receiveStorageCode != null">
#{receiveStorageCode,jdbcType=VARCHAR},
</if>
<if test="receiveWarehouseCode != null">
#{receiveWarehouseCode,jdbcType=VARCHAR},
</if>
@ -208,12 +228,18 @@
<if test="updateTime != null">
updateTime = #{updateTime,jdbcType=VARCHAR},
</if>
<if test="invStorageCode != null">
invStorageCode = #{updateTime,jdbcType=VARCHAR},
</if>
<if test="invWarehouseCode != null">
invWarehouseCode = #{invWarehouseCode,jdbcType=VARCHAR},
</if>
<if test="invSpaceCode != null">
invSpaceCode = #{invSpaceCode,jdbcType=VARCHAR},
</if>
<if test="receiveStorageCode != null">
receiveStorageCode = #{invSpaceCode,jdbcType=VARCHAR},
</if>
<if test="receiveWarehouseCode != null">
receiveWarehouseCode = #{receiveWarehouseCode,jdbcType=VARCHAR},
</if>
@ -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}
</delete>
<select id="selectList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from device_collect_order_detail
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
</where>
</select>
</mapper>

@ -224,4 +224,26 @@
`status` = #{status,jdbcType=BOOLEAN}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceMAOrderResponse">
select dmo.id,
dmo.orderId,
dmo.code,
dmo.productId,
dmo.batchNo,
dmo.produceDate,
dmo.expireDate,
dmo.serialNo,
dmo.createTime,
dmo.updateTime,
dmo.deviceStatus,
dmo.maintenanceStatus,
dmo.createUser,
dmo.remark,
dmo.status,
bp.cpmctymc productName
from device_ma_order dmo
left join basic_udirel bu on dmo.productId = bu.id
left join basic_products bp on bu.uuid = bp.uuid
</select>
</mapper>

@ -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;
) 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`;
Loading…
Cancel
Save