自动化立体仓库 - WMS系统
zhangchao
2024-09-02 7a414e079a0f9536a5031e6ffedb98f9c594801c
src/main/java/com/zy/third/erp/task/ERPInCancelScheduler.java
@@ -7,6 +7,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
@@ -14,31 +15,43 @@
@Slf4j
@Component
public class ERPInCancelScheduler {
    @Value("${erp.enabled}")
    private Boolean erpEnabled;
    @Autowired
    private ERPInCancelSchedulerMS inMS;
    private ERPInOrOutCancelService inMS;
    @Autowired
    private ErpSqlServer erpSqlServer;
    @Scheduled(cron = "${erp.refreshtime}")
    public void itemScheduler() {
    @Transactional(rollbackFor = Throwable.class)
    //@Scheduled(cron = "${erp.refreshtime}")
    public void InCancelScheduler() {
        if (!erpEnabled) return;
        String sqlInCancelTB = "select * from erp_InCancelTB where LKName='中扬二期'";
        List<InCancelTB> ins = erpSqlServer.select(sqlInCancelTB, InCancelTB.class);
        for (InCancelTB in : ins) {
            com.zy.third.lk.entity.InCancelTB lkCancel = inMS.tryCancel(in);
            com.zy.third.lk.entity.InCancelTB lkCancel = inMS.tryCancel(in.getBillNo());
            if (lkCancel != null) {
                HashMap<String, String> condition = new HashMap<>();
                condition.put("BillNo", "'" + in.getBillNo() + "'");
                erpSqlServer.delete(InCancelTB.class, condition);
                int delete = erpSqlServer.delete(InCancelTB.class, condition);
                if (delete > 0) {
                    log.info("将入库取消通知单删除成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单删除失败,{}", lkCancel.getBillNo());
                }
                HashMap<String, Object> content = new HashMap<>();
                content.put("BillNo", "'" + lkCancel.getBillNo() + "'");
                content.put("opFlag", lkCancel.getOpFlag());
                erpSqlServer.insert(com.zy.third.lk.entity.InCancelTB.class, content);
                int insert = erpSqlServer.insert(com.zy.third.lk.entity.InCancelTB.class, content);
                if (insert > 0) {
                    log.info("将入库取消通知单写入成功,{}", lkCancel.getBillNo());
                } else {
                    log.error("将入库取消通知单写入失败,{}", lkCancel.getBillNo());
                }
            } else {
                log.error("将入库取消通知单写入失败");
            }