diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index ecc536f4..2706020d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -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("更新库存失败"); }