增加查询等待入库或出库的单据接口
This commit is contained in:
@@ -573,4 +573,39 @@ public class DepotHeadController {
|
||||
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(
|
||||
@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 "";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user