给商品库存流水接口增加查询字段

This commit is contained in:
季圣华 2023-02-22 22:36:58 +08:00
parent 7b8db0f19f
commit 69c13f64b3
4 changed files with 80 additions and 6 deletions

View File

@ -75,10 +75,21 @@ public class DepotItemController {
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = "depotIds",required = false) String depotIds,
@RequestParam(value = "sku",required = false) String sku,
@RequestParam(value = "batchNumber",required = false) String batchNumber,
@RequestParam(value = "number",required = false) String number,
@RequestParam(value = "beginTime",required = false) String beginTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam("materialId") Long mId,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
List<DepotItemVo4DetailByTypeAndMId> list = depotItemService.findDetailByDepotIdsAndMaterialIdList(depotIds, sku, mId, (currentPage-1)*pageSize, pageSize);
if(StringUtil.isNotEmpty(beginTime)) {
beginTime = beginTime + BusinessConstants.DAY_FIRST_TIME;
}
if(StringUtil.isNotEmpty(endTime)) {
endTime = endTime + BusinessConstants.DAY_LAST_TIME;
}
List<DepotItemVo4DetailByTypeAndMId> list = depotItemService.findDetailByDepotIdsAndMaterialIdList(depotIds, sku,
batchNumber, StringUtil.toNull(number), beginTime, endTime, mId, (currentPage-1)*pageSize, pageSize);
JSONArray dataArray = new JSONArray();
if (list != null) {
for (DepotItemVo4DetailByTypeAndMId d: list) {
@ -105,7 +116,8 @@ public class DepotItemController {
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
objectMap.put("rows", dataArray);
objectMap.put("total", depotItemService.findDetailByDepotIdsAndMaterialIdCount(depotIds, sku, mId));
objectMap.put("total", depotItemService.findDetailByDepotIdsAndMaterialIdCount(depotIds, sku,
batchNumber, StringUtil.toNull(number), beginTime, endTime, mId));
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}

View File

@ -32,6 +32,10 @@ public interface DepotItemMapperEx {
List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(
@Param("depotIdArray") String[] depotIdArray,
@Param("sku") String sku,
@Param("batchNumber") String batchNumber,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("mId") Long mId,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
@ -39,6 +43,10 @@ public interface DepotItemMapperEx {
Long findDetailByDepotIdsAndMaterialIdCount(
@Param("depotIdArray") String[] depotIdArray,
@Param("sku") String sku,
@Param("batchNumber") String batchNumber,
@Param("number") String number,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("mId") Long mId);
List<DepotItemVo4WithInfoEx> getDetailList(

View File

@ -171,28 +171,30 @@ public class DepotItemService {
return list==null?0:list.size();
}
public List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(String depotIds, String sku, Long mId, int offset, int rows)throws Exception {
public List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(String depotIds, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId, int offset, int rows)throws Exception {
String [] depotIdArray = null;
if(StringUtil.isNotEmpty(depotIds)) {
depotIdArray = depotIds.split(",");
}
List<DepotItemVo4DetailByTypeAndMId> list =null;
try{
list = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdList(depotIdArray, sku, mId, offset, rows);
list = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdList(depotIdArray, sku, batchNumber, number, beginTime, endTime, mId, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, String sku, Long mId)throws Exception {
public Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId)throws Exception {
String [] depotIdArray = null;
if(StringUtil.isNotEmpty(depotIds)) {
depotIdArray = depotIds.split(",");
}
Long result =null;
try{
result = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdCount(depotIdArray, sku, mId);
result = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdCount(depotIdArray, sku, batchNumber, number, beginTime, endTime, mId);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@ -170,6 +170,19 @@
<if test="sku != null and sku !=''">
and di.sku = #{sku}
</if>
<if test="batchNumber != null and batchNumber !=''">
and di.batch_number = #{batchNumber}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1'
union all
@ -191,6 +204,19 @@
<if test="sku != null and sku !=''">
and di.sku = #{sku}
</if>
<if test="batchNumber != null and batchNumber !=''">
and di.batch_number = #{batchNumber}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1') tb
order by tb.oTime desc
@ -215,6 +241,19 @@
<if test="sku != null and sku !=''">
and di.sku = #{sku}
</if>
<if test="batchNumber != null and batchNumber !=''">
and di.batch_number = #{batchNumber}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and di.material_id =#{mId}
and ifnull(dh.delete_flag,'0') !='1'
union all
@ -230,6 +269,19 @@
<if test="sku != null and sku !=''">
and di.sku = #{sku}
</if>
<if test="batchNumber != null and batchNumber !=''">
and di.batch_number = #{batchNumber}
</if>
<if test="number != null and number !=''">
<bind name="bindNumber" value="'%'+number+'%'"/>
and dh.number like #{bindNumber}
</if>
<if test="beginTime != null and beginTime !=''">
and dh.oper_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and dh.oper_time &lt;= #{endTime}
</if>
and di.material_id = #{mId}
and ifnull(dh.delete_flag,'0') !='1') tb
</select>