| | |
| | | package com.zy.third.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.OrderDetl1; |
| | | import com.zy.asrs.service.impl.OrderDetl1ServiceImpl; |
| | | import com.zy.third.entity.ExdInstockSource; |
| | | import com.zy.third.entity.ExdInstockTarget; |
| | | import com.zy.third.entity.ExdOutstockSource; |
| | | import com.zy.third.entity.ExdOutstockTarget; |
| | | import com.zy.third.mapper.ExdInstockSourceMapper; |
| | | import com.zy.third.mapper.ExdOutstockSourceMapper; |
| | | import com.zy.third.service.ExdInstockTargetService; |
| | | import com.zy.third.service.ExdOutstockTargetService; |
| | | import com.zy.third.task.handler.OrderHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private ExdOutstockSourceMapper exdOutstockSourceMapper; |
| | | |
| | | @Autowired |
| | | private ExdInstockTargetService exdInstockTargetService; |
| | | |
| | | @Autowired |
| | | private ExdOutstockTargetService exdOutstockTargetService; |
| | | @Autowired |
| | | private OrderDetl1ServiceImpl orderDetl1ServiceImpl; |
| | | @Autowired |
| | | private OrderDetl1ServiceImpl orderDetl1Service; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 读取入库单据,对erp标记为删除的订单进行删除 |
| | | * status 5 --》 8 删除成功 |
| | | * status 5 --》 7 删除失败 |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | public void deleteInOrder() { |
| | | //log.info("读取入库单据"); |
| | | List<ExdInstockSource> exdInstockSources = exdInstockSourceMapper.deletelistOrderNo(); |
| | | for (ExdInstockSource exdInstockSource : exdInstockSources) { |
| | | try { |
| | | boolean success = orderHandler.deletereadInOrder(exdInstockSource).isSuccess(); |
| | | if (success) { |
| | | exdInstockSource.setReadtime(new Date()); |
| | | exdInstockSource.setStatus(8); |
| | | exdInstockSourceMapper.updateById(exdInstockSource); |
| | | } else { |
| | | exdInstockSource.setReadtime(new Date()); |
| | | exdInstockSource.setStatus(7); |
| | | exdInstockSourceMapper.updateById(exdInstockSource); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | // log.error("读取入库单据信息失败:{},{}", exdInstockSources, e.getMessage()); |
| | | e.printStackTrace(); |
| | | exdInstockSource.setReadormsg(e.getMessage()); |
| | | exdInstockSource.setStatus(7); |
| | | exdInstockSourceMapper.updateById(exdInstockSource); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 读取出库单据 |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读取删除出库单据 |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | public void deletereadOutOrder() { |
| | | //log.info("读取出库单据"); |
| | | List<ExdOutstockSource> exdOutstockSources = exdOutstockSourceMapper.deletelistOrderNo(); |
| | | for (ExdOutstockSource exdOutstockSource : exdOutstockSources) { |
| | | try { |
| | | boolean success = orderHandler.deletereadOutOrder(exdOutstockSource).isSuccess(); |
| | | if (success) { |
| | | exdOutstockSource.setReadtime(new Date()); |
| | | exdOutstockSource.setStatus(8); |
| | | exdOutstockSourceMapper.updateById(exdOutstockSource); |
| | | } else { |
| | | exdOutstockSource.setReadtime(new Date()); |
| | | exdOutstockSource.setStatus(7); |
| | | exdOutstockSourceMapper.updateById(exdOutstockSource); |
| | | } |
| | | } catch (Exception e) { |
| | | // log.error("读取出库单据信息失败:{},{}", exdOutstockSources, e.getMessage()); |
| | | e.printStackTrace(); |
| | | exdOutstockSource.setStatus(7); |
| | | exdOutstockSource.setReadormsg(e.getMessage()); |
| | | exdOutstockSourceMapper.updateById(exdOutstockSource); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 读取错误出库完成单据 |
| | | */ |
| | | // @Scheduled(cron = "* 0/10 * * * ? ") |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | public void readOutOrdererror() { |
| | | List<ExdOutstockTarget> status = exdOutstockTargetService.selectList(new EntityWrapper<ExdOutstockTarget>().isNotNull("ReadorMsg")); |
| | | if (status.size() > 0) { |
| | | for (ExdOutstockTarget exdOutstockTarget : status) { |
| | | List<OrderDetl1> orderNo = orderDetl1Service.selectList(new EntityWrapper<OrderDetl1>().eq("order_no", exdOutstockTarget.getFbillno())); |
| | | if (!Cools.isEmpty(orderNo)) { |
| | | for (OrderDetl1 orderDetl1 : orderNo) { |
| | | if (!Cools.isEmpty(orderDetl1.getMemo()) && orderDetl1.getMemo().equals(exdOutstockTarget.getReadormsg())) { |
| | | break; |
| | | } |
| | | orderDetl1.setMemo(exdOutstockTarget.getReadormsg()); |
| | | orderDetl1Service.updateById(orderDetl1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 读取错误入库完成单据 |
| | | */ |
| | | @Scheduled(cron = "* 0/10 * * * ? ") |
| | | // @Scheduled(cron = "0/10 * * * * ? ") |
| | | public void readInOrdererror() { |
| | | List<ExdInstockTarget> status = exdInstockTargetService.selectList(new EntityWrapper<ExdInstockTarget>().isNotNull("ReadorMsg")); |
| | | if (status.size() > 0) { |
| | | for (ExdInstockTarget exdInstockTarget : status) { |
| | | List<OrderDetl1> orderNo = orderDetl1Service.selectList(new EntityWrapper<OrderDetl1>().eq("order_no", exdInstockTarget.getFbillno())); |
| | | if (!Cools.isEmpty(orderNo)) { |
| | | for (OrderDetl1 orderDetl1 : orderNo) { |
| | | if (orderDetl1.getMemo().equals(exdInstockTarget.getReadormsg())) { |
| | | break; |
| | | } |
| | | orderDetl1.setMemo(exdInstockTarget.getReadormsg()); |
| | | orderDetl1Service.updateById(orderDetl1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |