收发货记录增加查询条件
This commit is contained in:
		
							parent
							
								
									2ba2b59130
								
							
						
					
					
						commit
						5f171c3112
					
				|  | @ -70,9 +70,7 @@ public class ReceiptRecordsController extends BaseController { | |||
|             @ApiParam(required = false, value = "经销商收货结束时间") @RequestParam(required = false) String endTime, | ||||
|             @ApiParam(required = false, value = "经销商出货开始时间") @RequestParam(required = false) String startDate, | ||||
|             @ApiParam(required = false, value = "经销商出货结束时间") @RequestParam(required = false) String endDate, | ||||
|              @ApiParam(required = false, value = "商品编码") @RequestParam(required = false) String goodsNo, | ||||
|             @ApiParam(required = false, value = "商品名称") @RequestParam(required = false) String goodsName, | ||||
|             @ApiParam(required = false, value = "商品规格") @RequestParam(required = false) String specifications, | ||||
|             @ApiParam(required = false, value = "发货单客户id") @RequestParam(required = false) String invoiceClientId, | ||||
|             @ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(value = "page") Integer pageNum, | ||||
|             @ApiParam(required = true, value = "每页条数", defaultValue = "10") @RequestParam(value = "pageSize") Integer pageSize, | ||||
|             HttpServletRequest request) { | ||||
|  | @ -97,6 +95,7 @@ public class ReceiptRecordsController extends BaseController { | |||
|         params.put("endTime", endTime); | ||||
|         params.put("startDate", startDate); | ||||
|         params.put("endDate", endDate); | ||||
|         params.put("invoiceClientId", invoiceClientId); | ||||
|         params.put("page", pageNum); | ||||
|         params.put("pageSize", pageSize); | ||||
|         return toPage(receiptRecordsService.pageList(params, ".findRecordsByCondition")); | ||||
|  |  | |||
|  | @ -106,6 +106,9 @@ | |||
|             <if test="clientName != null and clientName != ''"> | ||||
|                 AND a.client_name LIKE '%' || #{clientName} || '%' | ||||
|             </if> | ||||
|             <if test="invoiceClientId != null and invoiceClientId != ''"> | ||||
|                 AND a.invoice_client_id = #{invoiceClientId} | ||||
|             </if> | ||||
|             <if test="isSent != null and isSent != ''"> | ||||
|                 AND a.is_sent = #{isSent} | ||||
|             </if> | ||||
|  |  | |||
|  | @ -98,152 +98,6 @@ public class ReceiptRecordsService { | |||
|         return dao.count(ReceiptRecordsInfo.class.getName() + id, params); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @description: 统计每个客户的数据 | ||||
|      * @author: lj | ||||
|      * @date: 2024/04/09 | ||||
|      **/ | ||||
|     public List<Map<String, Object>> getCountNums2(String startCode, String endCode, String startTime, String endTime, String goodsNo, List<Map<String, Object>> list) { | ||||
|         List<Map<String, Object>> resultList = new ArrayList<>(); | ||||
|         for (Map<String, Object> objectMap : list) { | ||||
|             String clientId1 = objectMap.get("clientId") + ""; | ||||
|             Map<String, Object> map = new HashMap<>(); | ||||
|             // 应发数量 该经销商发货单的商品的实发数量汇总 | ||||
|             map.put("clientId", clientId1); | ||||
|             map.put("startCode", startCode); | ||||
|             map.put("endCode", endCode); | ||||
|             map.put("startTime", startTime); | ||||
|             map.put("endTime", endTime); | ||||
|             List list2 = this.findGoods(map, ".getMajorNum"); | ||||
|             Map map1 = (Map) list2.get(0); | ||||
|             if (map1 != null) { | ||||
|                 String majorNum = StringUtil.isEmpty(map1.get("majorNum")) ? "0.00" : String.format("%.2f", Double.parseDouble(map1.get("majorNum") + "")); | ||||
|                 objectMap.put("majorNum", majorNum); | ||||
|             } else { | ||||
|                 objectMap.put("majorNum", "0.00"); | ||||
|             } | ||||
| 
 | ||||
|             // 实发数量 仓库扫码条数 | ||||
|             map.clear(); | ||||
|             map.put("clientId", clientId1); | ||||
|             map.put("startCode", startCode); | ||||
|             map.put("endCode", endCode); | ||||
|             map.put("invoiceStartTime", startTime); | ||||
|             map.put("invoiceEndTime", endTime); | ||||
|             map.put("goodsNo", goodsNo); | ||||
|             List<ReceiptRecordsInfo> sfMapList = dao.list(ReceiptRecordsInfo.class.getName() + ".countRecordsByCondition", map); | ||||
| 
 | ||||
|             if(sfMapList.size() == 0){ | ||||
|                 Map itemMap = new HashMap(); | ||||
|                 itemMap.put("clientId",objectMap.get("clientId")); | ||||
|                 itemMap.put("clientName",objectMap.get("clientName")); | ||||
|                 itemMap.put("areaId",objectMap.get("areaId")); | ||||
|                 itemMap.put("uecode",objectMap.get("uecode")); | ||||
|                 itemMap.put("staffName",objectMap.get("staffName")); | ||||
|                 itemMap.put("areaName",objectMap.get("areaName")); | ||||
|                 itemMap.put("majorNum",objectMap.get("majorNum")); | ||||
|                 itemMap.put("goodsNo",""); | ||||
|                 itemMap.put("goodsName",""); | ||||
|                 itemMap.put("specifications",""); | ||||
|                 itemMap.put("invoiceNum","0"); | ||||
|                 itemMap.put("receiveNum","0"); | ||||
|                 itemMap.put("receiveRate","0.00"); | ||||
|                 itemMap.put("deliveryNum","0"); | ||||
|                 itemMap.put("deliveryRate","0.00"); | ||||
|                 resultList.add(itemMap); | ||||
|                 continue; | ||||
|             }else{ | ||||
|                 //合并实发数量 | ||||
|                 for(int i = 0; i < sfMapList.size(); i++){ | ||||
|                     Map itemMap = new HashMap(); | ||||
|                     itemMap.put("clientId",objectMap.get("clientId")); | ||||
|                     itemMap.put("clientName",objectMap.get("clientName")); | ||||
|                     itemMap.put("areaId",objectMap.get("areaId")); | ||||
|                     itemMap.put("uecode",objectMap.get("uecode")); | ||||
|                     itemMap.put("staffName",objectMap.get("staffName")); | ||||
|                     itemMap.put("areaName",objectMap.get("areaName")); | ||||
|                     itemMap.put("majorNum",objectMap.get("majorNum")); | ||||
|                     itemMap.put("goodsNo",sfMapList.get(i).getGoodsNo()); | ||||
|                     itemMap.put("goodsName",sfMapList.get(i).getGoodsName()); | ||||
|                     itemMap.put("specifications",sfMapList.get(i).getSpecifications()); | ||||
|                     itemMap.put("invoiceNum",StringUtil.isNullOrEmpty(sfMapList.get(i).getInvoiceNum())?"0":sfMapList.get(i).getInvoiceNum()); | ||||
|                     resultList.add(itemMap); | ||||
|                 } | ||||
|             } | ||||
| //            Integer invoiceNum = this.countAll(map, ".countRecordsByCondition"); | ||||
|             // receiptRecordsBo.setInvoiceNum(invoiceNum.toString()); | ||||
| //            objectMap.put("invoiceNum", invoiceNum.toString()); | ||||
|             // 入库数量  经销商扫码入库数量汇总 | ||||
|             map.clear(); | ||||
|             map.put("clientId", clientId1); | ||||
|             map.put("startCode", startCode); | ||||
|             map.put("endCode", endCode); | ||||
|             map.put("receiveStartTime", startTime); | ||||
|             map.put("receiveEndTime", endTime); | ||||
|             map.put("timeFlag", "1"); | ||||
|             List<ReceiptRecordsInfo> rkMapList = dao.list(ReceiptRecordsInfo.class.getName() + ".statisticsRecords", map); | ||||
|                 //合并入库数量 | ||||
|                 for(int i = 0; i < rkMapList.size();i++){ | ||||
|                     ReceiptRecordsInfo rkRinfo = rkMapList.get(i); | ||||
| //                resultList.stream().filter(x-> x.get("clientId").equals(item.getClientId()) && x.get("goodsNo").equals(item.getGoodsNo())); | ||||
|                     resultList.forEach(resultMap->{ | ||||
|                         boolean rkgoodsNoFlag = StringUtil.isNullOrEmpty(rkRinfo.getGoodsNo()); | ||||
|                         boolean rsgoodsNoFlag = StringUtil.isNullOrEmpty(resultMap.get("goodsNo")); | ||||
|                         //clientid 和 goodsNo匹配 或者 goodsNo都为空时 | ||||
|                         if((rkRinfo.getClientId().equals(resultMap.get("clientId"))) | ||||
|                                 && ((rkgoodsNoFlag && rsgoodsNoFlag) || ((!rkgoodsNoFlag && !rsgoodsNoFlag && rkRinfo.getGoodsNo().equals(resultMap.get("goodsNo"))))) ){ | ||||
|                             resultMap.put("receiveNum",StringUtil.isNullOrEmpty(rkRinfo.getReceiveNum())?"0":rkRinfo.getReceiveNum()); | ||||
|                             DecimalFormat df = new DecimalFormat("0.00"); | ||||
|                             Integer invoiceNum = Integer.valueOf(resultMap.get("invoiceNum").toString()); | ||||
|                             Integer receiveNum = Integer.valueOf(resultMap.get("receiveNum").toString()); | ||||
|                             // 入库率 入库数量/实发数量*100 | ||||
|                             resultMap.put("receiveRate", df.format((float) receiveNum / invoiceNum * 100)); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //            Integer receiveNum = this.countAll(map, ".statisticsRecords"); | ||||
|             // receiptRecordsBo.setReceiveNum(receiveNum.toString()); | ||||
| //            objectMap.put("receiveNum", receiveNum.toString()); | ||||
|             // 出库数量 经销商扫码出库数量汇总 | ||||
|             map.clear(); | ||||
|             map.put("clientId", clientId1); | ||||
|             map.put("startCode", startCode); | ||||
|             map.put("endCode", endCode); | ||||
|             map.put("deliveryStartTime", startTime); | ||||
|             map.put("deliveryEndTime", endTime); | ||||
|             map.put("timeFlag", "2"); | ||||
|             List<ReceiptRecordsInfo> ckMapList = dao.list(ReceiptRecordsInfo.class.getName() + ".statisticsRecords", map); | ||||
| //            Integer deliveryNum = this.countAll(map, ".statisticsRecords"); | ||||
|             // receiptRecordsBo.setDeliveryNum(deliveryNum.toString()); | ||||
| //            objectMap.put("deliveryNum", deliveryNum.toString()); | ||||
| 
 | ||||
|             //合并出库数量 | ||||
|             for(int i = 0; i < ckMapList.size();i++){ | ||||
|                 ReceiptRecordsInfo ckRinfo = ckMapList.get(i); | ||||
| //            ckMapList.forEach(item-> { | ||||
| //                resultList.stream().filter(x-> x.get("clientId").equals(item.getClientId()) && x.get("goodsNo").equals(item.getGoodsNo())); | ||||
|                 resultList.forEach(resultMap->{ | ||||
|                     boolean ckgoodsNoFlag = StringUtil.isNullOrEmpty(ckRinfo.getGoodsNo()); | ||||
|                     boolean rsgoodsNoFlag = StringUtil.isNullOrEmpty(resultMap.get("goodsNo")); | ||||
|                     //clientid 和 goodsNo匹配 或者 goodsNo都为空时 | ||||
|                     if((ckRinfo.getClientId().equals(resultMap.get("clientId"))) | ||||
|                             && ((ckgoodsNoFlag && rsgoodsNoFlag) || ((!ckgoodsNoFlag && !rsgoodsNoFlag && ckRinfo.getGoodsNo().equals(resultMap.get("goodsNo"))))) ){ | ||||
|                         resultMap.put("deliveryNum",StringUtil.isNullOrEmpty(ckRinfo.getReceiveNum())?"0":ckRinfo.getReceiveNum()); | ||||
|                         DecimalFormat df = new DecimalFormat("0.00"); | ||||
|                         Integer invoiceNum = Integer.valueOf(resultMap.get("invoiceNum").toString()); | ||||
|                         Integer deliveryNum = Integer.valueOf(resultMap.get("deliveryNum").toString()); | ||||
|                         // 出库率 出库数量/实发数量*100 | ||||
|                         resultMap.put("deliveryRate", df.format((float) deliveryNum / invoiceNum * 100)); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|         return resultList; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @description: 统计每个客户的数据 | ||||
|      * @author: mzr | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue