|
|
|
@ -12,6 +12,7 @@ import com.glxp.api.dao.inout.IoSplitFifoCodeMapper;
|
|
|
|
|
import com.glxp.api.dao.inout.IoSplitFifoInvMapper;
|
|
|
|
|
import com.glxp.api.entity.auth.SysWorkplace;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectOrder;
|
|
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoInv;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
@ -25,6 +26,7 @@ import com.glxp.api.res.collect.IoCollectOrderResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoSplitCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoSplitInvResponse;
|
|
|
|
|
import com.glxp.api.service.auth.SysWorkplaceService;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -159,8 +161,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过 单据 锁定库存
|
|
|
|
|
* lockType 1 上锁 2释放锁
|
|
|
|
@ -219,7 +219,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// * 预分配库存
|
|
|
|
|
// */
|
|
|
|
@ -306,7 +305,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
// return invAlert;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
Integer autoAllocationBillNoInv(Map<Long, List<IoSplitInvResponse>> splitMap, List<CollectOrderBizResponse> bizList) {
|
|
|
|
|
Integer invAlert = 1;
|
|
|
|
@ -316,15 +314,20 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
CollectOrderBizResponse collectOrderBizResponse = bizList.get(i);
|
|
|
|
|
Long relId = collectOrderBizResponse.getRelId();
|
|
|
|
|
String batchNo = collectOrderBizResponse.getBatchNo();
|
|
|
|
|
Integer count = collectOrderBizResponse.getCount(); //当前明细 需要的数量
|
|
|
|
|
//当前明细 需要的数量
|
|
|
|
|
Integer count = 0;
|
|
|
|
|
if (IntUtil.value(collectOrderBizResponse.getAutoResCount()) < 0) {
|
|
|
|
|
count = 0 - IntUtil.value(collectOrderBizResponse.getAutoResCount());
|
|
|
|
|
} else {
|
|
|
|
|
count = collectOrderBizResponse.getCount();
|
|
|
|
|
}
|
|
|
|
|
Long bizId = collectOrderBizResponse.getId();
|
|
|
|
|
|
|
|
|
|
List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId);
|
|
|
|
|
List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size());
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(newioSplitCodeResponses)) {
|
|
|
|
|
for (int j = 0; j < newioSplitCodeResponses.size(); j++) {
|
|
|
|
|
IoSplitInvResponse ioSplit = newioSplitCodeResponses.get(j);
|
|
|
|
|
if (CollUtil.isNotEmpty(ioSplitInvResponses)) {
|
|
|
|
|
for (int j = 0; j < ioSplitInvResponses.size(); j++) {
|
|
|
|
|
IoSplitInvResponse ioSplit = ioSplitInvResponses.get(j);
|
|
|
|
|
Integer reCount = ioSplit.getReCount();
|
|
|
|
|
Integer lockCount = ioSplit.getLockCount();
|
|
|
|
|
Integer totalCount = reCount - lockCount;//剩余可分配数量
|
|
|
|
@ -332,11 +335,12 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0 && totalCount > 0) {
|
|
|
|
|
Integer resCount = totalCount - count;//预分配后剩余 工位存量
|
|
|
|
|
if (resCount >= 0) {//足够分配
|
|
|
|
|
count = 0;
|
|
|
|
|
ioSplit.setLockCount(lockCount + count);
|
|
|
|
|
IoSplitFifoInv bean = new IoSplitFifoInv();
|
|
|
|
|
ioSplit.setAvailableCount(ioSplit.getInCount() - ioSplit.getOutCount() - ioSplit.getLockCount());
|
|
|
|
|
BeanUtils.copyProperties(ioSplit, bean);
|
|
|
|
|
updateIoSplitFifoInv.add(bean);
|
|
|
|
|
count = 0;
|
|
|
|
|
} else {//不够分配
|
|
|
|
|
count = -resCount;
|
|
|
|
|
}
|
|
|
|
@ -353,11 +357,9 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
collectOrderBizMapper.updateAutoResCount(bizId, collectOrderBizResponse.getCount());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(updateIoSplitFifoInv)) {
|
|
|
|
|
splitFifoInvService.updateBatchById(updateIoSplitFifoInv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return invAlert;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -375,13 +377,14 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId);
|
|
|
|
|
List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size());
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(newioSplitCodeResponses)) {
|
|
|
|
|
for (int j = 0; j < newioSplitCodeResponses.size(); j++) {
|
|
|
|
|
IoSplitInvResponse ioSplit = newioSplitCodeResponses.get(j);
|
|
|
|
|
if (CollUtil.isNotEmpty(ioSplitInvResponses)) {
|
|
|
|
|
for (int j = 0; j < ioSplitInvResponses.size(); j++) {
|
|
|
|
|
IoSplitInvResponse ioSplit = ioSplitInvResponses.get(j);
|
|
|
|
|
Integer lockCount = ioSplit.getLockCount();
|
|
|
|
|
|
|
|
|
|
if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0) {
|
|
|
|
|
ioSplit.setLockCount(lockCount - count);
|
|
|
|
|
ioSplit.setAvailableCount(ioSplit.getInCount() - ioSplit.getOutCount() - ioSplit.getLockCount());
|
|
|
|
|
IoSplitFifoInv bean = new IoSplitFifoInv();
|
|
|
|
|
BeanUtils.copyProperties(ioSplit, bean);
|
|
|
|
|
updateIoSplitFifoInv.add(bean);
|
|
|
|
@ -399,4 +402,24 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新工位下库存不足单据,进行再次锁定库存
|
|
|
|
|
*
|
|
|
|
|
* @param workPlaceCode
|
|
|
|
|
*/
|
|
|
|
|
public void updateAllInvAlert(Long workPlaceCode) {
|
|
|
|
|
List<IoCollectOrder> collectOrderList =
|
|
|
|
|
collectOrderMapper.selectList(new LambdaQueryWrapper<IoCollectOrder>()
|
|
|
|
|
.eq(IoCollectOrder::getWorkPlaceCode, workPlaceCode)
|
|
|
|
|
.eq(IoCollectOrder::getInvAlert, 2)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isNotEmpty(collectOrderList)) {
|
|
|
|
|
for (IoCollectOrder ioCollectOrder : collectOrderList) {
|
|
|
|
|
lockInventoryByOrder(ioCollectOrder.getBillNo(), 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|