解决bug:新的租户如果没有创建仓库,只创建了商品,点击修正库存,报错
This commit is contained in:
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.base.BaseController;
|
import com.jsh.erp.base.BaseController;
|
||||||
import com.jsh.erp.base.TableDataInfo;
|
import com.jsh.erp.base.TableDataInfo;
|
||||||
import com.jsh.erp.datasource.entities.Material;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.MaterialExtend;
|
|
||||||
import com.jsh.erp.datasource.entities.MaterialVo4Unit;
|
|
||||||
import com.jsh.erp.datasource.entities.Unit;
|
|
||||||
import com.jsh.erp.datasource.vo.MaterialDepotStock;
|
import com.jsh.erp.datasource.vo.MaterialDepotStock;
|
||||||
import com.jsh.erp.service.DepotService;
|
import com.jsh.erp.service.DepotService;
|
||||||
import com.jsh.erp.service.DepotItemService;
|
import com.jsh.erp.service.DepotItemService;
|
||||||
@@ -777,7 +774,11 @@ public class MaterialController extends BaseController {
|
|||||||
HttpServletRequest request)throws Exception {
|
HttpServletRequest request)throws Exception {
|
||||||
String ids = jsonObject.getString("ids");
|
String ids = jsonObject.getString("ids");
|
||||||
Map<String, Object> objectMap = new HashMap<>();
|
Map<String, Object> objectMap = new HashMap<>();
|
||||||
int res = materialService.batchSetMaterialCurrentStock(ids);
|
List<Depot> depotList = depotService.getAllList();
|
||||||
|
if(depotList.isEmpty()) {
|
||||||
|
return returnJson(objectMap, "请先创建仓库后再操作", ErpInfo.WARING_MSG.code);
|
||||||
|
}
|
||||||
|
int res = materialService.batchSetMaterialCurrentStock(ids, depotList);
|
||||||
if(res > 0) {
|
if(res > 0) {
|
||||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1430,10 +1430,9 @@ public class MaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchSetMaterialCurrentStock(String ids) throws Exception {
|
public int batchSetMaterialCurrentStock(String ids, List<Depot> depotList) throws Exception {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
List<Long> idList = StringUtil.strToLongList(ids);
|
List<Long> idList = StringUtil.strToLongList(ids);
|
||||||
List<Depot> depotList = depotService.getAllList();
|
|
||||||
for(Long mId: idList) {
|
for(Long mId: idList) {
|
||||||
BigDecimal currentUnitPrice = materialCurrentStockMapperEx.getCurrentUnitPriceByMId(mId);
|
BigDecimal currentUnitPrice = materialCurrentStockMapperEx.getCurrentUnitPriceByMId(mId);
|
||||||
for(Depot depot: depotList) {
|
for(Depot depot: depotList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user