|
|
package com.glxp.api.service.inout;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.glxp.api.dao.inout.IoSplitCodeMapper;
|
|
|
import com.glxp.api.entity.basic.BasicSkPrescribeDiEntity;
|
|
|
import com.glxp.api.entity.basic.BasicSkPrescribeEntity;
|
|
|
import com.glxp.api.entity.basic.UdiRelevanceEntity;
|
|
|
import com.glxp.api.entity.collect.IoCollectOrder;
|
|
|
import com.glxp.api.entity.collect.IoCollectOrderBiz;
|
|
|
import com.glxp.api.entity.collect.IoCollectOrderCodeAuto;
|
|
|
import com.glxp.api.entity.inout.IoSplitCodeEntity;
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoCodeEntity;
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoInv;
|
|
|
import com.glxp.api.req.inout.IoSplitCodeRequest;
|
|
|
import com.glxp.api.service.basic.BasicSkPrescribeDiService;
|
|
|
import com.glxp.api.service.basic.BasicSkPrescribeService;
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
import com.glxp.api.service.collect.IoCollectOrderBizService;
|
|
|
import com.glxp.api.service.collect.IoCollectOrderCodeAutoService;
|
|
|
import com.glxp.api.service.collect.IoCollectOrderService;
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCodeEntity> {
|
|
|
|
|
|
@Resource
|
|
|
BasicSkPrescribeDiService basicSkPrescribeDiService;
|
|
|
@Resource
|
|
|
IoSplitCodeMapper splitCodeMapper;
|
|
|
@Resource
|
|
|
IoSplitFifoCodeService splitFifoCodeService;
|
|
|
@Resource
|
|
|
BasicSkPrescribeService basicSkPrescribeService;
|
|
|
@Resource
|
|
|
IoCollectOrderService collectOrderService;
|
|
|
@Resource
|
|
|
IoCollectOrderBizService collectOrderBizService;
|
|
|
@Resource
|
|
|
IoCollectOrderCodeAutoService collectOrderCodeAutoService;
|
|
|
|
|
|
public List<IoSplitCodeEntity> filterList(IoSplitCodeRequest splitCodeRequest) {
|
|
|
if (splitCodeRequest == null) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
if (splitCodeRequest.getPage() != null) {
|
|
|
int offset = (splitCodeRequest.getPage() - 1) * splitCodeRequest.getLimit();
|
|
|
PageHelper.offsetPage(offset, splitCodeRequest.getLimit());
|
|
|
}
|
|
|
return super.baseMapper.filterList(splitCodeRequest);
|
|
|
|
|
|
}
|
|
|
|
|
|
public List<IoSplitCodeEntity> findSplitCodes(Long relId, String batchNo, Long workPlaceCode) {
|
|
|
List<IoSplitCodeEntity> ioSplitCodeEntities = splitCodeMapper.selectList(new LambdaQueryWrapper<IoSplitCodeEntity>()
|
|
|
.eq(IoSplitCodeEntity::getRelId, relId)
|
|
|
.eq(StrUtil.isNotEmpty(batchNo), IoSplitCodeEntity::getBatchNo, batchNo)
|
|
|
.eq(workPlaceCode != null, IoSplitCodeEntity::getWorkPlaceCode, workPlaceCode)
|
|
|
.in(IoSplitCodeEntity::getStatus, 1, 2).orderByAsc(IoSplitCodeEntity::getInBactchNo));
|
|
|
return ioSplitCodeEntities;
|
|
|
}
|
|
|
|
|
|
public IoSplitCodeEntity findByCode(String code, Long workPlaceCode, String busType) {
|
|
|
List<IoSplitCodeEntity> ioSplitCodeEntities = splitCodeMapper.selectList(new LambdaQueryWrapper<IoSplitCodeEntity>()
|
|
|
.eq(IoSplitCodeEntity::getCode, code)
|
|
|
.eq(workPlaceCode != null, IoSplitCodeEntity::getWorkPlaceCode, workPlaceCode)
|
|
|
.in(IoSplitCodeEntity::getStatus, 1, 2).orderByAsc(IoSplitCodeEntity::getInBactchNo));
|
|
|
if (CollUtil.isNotEmpty(ioSplitCodeEntities))
|
|
|
return ioSplitCodeEntities.get(0);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 处方自动赋码
|
|
|
*/
|
|
|
public void prescribeAutoTagCode(BasicSkPrescribeEntity basicSkPrescribeEntity) {
|
|
|
|
|
|
List<BasicSkPrescribeDiEntity> basicSkPrescribeDiEntities = basicSkPrescribeDiService.findByPrescribe(basicSkPrescribeEntity.getAdNum());
|
|
|
//处方赋码状态 1:未赋码,2:部分赋码,3:全部赋码
|
|
|
for (BasicSkPrescribeDiEntity basicSkPrescribeDiEntity : basicSkPrescribeDiEntities) {
|
|
|
|
|
|
//1.按照先进先出原则,查询拆零表,获取拆零表ID
|
|
|
List<IoSplitCodeEntity> ioSplitCodeEntities = findSplitCodes(basicSkPrescribeDiEntity.getRelId(), basicSkPrescribeDiEntity.getBatchNo(), basicSkPrescribeEntity.getWorkPlaceCode());
|
|
|
|
|
|
//2.如果拆零表为空,则自动从预出库队列中获拉取数据
|
|
|
if (CollUtil.isEmpty(ioSplitCodeEntities)) {
|
|
|
addFifoCode(basicSkPrescribeDiEntity.getRelId(), basicSkPrescribeDiEntity.getBatchNo(), IntUtil.value(basicSkPrescribeDiEntity.getMeasureCount()));
|
|
|
}
|
|
|
ioSplitCodeEntities = findSplitCodes(basicSkPrescribeDiEntity.getRelId(), basicSkPrescribeDiEntity.getBatchNo(), basicSkPrescribeEntity.getWorkPlaceCode());
|
|
|
|
|
|
//3.如果拆零表不为空,则开始扣除数量
|
|
|
int count = 0;
|
|
|
int unCount = 0; //剩余未扣减数量
|
|
|
unCount = IntUtil.value(basicSkPrescribeDiEntity.getMeasureCount());
|
|
|
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
|
|
|
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
|
|
|
if (count > 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(count);
|
|
|
break;
|
|
|
} else if (count == 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
} else {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
unCount = -count;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (unCount > 0) {
|
|
|
//4.拆零表数量不足,则从预出库队列中获取数据
|
|
|
Integer fifoCount = addFifoCode(basicSkPrescribeDiEntity.getRelId(), basicSkPrescribeDiEntity.getBatchNo(), unCount);
|
|
|
if (fifoCount == 0) {
|
|
|
//预出库队列数量不足
|
|
|
basicSkPrescribeDiEntity.setTagStatus(2);
|
|
|
basicSkPrescribeDiEntity.setTagMsg("预出库队列码数量不足,赋码失败!");
|
|
|
} else {
|
|
|
//再次执行赋码
|
|
|
ioSplitCodeEntities = findSplitCodes(basicSkPrescribeDiEntity.getRelId(), basicSkPrescribeDiEntity.getBatchNo(), basicSkPrescribeEntity.getWorkPlaceCode());
|
|
|
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
|
|
|
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
|
|
|
if (count > 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(count);
|
|
|
break;
|
|
|
} else if (count == 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
} else {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
unCount = -count;
|
|
|
}
|
|
|
}
|
|
|
if (unCount > 0) {
|
|
|
basicSkPrescribeDiEntity.setTagStatus(2);
|
|
|
basicSkPrescribeDiEntity.setTagMsg("预出库队列码数量不足,赋码失败!");
|
|
|
} else {
|
|
|
basicSkPrescribeDiEntity.setTagStatus(3);
|
|
|
basicSkPrescribeDiEntity.setTagMsg("赋码完成!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
basicSkPrescribeDiService.updateById(basicSkPrescribeDiEntity);
|
|
|
}
|
|
|
basicSkPrescribeEntity.setTagStatus(checkStatus1(basicSkPrescribeDiEntities));
|
|
|
basicSkPrescribeService.updateById(basicSkPrescribeEntity);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 单据自动赋码
|
|
|
*/
|
|
|
public void orderAutoTagCode(IoCollectOrder collectOrder) {
|
|
|
|
|
|
List<IoCollectOrderBiz> collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo());
|
|
|
//处方赋码状态 1:未赋码,2:部分赋码,3:全部赋码
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
if (IntUtil.value(collectOrderBiz.getTagStatus()) == 3) {
|
|
|
continue;
|
|
|
}
|
|
|
//1.按照先进先出原则,查询拆零表,获取拆零表ID
|
|
|
List<IoSplitCodeEntity> ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode());
|
|
|
|
|
|
//2.如果拆零表为空,则自动从预出库队列中获拉取数据
|
|
|
if (CollUtil.isEmpty(ioSplitCodeEntities)) {
|
|
|
addFifoCode(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), IntUtil.value(collectOrderBiz.getCount()));
|
|
|
ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode());
|
|
|
}
|
|
|
//3.如果拆零表不为空,则开始扣除数量
|
|
|
int count = 0;
|
|
|
int unCount = 0; //剩余未扣减数量
|
|
|
unCount = IntUtil.value(collectOrderBiz.getUnTagCount());
|
|
|
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
|
|
|
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
|
|
|
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder()
|
|
|
.codeIdFk(ioSplitCodeEntity.getId())
|
|
|
.udiCode(ioSplitCodeEntity.getCode())
|
|
|
.orderIdFk(collectOrder.getBillNo())
|
|
|
.batchNo(ioSplitCodeEntity.getBatchNo())
|
|
|
.productDate(ioSplitCodeEntity.getProduceDate())
|
|
|
.expireDate(ioSplitCodeEntity.getExpireDate())
|
|
|
.serialNo(ioSplitCodeEntity.getSerialNo())
|
|
|
.relId(collectOrderBiz.getRelId())
|
|
|
.bizIdFk(collectOrderBiz.getId())
|
|
|
.fifoSplit(ioSplitCodeEntity.getFifoSplit())
|
|
|
.createTime(new Date())
|
|
|
.updateTime(new Date())
|
|
|
.build());
|
|
|
if (count > 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(count);
|
|
|
unCount = 0;
|
|
|
splitCodeMapper.updateById(ioSplitCodeEntity);
|
|
|
break;
|
|
|
} else if (count == 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
unCount = 0;
|
|
|
} else {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
unCount = -count;
|
|
|
}
|
|
|
splitCodeMapper.updateById(ioSplitCodeEntity);
|
|
|
}
|
|
|
|
|
|
if (unCount > 0) {
|
|
|
//4.拆零表数量不足,则从预出库队列中获取数据
|
|
|
Integer fifoCount = addFifoCode(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), unCount);
|
|
|
if (fifoCount == 0) {
|
|
|
//预出库队列数量不足
|
|
|
collectOrderBiz.setTagStatus(2);
|
|
|
collectOrderBiz.setTagMsg("预出库队列码数量不足,赋码失败!");
|
|
|
} else {
|
|
|
//再次执行赋码
|
|
|
ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode());
|
|
|
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
|
|
|
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
|
|
|
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder()
|
|
|
.codeIdFk(ioSplitCodeEntity.getId())
|
|
|
.udiCode(ioSplitCodeEntity.getCode())
|
|
|
.orderIdFk(collectOrder.getBillNo())
|
|
|
.batchNo(ioSplitCodeEntity.getBatchNo())
|
|
|
.productDate(ioSplitCodeEntity.getProduceDate())
|
|
|
.expireDate(ioSplitCodeEntity.getExpireDate())
|
|
|
.serialNo(ioSplitCodeEntity.getSerialNo())
|
|
|
.relId(collectOrderBiz.getRelId())
|
|
|
.bizIdFk(collectOrderBiz.getId())
|
|
|
.fifoSplit(ioSplitCodeEntity.getFifoSplit())
|
|
|
.createTime(new Date())
|
|
|
.updateTime(new Date())
|
|
|
.build());
|
|
|
if (count > 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(count);
|
|
|
break;
|
|
|
} else if (count == 0) {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
} else {
|
|
|
ioSplitCodeEntity.setRemainCount(0);
|
|
|
unCount = -count;
|
|
|
}
|
|
|
}
|
|
|
if (unCount > 0) {
|
|
|
collectOrderBiz.setTagStatus(2);
|
|
|
collectOrderBiz.setTagMsg("预出库队列码数量不足,赋码失败!");
|
|
|
} else {
|
|
|
collectOrderBiz.setTagStatus(3);
|
|
|
collectOrderBiz.setTagMsg("赋码完成!");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
collectOrderBiz.setTagStatus(3);
|
|
|
collectOrderBiz.setTagMsg("赋码完成!");
|
|
|
}
|
|
|
collectOrderBiz.setUnTagCount(unCount);
|
|
|
collectOrderBizService.updateById(collectOrderBiz);
|
|
|
}
|
|
|
collectOrder.setSplitStatus(checkStatus(collectOrderBizs));
|
|
|
collectOrderService.updateById(collectOrder);
|
|
|
}
|
|
|
|
|
|
@Resource
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
|
public void finishAutoTagCode(IoCollectOrder collectOrder) {
|
|
|
List<IoCollectOrderBiz> collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo());
|
|
|
List<IoCollectOrderBiz> needAutotagBizs = new ArrayList<>();
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
int unTagCount = collectOrderBiz.getCount() - IntUtil.value(collectOrderBiz.getScanActCount());
|
|
|
if (unTagCount > 0) {
|
|
|
collectOrderBiz.setUnTagCount(unTagCount);
|
|
|
} else {
|
|
|
collectOrderBiz.setTagStatus(3);
|
|
|
continue;
|
|
|
}
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(collectOrderBiz.getRelId());
|
|
|
int quotient = collectOrderBiz.getUnTagCount() / IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
int remainder = collectOrderBiz.getUnTagCount() % IntUtil.value(udiRelevanceEntity.getUseLeverCount());
|
|
|
if (quotient > 0) {
|
|
|
|
|
|
for(int i = 0;i<quotient;i++){
|
|
|
// splitFifoCodeService.findByCode()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 单据预赋码
|
|
|
*
|
|
|
* @param collectOrder
|
|
|
*/
|
|
|
public void preAutoTagCode(IoCollectOrder collectOrder) {
|
|
|
List<IoCollectOrderBiz> collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo());
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
List<IoSplitFifoCodeEntity> splitFifoCodeEntities =
|
|
|
splitFifoCodeService.findByRelId(collectOrder.getWorkPlaceCode(), collectOrder.getBusType(),
|
|
|
collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo());
|
|
|
|
|
|
int total = splitFifoCodeEntities.stream()
|
|
|
.mapToInt(IoSplitFifoCodeEntity::getTotalCount)
|
|
|
.sum();
|
|
|
//todo 拆零表里取数据
|
|
|
if (total > IntUtil.value(collectOrderBiz.getCount())) {
|
|
|
collectOrderBiz.setAutoTagStatus(2);
|
|
|
} else if (total > 0) {
|
|
|
collectOrderBiz.setAutoTagStatus(3);
|
|
|
} else
|
|
|
collectOrderBiz.setAutoTagStatus(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 拆零单据撤回,则将拆零表剩余数量加回预出库队列
|
|
|
*
|
|
|
* @param collectOrder
|
|
|
*/
|
|
|
public void backSplit(IoCollectOrder collectOrder) {
|
|
|
List<IoCollectOrderBiz> collectOrderBizs = collectOrderBizService.listByBillNo(collectOrder.getBillNo());
|
|
|
for (IoCollectOrderBiz collectOrderBiz : collectOrderBizs) {
|
|
|
List<IoSplitCodeEntity> ioSplitCodeEntities = findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), collectOrder.getWorkPlaceCode());
|
|
|
if (CollUtil.isNotEmpty(ioSplitCodeEntities)) {
|
|
|
IoSplitCodeEntity splitCodeEntity = ioSplitCodeEntities.get(0);
|
|
|
splitCodeEntity.setRemainCount(IntUtil.value(splitCodeEntity.getRemainCount()) + (IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getUnTagCount())));
|
|
|
splitCodeMapper.updateById(splitCodeEntity);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Resource
|
|
|
IoSplitFifoInvService splitFifoInvService;
|
|
|
|
|
|
/**
|
|
|
* 从预出库队列里面取出数据,添加至拆零表
|
|
|
*/
|
|
|
public Integer addFifoCode(Long relId, String batchNo, Integer needCount) {
|
|
|
|
|
|
List<IoSplitFifoCodeEntity> splitFifoCodeEntities = splitFifoCodeService
|
|
|
.list(new LambdaQueryWrapper<IoSplitFifoCodeEntity>()
|
|
|
.eq(IoSplitFifoCodeEntity::getRelId, relId)
|
|
|
.eq(StrUtil.isNotEmpty(batchNo), IoSplitFifoCodeEntity::getBatchNo, batchNo)
|
|
|
.orderByAsc(IoSplitFifoCodeEntity::getInBactchNo)
|
|
|
);
|
|
|
Integer count = 0;
|
|
|
List<IoSplitCodeEntity> addSplitCodeEntities = new ArrayList<>();
|
|
|
List<Integer> removeIds = new ArrayList<>();
|
|
|
for (IoSplitFifoCodeEntity splitFifoCodeEntity : splitFifoCodeEntities) {
|
|
|
IoSplitCodeEntity splitCodeEntity = new IoSplitCodeEntity();
|
|
|
BeanUtils.copyProperties(splitFifoCodeEntity, splitCodeEntity);
|
|
|
if (IntUtil.value(splitFifoCodeEntity.getFifoSplit()) == 1) {
|
|
|
//拆零
|
|
|
count = IntUtil.value(splitFifoCodeEntity.getTotalCount()) + count;
|
|
|
splitCodeEntity.setRemainCount(splitCodeEntity.getTotalCount());
|
|
|
} else {
|
|
|
//整取
|
|
|
count = IntUtil.value(splitFifoCodeEntity.getScanCount()) + count;
|
|
|
splitCodeEntity.setRemainCount(splitCodeEntity.getScanCount());
|
|
|
}
|
|
|
|
|
|
|
|
|
splitCodeEntity.setStatus(1);
|
|
|
splitCodeEntity.setFifoSplit(splitFifoCodeEntity.getFifoSplit());
|
|
|
splitCodeEntity.setId(null);
|
|
|
addSplitCodeEntities.add(splitCodeEntity);
|
|
|
removeIds.add(splitFifoCodeEntity.getId());
|
|
|
IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity);
|
|
|
if (splitFifoInv != null) {
|
|
|
splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + IntUtil.value(splitCodeEntity.getTotalCount()));
|
|
|
splitFifoInv.setLockCount(IntUtil.value(splitFifoInv.getLockCount()) - IntUtil.value(splitCodeEntity.getTotalCount()));
|
|
|
splitFifoInv.setReCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getOutCount())));
|
|
|
splitFifoInv.setAvailableCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getLockCount()) - IntUtil.value(splitFifoInv.getOutCount())));
|
|
|
}
|
|
|
if (count >= needCount) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (removeIds.size() > 0) {
|
|
|
splitFifoCodeService.removeByIds(removeIds);
|
|
|
}
|
|
|
if (addSplitCodeEntities.size() > 0) {
|
|
|
splitCodeMapper.insertBatch(addSplitCodeEntities);
|
|
|
}
|
|
|
return count;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public int checkStatus1(List<BasicSkPrescribeDiEntity> list) {
|
|
|
boolean hasTwo = false;
|
|
|
boolean hasOne = false;
|
|
|
for (BasicSkPrescribeDiEntity di : list) {
|
|
|
int tagStatus = di.getTagStatus();
|
|
|
if (tagStatus == 2) {
|
|
|
hasTwo = true;
|
|
|
} else if (tagStatus == 1) {
|
|
|
hasOne = true;
|
|
|
} else if (tagStatus != 3) {
|
|
|
throw new IllegalArgumentException("Invalid tagStatus value: " + tagStatus);
|
|
|
}
|
|
|
}
|
|
|
if (hasTwo) {
|
|
|
return 2;
|
|
|
} else if (hasOne) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
return 3;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public int checkStatus(List<IoCollectOrderBiz> list) {
|
|
|
boolean hasTwo = false;
|
|
|
boolean hasOne = false;
|
|
|
boolean hasNone = true;
|
|
|
for (IoCollectOrderBiz di : list) {
|
|
|
int tagStatus = di.getTagStatus();
|
|
|
if (tagStatus == 2) {
|
|
|
hasTwo = true;
|
|
|
} else if (tagStatus == 1) {
|
|
|
hasOne = true;
|
|
|
} else if (tagStatus != 3) {
|
|
|
throw new IllegalArgumentException("Invalid tagStatus value: " + tagStatus);
|
|
|
}
|
|
|
}
|
|
|
for (IoCollectOrderBiz di : list) {
|
|
|
if (IntUtil.value(di.getCount()) != IntUtil.value(di.getUnTagCount())) {
|
|
|
hasNone = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (hasNone) {
|
|
|
return 1;
|
|
|
}
|
|
|
if (hasTwo) {
|
|
|
return 2;
|
|
|
} else if (hasOne) {
|
|
|
return 1;
|
|
|
} else {
|
|
|
return 3;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|