1.待处理单据库存锁定修改,2.单据拆零出库锁定修改,3;单据上下货库存修改,4.上货后触发单据锁定

workplace
yewj 10 months ago
parent 550d22f90a
commit 3b7b118370

@ -1193,9 +1193,9 @@ public class IoCodeTempController extends BaseController {
//计算实际数量 //计算实际数量
if (bussinessTypeEntity.isUse()) { if (bussinessTypeEntity.isUse()) {
codeEnttity.setReCount(codeEnttity.getMyCount() + udiCalCountUtil.getUseActCount(udiRelevanceResponses.get(0))); codeEnttity.setReCount(codeEnttity.getMyReCount() + udiCalCountUtil.getUseActCount(udiRelevanceResponses.get(0)));
} else { } else {
codeEnttity.setReCount(codeEnttity.getMyCount() + udiCalCountUtil.getCirActCount(udiRelevanceResponses.get(0))); codeEnttity.setReCount(codeEnttity.getMyReCount() + udiCalCountUtil.getCirActCount(udiRelevanceResponses.get(0)));
} }
} else if (udiRelevanceResponses.size() == 0) { } else if (udiRelevanceResponses.size() == 0) {
if (unitFk == null) if (unitFk == null)

@ -117,7 +117,7 @@ public class SysWorkplaceDocumentEntity {
private Integer orderCirType; private Integer orderCirType;
/** /**
* : 1:; 2: * : 1:; 2:
*/ */
@TableField(value = "inoutType") @TableField(value = "inoutType")
private Integer inoutType; private Integer inoutType;
@ -135,7 +135,11 @@ public class SysWorkplaceDocumentEntity {
private Integer workplaceType; private Integer workplaceType;
/**
* : 1:; 0:
*/
@TableField(value = "autoTag")
private Integer autoTag;
} }

@ -127,7 +127,7 @@ public class IoCollectOrder implements Serializable {
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private Long updateUser; private Long updateUser;
/** /**
* 0:1:234,-1:稿 * 0:1:234,-1:稿5
*/ */
@TableField(value = "tagStatus") @TableField(value = "tagStatus")
private Integer tagStatus; private Integer tagStatus;

@ -127,6 +127,7 @@ public class SysWorkplaceDocumentResponse {
private String innerBusName; private String innerBusName;
private String outBusName; private String outBusName;
private String thrBusName; private String thrBusName;
private Integer autoTag;
public String getThrBusName() { public String getThrBusName() {
if (StrUtil.isNotEmpty(innerBusName)) if (StrUtil.isNotEmpty(innerBusName))

@ -124,4 +124,6 @@ public class CollectOrderBizResponse {
private String finishUdiCode; private String finishUdiCode;
private String bzgg; private String bzgg;
private Integer autoResCount;
} }

@ -130,6 +130,7 @@ public class IoSplitInvResponse {
private String nameCode; private String nameCode;
private Integer remindState; private Integer remindState;
private String busName; private String busName;
private Integer availableCount;
} }

@ -213,9 +213,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, ioOrderEntity.getBillNo()))) { if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, ioOrderEntity.getBillNo()))) {
continue; continue;
} }
// BasicCollectBustypeEntity collectBustypeEntity = collectBustypeService.findByAddr(ioOrderEntity.getAction());
// if (collectBustypeEntity == null)
// continue;
SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction());
if (sysWorkplaceDocumentEntity == null) if (sysWorkplaceDocumentEntity == null)
continue; continue;
@ -263,8 +260,7 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
if (collectOrder.getWorkPlaceCode() != null) { if (collectOrder.getWorkPlaceCode() != null) {
collectOrder.setTagStatus(1); collectOrder.setTagStatus(1);
} }
save(collectOrder);
collectOrderList.add(collectOrder);
List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo());
List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>();
@ -296,10 +292,15 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
collectOrderBizService.saveBatch(collectOrderBizs); collectOrderBizService.saveBatch(collectOrderBizs);
} }
allWorksList.addAll(sysWorkplaces); allWorksList.addAll(sysWorkplaces);
if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) {
splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1);
}
} }
if (CollUtil.isNotEmpty(collectOrderList)) { // if (CollUtil.isNotEmpty(collectOrderList)) {
saveBatch(collectOrderList); // saveBatch(collectOrderList);
} // }
// Map<Long, SysWorkplaceResponse> sysWorkplaceMap = new HashMap<>(); // Map<Long, SysWorkplaceResponse> sysWorkplaceMap = new HashMap<>();
// for (SysWorkplaceResponse sysWorkplace : allWorksList) { // for (SysWorkplaceResponse sysWorkplace : allWorksList) {
@ -373,7 +374,8 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
if (collectOrder.getWorkPlaceCode() != null) { if (collectOrder.getWorkPlaceCode() != null) {
collectOrder.setTagStatus(1); collectOrder.setTagStatus(1);
} }
collectOrderList.add(collectOrder); // collectOrderList.add(collectOrder);
save(collectOrder);
List<BasicSkPrescribeItemEntity> basicSkPrescribeItemEntities = basicSkPrescirbeDetailService.findByPrescribeNum(basicSkPrescribeEntity.getCode()); List<BasicSkPrescribeItemEntity> basicSkPrescribeItemEntities = basicSkPrescirbeDetailService.findByPrescribeNum(basicSkPrescribeEntity.getCode());
List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>();
for (BasicSkPrescribeItemEntity bizEntity : basicSkPrescribeItemEntities) { for (BasicSkPrescribeItemEntity bizEntity : basicSkPrescribeItemEntities) {
@ -400,11 +402,16 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
} }
if (CollUtil.isNotEmpty(collectOrderBizs)) if (CollUtil.isNotEmpty(collectOrderBizs))
collectOrderBizService.saveBatch(collectOrderBizs); collectOrderBizService.saveBatch(collectOrderBizs);
allWorksList.addAll(sysWorkplaces); allWorksList.addAll(sysWorkplaces);
if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) {
splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1);
}
} }
if (CollUtil.isNotEmpty(collectOrderList)) { // if (CollUtil.isNotEmpty(collectOrderList)) {
saveBatch(collectOrderList); // saveBatch(collectOrderList);
} // }
// Map<Long, SysWorkplaceResponse> sysWorkplaceMap = new HashMap<>(); // Map<Long, SysWorkplaceResponse> sysWorkplaceMap = new HashMap<>();
// for (SysWorkplaceResponse sysWorkplace : allWorksList) { // for (SysWorkplaceResponse sysWorkplace : allWorksList) {
// sysWorkplaceMap.put(sysWorkplace.getId(), sysWorkplace); // sysWorkplaceMap.put(sysWorkplace.getId(), sysWorkplace);
@ -480,7 +487,7 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
public void orderTop(CollectOrderRequest collectOrderRequest) { public void orderTop(CollectOrderRequest collectOrderRequest) {
Assert.notNull(collectOrderRequest.getId(), "id不能为空"); Assert.notNull(collectOrderRequest.getId(), "id不能为空");
IoCollectOrder old = this.getById(collectOrderRequest.getId()); IoCollectOrder old = this.getById(collectOrderRequest.getId());
Assert.notNull(old,"不存在该库存预警设置"); Assert.notNull(old, "不存在该库存预警设置");
//TODO 新建单据未赋值排序时间 //TODO 新建单据未赋值排序时间
//1.获取tagStatus = 1的单据最早orderTime时间往前移1分钟 //1.获取tagStatus = 1的单据最早orderTime时间往前移1分钟
//2.在赋值给当前 //2.在赋值给当前

@ -1243,6 +1243,8 @@ public class IoCheckInoutService {
if (orderEntity.getAction().equals(ConstantType.SPLIT_OUT)) { if (orderEntity.getAction().equals(ConstantType.SPLIT_OUT)) {
List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo()); List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo());
fifoInvService.insertInv(codeList, orderEntity.getWorkPlaceCode()); fifoInvService.insertInv(codeList, orderEntity.getWorkPlaceCode());
//更新待处理库存不足单据
splitFifoCodeService.updateAllInvAlert(orderEntity.getWorkPlaceCode());
} else if (orderEntity.getAction().equals(ConstantType.SPLIT_RETURN)) { } else if (orderEntity.getAction().equals(ConstantType.SPLIT_RETURN)) {
//拆零预出库退回 //拆零预出库退回
List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo()); List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo());

@ -13,6 +13,7 @@ import com.glxp.api.entity.collect.IoCollectOrderBiz;
import com.glxp.api.entity.collect.IoCollectOrderCodeAuto; import com.glxp.api.entity.collect.IoCollectOrderCodeAuto;
import com.glxp.api.entity.inout.IoSplitCodeEntity; import com.glxp.api.entity.inout.IoSplitCodeEntity;
import com.glxp.api.entity.inout.IoSplitFifoCodeEntity; 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.req.inout.IoSplitCodeRequest;
import com.glxp.api.service.basic.BasicSkPrescribeDiService; import com.glxp.api.service.basic.BasicSkPrescribeDiService;
import com.glxp.api.service.basic.BasicSkPrescribeService; import com.glxp.api.service.basic.BasicSkPrescribeService;
@ -271,6 +272,8 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
} }
} }
@Resource
IoSplitFifoInvService splitFifoInvService;
/** /**
* *
@ -298,11 +301,20 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
count = IntUtil.value(splitFifoCodeEntity.getScanCount()) + count; count = IntUtil.value(splitFifoCodeEntity.getScanCount()) + count;
splitCodeEntity.setRemainCount(splitCodeEntity.getScanCount()); splitCodeEntity.setRemainCount(splitCodeEntity.getScanCount());
} }
splitCodeEntity.setStatus(1); splitCodeEntity.setStatus(1);
splitCodeEntity.setFifoSplit(splitFifoCodeEntity.getFifoSplit()); splitCodeEntity.setFifoSplit(splitFifoCodeEntity.getFifoSplit());
splitCodeEntity.setId(null); splitCodeEntity.setId(null);
addSplitCodeEntities.add(splitCodeEntity); addSplitCodeEntities.add(splitCodeEntity);
removeIds.add(splitFifoCodeEntity.getId()); 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) { if (count >= needCount) {
break; break;
} }

@ -12,6 +12,7 @@ import com.glxp.api.dao.inout.IoSplitFifoCodeMapper;
import com.glxp.api.dao.inout.IoSplitFifoInvMapper; import com.glxp.api.dao.inout.IoSplitFifoInvMapper;
import com.glxp.api.entity.auth.SysWorkplace; import com.glxp.api.entity.auth.SysWorkplace;
import com.glxp.api.entity.basic.UdiRelevanceEntity; 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.IoSplitFifoCodeEntity;
import com.glxp.api.entity.inout.IoSplitFifoInv; import com.glxp.api.entity.inout.IoSplitFifoInv;
import com.glxp.api.exception.JsonException; 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.IoSplitCodeResponse;
import com.glxp.api.res.inout.IoSplitInvResponse; import com.glxp.api.res.inout.IoSplitInvResponse;
import com.glxp.api.service.auth.SysWorkplaceService; import com.glxp.api.service.auth.SysWorkplaceService;
import com.glxp.api.util.IntUtil;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -111,16 +113,16 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
} }
ioSplitInvResponses.forEach(item -> { ioSplitInvResponses.forEach(item -> {
Boolean enableRemind = item.getEnableRemind(); Boolean enableRemind = item.getEnableRemind();
if (enableRemind){ if (enableRemind) {
Integer reCount = item.getReCount(); Integer reCount = item.getReCount();
Integer invRemindCount = item.getInvRemindCount(); Integer invRemindCount = item.getInvRemindCount();
if (reCount < invRemindCount) { if (reCount < invRemindCount) {
String cpmctymc = item.getCpmctymc(); String cpmctymc = item.getCpmctymc();
String batchNo = item.getBatchNo(); String batchNo = item.getBatchNo();
if (StrUtil.isBlank(batchNo)) { if (StrUtil.isBlank(batchNo)) {
msg[0] = msg[0] + cpmctymc + "存量为:" + reCount+";"; msg[0] = msg[0] + cpmctymc + "存量为:" + reCount + ";";
} else { } else {
msg[0] = msg[0] + cpmctymc + "[" + batchNo + "]存量为:" + reCount+";"; msg[0] = msg[0] + cpmctymc + "[" + batchNo + "]存量为:" + reCount + ";";
} }
} }
} }
@ -159,8 +161,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
} }
/** /**
* *
* lockType 1 2 * lockType 1 2
@ -168,7 +168,7 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
* 2 false * 2 false
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean lockInventoryByOrder(String billNo,Integer lockType){ public boolean lockInventoryByOrder(String billNo, Integer lockType) {
if (StrUtil.isEmpty(billNo)) throw new JsonException("单据号不可以为空!"); if (StrUtil.isEmpty(billNo)) throw new JsonException("单据号不可以为空!");
@ -180,9 +180,9 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
IoCollectOrderResponse order = orderList.get(0); IoCollectOrderResponse order = orderList.get(0);
Integer invAlert1 = order.getInvAlert(); Integer invAlert1 = order.getInvAlert();
if (lockType == 1){ if (lockType == 1) {
if (invAlert1 == 1) throw new JsonException("该单据已锁定库存过请勿重复锁定!"); if (invAlert1 == 1) throw new JsonException("该单据已锁定库存过请勿重复锁定!");
}else if (lockType == 2){ } else if (lockType == 2) {
if (invAlert1 != 1) throw new JsonException("该单据未正常锁定库存过不可进行解锁库存操作!"); if (invAlert1 != 1) throw new JsonException("该单据未正常锁定库存过不可进行解锁库存操作!");
} }
@ -201,16 +201,16 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
Map<Long, List<IoSplitInvResponse>> splitInvMap = ioSplitInvResponses.stream().collect(Collectors.groupingBy(IoSplitInvResponse::getRelId)); Map<Long, List<IoSplitInvResponse>> splitInvMap = ioSplitInvResponses.stream().collect(Collectors.groupingBy(IoSplitInvResponse::getRelId));
if (CollUtil.isNotEmpty(bizList)) { if (CollUtil.isNotEmpty(bizList)) {
if (lockType == 1){ if (lockType == 1) {
//自动分配 工位存量、更新splitMap、更新 bizList上的 缺少存量数 //自动分配 工位存量、更新splitMap、更新 bizList上的 缺少存量数
Integer invAlert = autoAllocationBillNoInv(splitInvMap, bizList); Integer invAlert = autoAllocationBillNoInv(splitInvMap, bizList);
collectOrderMapper.updateInvAlert(order.getId(), invAlert); collectOrderMapper.updateInvAlert(order.getId(), invAlert);
if (invAlert == 2){ if (invAlert == 2) {
return false; return false;
}else { } else {
return true; return true;
} }
}else if (lockType == 2){ } else if (lockType == 2) {
unAutoAllocationBillNoInv(splitInvMap, bizList); unAutoAllocationBillNoInv(splitInvMap, bizList);
collectOrderMapper.updateInvAlert(order.getId(), 3); collectOrderMapper.updateInvAlert(order.getId(), 3);
} }
@ -219,7 +219,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
return true; return true;
} }
// /** // /**
// * 预分配库存 // * 预分配库存
// */ // */
@ -306,7 +305,6 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
// return invAlert; // return invAlert;
// } // }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
Integer autoAllocationBillNoInv(Map<Long, List<IoSplitInvResponse>> splitMap, List<CollectOrderBizResponse> bizList) { Integer autoAllocationBillNoInv(Map<Long, List<IoSplitInvResponse>> splitMap, List<CollectOrderBizResponse> bizList) {
Integer invAlert = 1; Integer invAlert = 1;
@ -316,27 +314,33 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
CollectOrderBizResponse collectOrderBizResponse = bizList.get(i); CollectOrderBizResponse collectOrderBizResponse = bizList.get(i);
Long relId = collectOrderBizResponse.getRelId(); Long relId = collectOrderBizResponse.getRelId();
String batchNo = collectOrderBizResponse.getBatchNo(); 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(); Long bizId = collectOrderBizResponse.getId();
List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId); List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId);
List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size()); List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size());
if (CollUtil.isNotEmpty(newioSplitCodeResponses)) { if (CollUtil.isNotEmpty(ioSplitInvResponses)) {
for (int j = 0; j < newioSplitCodeResponses.size(); j++) { for (int j = 0; j < ioSplitInvResponses.size(); j++) {
IoSplitInvResponse ioSplit = newioSplitCodeResponses.get(j); IoSplitInvResponse ioSplit = ioSplitInvResponses.get(j);
Integer reCount = ioSplit.getReCount(); Integer reCount = ioSplit.getReCount();
Integer lockCount = ioSplit.getLockCount(); Integer lockCount = ioSplit.getLockCount();
Integer totalCount = reCount-lockCount;//剩余可分配数量 Integer totalCount = reCount - lockCount;//剩余可分配数量
if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0 && totalCount > 0) { if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0 && totalCount > 0) {
Integer resCount = totalCount - count;//预分配后剩余 工位存量 Integer resCount = totalCount - count;//预分配后剩余 工位存量
if (resCount >= 0) {//足够分配 if (resCount >= 0) {//足够分配
count = 0; ioSplit.setLockCount(lockCount + count);
ioSplit.setLockCount( lockCount + count );
IoSplitFifoInv bean = new IoSplitFifoInv(); IoSplitFifoInv bean = new IoSplitFifoInv();
BeanUtils.copyProperties(ioSplit,bean); ioSplit.setAvailableCount(ioSplit.getInCount() - ioSplit.getOutCount() - ioSplit.getLockCount());
BeanUtils.copyProperties(ioSplit, bean);
updateIoSplitFifoInv.add(bean); updateIoSplitFifoInv.add(bean);
count = 0;
} else {//不够分配 } else {//不够分配
count = -resCount; count = -resCount;
} }
@ -353,11 +357,9 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
collectOrderBizMapper.updateAutoResCount(bizId, collectOrderBizResponse.getCount()); collectOrderBizMapper.updateAutoResCount(bizId, collectOrderBizResponse.getCount());
} }
} }
if (CollUtil.isNotEmpty(updateIoSplitFifoInv)) {
if (CollUtil.isNotEmpty(updateIoSplitFifoInv)){
splitFifoInvService.updateBatchById(updateIoSplitFifoInv); splitFifoInvService.updateBatchById(updateIoSplitFifoInv);
} }
return invAlert; return invAlert;
} }
@ -375,17 +377,18 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId); List<IoSplitInvResponse> ioSplitInvResponses = splitMap.get(relId);
List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size()); List<IoSplitInvResponse> newioSplitCodeResponses = new ArrayList<>(ioSplitInvResponses.size());
if (CollUtil.isNotEmpty(newioSplitCodeResponses)) { if (CollUtil.isNotEmpty(ioSplitInvResponses)) {
for (int j = 0; j < newioSplitCodeResponses.size(); j++) { for (int j = 0; j < ioSplitInvResponses.size(); j++) {
IoSplitInvResponse ioSplit = newioSplitCodeResponses.get(j); IoSplitInvResponse ioSplit = ioSplitInvResponses.get(j);
Integer lockCount = ioSplit.getLockCount(); Integer lockCount = ioSplit.getLockCount();
if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0 ) { if ((StrUtil.isBlank(batchNo) || batchNo.equals(ioSplit.getBatchNo())) && count > 0) {
ioSplit.setLockCount( lockCount - count ); ioSplit.setLockCount(lockCount - count);
IoSplitFifoInv bean = new IoSplitFifoInv(); ioSplit.setAvailableCount(ioSplit.getInCount() - ioSplit.getOutCount() - ioSplit.getLockCount());
BeanUtils.copyProperties(ioSplit,bean); IoSplitFifoInv bean = new IoSplitFifoInv();
updateIoSplitFifoInv.add(bean); BeanUtils.copyProperties(ioSplit, bean);
} updateIoSplitFifoInv.add(bean);
}
newioSplitCodeResponses.add(ioSplit); newioSplitCodeResponses.add(ioSplit);
} }
splitMap.put(relId, newioSplitCodeResponses); splitMap.put(relId, newioSplitCodeResponses);
@ -394,9 +397,29 @@ public class IoSplitFifoCodeService extends ServiceImpl<IoSplitFifoCodeMapper, I
collectOrderBizMapper.updateAutoResCount(bizId, 0); collectOrderBizMapper.updateAutoResCount(bizId, 0);
} }
if (CollUtil.isNotEmpty(updateIoSplitFifoInv)){ if (CollUtil.isNotEmpty(updateIoSplitFifoInv)) {
splitFifoInvService.updateBatchById(updateIoSplitFifoInv); splitFifoInvService.updateBatchById(updateIoSplitFifoInv);
} }
} }
/**
*
*
* @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);
}
}
}
} }

@ -121,6 +121,14 @@ public class IoSplitFifoInvService extends ServiceImpl<IoSplitFifoInvMapper, IoS
} }
splitFifoCodeService.removeBatchByIds(splitCodeEntities); splitFifoCodeService.removeBatchByIds(splitCodeEntities);
for (IoSplitFifoCodeEntity ioSplitFifoCodeEntity : splitCodeEntities) {
IoSplitFifoInv splitFifoInv = findByFifoCode(ioSplitFifoCodeEntity);
if (splitFifoInv != null) {
splitFifoInv.setOutCount(IntUtil.value(splitFifoInv.getOutCount()) + IntUtil.value(ioSplitFifoCodeEntity.getTotalCount()));
splitFifoInv.setReCount(IntUtil.value(splitFifoInv.getInCount() - IntUtil.value(splitFifoInv.getOutCount())));
}
}
//todo 根据工位产品ID批次号供应商 进行库存表进行移除 //todo 根据工位产品ID批次号供应商 进行库存表进行移除
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
@ -129,9 +137,20 @@ public class IoSplitFifoInvService extends ServiceImpl<IoSplitFifoInvMapper, IoS
} }
public IoSplitFifoInv findByFifoCode(IoSplitFifoCodeEntity ioSplitFifoCodeEntity) {
IoSplitFifoInv splitFifoInv = getOne(new LambdaQueryWrapper<IoSplitFifoInv>()
.eq(IoSplitFifoInv::getRelId, ioSplitFifoCodeEntity.getRelId())
.eq(IoSplitFifoInv::getWorkPlaceCode, ioSplitFifoCodeEntity.getWorkPlaceCode())
.eq(StrUtil.isNotEmpty(ioSplitFifoCodeEntity.getBatchNo()), IoSplitFifoInv::getBatchNo, ioSplitFifoCodeEntity.getBatchNo())
.eq(ioSplitFifoCodeEntity.getSupId() != null, IoSplitFifoInv::getSupId, ioSplitFifoCodeEntity.getSupId()).last("limit 1"));
return splitFifoInv;
}
/** /**
* *
* 1:2:3: * 1:2:3:
*
* @param ioSplitFifoInvRequest * @param ioSplitFifoInvRequest
* @return * @return
*/ */
@ -144,39 +163,40 @@ public class IoSplitFifoInvService extends ServiceImpl<IoSplitFifoInvMapper, IoS
PageHelper.offsetPage(offset, ioSplitFifoInvRequest.getLimit()); PageHelper.offsetPage(offset, ioSplitFifoInvRequest.getLimit());
} }
List<IoSplitInvResponse> ioSplitInvResponses = this.baseMapper.filterList(ioSplitFifoInvRequest); List<IoSplitInvResponse> ioSplitInvResponses = this.baseMapper.filterList(ioSplitFifoInvRequest);
if(CollUtil.isNotEmpty(ioSplitInvResponses)){ if (CollUtil.isNotEmpty(ioSplitInvResponses)) {
ioSplitInvResponses.forEach( t ->{ ioSplitInvResponses.forEach(t -> {
if(t.getEnableRemind()){ if (t.getEnableRemind()) {
int count = t.getReCount() - t.getInvRemindCount(); int count = t.getReCount() - t.getInvRemindCount();
if(count >= 0){ if (count >= 0) {
t.setRemindState(1); t.setRemindState(1);
}else{ } else {
t.setRemindState(2); t.setRemindState(2);
} }
}else { } else {
t.setRemindState(1); t.setRemindState(1);
} }
}); });
return ioSplitInvResponses; return ioSplitInvResponses;
}else{ } else {
return Collections.emptyList(); return Collections.emptyList();
} }
} }
/** /**
* *
*
* @param ioSplitFifoInvRequest * @param ioSplitFifoInvRequest
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void remindSet(IoSplitFifoInvRequest ioSplitFifoInvRequest) { public void remindSet(IoSplitFifoInvRequest ioSplitFifoInvRequest) {
Assert.notNull(ioSplitFifoInvRequest.getId(),"Id不能为空"); Assert.notNull(ioSplitFifoInvRequest.getId(), "Id不能为空");
IoSplitFifoInv old = this.getById(ioSplitFifoInvRequest.getId()); IoSplitFifoInv old = this.getById(ioSplitFifoInvRequest.getId());
Assert.notNull(old,"不存在该库存预警设置"); Assert.notNull(old, "不存在该库存预警设置");
this.lambdaUpdate() this.lambdaUpdate()
.set(ioSplitFifoInvRequest.getEnableRemind() != null,IoSplitFifoInv::getEnableRemind,ioSplitFifoInvRequest.getEnableRemind()?1:0) .set(ioSplitFifoInvRequest.getEnableRemind() != null, IoSplitFifoInv::getEnableRemind, ioSplitFifoInvRequest.getEnableRemind() ? 1 : 0)
.set(ioSplitFifoInvRequest.getInvRemindCount() != null,IoSplitFifoInv::getInvRemindCount,ioSplitFifoInvRequest.getInvRemindCount()) .set(ioSplitFifoInvRequest.getInvRemindCount() != null, IoSplitFifoInv::getInvRemindCount, ioSplitFifoInvRequest.getInvRemindCount())
.set(IoSplitFifoInv::getUpdateTime,new Date()) .set(IoSplitFifoInv::getUpdateTime, new Date())
.eq(IoSplitFifoInv::getId,ioSplitFifoInvRequest.getId()) .eq(IoSplitFifoInv::getId, ioSplitFifoInvRequest.getId())
.update(); .update();
} }

@ -3,9 +3,9 @@
<mapper namespace="com.glxp.api.dao.basic.SysWorkplaceDocumentDao"> <mapper namespace="com.glxp.api.dao.basic.SysWorkplaceDocumentDao">
<select id="filterList" resultType="com.glxp.api.res.basic.SysWorkplaceDocumentResponse"> <select id="filterList" resultType="com.glxp.api.res.basic.SysWorkplaceDocumentResponse">
select sys_workplace_document.*, select sys_workplace_document.*,
aw.name invName, aw.name invName,
basic_bussiness_type.name innerBusName, basic_bussiness_type.name innerBusName,
thr_bustype_origin.name outBusName thr_bustype_origin.name outBusName
from sys_workplace_document from sys_workplace_document
left join auth_warehouse aw on aw.code = sys_workplace_document.invCode left join auth_warehouse aw on aw.code = sys_workplace_document.invCode
left join basic_bussiness_type on sys_workplace_document.documentTypeCode = basic_bussiness_type.action left join basic_bussiness_type on sys_workplace_document.documentTypeCode = basic_bussiness_type.action

Loading…
Cancel
Save