设备代码提交

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,6 +80,7 @@ public class DeviceReceiveOrderDetailServiceImpl implements DeviceReceiveOrderDe
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "请添加领用设备!");
}
if (StrUtil.isNotBlank(addDetailRequest.getCode())) {
if(addDetailRequest.getType() == 1){
//通过条码添加
//解析此条码,判断此条码是否已经存在
UdiEntity udi = FilterUdiUtils.getUdi(addDetailRequest.getCode());
@ -109,6 +111,22 @@ public class DeviceReceiveOrderDetailServiceImpl implements DeviceReceiveOrderDe
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);
}
} 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