5号库改造

This commit is contained in:
hayu 2026-01-09 10:06:19 +08:00
parent 7790c6479d
commit 5b3b82a292
1 changed files with 6 additions and 0 deletions

View File

@ -238,6 +238,7 @@ public class TypeServiceImpl implements ITypeService {
// 获取锁公平锁会按线程等待请求顺序分配锁
lock.lock();
try {
Long deptId = getUserDeptId();
int result = 0;
// 根据typeId查询物资名称和规格型号
Type info = typeMapper.selectTypeByTypeId(type.getTypeId());
@ -267,6 +268,7 @@ public class TypeServiceImpl implements ITypeService {
result = typeMapper.updateMaTypeStockNum(type);
if (result > 0) {
type.setStorageNum(type.getPreStoreNum().subtract(type.getOutNum()));
type.setCompanyId(deptId);
typeMapper.insertStorageNumLog(type);
} else {
throw new RuntimeException("更新库存失败");
@ -275,6 +277,7 @@ public class TypeServiceImpl implements ITypeService {
result = typeMapper.updateStorageNum(type);
if (result > 0) {
type.setModelTitle("直接修改库存");
type.setCompanyId(deptId);
typeMapper.insertStorageNumLog(type);
} else {
throw new RuntimeException("更新库存失败");
@ -283,6 +286,7 @@ public class TypeServiceImpl implements ITypeService {
result = typeMapper.addStockNum(type);
if (result > 0) {
type.setStorageNum(type.getPreStoreNum().add(type.getInputNum()));
type.setCompanyId(deptId);
typeMapper.insertStorageNumLog(type);
} else {
throw new RuntimeException("更新库存失败");
@ -295,11 +299,13 @@ public class TypeServiceImpl implements ITypeService {
}else{
type.setInputType(1);
}
type.setCompanyId(deptId);
typeMapper.insertBmStorageNumLog(type);
}
} catch (Exception e) {
type.setResultMsg("操作失败");
type.setStatus(1);
type.setCompanyId(deptId);
typeMapper.insertBmStorageNumLog(type);
throw new RuntimeException("更新库存失败");
}