From 648bf33b9af7fff73de78a60b31766b1c78da024 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Fri, 8 Nov 2024 15:32:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/plan/entity/ProPlanInfoVo.java | 12 ++++ .../business/plan/entity/StatisticsVo.java | 25 ++++++++ .../business/plan/mapper/PlanOutMapper.java | 12 ++++ .../plan/service/PlanOutServiceImpl.java | 57 ++++++++++++------- .../resources/mappers/plan/PlanOutMapper.xml | 21 ++++++- 5 files changed, 103 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/bonus/gzgqj/business/plan/entity/StatisticsVo.java diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoVo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoVo.java index 2bb9902..2eeb8fc 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoVo.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoVo.java @@ -20,6 +20,11 @@ public class ProPlanInfoVo extends PageInfo { */ private int recordNum; + /** + * 出库单量 + */ + private int recordNum2; + /** * 需用数量 */ @@ -29,6 +34,11 @@ public class ProPlanInfoVo extends PageInfo { */ private int outNum; + /** + * 出库量 + */ + private int outNum2; + /** * 出库量 */ @@ -52,6 +62,8 @@ public class ProPlanInfoVo extends PageInfo { private String proName; + + } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/StatisticsVo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/StatisticsVo.java new file mode 100644 index 0000000..7230c1e --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/StatisticsVo.java @@ -0,0 +1,25 @@ +package com.bonus.gzgqj.business.plan.entity; + +import lombok.Data; + +@Data +public class StatisticsVo { + + /** + * 需要数量 + */ + private int neeNum; + /** + * 发货数量 + */ + private int fhNum; + /** + * 待发货数量 + */ + private int dfhNum; + + /** + * 待发货数量 + */ + private int num; +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java index 0a109e3..a086c5d 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java @@ -86,4 +86,16 @@ public interface PlanOutMapper { * @param data */ void updatePriPlanInfo(ProPlanInfoVo data); + + /** + * 查询发货统计 + * @return + */ + List getStatistics(); + + /** + * 超出 库存数量 + * @return + */ + StatisticsVo getOverNum(); } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java index a2bb0f0..6ec30a6 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java @@ -133,20 +133,23 @@ public class PlanOutServiceImpl implements PlanOutService{ if(num>0){ //计算 本次全部发货数量及整改数量 最后同步到 工程 -计划-发货统计表中 int allFhNum=0; + //非计划发货数量 + int allFhNum2=0; + //非计划发货次数 + int count=0; int allTzNum=0; - int excNum=0; //处理 发货单 - boolean a= planOutInfo(list,vo,allFhNum,allTzNum,excNum); + boolean a= planOutInfo(list,vo,allFhNum,allTzNum); if(!a){ return ServerResponse.createErroe("发货失败"); } //处理新增发货单 - boolean b=addOutPlanInfo(addList,vo,allFhNum); + boolean b=addOutPlanInfo(addList,vo,allFhNum2,count); if(!b){ return ServerResponse.createErroe("发货失败"); } //处理 发货后 统计及 详情数据 - boolean c= updateProPlan(vo,allFhNum,allTzNum); + boolean c= updateProPlan(vo,allFhNum,allTzNum,allFhNum2,count); if(!c){ return ServerResponse.createErroe("发货失败"); } @@ -162,19 +165,30 @@ public class PlanOutServiceImpl implements PlanOutService{ @Override public ServerResponse getStatistics() { + Map map= Maps.newHashMap(); try{ - Map map= Maps.newHashMap(); - - - + List list=mapper.getStatistics(); + StatisticsVo data=mapper.getOverNum(); + map.put("neeNum",list.get(0).getNeeNum()); + map.put("dfhNum",list.get(0).getDfhNum()); + map.put("fhNum",list.get(0).getFhNum()); + map.put("overNum",data.getNum()); + //不在计划内的数量 + map.put("noPlanNum",list.get(1).getFhNum()); }catch (Exception e){ + map.put("neeNum",0); + map.put("dfhNum",0); + map.put("fhNum",0); + map.put("overNum",0); + //不在计划内的数量 + map.put("noPlanNum",0); log.error(e.toString(),e); } - return ServerResponse.createSuccess(); + return ServerResponse.createSuccess(map); } - public boolean planOutInfo(List list,ProOutInfoVo vo,int allFhNum, int allTzNum,int excNum){ + public boolean planOutInfo(List list,ProOutInfoVo vo,int allFhNum, int allTzNum){ try { for (ProOutDetail details:list){ allFhNum=allFhNum+details.getFhNum(); @@ -186,9 +200,6 @@ public class PlanOutServiceImpl implements PlanOutService{ return false; }else{ //需要的数量 - int needNum=data.getNeedNum(); - - ProNeedInfo insertObj=new ProNeedInfo(); BeanUtils.copyProperties(insertObj,data); insertObj.setOutId(vo.getId()); @@ -206,6 +217,7 @@ public class PlanOutServiceImpl implements PlanOutService{ int tzNum2=details.getFhNum(); data.setFhNum(fhNum+fhNum2); data.setTzNum(tzNum+tzNum2); + mapper.updateNeedInfo(data); return true; }else { @@ -222,12 +234,13 @@ public class PlanOutServiceImpl implements PlanOutService{ /** * 更新工程 -统计数据 - * @param allTzNum + * @param allTzNum 全部调整数量 * @param vo - * @param allFhNum + * @param allFhNum 全部发货数量 + * @param allFhNum 超出需求数量 * @return */ - public Boolean updateProPlan( ProOutInfoVo vo,int allFhNum, int allTzNum){ + public Boolean updateProPlan( ProOutInfoVo vo,int allFhNum, int allTzNum ,int allFhNum2,int count ){ try { //更新工程 总数据信息 ProPlanInfoVo data= mapper.getProPlanInfo(vo); @@ -248,6 +261,10 @@ public class PlanOutServiceImpl implements PlanOutService{ data.setStatus(2); } data.setLastDay(vo.getCreateDay()); + //非计划发货数量 + data.setOutNum2(allFhNum2); + //非计划发货次数 . + data.setRecordNum2(count); //更新 工程-计划 -统计表 mapper.updatePriPlanInfo(data); return true; @@ -261,12 +278,14 @@ public class PlanOutServiceImpl implements PlanOutService{ * 传入 * 新增集合、发货单、发货数量 */ - public Boolean addOutPlanInfo(List addList, ProOutInfoVo vo,int allFhNum){ + public Boolean addOutPlanInfo(List addList, ProOutInfoVo vo,int allFhNum,int count){ try { //是否有 新增 if(StringUtils.isNotEmpty(addList)){ + count=count+1; //全部新增发货清单 for (ProAddInfoDetails details:addList){ + allFhNum=allFhNum+details.getFhNum(); ProNeedInfo insertObj=new ProNeedInfo(); insertObj.setOutId(vo.getId()); @@ -301,9 +320,5 @@ public class PlanOutServiceImpl implements PlanOutService{ - public static void main(String[] args) { - String suffx= IDUtils.getSuffix("/C/SSSK4555.PNG"); - System.err.println(suffx); - } } diff --git a/src/main/resources/mappers/plan/PlanOutMapper.xml b/src/main/resources/mappers/plan/PlanOutMapper.xml index c1d14ad..d3cfd5a 100644 --- a/src/main/resources/mappers/plan/PlanOutMapper.xml +++ b/src/main/resources/mappers/plan/PlanOutMapper.xml @@ -23,7 +23,7 @@ update t_pro_plan_info set record_num=#{recordNum},out_num=#{outNum},tz_num=#{tzNum},last_day=#{lastDay}, - status=#{status} + status=#{status},out2_num=#{outNum2},record2_num=#{recordNum} where pro_id=#{proId} @@ -87,11 +87,26 @@ select ppi.pro_id proId, ppi.need_num needNum, ppi.plan_num planNum,ppi.record_num recordNum, - ppi.out_num outNum, ppi.status, + ppi.out_num outNum, ppi.status,out2_num outNum2,record2_num recordNum2, ppi.last_day lastDay from t_pro_plan_info ppi where ppi.pro_id=#{proId} - + + + \ No newline at end of file