合并商品的库存到商品列表接口一起查询
This commit is contained in:
@@ -290,8 +290,8 @@ public class DepotItemService {
|
||||
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
|
||||
}
|
||||
|
||||
public int findByTypeAndMaterialId(String type, Long mId) throws Exception{
|
||||
int result =0;
|
||||
public Long findByTypeAndMaterialId(String type, Long mId) throws Exception{
|
||||
Long result = 0l;
|
||||
try{
|
||||
if(type.equals(TYPE)) {
|
||||
result= depotItemMapperEx.findByTypeAndMaterialIdIn(mId);
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapper;
|
||||
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depotItem.DepotItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
@@ -38,6 +39,8 @@ public class MaterialService {
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private DepotItemMapperEx depotItemMapperEx;
|
||||
@Resource
|
||||
private DepotItemService depotItemService;
|
||||
|
||||
public Material getMaterial(long id)throws Exception {
|
||||
Material result=null;
|
||||
@@ -105,6 +108,9 @@ public class MaterialService {
|
||||
}
|
||||
}
|
||||
m.setMaterialOther(materialOther);
|
||||
Long InSum = depotItemService.findByTypeAndMaterialId("入库", m.getId());
|
||||
Long OutSum = depotItemService.findByTypeAndMaterialId("出库", m.getId());
|
||||
m.setStock(InSum - OutSum);
|
||||
resList.add(m);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user