增加查询等待入库或出库的单据接口
This commit is contained in:
@@ -573,4 +573,39 @@ public class DepotHeadController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询等待入库或出库的单据
|
||||||
|
* @param search
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/waitBillList")
|
||||||
|
@ApiOperation(value = "查询等待入库或出库的单据")
|
||||||
|
public String waitBillList(@RequestParam(value = Constants.SEARCH, required = false) String search,
|
||||||
|
@RequestParam("currentPage") Integer currentPage,
|
||||||
|
@RequestParam("pageSize") Integer pageSize,
|
||||||
|
HttpServletRequest request)throws Exception {
|
||||||
|
Map<String, Object> objectMap = new HashMap<>();
|
||||||
|
String number = StringUtil.getInfo(search, "number");
|
||||||
|
String materialParam = StringUtil.getInfo(search, "materialParam");
|
||||||
|
String type = StringUtil.getInfo(search, "type");
|
||||||
|
String subType = StringUtil.getInfo(search, "subType");
|
||||||
|
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||||
|
String endTime = StringUtil.getInfo(search, "endTime");
|
||||||
|
String status = StringUtil.getInfo(search, "status");
|
||||||
|
List<DepotHeadVo4List> list = depotHeadService.waitBillList(number, materialParam, type, subType, beginTime, endTime,
|
||||||
|
status, (currentPage-1)*pageSize, pageSize);
|
||||||
|
long total = depotHeadService.waitBillCount(number, materialParam, type, subType, beginTime, endTime, status);
|
||||||
|
if (list != null) {
|
||||||
|
objectMap.put("rows", list);
|
||||||
|
objectMap.put("total", total);
|
||||||
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||||
|
} else {
|
||||||
|
objectMap.put("rows", new ArrayList<>());
|
||||||
|
objectMap.put("total", 0);
|
||||||
|
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,4 +243,28 @@ public interface DepotHeadMapperEx {
|
|||||||
|
|
||||||
int getSerialNumberBySell(
|
int getSerialNumberBySell(
|
||||||
@Param("number") String number);
|
@Param("number") String number);
|
||||||
|
|
||||||
|
List<DepotHeadVo4List> waitBillList(
|
||||||
|
@Param("type") String type,
|
||||||
|
@Param("subTypeArray") String[] subTypeArray,
|
||||||
|
@Param("creatorArray") String[] creatorArray,
|
||||||
|
@Param("statusArray") String[] statusArray,
|
||||||
|
@Param("number") String number,
|
||||||
|
@Param("beginTime") String beginTime,
|
||||||
|
@Param("endTime") String endTime,
|
||||||
|
@Param("materialParam") String materialParam,
|
||||||
|
@Param("depotArray") String[] depotArray,
|
||||||
|
@Param("offset") Integer offset,
|
||||||
|
@Param("rows") Integer rows);
|
||||||
|
|
||||||
|
Long waitBillCount(
|
||||||
|
@Param("type") String type,
|
||||||
|
@Param("subTypeArray") String[] subTypeArray,
|
||||||
|
@Param("creatorArray") String[] creatorArray,
|
||||||
|
@Param("statusArray") String[] statusArray,
|
||||||
|
@Param("number") String number,
|
||||||
|
@Param("beginTime") String beginTime,
|
||||||
|
@Param("endTime") String endTime,
|
||||||
|
@Param("materialParam") String materialParam,
|
||||||
|
@Param("depotArray") String[] depotArray);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1484,4 +1484,70 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DepotHeadVo4List> waitBillList(String number, String materialParam, String type, String subType,
|
||||||
|
String beginTime, String endTime, String status, int offset, int rows) {
|
||||||
|
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||||
|
try{
|
||||||
|
String [] depotArray = getDepotArray("其它");
|
||||||
|
String [] creatorArray = getCreatorArray();
|
||||||
|
String [] subTypeArray = StringUtil.isNotEmpty(subType) ? subType.split(",") : null;
|
||||||
|
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||||
|
Map<Long,String> accountMap = accountService.getAccountMap();
|
||||||
|
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||||
|
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||||
|
List<DepotHeadVo4List> list = depotHeadMapperEx.waitBillList(type, subTypeArray, creatorArray, statusArray, number, beginTime, endTime,
|
||||||
|
materialParam, depotArray, offset, rows);
|
||||||
|
if (null != list) {
|
||||||
|
List<Long> idList = new ArrayList<>();
|
||||||
|
List<String> numberList = new ArrayList<>();
|
||||||
|
for (DepotHeadVo4List dh : list) {
|
||||||
|
idList.add(dh.getId());
|
||||||
|
numberList.add(dh.getNumber());
|
||||||
|
}
|
||||||
|
//通过批量查询去构造map
|
||||||
|
Map<Long,String> materialsListMap = findMaterialsListMapByHeaderIdList(idList);
|
||||||
|
Map<Long,BigDecimal> materialCountListMap = getMaterialCountListMapByHeaderIdList(idList);
|
||||||
|
for (DepotHeadVo4List dh : list) {
|
||||||
|
if(accountMap!=null && StringUtil.isNotEmpty(dh.getAccountIdList()) && StringUtil.isNotEmpty(dh.getAccountMoneyList())) {
|
||||||
|
String accountStr = accountService.getAccountStrByIdAndMoney(accountMap, dh.getAccountIdList(), dh.getAccountMoneyList());
|
||||||
|
dh.setAccountName(accountStr);
|
||||||
|
}
|
||||||
|
if(dh.getOperTime() != null) {
|
||||||
|
dh.setOperTimeStr(getCenternTime(dh.getOperTime()));
|
||||||
|
}
|
||||||
|
//商品信息简述
|
||||||
|
if(materialsListMap!=null) {
|
||||||
|
dh.setMaterialsList(materialsListMap.get(dh.getId()));
|
||||||
|
}
|
||||||
|
//商品总数量
|
||||||
|
if(materialCountListMap!=null) {
|
||||||
|
dh.setMaterialCount(materialCountListMap.get(dh.getId()));
|
||||||
|
}
|
||||||
|
resList.add(dh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.readFail(logger, e);
|
||||||
|
}
|
||||||
|
return resList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long waitBillCount(String number, String materialParam, String type, String subType,
|
||||||
|
String beginTime, String endTime, String status) {
|
||||||
|
Long result=null;
|
||||||
|
try{
|
||||||
|
String [] depotArray = getDepotArray("其它");
|
||||||
|
String [] creatorArray = getCreatorArray();
|
||||||
|
String [] subTypeArray = StringUtil.isNotEmpty(subType) ? subType.split(",") : null;
|
||||||
|
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
|
||||||
|
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||||
|
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||||
|
result=depotHeadMapperEx.waitBillCount(type, subTypeArray, creatorArray, statusArray, number, beginTime, endTime,
|
||||||
|
materialParam, depotArray);
|
||||||
|
}catch(Exception e){
|
||||||
|
JshException.readFail(logger, e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1097,4 +1097,130 @@
|
|||||||
where dh.number = #{number}
|
where dh.number = #{number}
|
||||||
and (s.out_bill_no is not null or s.out_bill_no!='')
|
and (s.out_bill_no is not null or s.out_bill_no!='')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="waitBillList" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||||
|
select jdh.*, s.supplier OrganName, u.username userName, a.name AccountName
|
||||||
|
from (select dh.id
|
||||||
|
from jsh_depot_head dh
|
||||||
|
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
|
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
||||||
|
left join jsh_material_extend me on di.material_extend_id = me.id and ifnull(me.delete_flag,'0') !='1'
|
||||||
|
where 1=1
|
||||||
|
<if test="type != null">
|
||||||
|
and dh.type=#{type}
|
||||||
|
</if>
|
||||||
|
<if test="subTypeArray != null and subTypeArray !=''">
|
||||||
|
and dh.sub_type in (
|
||||||
|
<foreach collection="subTypeArray" item="subType" separator=",">
|
||||||
|
#{subType}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="statusArray != null and statusArray !=''">
|
||||||
|
and dh.status in (
|
||||||
|
<foreach collection="statusArray" item="status" separator=",">
|
||||||
|
#{status}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="number != null">
|
||||||
|
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||||
|
and dh.number like #{bindNumber}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
and dh.oper_time >= #{beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
and dh.oper_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="materialParam != null and materialParam !=''">
|
||||||
|
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||||
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like
|
||||||
|
#{bindKey}
|
||||||
|
or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.other_field1 like #{bindKey}
|
||||||
|
or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
|
||||||
|
</if>
|
||||||
|
<if test="depotArray != null and depotArray !=''">
|
||||||
|
and di.depot_id in (
|
||||||
|
<foreach collection="depotArray" item="depotId" separator=",">
|
||||||
|
#{depotId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="creatorArray != null">
|
||||||
|
and dh.creator in (
|
||||||
|
<foreach collection="creatorArray" item="creator" separator=",">
|
||||||
|
#{creator}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
and ifnull(dh.delete_flag,'0') !='1'
|
||||||
|
group by dh.id
|
||||||
|
order by dh.id desc
|
||||||
|
<if test="offset != null and rows != null">
|
||||||
|
limit #{offset},#{rows}
|
||||||
|
</if>) tb
|
||||||
|
left join jsh_depot_head jdh on jdh.id=tb.id and ifnull(jdh.delete_flag,'0') !='1'
|
||||||
|
left join jsh_supplier s on jdh.organ_id=s.id and ifnull(s.delete_flag,'0') !='1'
|
||||||
|
left join jsh_user u on jdh.creator=u.id and ifnull(u.Status,'0') !='1'
|
||||||
|
left join jsh_account a on jdh.account_id=a.id and ifnull(a.delete_flag,'0') !='1'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="waitBillCount" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
count(1) from
|
||||||
|
(select distinct dh.id from jsh_depot_head dh
|
||||||
|
left join jsh_depot_item di on dh.Id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
|
left join jsh_material m on di.material_id = m.Id and ifnull(m.delete_Flag,'0') !='1'
|
||||||
|
left join jsh_material_extend me on di.material_extend_id = me.id and ifnull(me.delete_flag,'0') !='1'
|
||||||
|
WHERE 1=1
|
||||||
|
<if test="type != null">
|
||||||
|
and dh.type=#{type}
|
||||||
|
</if>
|
||||||
|
<if test="subTypeArray != null and subTypeArray !=''">
|
||||||
|
and dh.sub_type in (
|
||||||
|
<foreach collection="subTypeArray" item="subType" separator=",">
|
||||||
|
#{subType}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="statusArray != null and statusArray !=''">
|
||||||
|
and dh.status in (
|
||||||
|
<foreach collection="statusArray" item="status" separator=",">
|
||||||
|
#{status}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="number != null">
|
||||||
|
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||||
|
and dh.number like #{bindNumber}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
and dh.oper_time >= #{beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
and dh.oper_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="materialParam != null and materialParam !=''">
|
||||||
|
<bind name="bindKey" value="'%'+materialParam+'%'"/>
|
||||||
|
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey}
|
||||||
|
or m.color like #{bindKey} or m.mfrs like #{bindKey} or m.other_field1 like #{bindKey}
|
||||||
|
or m.other_field2 like #{bindKey} or m.other_field3 like #{bindKey})
|
||||||
|
</if>
|
||||||
|
<if test="depotArray != null and depotArray !=''">
|
||||||
|
and di.depot_id in (
|
||||||
|
<foreach collection="depotArray" item="depotId" separator=",">
|
||||||
|
#{depotId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="creatorArray != null">
|
||||||
|
and dh.creator in (
|
||||||
|
<foreach collection="creatorArray" item="creator" separator=",">
|
||||||
|
#{creator}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
and ifnull(dh.delete_Flag,'0') !='1') tb
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user