自动化立体仓库 - WMS系统
LSH
2023-01-04 459455673c8ffef5ad1cd73eccc3ddb76a42d567
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.zy.ints.task.scheduler;
 
import com.zy.asrs.service.ApiLogService;
import com.zy.ints.entity.ErpDetTb;
import com.zy.ints.entity.ErpLk;
import com.zy.ints.erp.ErpSqlServer;
import lombok.extern.slf4j.Slf4j;
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.Date;
import java.util.List;
 
/**
 * erp任务控制器
 * Created by vincent on 2020/11/27
 */
@Slf4j
@Component
public class ErpLkScheduler {
    /**
     * ERP接口是否启用
     */
    @Value("${erp.enabled}")
    private Boolean erpEnabled;
    @Value("${erp.useName.ip}")
    private String ip;
    @Autowired
    private ApiLogService apiLogService;
    @Autowired
    private ErpSqlServer erpSqlServer;
    /**
     * ERP与lk库存数据比对
     */
    @Scheduled(cron = "${erp.refreshtime}")
    public void proofread() {
        if (!erpEnabled) return;
        String sqlSelectErpLk = "select prd_no as prdNo,prd_mark as prdMark,qty,wh,status,temp1,temp2,temp3 from bas_erp_lk where 1=1";
        String sqlUpDateErpLkOne = "update bas_erp_lk set status=1 where prd_no=";
        String sqlUpDateErpLkTwo = "update bas_erp_lk set status=2 where prd_no=";
 
        try {
            List<ErpLk> erpLks = erpSqlServer.select(sqlSelectErpLk, ErpLk.class);
            if (erpLks.size() > 0){
                for (ErpLk erpLk:erpLks){
                    Integer status = erpLk.getStatus();
                    if (status == 0){
 
                    }else if (status == 1){
 
                    }else if (status == 2){
 
                    }else {
 
                    }
                }
            }
        }catch (Exception e){
            Date date = new Date();
            log.error(date + ": 表名:bas_erp_lk :" + e);
        }
    }
 
    public void callApiLogSave(ErpLk erpLk, String tableName, String response, Boolean bool) {
        apiLogService.save("ERP与lk库存数据比对",  tableName, "null", ip,
                "品号:" + erpLk.getPrdNo() + "、货品特征:" + erpLk.getPrdMark() + "、数量:" + erpLk.getQty() + "、状态:" + erpLk.getStatus(),
                response, bool);
    }
}