增加修复库存的接口
This commit is contained in:
parent
4b23754c4f
commit
0e5374e1d4
@ -547,6 +547,7 @@ public class MaterialController {
|
||||
@RequestParam("depotId") Long depotId,
|
||||
@RequestParam("categoryId") Long categoryId,
|
||||
@RequestParam("materialParam") String materialParam,
|
||||
@RequestParam("zeroStock") Integer zeroStock,
|
||||
@RequestParam("mpList") String mpList,
|
||||
@RequestParam("column") String column,
|
||||
@RequestParam("order") String order,
|
||||
@ -558,9 +559,9 @@ public class MaterialController {
|
||||
if(categoryId != null){
|
||||
idList = materialService.getListByParentId(categoryId);
|
||||
}
|
||||
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotId, idList, StringUtil.toNull(materialParam),
|
||||
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotId, idList, StringUtil.toNull(materialParam), zeroStock,
|
||||
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
|
||||
int total = materialService.getListWithStockCount(depotId, idList, StringUtil.toNull(materialParam));
|
||||
int total = materialService.getListWithStockCount(depotId, idList, StringUtil.toNull(materialParam), zeroStock);
|
||||
MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotId, idList, StringUtil.toNull(materialParam));
|
||||
map.put("total", total);
|
||||
map.put("currentStock", materialVo4Unit.getCurrentStock());
|
||||
@ -576,4 +577,24 @@ public class MaterialController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置商品当前的实时库存(按每个仓库)
|
||||
* @param jsonObject
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/batchSetMaterialCurrentStock")
|
||||
public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
|
||||
HttpServletRequest request)throws Exception {
|
||||
String ids = jsonObject.getString("ids");
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
int res = materialService.batchSetMaterialCurrentStock(ids);
|
||||
if(res > 0) {
|
||||
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||
} else {
|
||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ public interface MaterialMapperEx {
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("idList") List<Long> idList,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("zeroStock") Integer zeroStock,
|
||||
@Param("column") String column,
|
||||
@Param("order") String order,
|
||||
@Param("offset") Integer offset,
|
||||
@ -100,7 +101,8 @@ public interface MaterialMapperEx {
|
||||
int getListWithStockCount(
|
||||
@Param("depotId") Long depotId,
|
||||
@Param("idList") List<Long> idList,
|
||||
@Param("materialParam") String materialParam);
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("zeroStock") Integer zeroStock);
|
||||
|
||||
MaterialVo4Unit getTotalStockAndPrice(
|
||||
@Param("depotId") Long depotId,
|
||||
|
||||
@ -818,16 +818,30 @@ public class MaterialService {
|
||||
return materialMapperEx.getMaterialByBarCode(barCodeArray);
|
||||
}
|
||||
|
||||
public List<MaterialVo4Unit> getListWithStock(Long depotId, List<Long> idList, String materialParam,
|
||||
public List<MaterialVo4Unit> getListWithStock(Long depotId, List<Long> idList, String materialParam, Integer zeroStock,
|
||||
String column, String order, Integer offset, Integer rows) {
|
||||
return materialMapperEx.getListWithStock(depotId, idList, materialParam, column, order, offset, rows);
|
||||
return materialMapperEx.getListWithStock(depotId, idList, materialParam, zeroStock, column, order, offset, rows);
|
||||
}
|
||||
|
||||
public int getListWithStockCount(Long depotId, List<Long> idList, String materialParam) {
|
||||
return materialMapperEx.getListWithStockCount(depotId, idList, materialParam);
|
||||
public int getListWithStockCount(Long depotId, List<Long> idList, String materialParam, Integer zeroStock) {
|
||||
return materialMapperEx.getListWithStockCount(depotId, idList, materialParam, zeroStock);
|
||||
}
|
||||
|
||||
public MaterialVo4Unit getTotalStockAndPrice(Long depotId, List<Long> idList, String materialParam) {
|
||||
return materialMapperEx.getTotalStockAndPrice(depotId, idList, materialParam);
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchSetMaterialCurrentStock(String ids) throws Exception {
|
||||
int res = 0;
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
List<Depot> depotList = depotService.getAllList();
|
||||
for(Long mId: idList) {
|
||||
for(Depot depot: depotList) {
|
||||
depotItemService.updateCurrentStockFun(mId, depot.getId());
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,6 +367,9 @@
|
||||
</if>
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
group by m.id
|
||||
<if test="zeroStock == 0">
|
||||
having currentStock!=0
|
||||
</if>
|
||||
<if test="column == 'createTime'">
|
||||
order by m.id desc
|
||||
</if>
|
||||
@ -380,7 +383,7 @@
|
||||
|
||||
<select id="getListWithStockCount" resultType="java.lang.Integer">
|
||||
select count(tb.id) from
|
||||
(select m.id from jsh_material m
|
||||
(select m.id, ifnull(sum(mcs.current_number),0) currentStock from jsh_material m
|
||||
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
|
||||
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
@ -401,7 +404,11 @@
|
||||
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})
|
||||
</if>
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
group by m.id) tb
|
||||
group by m.id
|
||||
<if test="zeroStock == 0">
|
||||
having currentStock!=0
|
||||
</if>
|
||||
) tb
|
||||
</select>
|
||||
|
||||
<select id="getTotalStockAndPrice" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user