修改查询库存数量的方法
This commit is contained in:
@@ -176,5 +176,5 @@ public interface DepotItemMapperEx {
|
||||
|
||||
int findStockWarningCountTotal( @Param("pid") Integer pid);
|
||||
|
||||
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId")Long materialId,@Param("depotId") Long depotId);
|
||||
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId") Long materialId, @Param("depotId") Long depotId,@Param("tenantId")Long tenantId);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class DepotItemService {
|
||||
@@ -819,8 +820,18 @@ public class DepotItemService {
|
||||
*/
|
||||
public BigDecimal getCurrentRepByMaterialIdAndDepotId(Long materialId,Long depotId) {
|
||||
BigDecimal result = BigDecimal.ZERO;
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
Long tenantId=null;
|
||||
Object tenantIdO = request.getSession().getAttribute("tenantId");
|
||||
if(tenantIdO!=null){
|
||||
//多租户模式,租户id从当前用户获取
|
||||
tenantId=Long.valueOf(tenantId.toString());
|
||||
} else {
|
||||
//无租户模式,租户id为-1
|
||||
tenantId=Long.valueOf(-1);
|
||||
}
|
||||
try{
|
||||
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId);
|
||||
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId,tenantId);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
|
||||
|
||||
@@ -618,6 +618,8 @@
|
||||
jsh_depothead dh,jsh_depotitem di
|
||||
where 1=1
|
||||
and dh.id=di.HeaderId
|
||||
and dh.tenant_id=#{tenantId}
|
||||
and di.tenant_id=#{tenantId}
|
||||
and di.MaterialId=#{materialId}
|
||||
and ifnull(dh.delete_Flag,'0') !='1'
|
||||
and ifnull(di.delete_Flag,'0') !='1') as curep
|
||||
|
||||
Reference in New Issue
Block a user