设备代码提交

dev2.0
郑明梁 2 years ago
parent 06ebf55ed0
commit 52e1ffd273

@ -2,6 +2,7 @@ package com.glxp.api.service.inv.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
@ -79,36 +80,53 @@ public class DeviceReceiveOrderDetailServiceImpl implements DeviceReceiveOrderDe
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!");
}
if (StrUtil.isNotBlank(addDetailRequest.getCode())) {
//通过条码添加
//解析此条码,判断此条码是否已经存在
UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode());
if (StrUtil.isNotBlank(udi.getSerialNo())) {
//条码为完整码,查询此条码在当前领用记录中是否存在,如果存在则无法添加
FilterDeviceReceiveOrderDetailRequest detailRequest = new FilterDeviceReceiveOrderDetailRequest();
detailRequest.setOrderIdFk(addDetailRequest.getOrderIdFk());
detailRequest.setCode(addDetailRequest.getCode());
List<DeviceReceiveOrderDetailResponse> list = deviceReceiveOrderDetailDao.filterList(detailRequest);
if (CollUtil.isNotEmpty(list)) {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "条码重复!");
if(addDetailRequest.getType() == 1){
//通过条码添加
//解析此条码,判断此条码是否已经存在
UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode());
if (StrUtil.isNotBlank(udi.getSerialNo())) {
//条码为完整码,查询此条码在当前领用记录中是否存在,如果存在则无法添加
FilterDeviceReceiveOrderDetailRequest detailRequest = new FilterDeviceReceiveOrderDetailRequest();
detailRequest.setOrderIdFk(addDetailRequest.getOrderIdFk());
detailRequest.setCode(addDetailRequest.getCode());
List<DeviceReceiveOrderDetailResponse> list = deviceReceiveOrderDetailDao.filterList(detailRequest);
if (CollUtil.isNotEmpty(list)) {
return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "条码重复!");
}
}
}
//设置库存详情查询参数
FilterInvProductDetailRequest invProductDetailRequest = new FilterInvProductDetailRequest();
invProductDetailRequest.setCode(addDetailRequest.getCode());
//设置库存详情查询参数
FilterInvProductDetailRequest invProductDetailRequest = new FilterInvProductDetailRequest();
invProductDetailRequest.setCode(addDetailRequest.getCode());
//判断是否有选入的仓库信息,如果没有,说明此条码仅存在一条仓库信息,直接使用即可
if (StrUtil.isNotBlank(addDetailRequest.getInvCode())) {
invProductDetailRequest.setDeptCode(addDetailRequest.getDeptCode());
invProductDetailRequest.setInvCode(addDetailRequest.getInvCode());
invProductDetailRequest.setInvSpaceCode(addDetailRequest.getInvSpaceCode());
invProductDetailRequest.setSupId(addDetailRequest.getSupId());
//判断是否有选入的仓库信息,如果没有,说明此条码仅存在一条仓库信息,直接使用即可
if (StrUtil.isNotBlank(addDetailRequest.getInvCode())) {
invProductDetailRequest.setDeptCode(addDetailRequest.getDeptCode());
invProductDetailRequest.setInvCode(addDetailRequest.getInvCode());
invProductDetailRequest.setInvSpaceCode(addDetailRequest.getInvSpaceCode());
invProductDetailRequest.setSupId(addDetailRequest.getSupId());
}
//查询库存详情
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetailList(invProductDetailRequest);
InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0);
DeviceReceiveOrderDetailEntity orderDetail = getDeviceReceiveOrderDetailEntity(addDetailRequest.getOrderIdFk(), addDetailRequest.getCode(), invProductDetailEntity);
deviceReceiveOrderDetailDao.insert(orderDetail);
}else if(addDetailRequest.getType() == 2){
DeptDeviceDetailEntity deptDeviceDetailEntity= deptDeviceDetailDao.selectOne(new QueryWrapper<DeptDeviceDetailEntity>().eq("originCode", addDetailRequest.getCode()).last("limit 1"));
DeviceReceiveOrderDetailEntity deviceReceiveOrderDetailEntity = getDeviceReceiveOrderDetailAndDelectEntity(addDetailRequest.getOrderIdFk(),deptDeviceDetailEntity);
deviceReceiveOrderDetailDao.insert(deviceReceiveOrderDetailEntity);
}else if(addDetailRequest.getType() == 3){
UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode());
UdiProductEntity udiProductEntity = udiProductService.selectUdiByName(udi.getUdi());
DeviceReceiveOrderDetailEntity deviceReceiveOrderDetailEntity = new DeviceReceiveOrderDetailEntity();
deviceReceiveOrderDetailEntity.setNameCode(udiProductEntity.getNameCode());
deviceReceiveOrderDetailEntity.setRelId(Long.valueOf(udiProductEntity.getRelId()));
deviceReceiveOrderDetailEntity.setOrderIdFk(addDetailRequest.getOrderIdFk());
deviceReceiveOrderDetailEntity.setSupId(udiProductEntity.getSupId());
deviceReceiveOrderDetailEntity.setCreateTime(new Date());
deviceReceiveOrderDetailEntity.setUpdateTime(new Date());
deviceReceiveOrderDetailDao.insert(deviceReceiveOrderDetailEntity);
}
//查询库存详情
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailDao.filterInvProductDetailList(invProductDetailRequest);
InvProductDetailEntity invProductDetailEntity = invProductDetailEntities.get(0);
DeviceReceiveOrderDetailEntity orderDetail = getDeviceReceiveOrderDetailEntity(addDetailRequest.getOrderIdFk(), addDetailRequest.getCode(), invProductDetailEntity);
deviceReceiveOrderDetailDao.insert(orderDetail);
} else {
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("device_product");
if(systemParamConfigEntity.getParamValue().equals("0") || addDetailRequest.getType() == 1){
@ -190,6 +208,25 @@ public class DeviceReceiveOrderDetailServiceImpl implements DeviceReceiveOrderDe
return orderDetail;
}
private static DeviceReceiveOrderDetailEntity getDeviceReceiveOrderDetailAndDelectEntity(String orderIdFk,DeptDeviceDetailEntity deptDeviceDetailEntity) {
DeviceReceiveOrderDetailEntity deviceReceiveOrderDetailEntity = new DeviceReceiveOrderDetailEntity();
//查询库存详情
deviceReceiveOrderDetailEntity.setNameCode(deptDeviceDetailEntity.getNameCode());
deviceReceiveOrderDetailEntity.setRelId(Long.valueOf(deptDeviceDetailEntity.getRelId()));
deviceReceiveOrderDetailEntity.setOriginCode(deptDeviceDetailEntity.getOriginCode());
deviceReceiveOrderDetailEntity.setCode(deptDeviceDetailEntity.getCode());
deviceReceiveOrderDetailEntity.setOrderIdFk(orderIdFk);
deviceReceiveOrderDetailEntity.setSupId(deptDeviceDetailEntity.getSupId());
deviceReceiveOrderDetailEntity.setBatchNo(deptDeviceDetailEntity.getBatchNo());
deviceReceiveOrderDetailEntity.setProductionDate(deptDeviceDetailEntity.getProductionDate());
deviceReceiveOrderDetailEntity.setExpireDate(deptDeviceDetailEntity.getExpireDate());
deviceReceiveOrderDetailEntity.setSerialNo(deptDeviceDetailEntity.getSerialNo());
deviceReceiveOrderDetailEntity.setCreateTime(new Date());
deviceReceiveOrderDetailEntity.setUpdateTime(new Date());
return deviceReceiveOrderDetailEntity;
}
@Override
public BaseResponse updateOrderDetail(DeviceReceiveOrderDetailEntity detailEntity) {
if (null == detailEntity || null == detailEntity.getId()) {

Loading…
Cancel
Save