package com.zy.ints.task;
|
|
import com.zy.asrs.task.core.ReturnT;
|
import com.zy.ints.entity.WaitMatout;
|
import com.zy.ints.service.WaitMatoutService;
|
import com.zy.ints.task.handler.WaitMatoutLogHandler;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
import java.util.List;
|
|
/**
|
* 出库通知档转历史档
|
* Created by TQS on 2021/8/31
|
*/
|
@Component
|
public class WaitMatoutLogScheduler {
|
private static final Logger log = LoggerFactory.getLogger(WaitMatoutLogScheduler.class);
|
|
@Autowired
|
private WaitMatoutService waitMatoutService;
|
@Autowired
|
private WaitMatoutLogHandler waitMatOutLogHandler;
|
|
/**
|
* ERP接口是否启用
|
*/
|
@Value("${erp.enabled}")
|
private Boolean erpEnabled;
|
|
@Scheduled(cron = "0/4 * * * * ? ")
|
private void execute(){
|
if(!erpEnabled) return;
|
List<WaitMatout> waitMatouts = waitMatoutService.selectWaitMatOutBySts();
|
for (WaitMatout waitMatout : waitMatouts) {
|
ReturnT<String> result = waitMatOutLogHandler.start(waitMatout);
|
if (!result.isSuccess()) {
|
log.error("出库通知档[billNo={},seqNo={}]历史档处理失败", waitMatout.getBillNo(),waitMatout.getSeqNo());
|
}
|
}
|
}
|
|
}
|