| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Desc: 出入库定时任务。 |
| | | * 1、通知单完成量统计 |
| | | * 2、出入库库存管理统计 |
| | | * @Desc: 出入库定时任务。 1、通知单完成量统计 2、出入库库存管理统计 |
| | | * @author: Andy |
| | | * @update-time: 2022/11/22 |
| | | */ |
| | |
| | | @Resource |
| | | private CoreCommonService commonService; |
| | | |
| | | |
| | | /** |
| | | * 每天晚上11点进行更新未完成出入库通知单的完成量 |
| | | */ |
| | |
| | | public void scheduled1() { |
| | | |
| | | List<DefaultCompany> listCompany = commonService.getCompanyList(); |
| | | if (null == listCompany) return; |
| | | if (null == listCompany) |
| | | return; |
| | | |
| | | //获取3天内的出入库记录,如果有记录则执行,如果没有,则无需执行 |
| | | Date start = DateUtil.getNewByDay(null, -3); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * basic.inoutScheduled#sumDepotStoreExeByHand |
| | | * <p> |
| | |
| | | @Expose |
| | | public String sumDepotStoreExeByHand(Date start) { |
| | | |
| | | if (null == start) start = new Date(); |
| | | if (null == start) |
| | | start = new Date(); |
| | | |
| | | start = DateUtil.getCurZero(start); |
| | | |
| | |
| | | InoutParam param; |
| | | for (InoutData data : listRecord) { |
| | | key = data.getDepotId() + "_" + data.getType(); |
| | | if (null != map.get(key)) continue; |
| | | |
| | | if (null != map.get(key)) |
| | | continue; |
| | | |
| | | map.put(key, data); |
| | | |
| | | //根据最后一车进行汇总统计,开始时间是仓库库存最后一个时间截止到当前 |
| | | lastStore = commonService.getLastDepotStore(data.getDepotId()); |
| | | if (null == lastStore) { |
| | | log.error("--------出入库定时任务-----没有获取到仓库最后库存信息,取消自动统计,请核对业务逻辑--仓库-{}", data.getDepotId()); |
| | | log.error( |
| | | "--------出入库定时任务-----没有获取到仓库最后库存信息,取消自动统计,请核对业务逻辑--仓库-{}", |
| | | data.getDepotId()); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | //只有出入库状态的仓库才进行统计,其他状态表示出入库作业完成,不在执行统计 |
| | | if (DepotStatus.STATUS_2.getCode().equals(lastStore.getDepotStatus()) || |
| | | DepotStatus.STATUS_4.getCode().equals(lastStore.getDepotStatus())) { |
| | | if (DepotStatus.STATUS_2.getCode().equals( |
| | | lastStore.getDepotStatus()) |
| | | || DepotStatus.STATUS_4.getCode().equals( |
| | | lastStore.getDepotStatus())) { |
| | | |
| | | param = new InoutParam(); |
| | | //param.setStart(lastStore.getCreateDate()); |
| | |
| | | // lastStore.setCreateDate(new Date()); |
| | | |
| | | if (InoutConstant.TYPE_IN.equals(data.getType())) { |
| | | lastStore.setStorageReal(lastStore.getStorageReal() + sumRecordWeight); |
| | | lastStore.setStorageReal(lastStore.getStorageReal() |
| | | + sumRecordWeight); |
| | | } |
| | | |
| | | if (InoutConstant.TYPE_OUT.equals(data.getType())) { |
| | | lastStore.setStorageReal(lastStore.getStorageReal() - sumRecordWeight); |
| | | lastStore.setStorageReal(lastStore.getStorageReal() |
| | | - sumRecordWeight); |
| | | } |
| | | |
| | | commonService.addDepotStore(lastStore, true); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 同步通知单完成量,根据近期出入库记录,如果无近期出入库记录,则表示无出入库作业,取消执行 |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | List<InoutSysConf> inoutSysConfList = inoutCommonService.getCacheInoutSysConf(companyId); |
| | | |
| | | //不配置说明没有启动出入库 |
| | | if (null == inoutSysConfList || inoutSysConfList.isEmpty()) { |
| | | return; |
| | | } |
| | | //TODO 待优化 |
| | | |
| | | //获取所有未完成状态的出库通知单 |
| | | List<InoutNoticeOut> noticeOutList = inoutCommonService.getUnComNoticeOut(companyId); |
| | | |
| | | |
| | | //获取所有未完成状态的入库通知单 |
| | | List<InoutNoticeIn> noticeInList = inoutCommonService.getUnComNoticeIn(companyId); |
| | | |
| | | String deptId = noticeInList.get(0).getDeptId(); |
| | | |
| | | for (InoutSysConf inoutSysConf : inoutSysConfList) { |
| | | |
| | | // 判断入库通知单是否启用 |
| | | //更新入库通知单完成量 |
| | | inoutCommonService.updateSumNoticeIn(inoutSysConf.getDeptId(), noticeInList); |
| | | inoutCommonService.updateSumNoticeIn(deptId, |
| | | noticeInList); |
| | | |
| | | // 判断出库通知单是否启用 |
| | | //更新出库通知单完成量 |
| | | inoutCommonService.updateSumNoticeOut(inoutSysConf.getDeptId(), noticeOutList); |
| | | } |
| | | inoutCommonService.updateSumNoticeOut(deptId,noticeOutList); |
| | | } |
| | | |
| | | } |