收发货记录增加查询条件
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 endTime, | ||||||
|             @ApiParam(required = false, value = "经销商出货开始时间") @RequestParam(required = false) String startDate, |             @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 endDate, | ||||||
|              @ApiParam(required = false, value = "商品编码") @RequestParam(required = false) String goodsNo, |             @ApiParam(required = false, value = "发货单客户id") @RequestParam(required = false) String invoiceClientId, | ||||||
|             @ApiParam(required = false, value = "商品名称") @RequestParam(required = false) String goodsName, |  | ||||||
|             @ApiParam(required = false, value = "商品规格") @RequestParam(required = false) String specifications, |  | ||||||
|             @ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(value = "page") Integer pageNum, |             @ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(value = "page") Integer pageNum, | ||||||
|             @ApiParam(required = true, value = "每页条数", defaultValue = "10") @RequestParam(value = "pageSize") Integer pageSize, |             @ApiParam(required = true, value = "每页条数", defaultValue = "10") @RequestParam(value = "pageSize") Integer pageSize, | ||||||
|             HttpServletRequest request) { |             HttpServletRequest request) { | ||||||
|  | @ -97,6 +95,7 @@ public class ReceiptRecordsController extends BaseController { | ||||||
|         params.put("endTime", endTime); |         params.put("endTime", endTime); | ||||||
|         params.put("startDate", startDate); |         params.put("startDate", startDate); | ||||||
|         params.put("endDate", endDate); |         params.put("endDate", endDate); | ||||||
|  |         params.put("invoiceClientId", invoiceClientId); | ||||||
|         params.put("page", pageNum); |         params.put("page", pageNum); | ||||||
|         params.put("pageSize", pageSize); |         params.put("pageSize", pageSize); | ||||||
|         return toPage(receiptRecordsService.pageList(params, ".findRecordsByCondition")); |         return toPage(receiptRecordsService.pageList(params, ".findRecordsByCondition")); | ||||||
|  |  | ||||||
|  | @ -106,6 +106,9 @@ | ||||||
|             <if test="clientName != null and clientName != ''"> |             <if test="clientName != null and clientName != ''"> | ||||||
|                 AND a.client_name LIKE '%' || #{clientName} || '%' |                 AND a.client_name LIKE '%' || #{clientName} || '%' | ||||||
|             </if> |             </if> | ||||||
|  |             <if test="invoiceClientId != null and invoiceClientId != ''"> | ||||||
|  |                 AND a.invoice_client_id = #{invoiceClientId} | ||||||
|  |             </if> | ||||||
|             <if test="isSent != null and isSent != ''"> |             <if test="isSent != null and isSent != ''"> | ||||||
|                 AND a.is_sent = #{isSent} |                 AND a.is_sent = #{isSent} | ||||||
|             </if> |             </if> | ||||||
|  |  | ||||||
|  | @ -98,152 +98,6 @@ public class ReceiptRecordsService { | ||||||
|         return dao.count(ReceiptRecordsInfo.class.getName() + id, params); |         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: 统计每个客户的数据 |      * @description: 统计每个客户的数据 | ||||||
|      * @author: mzr |      * @author: mzr | ||||||
|  | @ -276,9 +130,9 @@ public class ReceiptRecordsService { | ||||||
|             map.put("invoiceStartTime", startTime); |             map.put("invoiceStartTime", startTime); | ||||||
|             map.put("invoiceEndTime", endTime); |             map.put("invoiceEndTime", endTime); | ||||||
|             Integer invoiceNum = this.countAll(map, ".countRecordsByCondition"); |             Integer invoiceNum = this.countAll(map, ".countRecordsByCondition"); | ||||||
|             invoiceNum = StringUtil.isNullOrEmpty(invoiceNum)? 0:invoiceNum; |             invoiceNum = StringUtil.isNullOrEmpty(invoiceNum) ? 0 : invoiceNum; | ||||||
|             // receiptRecordsBo.setInvoiceNum(invoiceNum.toString()); |             // receiptRecordsBo.setInvoiceNum(invoiceNum.toString()); | ||||||
|             objectMap.put("invoiceNum", StringUtil.isNullOrEmpty(invoiceNum)?"0":invoiceNum.toString()); |             objectMap.put("invoiceNum", StringUtil.isNullOrEmpty(invoiceNum) ? "0" : invoiceNum.toString()); | ||||||
|             // 入库数量  经销商扫码入库数量汇总 |             // 入库数量  经销商扫码入库数量汇总 | ||||||
|             map.clear(); |             map.clear(); | ||||||
|             map.put("clientId", clientId1); |             map.put("clientId", clientId1); | ||||||
|  | @ -288,9 +142,9 @@ public class ReceiptRecordsService { | ||||||
|             map.put("receiveEndTime", endTime); |             map.put("receiveEndTime", endTime); | ||||||
|             map.put("timeFlag", "1"); |             map.put("timeFlag", "1"); | ||||||
|             Integer receiveNum = this.countAll(map, ".statisticsRecords"); |             Integer receiveNum = this.countAll(map, ".statisticsRecords"); | ||||||
|             receiveNum = StringUtil.isNullOrEmpty(receiveNum)? 0:receiveNum; |             receiveNum = StringUtil.isNullOrEmpty(receiveNum) ? 0 : receiveNum; | ||||||
|             // receiptRecordsBo.setReceiveNum(receiveNum.toString()); |             // receiptRecordsBo.setReceiveNum(receiveNum.toString()); | ||||||
|             objectMap.put("receiveNum", StringUtil.isNullOrEmpty(receiveNum)?"0":receiveNum.toString()); |             objectMap.put("receiveNum", StringUtil.isNullOrEmpty(receiveNum) ? "0" : receiveNum.toString()); | ||||||
|             // 出库数量 经销商扫码出库数量汇总 |             // 出库数量 经销商扫码出库数量汇总 | ||||||
|             map.clear(); |             map.clear(); | ||||||
|             map.put("clientId", clientId1); |             map.put("clientId", clientId1); | ||||||
|  | @ -300,9 +154,9 @@ public class ReceiptRecordsService { | ||||||
|             map.put("deliveryEndTime", endTime); |             map.put("deliveryEndTime", endTime); | ||||||
|             map.put("timeFlag", "2"); |             map.put("timeFlag", "2"); | ||||||
|             Integer deliveryNum = this.countAll(map, ".statisticsRecords"); |             Integer deliveryNum = this.countAll(map, ".statisticsRecords"); | ||||||
|             deliveryNum = StringUtil.isNullOrEmpty(deliveryNum)? 0:deliveryNum; |             deliveryNum = StringUtil.isNullOrEmpty(deliveryNum) ? 0 : deliveryNum; | ||||||
|             // receiptRecordsBo.setDeliveryNum(deliveryNum.toString()); |             // receiptRecordsBo.setDeliveryNum(deliveryNum.toString()); | ||||||
|             objectMap.put("deliveryNum", StringUtil.isNullOrEmpty(deliveryNum)? "0":deliveryNum.toString()); |             objectMap.put("deliveryNum", StringUtil.isNullOrEmpty(deliveryNum) ? "0" : deliveryNum.toString()); | ||||||
| 
 | 
 | ||||||
|             if (StringUtil.isNotEmpty(invoiceNum) && (0 != invoiceNum)) { |             if (StringUtil.isNotEmpty(invoiceNum) && (0 != invoiceNum)) { | ||||||
|                 DecimalFormat df = new DecimalFormat("0.00"); |                 DecimalFormat df = new DecimalFormat("0.00"); | ||||||
|  | @ -347,7 +201,7 @@ public class ReceiptRecordsService { | ||||||
|         map.put("invoiceStartTime", startTime); |         map.put("invoiceStartTime", startTime); | ||||||
|         map.put("invoiceEndTime", endTime); |         map.put("invoiceEndTime", endTime); | ||||||
|         Integer invoiceNum = this.countAll(map, ".countRecordsByCondition"); |         Integer invoiceNum = this.countAll(map, ".countRecordsByCondition"); | ||||||
|         receiptRecordsBo.setInvoiceNum(StringUtil.isNullOrEmpty(invoiceNum) ? "0":invoiceNum+""); |         receiptRecordsBo.setInvoiceNum(StringUtil.isNullOrEmpty(invoiceNum) ? "0" : invoiceNum + ""); | ||||||
| 
 | 
 | ||||||
|         // 入库数量  经销商扫码入库数量汇总 |         // 入库数量  经销商扫码入库数量汇总 | ||||||
|         map.remove("invoiceStartTime"); |         map.remove("invoiceStartTime"); | ||||||
|  | @ -356,7 +210,7 @@ public class ReceiptRecordsService { | ||||||
|         map.put("receiveEndTime", endTime); |         map.put("receiveEndTime", endTime); | ||||||
|         map.put("timeFlag", "1"); |         map.put("timeFlag", "1"); | ||||||
|         Integer receiveNum = this.countAll(map, ".statisticsRecords"); |         Integer receiveNum = this.countAll(map, ".statisticsRecords"); | ||||||
|         receiptRecordsBo.setReceiveNum(StringUtil.isNullOrEmpty(receiveNum) ? "0":receiveNum+""); |         receiptRecordsBo.setReceiveNum(StringUtil.isNullOrEmpty(receiveNum) ? "0" : receiveNum + ""); | ||||||
| 
 | 
 | ||||||
|         // 出库数量 经销商扫码出库数量汇总 |         // 出库数量 经销商扫码出库数量汇总 | ||||||
|         map.remove("receiveStartTime"); |         map.remove("receiveStartTime"); | ||||||
|  | @ -365,7 +219,7 @@ public class ReceiptRecordsService { | ||||||
|         map.put("deliveryEndTime", endTime); |         map.put("deliveryEndTime", endTime); | ||||||
|         map.put("timeFlag", "2"); |         map.put("timeFlag", "2"); | ||||||
|         Integer deliveryNum = this.countAll(map, ".statisticsRecords"); |         Integer deliveryNum = this.countAll(map, ".statisticsRecords"); | ||||||
|         receiptRecordsBo.setDeliveryNum(StringUtil.isNullOrEmpty(deliveryNum) ? "0":deliveryNum+""); |         receiptRecordsBo.setDeliveryNum(StringUtil.isNullOrEmpty(deliveryNum) ? "0" : deliveryNum + ""); | ||||||
| 
 | 
 | ||||||
|         // 如果实发数量没有值或者等于0,出库率和入库率等于0.00 |         // 如果实发数量没有值或者等于0,出库率和入库率等于0.00 | ||||||
|         if (StringUtil.isNotEmpty(invoiceNum) && (0 != invoiceNum)) { |         if (StringUtil.isNotEmpty(invoiceNum) && (0 != invoiceNum)) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue