|
|
@ -1,12 +1,12 @@
|
|
|
|
package com.glxp.api.service.inv.impl;
|
|
|
|
package com.glxp.api.service.inv.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.dao.inv.InvCountOrderDao;
|
|
|
|
import com.glxp.api.dao.inv.*;
|
|
|
|
import com.glxp.api.dao.inv.InvCountOrderDetailDao;
|
|
|
|
import com.glxp.api.entity.inv.InvCountCodesEntity;
|
|
|
|
import com.glxp.api.dao.inv.InvProductDao;
|
|
|
|
|
|
|
|
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
|
|
|
|
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
|
|
|
|
import com.glxp.api.entity.inv.InvCountOrderEntity;
|
|
|
|
import com.glxp.api.entity.inv.InvCountOrderEntity;
|
|
|
|
import com.glxp.api.entity.inv.InvProductEntity;
|
|
|
|
import com.glxp.api.entity.inv.InvProductEntity;
|
|
|
@ -23,7 +23,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
@ -38,6 +40,8 @@ public class InvCountOrderDetailServiceImpl implements InvCountOrderDetailServic
|
|
|
|
private InvProductDao invProductDao;
|
|
|
|
private InvProductDao invProductDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private InvProductDetailDao invProductDetailDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<InvCountOrderDetailEntity> filterList(FilterInvCountOrderDetailRequest detailRequest) {
|
|
|
|
public List<InvCountOrderDetailEntity> filterList(FilterInvCountOrderDetailRequest detailRequest) {
|
|
|
@ -90,10 +94,38 @@ public class InvCountOrderDetailServiceImpl implements InvCountOrderDetailServic
|
|
|
|
InvCountOrderEntity invCountOrder = invCountOrderDao.selectByOrderId(orderId);
|
|
|
|
InvCountOrderEntity invCountOrder = invCountOrderDao.selectByOrderId(orderId);
|
|
|
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
|
|
|
InvCountOrderDetailDao mapper = sqlSession.getMapper(InvCountOrderDetailDao.class);
|
|
|
|
InvCountOrderDetailDao mapper = sqlSession.getMapper(InvCountOrderDetailDao.class);
|
|
|
|
|
|
|
|
InvCountCodesDao codeMapper = sqlSession.getMapper(InvCountCodesDao.class);
|
|
|
|
for (InvCountOrderDetailEntity orderDetailEntity : countOrderDetailList) {
|
|
|
|
for (InvCountOrderDetailEntity orderDetailEntity : countOrderDetailList) {
|
|
|
|
InvProductEntity invProductEntity = invProductDao.selectProductInfo(orderDetailEntity.getRelId(), orderDetailEntity.getBatchNo(), invCountOrder.getDeptCode(), invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode());
|
|
|
|
InvProductEntity invProductEntity = invProductDao.selectProductInfo(orderDetailEntity.getRelId(), orderDetailEntity.getBatchNo(), invCountOrder.getDeptCode(), invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode());
|
|
|
|
orderDetailEntity.setInvNum(invProductEntity.getReCount());
|
|
|
|
orderDetailEntity.setInvNum(invProductEntity.getReCount());
|
|
|
|
orderDetailEntity.setCountNum(0);
|
|
|
|
orderDetailEntity.setCountNum(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 此查询无法区分无序列号条码,待优化
|
|
|
|
|
|
|
|
//查询此库存的详情,构造并插入码数据
|
|
|
|
|
|
|
|
List<String> codes = invProductDetailDao.selectCountOrderCodes(invCountOrder.getInvCode(), invCountOrder.getInvSpaceCode(), orderDetailEntity.getRelId(), orderDetailEntity.getBatchNo());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(codes)) {
|
|
|
|
|
|
|
|
Map<String, InvCountCodesEntity> codesMap = new HashMap<>(codes.size());
|
|
|
|
|
|
|
|
for (String code : codes) {
|
|
|
|
|
|
|
|
InvCountCodesEntity codesEntity = codesMap.get(code);
|
|
|
|
|
|
|
|
if (null == codesEntity) {
|
|
|
|
|
|
|
|
//构造条码信息
|
|
|
|
|
|
|
|
codesEntity.setCode(code);
|
|
|
|
|
|
|
|
codesEntity.setOrderIdFk(orderId);
|
|
|
|
|
|
|
|
codesEntity.setCount(1);
|
|
|
|
|
|
|
|
codesEntity.setBatchNo(orderDetailEntity.getBatchNo());
|
|
|
|
|
|
|
|
codesEntity.setRelId(orderDetailEntity.getRelId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
codesMap.put(code, codesEntity);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
codesEntity.setCount(codesEntity.getCount() + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String key : codesMap.keySet()) {
|
|
|
|
|
|
|
|
codeMapper.insert(codesMap.get(key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
mapper.insert(orderDetailEntity);
|
|
|
|
mapper.insert(orderDetailEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sqlSession.commit();
|
|
|
|
sqlSession.commit();
|
|
|
|