|
|
@ -31,10 +31,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
@ -372,6 +369,8 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
IoCollectOrderCodeManService collectOrderCodeManService;
|
|
|
|
IoCollectOrderCodeManService collectOrderCodeManService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IoSplitCodeService splitCodeService;
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public void finishAutoTagCode(IoCollectOrder collectOrder) {
|
|
|
|
public void finishAutoTagCode(IoCollectOrder collectOrder) {
|
|
|
@ -383,9 +382,10 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
|
|
|
|
if (CollUtil.isNotEmpty(collectOrderCodeMEN)) {
|
|
|
|
if (CollUtil.isNotEmpty(collectOrderCodeMEN)) {
|
|
|
|
for (IoCollectOrderCodeMan collectOrderCodeMan : collectOrderCodeMEN) {
|
|
|
|
for (IoCollectOrderCodeMan collectOrderCodeMan : collectOrderCodeMEN) {
|
|
|
|
IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.findByCode(collectOrderCodeMan.getUdiCode(), collectOrder.getWorkPlaceCode());
|
|
|
|
IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.findByCode(collectOrderCodeMan.getUdiCode(), collectOrder.getWorkPlaceCode());
|
|
|
|
|
|
|
|
if (splitFifoCodeEntity != null) {
|
|
|
|
|
|
|
|
collectOrderCodeMan.setRemoveFlag(true);
|
|
|
|
if (IntUtil.value(splitFifoCodeEntity.getScanCount()) - IntUtil.value(collectOrderCodeMan.getScanCount()) <= 0) {
|
|
|
|
if (IntUtil.value(splitFifoCodeEntity.getScanCount()) - IntUtil.value(collectOrderCodeMan.getScanCount()) <= 0) {
|
|
|
|
splitFifoCodeService.removeById(splitFifoCodeEntity.getId());
|
|
|
|
splitFifoCodeService.removeById(splitFifoCodeEntity.getId());
|
|
|
|
|
|
|
|
|
|
|
|
IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity);
|
|
|
|
IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity);
|
|
|
|
if (splitFifoInv != null) {
|
|
|
|
if (splitFifoInv != null) {
|
|
|
|
splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + IntUtil.value(splitFifoCodeEntity.getTotalCount()));
|
|
|
|
splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + IntUtil.value(splitFifoCodeEntity.getTotalCount()));
|
|
|
@ -396,6 +396,7 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//队列码数量大于扫码数量更新数量(一般指无序列号)
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderCodeMan.getRelId());
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderCodeMan.getRelId());
|
|
|
|
int removeCount = IntUtil.value(collectOrderCodeMan.getScanCount()) * udiRelevanceEntity.getUseLeverCount();
|
|
|
|
int removeCount = IntUtil.value(collectOrderCodeMan.getScanCount()) * udiRelevanceEntity.getUseLeverCount();
|
|
|
|
splitFifoCodeService.updateById(IoSplitFifoCodeEntity.builder()
|
|
|
|
splitFifoCodeService.updateById(IoSplitFifoCodeEntity.builder()
|
|
|
@ -414,17 +415,54 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<Integer> removeIds = new ArrayList<>();
|
|
|
|
List<Integer> removeIds = new ArrayList<>();
|
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderBiz.getRelId());
|
|
|
|
|
|
|
|
//去除掉已经手动扫码的数据,找出需要自动扫码的明细,执行上述的拆零或整取
|
|
|
|
int unTagCount = collectOrderBiz.getCount() - IntUtil.value(collectOrderBiz.getScanActCount());
|
|
|
|
int unTagCount = collectOrderBiz.getCount() - IntUtil.value(collectOrderBiz.getScanActCount());
|
|
|
|
if (unTagCount > 0) {
|
|
|
|
if (unTagCount > 0) {
|
|
|
|
collectOrderBiz.setUnTagCount(unTagCount);
|
|
|
|
collectOrderBiz.setUnTagCount(unTagCount);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
collectOrderBiz.setTagStatus(3);
|
|
|
|
collectOrderBiz.setTagStatus(3);
|
|
|
|
|
|
|
|
//手动扫码时涉及到拆零时,把拆零剩余数量插入至拆零表里
|
|
|
|
|
|
|
|
if (unTagCount < 0) {
|
|
|
|
|
|
|
|
if (IntUtil.value(udiRelevanceEntity.getUseLeverCount()) > -unTagCount) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional<IoCollectOrderCodeMan> firstMatch = collectOrderCodeMEN.stream()
|
|
|
|
|
|
|
|
.filter(item -> !IntUtil.value(item.getRemoveFlag()))
|
|
|
|
|
|
|
|
.findFirst();
|
|
|
|
|
|
|
|
if (firstMatch.isPresent()) {
|
|
|
|
|
|
|
|
IoCollectOrderCodeMan result = firstMatch.get();
|
|
|
|
|
|
|
|
IoSplitCodeEntity ioSplitCodeEntity = IoSplitCodeEntity.builder().code(result.getUdiCode())
|
|
|
|
|
|
|
|
.errUdiCode(result.getUdiCode())
|
|
|
|
|
|
|
|
.orderId(result.getOrderIdFk())
|
|
|
|
|
|
|
|
.action(collectOrder.getBusType())
|
|
|
|
|
|
|
|
.relId(result.getRelId())
|
|
|
|
|
|
|
|
.nameCode(result.getNameCode())
|
|
|
|
|
|
|
|
.batchNo(result.getBatchNo())
|
|
|
|
|
|
|
|
.produceDate(result.getProductDate())
|
|
|
|
|
|
|
|
.expireDate(result.getExpireDate())
|
|
|
|
|
|
|
|
.serialNo(result.getSerialNo())
|
|
|
|
|
|
|
|
.scanCount(result.getScanCount())
|
|
|
|
|
|
|
|
.totalCount(result.getScanCount())
|
|
|
|
|
|
|
|
.workPlaceCode(collectOrder.getWorkPlaceCode())
|
|
|
|
|
|
|
|
.status(2)
|
|
|
|
|
|
|
|
.fifoSplit(1)
|
|
|
|
|
|
|
|
.createTime(new Date()).updateTime(new Date())
|
|
|
|
|
|
|
|
.remainCount(-unTagCount).build();
|
|
|
|
|
|
|
|
splitCodeService.save(ioSplitCodeEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderBiz.getRelId());
|
|
|
|
|
|
|
|
int quotient = collectOrderBiz.getUnTagCount() / IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
|
int quotient = collectOrderBiz.getUnTagCount() / IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
|
int remainder = collectOrderBiz.getUnTagCount() % IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
|
int remainder = collectOrderBiz.getUnTagCount() % IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
|
//2.如果整盒,从工位队列扣除
|
|
|
|
//2.如果整盒,从工位队列扣除
|
|
|
|